Google
 

Trailing-Edge - PDP-10 Archives - de-10-omona-v-mc9 - m680.mac
There are 8 other files named m680.mac in the archive. Click here to see a list.
	TITLE	M680  -DC68A SYSTEM GENERATOR- V.0A
	SUBTTL	R.KRASIN DEC-3-70
;USE WITH P680.PAL VERSIONS 0C OR LATER
VERZUN==1000

	EXTERN	.JBFF

	LOC	137
	EXP	VERZUN
	RELOC

;CONFIGURATION FILE DEFAULTS
;---------------------------

IFNDEF NAME,<DEFINE NAME<ASCII/X680/>>
IFNDEF MODCON,<MODCON=0>

IFNDEF DC08FX,<DC08FX=0>

IFNDEF BAUD1,<BAUD1=^D110>

IFNDEF LINES,<

DEFINE	LINES<

CONSOL

LOCAL 00,1,0
LOCAL 01,1,0
LOCAL 02,1,0
LOCAL 03,1,0
LOCAL 04,1,0
LOCAL 05,1,0
LOCAL 06,1,0
LOCAL 07,1,0
LOCAL 10,1,0
LOCAL 11,1,0
LOCAL 12,1,0
LOCAL 13,1,0
LOCAL 14,1,0
LOCAL 15,1,0
LOCAL 16,1,0
>

> ;IFNDEV LINES

IFNDEF INDEV,<INDEV=SIXBIT/DSK/>
IFNDEF INFIL,<INFIL=SIXBIT/P680/>
IFNDEF INEXT,<INEXT=SIXBIT/PAL/>
IFNDEF OUTDEV,<OUTDEV=SIXBIT/DSK/>
IFNDEF OUTFIL,<OUTFIL=SIXBIT/X680/>
IFNDEF OUTEXT,<OUTEXT=SIXBIT/PAL/>
IFNDEF LISTX,<LISTX=0>

IFE LISTX,<
PAGE
XLIST>

;BASIC MACROS
;------------


SYN ASCII,X

DEFINE U (ADDRES,LENGTH)<
ADDRES:	BLOCK	LENGTH>




;TEXT GENERATION

IFE LISTX,<
DEFINE L(T1,T2,T3,T4,T5)<
LIST
X\T1'T2'T3'T4'T5\
XLIST
X\
\
>>

IFN LISTX,<
DEFINE L(T1,T2,T3,T4,T5)<X\T1'T2'T3'T4'T5
\>
LALL
>




;CONCATENATION

DEFINE CAT(T1,T2,T3,T4,T5)<T1'T2'T3'T4'T5>


PALB2:;BEGINING OF PAL CODE TO BE SUFFIXED TO P680.PAL
;DEFINE AND GENERATE GENERAL LINE PARAMETERS
;-------------------------------------------



DEFINE LOCAL (PORT,CLOCK,FORM)<
IFL PORT-XPLO,<XPLO=PORT>	;FIND LOWEST PORT.NUM.
IFG PORT-XPHI,<XPHI=PORT>	;AND HIGHEST
CAT(<XC>,\CLOCK,<NUM=XC>,\CLOCK,<NUM+1>) ;COUNT NUM. LINES PER CLOCK.
XK=XLINE!<1000*FORM>
CAT(<PL>,\PORT,<=XK>)	;DEF SYMBOL FOR INVERSE MAP (PORTS TO LINES)
L<LSW>,\XLINE,<=0>
XLINE=XLINE+1
> ;DEFINE LOCAL



DEFINE MODEM (PORT)<
IFL PORT-XMLO,<XMLO=PORT>	;FIND LOWEST PORT.NUM.
IFG PORT-XMHI,<XMHI=PORT>	;AND HIGHEST
CAT(<ML>,\PORT,<=XLINE>)	;DEF SYMBOL FOR INVERSE MAP (MODEMS TO LINE)
L<LSW>,\XLINE,<=0>
XLINE=XLINE+1
> ;DEFINE MODEM


DEFINE REMOTE (DPORT,CLOCK,FORM,MPORT)<
LOCAL (DPORT,CLOCK)
XLINE=XLINE-1
MODEM (MPORT)
> ;DEFINE REMOTE


DEFINE NULL <
L<LSW>,\XLINE,<=0>
XLINE=XLINE+1>


DEFINE CONSOL<
XCTY=XLINE
L<LSW>,\XLINE,<=0>
XLINE=XLINE+1>
;INITILIZE INTERNAL PARAMETERS
;-----------------------------

XPLO=200		;LOWEST PORT NUM.
XPHI=-1			;HIGHEST...
XMLO=200		;LOWEST MODEM NUM.
XMHI=-1			;HIGHEST...
XC1NUM=0		;NUM. LINES AT CLOCK-1
XC2NUM=0		;...CLOCK-2
XC3NUM=0		;...CLOCK-3
XC4NUM=0		;...CLOCK-4

XLINE=0

L<	XLIST>


LINES			;INVOKE MACROS

L<	XLIST>


XLNUM=XLINE		;NUMBER OF LINES
XPSIZ=XPHI-XPLO+1
M689LO=XMLO/10		;LOWEST 689AG GROUP NUM.
M689HI=XMHI/10		;HIGHEST 689AG GROUP NUM.
IFL XPHI,<		;IF NO DATA PORTS
XPSIZ=0
XPLO=0
XPHI=0
> ;IFL XPHI
XMSIZ=XMHI-XMLO+1
IFL XMHI,<		;IF NO DATA SETS
M689LO=0
M689HI=0
XMSIZ=0
XMLO=0
XMHI=0
> ;IFL XMHI
;DEFINE AND GENERATE GENERAL CLOCK PARAMETERS
;--------------------------------------------



XK=1
REPEAT 4,<
CAT(<IFDEF BAUD>,\XK),<
XCNUM=XK			;AND REMEMBER NUM. OF CLOCKS
> ;IFDEF CAT(...
XK=XK+1
> ;REPEAT 4



XBHI=CAT(BAUD,\XCNUM)		;FASTEST BAUDRATE
XBLO=BAUD1		;LOWEST BAUD RATE
XCFNUM=CAT(XC,\XCNUM,NUM)	;NUM. LINES ON FASTEST CLOCK
;SET CLOCK-CODE PARAMETERS ACCORDING TO HIGHEST BAUD RATE DEFINED
;----------------------------------------------------------------

			;FAST CLOCKS (GREATER THAN 150 BAUD)

XTTIC=^D10	;MAX.NUM.CONSEQ.TTI'S BEFORE CHECKING HIGHER CLOCKS
XTTIF=1		;MAX.NUM.'FINISHED-CHAR.' SERVICES BEFORE CHECKING HIGHER CLOCKS
XTTOC=4		;MAX.NUM.CONSEQ.'TTOS' BEFORE CHECKING HIGHER CLOCKS
XTTOF=1		;MAX.NUM.'FINISHED-CHAR.' SERVICES BEFORE CHECKING HIGHER CLOCKS
XTTIFF=XCFNUM/^D10	;XTTIF FOR FASTEST (OR ONLY) CLOCK
IFLE XTTIFF,<XTTIFF=1>
XTTOFF=XCFNUM/^D25	;XTTOF ...
IFLE XTTOFF,<XTTOFF=1>

IFLE XBHI-^D150,<	;MEDIUM CLOCKS (110 TO 150 BAUD)
XTTIC=^D20
XTTIF=3
XTTOC=^D8
XTTOF=2
>

IFLE XBHI-^D110,<	;SLOW CLOCKS (110 OR LOWER)
XTTIC=^D40
XTTIF=5
XTTOC=^D15
XTTOF=4
>
;DEFINE MACROS FOR TTI-CHAIN GENERATION
;--------------------------------------

DEFINE TTIMAC (CLOK)<


DEFINE LOCAL (PORT,CLOCK,FORM)<
IFE CLOCK-XCLOK,<		;SELECT LINES ONLY FOR THIS CLOCK.

IFE XK-1,<			;RESET LCC 1ST TIME AND AFTER RETURNS FROM HIGHER CLOCKS
L<	XLIST>
L<	TAD	[->,\XLCC,<]	/SET LOAD.CONTROL.CTR>
L<	LCCCLR LCCLOD>
L<	XLIST>
> ;IFE XK-1

IFE FORM-0,<XF=2000>	;SELECT CAW CONST. ACCORDING TO FORM
IFE FORM-1,<XF=2000>
IFE FORM-2,<XF=1000>
IFE FORM-3,<XF=200>

L<	TTI>
L(<LSW>,\XLINE,<=.>)		;FOR SIMTAB
L<	>,\PORT,<0>
L<	>,\XF
L<	CALL	TTIX>

IFE XK-XTTI,<			;CK HIGHER.CLOCKS EVERY XTTI TIMES
XTTIR=XTTIR-1			;COUNT DOWN 'EXTRA LINE' CTR.
IFE XTTIR,<XTTI=XTTI-1>		;AND ADJUST XTTI IF GONE TO ZERO
L<	XLIST>
L<	JMS	CK>,\CLOCK,<ION	/CHECK HIGHER CLOCKS>
L<	XLIST>
XK=0
> ;IFE XK-XTTI

XK=XK+1
> ;IFE CLOCK-XCLOK
XLINE=XLINE+1
> ;DEFINE LOCAL

DEFINE REMOTE(PORT,CLOCK,FORM,A1)<LOCAL(PORT,CLOCK,FORM)>

DEFINE MODEM(A1)<
XLINE=XLINE+1
>

DEFINE NULL<
XLINE=XLINE+1
>

DEFINE CONSOL<
XLINE=XLINE+1
>
XK=1		;FOR COUNTING UP TO XTTI
XCLOK=CLOK	;LOCAL USES THIS TO TELL WHICH CLOCK ITS EXPANDING FOR

IFE CLOK-XCNUM,<	;IF FASTEST CLOCK
XLCC=XTTIFF		;   SET LCC.REG TO 1/5 TOTAL NUM. LINES
XTTIR=0
XTTI=1000		;   AND DONT WORRY ABOUT FASTER CLOCKS
> ;IFE CLOK-XCNUM

IFN CLOK-XCNUM,<	;IF NOT FASTEST CLOCK
XLCC=XTTIF		;   SET LCC.REG. TO XTTIF
XC=CAT(XC,\CLOK,NUM)		;XC=NUM. LINES ON THIS CLOCK
XB=<<XC-1>/XTTIC>+1		;XB=NUM. TTI GROUPS NEEDED
XTTI=XC/XB			;XTTI=NUM. TTI'S PER GROUP
XTTIR=XC-<XTTI+XB>		;XTTIR=NUM GROUPS WITH EXTRA TTI
IFG XTTIR,<XTTI=XTTI+1>
> ;IFN CLOK-XCNUM

L<	XLIST		/TTI CHAIN>

XLINE=0


LINES				;INVOKE MACROS

L<	XLIST>


IFN CLOK-XCNUM,<		;IF NOT FASTEST CLOCK
IFN XK-1,<			;   AND IF INCOMPLETE GROUP
L<	JMS	CK>,\CLOK,<ION	/CHECK HIGHER CLOCKS>
> ;IFN XK-1
> ;IFN CLOK-XCNUM
L<>


> ;DEFINE TTIMAC
;MACRO TO GENERATE  TTOX CALLS
;-----------------------------



DEFINE TTOMAC (CLOK)<

CAT(<XN=XC>,\CLOK,<NUM>)		;NUMBER OF LINES ON THIS CLOCK
XTTOTL=XTTOTL+XN+5		;ACCUMULATE LENGTH OF TTOX TABLES

IFE CLOK-XCNUM,<		;IF FASTEST CLOCK
XK=0				;    NUM. OF TABLES (ONLY ONE)
XKO=XTTOFF		;   TTO LOAD-CONTROL-CTR.
> ;IFE CLOK-XCNUM

IFN CLOK-XCNUM,<		;OTHER CLOCKS:
XK=<XN-1>/<5*XTTOC>		;   NUM. OF TABLES
XKO=XTTOF			;    LOAD-CONTROL
> ;IFN CLOK-XCNUM

CAT(<TTOXT>,\CLOK,<=>,\XK,<+1>)	;REMEMBER NUM. OF TABLES FOR TTOTAB MACRO

L<	CLA		/SERVICE OUTPUT>
L<	TAD	[->,\XKO,<-1]	/SET 'LOAD CONTROL'>
L<	CALL	TTOX>
L<	CK>,\CLOK,<O0-1>

XT=1				;GENERATE MORE CALLS AS REQUIRED
REPEAT XK,<
XTTOTL=XTTOTL+5			;TOTAL LENGTH OF TABLES TO DATE
L<	JMS	CK>,\CLOK,<ION>
L<	TAD	[->,\XKO,<-1]>
L<	CALL	TTOX>
L<	CK>,\CLOK,<O>,\XT,<-1>
XT=XT+1
> ;REPEAT XK

L<>

> ;DEFINE TTOMAC
;GENERATE CLOCK CODE AND TTI CHAINS
;----------------------------------

XTTOTL=0		;FOR COUNTING TOTAL LENGTH OF TABLES
XCNUM1=XCNUM-1



;GENERATE LEADING CODE
;---------------------

L<CLK0=NEXCLK>
L<>
L<CLKINI,	/CLOCK INITIALIZATION>

XK=1
REPEAT XCNUM1,<

L<	TAD	[CK>,\XK,<1]>
L<	DCA	CK>,\XK,<ION>
L<	CK>,\XK,<ON>

XK=XK+1
> ;REPEAT XCNUM1

L<	CK>,\XCNUM,<ON>
L<	JMP I	[CLKINX]>

L<>
;GENERATION FOR FASTEST CLOCK
;----------------------------


L<CLK,	CK>,\XCNUM,<SKP		/HERE FROM INTERRUPT CHAIN>
L<	JMP I	[CLK>,\XCNUM1,<]>
L<	DCA I	[DAOQUE]/IN ORDER TO TELL IF DAOQUE WAS CALLED>

IFN XCNUM-1,<			;NOT NEEDED IF NOLY ONE CLOCK
L<	JMP I	[CK>,\XCNUM,<0]>
L<>
L<CKION,	CK>,\XCNUM,<SKP		/HERE FROM LOWER CLOCKS>
L<	JMP I	CK>,\XCNUM1,<ION>
> ;IFN XCNUM-1

L<CK>,\XCNUM,<0,	CK>,\XCNUM,<ON>
L<>


TTIMAC (\XCNUM)		;GENERATE TTI CHAINS
TTOMAC (\XCNUM)		;   AND TTOX CALLS


X\IFNZRO FTCKOV<
\
L<	CK>,\XCNUM,<SKP		/CHECK FOR OVER-RUN>
L<	JMP I	CK>,\XCNUM1,<ION>
L<	INC	CK>,\XCNUM,<OVR>
L<	NOP>
L<	JMP I	[CK>,\XCNUM,<0]>
X\> /IFNZRO FTCKOV
\
L<>

X\IFZERO FTCKOV<
\
L<	JMP I	CK>,\XCNUM1,<ION>
X\> /IFZERO FTCKOV
\
L<>
;GENERATION FOR OTHER CLOCKS
;---------------------------



XCN=XCNUM1

REPEAT XCNUM1,<
XCP=XCN-1

L<CLK>,\XCN,<,	CK>,\XCN,<SKP		/HERE FROM INTERRUPT CHAIN>
L<	JMP I	[CLK>,\XCP,<]>
L<	DCA I	[DAOQUE]/IN ORDER TO TELL IF DAOQUE WAS CALLED>
L<CK>,\XCN,<0,	CK>,\XCN,<ON>


TTIMAC (\XCN)		;GENERATE TTI CHAIN
TTOMAC (\XCN)		;    AND TTOX CALLS


X\IFNZRO FTCKOV<
\
L<	CK>,\XCN,<SKP		/CHECK FOR OVER-RUN>
L<	SKP>
L<	INC	CK>,\XCN,<OVR>
L<	NOP>
L<>
X\> /IFNZRO FTCKOV
\
L<	JMS	CK>,\XCN,<ION	/CHECK HIGHER CLOCKS LAST TIME>
L<>
L<CK>,\XCN,<1,	CK>,\XCN,<SKP>
L<	JMP I	CK>,\XCP,<ION	/RETURN TO LOWER CLOCKS>
L<	CK>,\XCN,<ON>
L<	JMP I	[CK>,\XCN,<0]>
L<>


XCN=XCN-1
> ;REPEAT XCNUM1
;GENERATE TRAILING CODE
;----------------------

L<>
L<CK01,			/HERE WHEN ALL CLOCKS SATISFIED>
L<	TAD I	[DAOBZ]	/IF DA-10 IS IDLE>
L<	SKPE CLA>
L<	JMP I	[.+4]>
L<	TAD I	[DAOQUE]/   AND DAOQUE WAS CALLED>
L<	SKPE CLA>
L<	JMS I	DAOUTJ	/   START IT UP AGAIN>
L<>
L<	ISZ	TIKTIK	/SERVICE 1/5-SECOND CLOCK>
L<	XITIRP>
L<	REQTIK>
L<	XITIRP>
L<>
;GENERATE LINTAB
;----------------


DEFINE LOCAL(A1,A2,A3)<L<20>>
DEFINE REMOTE(A1,A2,A3,A4)<L<20>>
DEFINE MODEM(A1)<L<0>>
DEFINE CONSOL<L<10>>
DEFINE NULL<L<0>>


L<LINTAB=.>

LINES

L<>
;GENERATE LPTAB (LINE TO PORT MAP)
;---------------------------------

DEFINE LOCAL (PORT,CLOCK,FORM)<
L \PORT
XLINE=XLINE+1
> ;DEFINE LOCAL

DEFINE REMOTE(PORT,CLOCK,FORM,A1)<LOCAL(PORT,CLOCK,FORM)>


DEFINE CONSOL<
XK=4000!XLINE
L \XK
XLINE=XLINE+1
> ;DEFINE CONSOL


DEFINE NULL<
XK=4200!XLINE
L \XK
XLINE=XLINE+1
 > ;DEFINE NULL


DEFINE MODEM(A1)<NULL>



L<LPTABB=.		/BASE CONST. FOR ADDRESSING LPTAB>
L<LPTAB=.>


XLINE=0

LINES

L<>
;GENERATE PLTAB (PORT TO LINE MAP)
;---------------------------------


L<PLTABB=.-PLO		/BASE CONST. FOR ADDRESSING PLTAB>
L<PLTAB=.>


XK=XPLO
REPEAT XPSIZ,<

CAT(<IFDEF PL>,\XK),<
XC=CAT(PL,\XK)			;   GENERATE LINE.NUM. AS TABLE ENTRY
L \XC
> ;IFDEF ...

CAT(<IFNDEF PL>,\XK),<
L(<4200>)			;   GENERATE 4200
> ;IFNDEF ...

XK=XK+1
> ;REPEAT XPSIZ

L<>
;GENERATE MODEM TABLES
;---------------------

IFN XMSIZ,<		;ONLY IF THERE ARE SOME MODEMS

;GENERATE LMTAB (LINE TO MODEM MAP)
;----------------------------------

DEFINE MODEM (PORT)<
XK=4000!PORT
L \XK
XLINE=XLINE+1
> ;DEFINE MODEM

DEFINE REMOTE (A1,A2,A3,PORT)<MODEM (PORT)>

DEFINE CONSOL<
L<0>
XLINE=XLINE+1
> ;DEFINE CONSOL

DEFINE LOCAL(A1,A2,A3)<CONSOL>

DEFINE NULL<
L<0>
XLINE=XLINE+1
> ;DEFINE NULL


L<LMTABB=.	/BASE CONST. FOR ADDRESSING LMTAB>
L<LMTAB=.>


XLINE=0

LINES

L<>
;GENERATE MLTAB (MODEM TO LINE MAP)
;----------------------------------

L<MLTABB=.-MLO	/BASE CONST. FOR ADDRESSING MLTAB>
L<MLTAB=.>


XK=XMLO
REPEAT XMSIZ,<

CAT(<IFDEF ML>,\XK,<,>)
<
XC=CAT(ML,\XK)		;   GENERATE LINE. NUM. AS TABLE ENTRY
L \XC
> ;IFDEF...

CAT(<IFNDEF ML>,\XK,<,>)
<
L(<0>)		;   GENERATE 0
> ;IFNDEF ...


XK=XK+1
> ;REPEAT XMSIZ

L<>
;GENERATE TAB689 (IF 689AG)
;--------------------------

IFE DC08FX,<
XK=<M689HI-M689LO+1>*4
L<TAB689,	ZBLOCK	>,\XK
> ;IFE DC08FX


> ;IFN XMSIZ -- END OF MODEM TABLE GENERATION
;GENERATE SIMTAB
;----------------

X\IFNZRO FTSIM <
\
L<SIMTAB=.	/TABLE OF LSW ADDRESSES>

XLINE=0

REPEAT XLNUM,<
L<LSW>,\XLINE
XLINE=XLINE+1
> ;REPEAT XLNUM

X\> /IFNZRO FTSIM
\
L<>
;GENERATE BUFFER AND QUEUE STORAGE
;---------------------------------

L<TTOSHB=.-PLO	/BASE CONST. FOR ADDRESSING TTOSHF>
L<TTOSHF=.>
L<	XLIST>
L<	ZBLOCK	PSIZ>
L<	XLIST>
L<TTOBUF=.>
L<	XLIST>
L<	ZBLOCK	PSIZ>
L<	XLIST>
L<MONQA,	*.+MONQL>
L<MODQA,	*.+MODQL+MODQL>
L<MAPQA,	*.+MAPQL+MAPQL>
L<ERRQA,	*.+ERRQL+ERRQL>
L<DAOQA,	*.+NUMLIN+NUMLIN>
L<>
L<TABEND=.>
L<>
;DEFINE TTOX TABLE MACROS
;--------------------

DEFINE TTOTAB (CLOK)<


DEFINE LOCAL (PORT,CLOCK,FORM)<
IFE CLOCK-CLOK,<		;ONLY LINES. FOR CURRENT CLOCK.

IFE XK5,<			;BEGINNING OF EACH TABLE
L(<CK>,\CLOK,<O>,\XKT,<,>)	;   NEEDS LABEL
L<CKTO=.>
XK5=1
> ;IFE XK5

L(\PORT)		;GENERATE TABLE ENTRY

IFE XKC-XKCMAX,<		;ONE GROUP (TICK'S WORTH) OF LINES. ?

XKK=XKK-1			;DEC. 'EXTRA LINE PER GROUP' CTR.
IFE XKK,<XKCMAX=XKCMAX-1>

IFE XK5-5,<			;IF END OF TABLE
L(<CKTO-1>)			;   GENERATE PTR. TO BEGINING
XK5T=0
XKT=XKT+1
> ;IFE XK5-5

IFN XK5-5,<			;OTHERWISE
L(<.>)			;   GENERATE PTR. TO NEXT WD.
XK5T=XK5+1
> ;IFN XK5-5

XK5=XK5T
XKC=0
> ;IFE XKC-XKCMAX


XKC=XKC+1
> ;IFE CLOCK-CLOK
> ;DEFINE LOCAL


DEFINE REMOTE(PORT,CLOCK,FORM,A1)<LOCAL(PORT,CLOCK,FORM)>
DEFINE NULL<>
DEFINE MODEM(A1)<>
DEFINE CONSOL<>
XK5=0				;COUNT TO 5
XKC=1				;COUNT TO XKCMAX
XKT=0				;COUNT NUM. OF TABLES
CAT(<XM=XC>,\CLOK,<NUM>)	;XM=NUM. LINES THIS CLOCK
CAT(<XMT=TTOXT>,\CLOK)		;XMT=NUM. TTOX TABLES THIS CLOCK


XKCMAX=XM/<5*XMT>	;NUM. LINES/TICK (ONE GROUP)
XKK=XM-<5*XMT*XKCMAX>	;NUM. GROUPS WITH AN EXTRA LINE
IFG XKK,<XKCMAX=XKCMAX+1>



LINES				;INVOKE MACROS



IFN XK5,<			;FINISH UP LAST TABLE
REPEAT 5-XK5,<
L(<.>)			;   WITH NULL ENTRIES
> ;REPEAT 5-XK5
L(<CKTO-1>)			;   AND FINAL LINK TO BEGINING
> ;IFN XK5


> ;DEFINE TTOTAB




;GENERATE TTOX TABLES
;--------------------



L<*HICORE->,\XTTOTL,<	/TTOX TABLES MUST START AT 4001 OR HIGHER>
L<>

XC=1
REPEAT XCNUM,<
TTOTAB (XC)
L<>
XC=XC+1
> ;REPEAT XCNUM


L<$>

PALE2:;END OF PAL SOURCE TO BE SUFFIXED TO P680.PAL
;CODE TO BE PREFIXED TO P680.PAL
;-------------------------------

PALB1:

X\/\
NAME
L<-----GENERATED BY M680.MAC V.>,\VERZUN,<----->
L<>

L<NUMLIN=>,\XLNUM,<	/TOAL NUM. OF LINES>
L<PLO=>,\XPLO,<		/LOWEST PORT NUMBER>
L<PHI=>,\XPHI,<		/HIGHEST...>
L<PSIZ=>,\XPSIZ,<	/SIZE OF PORT-TABLES>
L<MLO=>,\XMLO,<		/LOWEST MODEM NUMBER>
L<MHI=>,\XMHI,<		/HIGHEST...>
L<MSIZ=>,\XMSIZ,<	/SIZE OF MODEM-TABLES>
L<M689LO=>,\M689LO,<	/LOWEST GROUP NUM. (689AG ONLY)>
L<M689HI=>,\M689HI,<	/HIGHEST...>
L<CTYLIN=>,\XCTY,<	/LINE NUM. OF CTY>

L<CNUM=>,\XCNUM,<		/NUMBER OF CLOCKS>
L<BAUD=>,\XBLO,<	/BAUDRATE OF SLOWEST CLOCK>
L<DAOQL=NUMLIN	/LENGTH OF DAOQ>
L<>
M689AG=-<DC08FX-1>
L<FTMOD=>,\MODCON,<	/1: ASSEMBLE MODEM CONTROL CODE>
L<FT689=>,\M689AG,<	/0: DC08-FX   1: 689AG>
L<>

PALE1:
;ACCUMULATORS
P=1
P1=2
P2=3
P3=4
P4=5
T=6
T1=7
T2=10
T3=11
T4=12
CH=13

;/I/O CHANNELS
OCHN=1
ICHN=2

PDLL=10	;PUSHDOWNLIST LENGTH
; HERE TO WRITE PAL SOURCE
;-----------------------
DEFINE TYPER(MSG)<
JRST	[TTCALL 3,[ASCIZ\MSG\]
EXIT]>

PALOUT:	MOVE	P,[IOWD PDLL,PDLA]
	RESET
	MOVE	P1,[OUTDEV]		;OPEN OUTPUT
	MOVE	P2,[OUTFIL]
	PUSHJ	P,OPENO
	  TYPER<CAN'T OPEN OUTPUT DEVICE>
	MOVE	P1,[INDEV]		;OPEN INPUT
	MOVE	P2,[INFIL]
	PUSHJ	P,OPENI
	  TYPER<CAN'T OPEN INPUT DEVICE>

	MOVE	T1,[POINT 7,PALB1]	;OUTPUT PREFIXED CODE
	MOVEI	T2,<PALE1-PALB1>*5
	PUSHJ	P,SPALO1

PALO0:	PUSHJ	P,INCH		;COPY BODY OF X680.PAL TO OUTPUT
	  JRST	PALO3
	PUSHJ	P,OUTCH
PALO4:	  TYPER<OUTPUT ERROR>
	JRST	PALO0

PALO3:	TLNE	T,740000	;ERRORS?
	TYPER<INPUT ERROR>
	PUSHJ	P,CLOSEI	;NO--END OF FILE
	  TYPER<CAN'T CLOSE INPUT>

	MOVE	T1,[POINT 7,PALB2] ;OUTPUT SUFFIXED CODE
	MOVEI	T2,<PALE2-PALB2>*5
	PUSHJ	P,SPALO1

	PUSHJ	P,CLOSEO		;CLOSE AND RELEASE
	  TYPER<CAN'T CLOSE OUTPUT>
	TYPER<***THE END***>

SPALO1:	ILDB	CH,T1		;GET CHARACTER
	JUMPE	CH,SPALO2		;   IGNORING NULLS
	PUSHJ	P,OUTCH
	  JRST	PALO4
SPALO2:	SOJGE	T2,SPALO1
	POPJ	P,
;SUBROUTINE TO OPEN OCHN FOR OUTPUT
;CALL	P1=DEVICE NAME
;	P2=FILE NAME
;RET+0	ERROR--STATUS IN T
;RET+1	OK

OPENO:	SETZM	T1		;OPEN OCHN FOR ODEV
	MOVE	T2,P1
	MOVSI	T3,OHED
	OPEN	OCHN,T1
	  JRST	OUTER

	MOVEI	T,OBUF		;   WITH ONE BUFFER
	HRRM	T,.JBFF
	OUTBUF	OCHN,1

	MOVE	T1,P2		;ENTER FILE NAME
	MOVSI	T2,(SIXBIT/PAL/) ;   WITH EXT. 'PAL'
	SETZB	T3,T4
	ENTER	OCHN,T1
	  JRST	OUTER
	JRST	CPOPJ1

;SUBROUTINE TO CLOSE AND RELEASE OCHN
;RET+0	ERRORS--STATUS IN T
;RET+1	OK

CLOSEO:	CLOSE	OCHN,		;CLOSE OCHN
	STATZ	OCHN,740000	;   AND GET FINAL STATUS
	  JRST	OUTER

	RELEASE	OCHN,		;RELEASE OCHN
CPOPJ1:	AOS	(P)		;AND SKIP RETURN
	POPJ	P,


OUTER:	GETSTS	OCHN,T		;GET STATUS
	POPJ	P,


;OUTPUT CHAR IN CH TO OCHN
;RET+0 IF ERROR
;RET+1 IF OK

OUTCH:	SOSLE	OHED+2	;ROOM?
	JRST	OUTCH2	;YES
	OUT	OCHN,		;NO-GET ANOTHER BUFFER
	  JRST	OUTCH2
	POPJ	P,		;ERROR RETTURN

OUTCH2:	IDPB	CH,OHED+1	;STORE CHAR
	JRST	CPOPJ1
;SUBROUTINE TO OPEN ICHN FOR INPUT

OPENI:	SETZM	T1
	MOVE	T2,P1
	MOVEI	T3,IHED
	OPEN	ICHN,T1
	  JRST	INER

	MOVEI	T,IBUF
	HRRM	T,.JBFF
	INBUF	ICHN,1

	MOVE	T1,P2
	MOVSI	T2,(SIXBIT/PAL/)
	SETZB	T3,T4
	LOOKUP	ICHN,T1
	  JRST	INER
	JRST	CPOPJ1


;SUBROUTINE TO CLOSE AND RELEASE ICHN

CLOSEI:	CLOSE	ICHN,
	STATZ	ICHN,740000
	  JRST	INER
	RELEASE	ICHN,
	JRST	CPOPJ1

INER:	GETSTS	ICHN,T
	POPJ	P,


;SUBROUTINE TO INPUT CHAR TO CH FROM OCHN

INCH:	SOSLE	IHED+2
	JRST	INCH2
	IN	ICHN,
	  JRST	INCH2
	POPJ	P,
INCH2:	ILDB	CH,IHED+1
	JRST	CPOPJ1
;STORAGE
;-------

U(PDLA,PDLL)	;PUSHDOWN LIST
U(OHED,3)	;OUTPUT BUFFER HEADER
U(IHED,3)
U(OBUF,203)	;OUTPUT BUFFER
U(IBUF,203)


	END	PALOUT