Trailing-Edge
-
PDP-10 Archives
-
decuslib20-05
-
decus/20-0136/lnkxex.mac
There are 2 other files named lnkxex.mac in the archive. Click here to see a list.
TITLE LNKXEX V022 28-APR-72
; COPYRIGHT 1969,1970,1971,1972, DIGITAL EQUIPMENT CORPORATION.
; edit history
;[w1] disable job logging (jobon and joboff)
;[w1] also convert jobdat symbols
;[w1] [stb 30-nov-80]
IFNDEF NONREN, <TWOSEG>
VNUM= 1022 ;VERSION NUMBER
LOC 137
EXP VNUM
IFNDEF NONREN, <RELOC 400000>
IFDEF NONREN, <RELOC>
TITLE: SIXBIT /LNKX11/
SUBTTL: SIXBIT /V022 /
ENTRY START
INTERNAL PATCH
INTERNAL SIXM40
;[w1] EXTERNAL LINK, JOBREL, JOBFF, JOBUUO, JOB41
EXTERNAL LINK, JOBREL, JOBFF
EXTERNAL OBJDEV, OBJNAM, OBJEXT
job41=.jb41##
jobuuo=.jbuuo##
; CCLSW=1 GIVES NEW COMMAND LANGUAGE FEATURES
IFNDEF CCLSW,<CCLSW==1> ;NORMALLY ASSEMBLE WITH CCL FEATURES
IFE CCLSW,<TEMPC==0> ;TMPCOR UUO FLAG
IFNDEF TEMPC,<TEMPC==1> ;NORMALLY USE CCL WITH TMPCOR UUO
SUBTTL VARIABLE PARAMETERS
NUMBUF= 2 ; NUMBER OF BUFFERS PER DEVICE
CORINC= 2000 ; CORE INCREMENT
PDPLEN= 100 ; PUSH-DOWN POINTER LENGTH
COLLPT= ^D128 ;CPL LPT
COLTTY= ^D72 ;CPL TTY
INTERNAL CCLFLA
INTERNAL SWTLEN, SWTNAM, SWTARG
SWTLEN= ^D20
SUBTTL ACCUMULATOR ASSIGNMENTS
%00= 0 ; ACCUMULATION OF SIXBIT SYMBOL, SCRATCH
%01= 1 ; SYMBOL VALUE AND FLAGS SET BY SRCH. SCRATCH
%02= 2 ; SCRATCH
%03= 3 ; UNIVERSAL SCRATCH
%04= 4 ; UNIVERSAL SCRATCH +1
%05= 5 ; LOCATION COUNTER
%06= 6 ; SCRATCH
%07= 7 ; SYMBOL TABLE SEARCH INDEX
%10= 10 ; EXPRESSION OR TERM VALUE, SCRATCH
%11= 11 ; SCRATCH
%12= 12 ; MACRO STORAGE BYTE POINTER
%13= 13 ; LINE BUFFER BYTE POINTER
%14= 14 ; CURRENT CHARACTER (ASCII)
%15= 15 ; LH - ASSEMBLER FLAGS, RH - ERROR FLAGS
%16= 16 ; EXEC FLAGS
%17= 17 ; PUSH-DOWN POINTER
SUBTTL FLAG REGISTERS
; %16 - LH
LSTBIT= 000001 ; 1- SUPRESS LISTING OUTPUT
BINBIT= 000002 ; 1- SUPRESS BINARY OUTPUT
NSWBIT= 000040 ; 1- SUPRESS ERRORS ON TTY
TTYBIT= 000200 ; 1- LISTING IS ON TTY
ERRBIT= 000400 ; 1- ERROR MESSAGES ENABLED
; %16 - RH
ARWBIT= 000001 ; 1- LEFT ARROW SEEN
EXTBIT= 000002 ; 1- EXPLICIT EXTENSION SEEN
SWTBIT= 000004 ; 1- ENTER SWITCH MODE
INFBIT= 000010 ; 1- VALID INFORMATION SEEN
FFBIT= 000020 ; 1- FORM-FEED SEEN
ENDBIT= 000400 ; 1- END OF ALL INPUT FILES
SLABIT= 001000 ; 1- SWITCH MODE ENTERED WITH A </>
HSHBIT= 002000 ; 1- NO "#" REQUIRED
NULBIT= 010000 ; 1- NON-NULL COMMAND STRING
MODBIT= 200000 ; 1- USER MODE AC'S SET
; %15 - LH
ENDFLG= 000020 ; 1- END OF SOURCE ENCOUNTERED
TTYFLG= 000100 ; 1- TTY MODE LISTING FORMAT
ISWFLG= 100000
IOSFLG= 040000 ; 1- /I ON OUTPUT SIDE
TAB= 11
LF= 12
CRR= 15
SPACE= 40
SUBTTL MISCELLANEOUS PARAMETERS
TTYDEV= 000010 ; 1- DEVICE IS A TTY
PTRDEV= 000200 ; 1- DEVICE IS A PTR
LPTDEV= 040000 ; 1- DEVICE IS A LPT
CDRDEV= 100000 ; 1- DEVICE IS A CDR
IODATA= 200000 ; 1- IO DATA ERROR
IODEV= 100000 ; 1- IO PARITY ERROR
IOWRLK= 400000 ; 1- IO WRITE LOCK ERROR
IOBKTL= 040000 ; 1- IO BLOCK TOO LARGE
IOEOF= 020000 ; 1- END OF FILE ON IO DEVICE
; DEVICE PARAMETERS
BIN= 1
LST= 2
SRC= 3
CMD= 4
INBIT= 2 ;DEVICE CAN DO INPUT
ALMODE= 1 ;ASCII LINE MODE
; OPDEFS
OPDEF RESET [CALLI 0]
OPDEF DEVCHR [CALLI 4]
OPDEF CORE [CALLI 11]
OPDEF EXIT [CALLI 12]
OPDEF DATE [CALLI 14]
OPDEF APRENB [CALLI 16]
OPDEF MSTIME [CALLI 23]
OPDEF RUNTIM [CALLI 27]
OPDEF ZBINK [CLOSE BIN,]
OPDEF OUTCHR [TTCALL 1,]
OPDEF OUTSTR [TTCALL 3,]
OPDEF INCHWL [TTCALL 4,]
DEFINE GENM40 (A,B,C,D,E,F) ;GEN MOD 40
<
XWD $'A*50*50+$'B*50+$'C , $'D*50*50+$'E*50+$'F
>
UUOPRO: ;UUO PROCESSOR
PUSHJ %17,ACEXCH ;SAVE REGS
LDB %02,[POINT 9,JOBUUO,8] ;FETCH NUMBER
CAILE %02,UUOMAX ;IN BOUNDS?
HALT . ; NO
XCT UUOTBL(%02) ;YES, DISPATCH
CAIA ; NORMAL RETURN
AOS 0(%17) ;SKIP-RETURN
JRST ACEXCH ;RESTORE REGS AND EXIT
DEFINE GENUUO (NAME,ADDR)
<
OPDEF NAME [<.-UUOTBL>B8]
PUSHJ %17,ADDR
>
UUOTBL: 0 ;UUOTABLE
GENUUO .TYPE,.TYPE0
GENUUO .WRITE,.WRIT0
GENUUO .HEAD,HEADER
GENUUO .READ,GETLIN
GENUUO .CSI,.CSI0
GENUUO .SETP2,SETP2
GENUUO .WBIN,.WBIN0
GENUUO .CORE,GETCOR
UUOMAX= .-UUOTBL ;SET MAX
.TYPE0: ;TYPE A LINE
TLOA %16,ERRBIT ;SET FLAG AND SKIP
.WRIT0: ;WRITE A LINE
TLZ %16,ERRBIT ;CLEAR FLAG
MOVEI %01,@JOBUUO ;SET POINTER
TLO %01,(POINT 7,,) ;FORM BYTE POINTER
.WRIT1: ILDB %02,%01 ;FETCH THE NEXT CHARACTER
PUSHJ %17,LSTOUT ;LIST THE CHARACTER
JUMPN %02,.WRIT1 ;LOOP IF NOT DONE
TLZ %16,ERRBIT ;CLEAR THE FLAG
POPJ %17, ; AND EXIT
.CSI0: ;INIT INPUT FIELD
PUSH %17,JOBUUO ;STACK ARG
TRZN %16,ENDBIT ;END SEEN?
JRST .CSI2 ; NO
MOVE %01,TTIPNT ;YES, GET CURRENT POINTER
MOVEI %02,","
DPB %02,%01 ;OVERWRITE CRR
TRZ %16,HSHBIT ;FORCE "#"
PUSHJ %17,GETCHI ;GET A COMMAND CHARACTER
JUMPN %02,.-1 ;LOOP IF NOT END
IDPB %02,%01
.CSI2: SETZM OBJDEV ;CLEAR NAMES FOR LINKER
SETZM OBJNAM
SETZM OBJEXT
MOVSI %01,(SIXBIT /DSK/) ;ASSUME DISK
TRNN %16,ENDBIT ;SKIP IF END
PUSHJ %17,GETSRC ;SET NEXT SOURCE FILE
TRNN %16,ENDBIT
TDZA %02,%02
MOVEI %02,1
POP %17,%01 ;RETRIEVE ARG
MOVEM %02,AC00(%01)
POPJ %17,
CRLF: BYTE (7) CRR, LF, 0
.WBIN0: ;WRITE BINARY
MOVEI %01,@JOBUUO ;GET ADDRESS
SETZM CHKSUM ;CLEAR CHECK SUM
MOVEI %02,01
PUSHJ %17,BINWRD ;WRITE HEADER
MOVE %02,1(%01)
ADDI %02,4
PUSHJ %17,BINWRD ; AND COUNT
SKIPN %04,1(%01) ;EMPTY?
JRST WBIN2 ; YES
MOVEI %03,2(%01)
HRLI %03,(POINT 8,,35) ;FORM BYTE POINTER
WBIN1: LDB %02,%03
PUSHJ %17,BINOUT ;WRITE BYTE
TLCE %03,(POINT 0,,35-8) ;TIME FOR NEXT WORD?
ADDI %03,1 ; YES
SOJG %04,WBIN1 ;LOOP IF MORE
WBIN2: MOVN %02,CHKSUM
PUSHJ %17,BINOUT ;WRITE CHECK-SUM
MOVEI %04,^D6
MOVEI %02,0
PUSHJ %17,BINOUT ;TRAILING NULLS
SOJG %04,.-2
POPJ %17,
SUBTTL EXEC
START: ;MAIN ENTRY POINT
IFN CCLSW,<
TDZA 0,0 ;NORMAL ENTRY, CLEAR CCL FLAG
SETOM 0 ;CCL ENTRY, SET FLAG
MOVEM 0,CCLFLA ;SAVE FLAG
>
NULFIL: RESET ;RESET ALL I/O
HRRZ %00,JOBFF
ADDI %00,204*NUMBUF*2+200+200 ;ACCOUNT FOR POSSIBLE CCL FILES
CORE %00,
HALT .
MOVE %17,[IOWD PDPLEN,PDPSTK]
MOVE %00,[PUSHJ %17,UUOPRO]
MOVEM %00,JOB41 ;SET UUO TRAP
IFN CCLSW,<
SKIPE CCLFLA
PUSHJ %17,DSKNIT ;INIT DSK: FOR COMMAND FILE
JFCL ;SKIP RETURN
>
OUTSTR CRLF
IFN CCLSW,
<
SKIPE CCLFLA
JRST NXTCCL
>
SKIPE FIRSTF ;FIRST TIME AROUND?
JRST NXTCCL ; NO, BYPASS MESSAGE
OUTSTR [ASCIZ /LNKX-11 V/]
OUTCHR [<<VNUM/100>&7>+"0"]
OUTCHR [<<VNUM/010>&7>+"0"]
OUTCHR [<<VNUM/001>&7>+"0"]
OUTSTR CRLF
NXTCCL:
AOS FIRSTF ;SHORT OUT FURTHER INTRO'S
MOVE %00,[XWD BZCOR,BZCOR+1]
SETZB %01,BZCOR
BLT %00,EZCOR-1
RUNTIM %01,
MOVEM %01,RUNTIM
DATE %00,
MOVEM %00,DATE ;SAVE DATE
MSTIME %00,
MOVEM %00,MSTIME ; AND TIME
PUSHJ %17,CORSET ;SET UPPER CORE
MOVSI %16,BINBIT!LSTBIT
SETZ %15, ;CLEAR ASSEMBLER FLAG REGISTER
MOVE %01,[POINT 7,TTIBUF]
MOVEM %01,TTIPNT
PUSHJ %17,GETCHI ;GET AN INPUT CHAR
JUMPN %02,.-1
IDPB %02,%01 ;STORE TERMINATOR
MOVSI %01,(SIXBIT /DSK/)
PUSHJ %17,GETBIN ;INITIALIZE THE BINARY FILE
MOVSI %01,(SIXBIT /DSK/)
TRNN %16,ARWBIT ;GO ON TO SOURCE IF _ HAS BEEN SEEN
PUSHJ %17,GETLST ;INITIALIZE THE LISTING FILE
TLZE %15,ISWFLG ;/I REQUESTED?
TLO %15,IOSFLG ; YES, XFER TO OUTPUT SIDE
MOVE %05,TTIPNT
MOVEM %05,TTISAV ;SAVE TTI POINTER
MOVSI %01,(SIXBIT /DSK/)
;[w1] PUSHJ %17,JOBON##
IFN CCLSW,<
; SKIPE CCLFLA
; OUTSTR [ASCIZ /LNKX11: /] ;ANNOUNCE YOURSELF
>
SKIPN CCLFLA
PUSHJ %17,ACEXCH ;SAVE EXEC AC'S
PUSHJ %17,LINK ;CALL THE ASSEMBLER
;[w1] PUSHJ %17,JOBOFF##
IFN CCLSW,<
SKIPN CCLFLA
>
PUSHJ %17,LSTCR ;SKIP ONE LINE
PUSHJ %17,ACEXCH ;SWAP AC'S
IFN CCLSW,<
; EXTERNAL joberr
HRRZ %11,ERRCNT
ADDM %11,.jberr## ;UPDATE ERROR COUNT
JUMPN %11,START2 ;DON'T PRINT 0 ERRORS
SKIPE CCLFLA ;IF CCL MODE
JRST EXIT
>
START2: PUSH %17,%16
TLO %16,ERRBIT
TLZ %16,NSWBIT ;BE SURE TO TYPE FINAL MESSAGE
PUSHJ %17,LSTCR ;SKIP A LINE
POP %17,%00
IFN CCLSW,<
SKIPE CCLFLA ;SKIP REST IF CCL MODE
JRST EXIT
>
AND %00,[XWD NSWBIT,0]
IOR %16,%00
SETZ %11,
RUNTIM %11, ;GET RUNTIM
SUB %11,RUNTIM ;DEDUCT STARTING TIME
IDIVI %11,^D1000 ;CONVERT TO SECONDS
MOVEI %10,[ASCIZ / RUN-TIME: 5 SECONDS/]
PUSHJ %17,LSTMSG
PUSHJ %17,LSTCR
HRRZ %11,JOBREL ;GET TOP OF COR
ASH %11,-^D10 ;CONVERT TO "K"
ADDI %11,1 ;BE HONEST ABOUT IT
MOVEI %10,[ASCIZ / 5K CORE USED/]
PUSHJ %17,LSTMSG ;LIST MESSAGE
JRST EXIT ;CLOSE OUT
GETCHI: ;GET INPUT CHAR
IFN CCLSW,
<
SKIPN CCLFLA
JRST GETCH1 ;INPUT FROM TELETYPE
PUSHJ %17,GETCMD ;READ A CHARACTER FROM COMMAND FILE
JRST GETCH2
>
GETCH1: TRON %16,HSHBIT ;TIME FOR "#"?
OUTSTR [BYTE (7) CRR, LF, "#", 0] ;YES
INCHWL %02
GETCH2: CAIE %02,SPACE
CAIN %02,TAB
JRST GETCHI
IDPB %02,%01
CAIN %02,LF
TDZA %02,%02
JRST GETCHI
POPJ %17, ;EXIT
SUBTTL FILE INITIALIZATION
;INITIALIZE A BINARY FILE
;COLLECTS A DEVICE NAME IN AC %01, A FILE NAME IN XE, AND
;AN OPTIONAL FILE NAME EXTENSION, THE DEVICE IS INITIALIZED IN
;BINARY MODE ON CHANNEL ONE, WITH EITHER ONE OR TWO BUFFERS.
GETBIN:
PUSHJ %17,GETNAM ;GET A DEVICE NAME AND FILE NAME
POPJ %17, ;NULL FILE EXIT
MOVE %00,%01 ;GET AN EXTRA COPY OF THE DEVICE
DEVCHR %00, ;TEST ITS CHARACTERISTICS
TLNE %00,TTYDEV!PTRDEV!LPTDEV!CDRDEV
JRST ERRTB ;ILLEGAL FOR BINARY
MOVE %00,[INIT BIN,10] ;INIT IMAGE MODE
MOVSI %02,BINBUF ;GET BUFFER HEADER ADDRESS
PUSHJ %17,INISET ;INITIALIZE THE BINARY DEVICE
OUTBUF BIN,NUMBUF
TRZN %16,EXTBIT ;WAS THERE AN EXTENSION
MOVSI %14,(SIXBIT /LDA/) ; NO
HLLZM %14,XE1 ;SET IN LOOKUP BLOCK
SETZM XE2 ;ZERO REMAINDER
SETZM XE3
ENTER BIN,XE ;ENTER FILE NAME IN DIRECTORY
JRST ERRNR ;DIRECTORY FULL
TLZ %16,BINBIT ;INDICATE GOOD BINARY FILE
IFN CCLSW,
<
SKIPN CCLFLA
POPJ %17,
OUTSTR [ASCIZ /LNKX11: /]
PUSH %17,%16
MOVSI %16,ERRBIT!LSTBIT!BINBIT
MOVE %00,XE
PUSHJ %17,LSTSIX
MOVEI %02,"."
PUSHJ %17,LSTOUT
HLLZ %00,XE1
PUSHJ %17,LSTSIX
PUSHJ %17,LSTCR
POP %17,%16
>
POPJ %17, ;EXIT
;INITIALIZE A LISTING FILE
;COLLECTS A DEVICE NAME IN AC %01, A FILE NAME IN XE AND
;AN OPTIONAL FILENAME EXTENSION, THE DEVICE IS INITIALIZED IN
;ASCII LINE MODE ON CHANNEL 2, IF THE DEVICE IS A TTY, THE
;TTYLST FLAG IS SET TO 1, AND THE INBUF/OUTBUF INDEX IS INCREMENTED.
GETLST:
SETZM XE
PUSHJ %17,GETNAM ;GET A DEVICE AND FILE NAME
POPJ %17,
MOVE %00,[INIT LST,1]
MOVSI %02,LSTBUF ;GET BUFFER HEADER ADDRESS
PUSHJ %17,INISET ;INITIALIZE LISTING FILE
MOVE %00,%01
DEVCHR %00, ;GET DEVICE CHARACTERISTICS
TLNE %00,TTYDEV ;IS IT A TTY?
TLO %16,TTYBIT ;SET FLAG
OUTBUF LST,NUMBUF
TRZN %16,EXTBIT ;WAS THERE AN EXTENSION?
MOVSI %14,(SIXBIT /MAP/) ;NO
HLLZM %14,XE1 ;SAVE EXTENSION IN LOOKUP BLOCK
ENTER LST,XE ;ENTER FILE NAME IN DIR.
JRST ERRNR ;DIRECTORY FULL
TLZ %16,LSTBIT ;INDICATE A GOOD LISTING FILE
TLNE %16,TTYBIT ;TOGGLE MODE?
TLC %15,TTYFLG ; YES
JRST LPTINI ;INIT LINE OUTPUT AND EXIT
;INITIALIZE A SOURCE FILE
;COLLECTS A DEVICE NAME IN AC %01, A FILE NAME IN XE AND
;AN OPTIONAL FILE NAME EXTENSION. THE DEVICE IS INITIALIZED
;IN ASCII LINE MODE ON CHANNEL 3, AND THE FILE NAME ASSOCIATED
;WITH THE SOURCE FILE IS USED AS THE TITLE ON THE LISTING.
GETSRC:
SETZM XE
PUSHJ %17,GETNAM ;GET A DEVICE NAME AND FILE NAME
POPJ %17, ;COMMAND ERROR IF A NULL
MOVEM %01,OBJDEV
MOVE %00,[INIT SRC,10]
MOVEI %02,SRCBUF ;GET BUFFER HEADER ADDRESS
PUSHJ %17,INISET ;INITIALIZE THE SOURCE DEVICE
MOVEI %05,JOBFFS
EXCH %05,JOBFF ;SET TO TOP OF INPUT BUFFER
INBUF SRC,NUMBUF
MOVEM %05,JOBFF ;RESTORE JOBFF
TRZE %16,EXTBIT ;WAS AN EXPLICIT EXTENSION SEEN?
JRST SRC3A ;YES, LOOK FOR IT
MOVSI %14,(SIXBIT /OBJ/)
HLLZM %14,XE1 ;NO, TRY .PAL FIRST
LOOKUP SRC,XE
TDZA %14,%14 ;NOT FOUND, TRY BLANK
JRST SRC3B ;FOUND
SRC3A: HLLZM %14,XE1 ;SAVE EXTENSION IN LOOKUP BLOCK
HLLZM %14,EXTSAV ;SAVE EXTENSION FOR HEADER
LOOKUP SRC,XE ;LOOKUP FILE NAME
JRST ERRCF ;FILE NOT FOUND
SRC3B: MOVE %05,XE ;SAVE NAMES
MOVEM %05,OBJNAM
MOVE %05,XE1
HLLZM %05,OBJEXT
POPJ %17, ;EXIT
SETP2: ;SET FOR PASS 2
TRZ %16,ENDBIT!FFBIT
TLZ %15,ISWFLG ;ZAP INPUT /I
MOVE %05,TTISAV
MOVEM %05,TTIPNT ;RESTORE INPUT COMMANDS
POPJ %17,
SUBTTL COMMAND STRING DECODER
;EXEC COMMAND STRING DISPATCHING
;THIS ROUTINE PICKS UP CHARACTERS FROM THE EXEC TTY BUFFER AND
;DISPATCHES TO THE PROPER ROUTINE DEPENDING ON THE TYPE OF
;CHARACTER. A TABLE OF BYTES AND BYTE POINTERS ALLOWS EACH CHARAC-
;TER IN THE ASCII SET TO BE TREATED INDIVIDUALLY.
GETNAM: SETZ %14, ;CLEAR SYMBOL WORD
MOVE %06,[POINT 6,%14]
GETCMN: PUSHJ %17,GETTTI ;GET NEXT CHARACTER
GETCMF: CAIN %05,"[" ;PROJECT-PROGRAMMER PAIR?
JRST LFTBRA ;YES
CAIGE %10,4 ;MODIFY CODE IF .GE. 4
TRNN %16,SWTBIT ;MODIFY IF SWITCH IS ON
ADDI %10,4 ;CHANGE DISPATCH BY ADDING 4
HRRZ %02,DSPTCH(%10) ;LOAD RIGHT HALF DISPATCH
CAIL %10,10 ;SKIP IF CORRECT
HLRZ %02,DSPTCH-10(%10);OTHERWISE, GET LEFT HALF DSPTCH
JRST @%02 ;GO TO CORRECT ROUTINE
GETTTI: ILDB %05,TTIPNT ;GET A CHARACTER FROM TTY BUFFER
GETTTF: MOVE %10,%05 ;ANOTHER COPY OF IT IN AC %10
IDIVI %10,8 ;TRANSLATE TO 4-BIT CODE
ADD %10,[POINT 4,BITE,] ;SET BYTE POINTER
IBP %10 ;MOVE TO PROPER BYTE
SOJGE %11,.-1 ;TEST FOR END
LDB %10,%10 ;OK, FETCH BYTE
CAIN %10,4 ;IS IT A NULL?
JRST GETTTI ;YES, TRY AGAIN
POPJ %17, ;NO, EXIT
;COMMAND DISPATCH TABLE AND BYTE POINTERS
DSPTCH: XWD GETCMN, ERRBS ;IGNORED CHAR, BAD CHAR(SWITCH)
XWD ERRIC, ERRIC ;<(>, LETTER(SWITCH MODE)
XWD COLON, ERRBS ;<:>, NUMBER(SWITCH MODE)
XWD PERIOD, ERRIC ;<.>,<)>ESCAPE SWITCH MODE
XWD LFTARW, ERRIC ;<_> OR <=>, BAD CHAR (NORMAL MODE)
XWD COMMA, STORE ;<,>,ALPHABETICH CHAR (NORMAL)
XWD CARRTN, STORE ;<CR>,NUMERIC CHAR (NORMAL)
XWD SLASH, ERRIC ;</>, <)> ILLEGAL ESCAPE
IFN CCLSW,<
XWD RUNUUO,0 ;<!>
XWD INDFIL,0 ;<@>
>
IFE CCLSW,<
XWD ERRIC,0
XWD ERRIC,0
>
;BYTE TABLE FOR DISPATCHING
;CLASSIFICATION BYTE CODES
; BYTE DISP CLASSIFICATION
; 00 00 ILLEGAL CHARACTER, SWITCH MODE
; 01 01 ALPHABETIC CHARACTER, SWITCH MODE
; 02 02 NUMERIC CHARACTER, SWTICH MODE
; 03 03 SWITCH MODE ESCAPE, SWITCH MODE
; 00 04 ILLEGAL CHARACTER, NORMAL MODE
; 01 05 ALPHABETIC CHARACTER, NORMAL MODE
; 02 06 NUMERIC CHARACTER, NORMAL MODE
; 03 07 SWITCH MODE ESCAPE, NORMAL MODE
; 04 10 IGNORED CHARACTER
; 05 11 ENTER SWITCH MODE WITH A <(>
; 06 12 DEVICE DELIMITER, <:>
; 07 13 FILE EXTENSION DELIMITER, <.>
; 10 14 OUTPUT SPEC. DELIMITER, <_> OR <=>
; 11 15 FILE DELIMITER, <,>
; 12 16 COMMAND TERMINATOR, <CR>
; 13 17 ENTER SWITCH MODE WITH </>
; 14 20 CCL FILE DELIMITER <!>
; 15 21 INDIRECT FILE DELIMITER <@>
;BYTE TABLE:
BITE:
BYTE (4) 4, , , , , , ,
BYTE (4) , 4,12, 4, 4,12, ,
BYTE (4) , , , , , , ,
BYTE (4) , ,12,12, , , ,
BYTE (4) 4,14, 4, ,10, , ,
BYTE (4) 5, 3, , ,11, , 7,13
BYTE (4) 2, 2, 2, 2, 2, 2, 2, 2
BYTE (4) 2, 2, 6, ,10,10, ,14
BYTE (4) 15, 1, 1, 1, 1, 1, 1, 1
BYTE (4) 1, 1, 1, 1, 1, 1, 1, 1
BYTE (4) 1, 1, 1, 1, 1, 1, 1, 1
BYTE (4) 1, 1, 1, , , , ,10
BYTE (4) , , , , , , ,
BYTE (4) , , , , , , ,
BYTE (4) , , , , , , ,
BYTE (4) , , , , ,12, , 4
;LEFT ARROW PROCESSOR
LFTARW: TRO %16,ARWBIT ;SET APPROPIATE FLAGS
TRNN %16,EXTBIT ;IS THIS A FILE NAME EXTENSION?
MOVEM %14,XE ;NO, ITS A FILE NAME
TRZE %16,INFBIT ;IS THIS A NULL FILE?
CPOPJ1: AOS (%17) ;GOOD EXIT
CPOPJ: POPJ %17, ;...
;PERIOD PROCESSOR
PERIOD: TRO %16,EXTBIT ;SET FLAG FOR EXPLICIT EXTENSION
MOVEM %14,XE ;SAVE THE FILE NAME
JRST GETNAM ;RE-ENTER THE GETNAM ROUTINE
;COLON PROCESSOR
COLON: MOVE %01,%14 ;SET UP NEW DEVICE NAME
JRST GETNAM ;RETURN FOR MORE COMMAND
;COMMA PROCESSOR
COMMA: TRZN %16,INFBIT ;IS THIS A NULL FILE?
POPJ %17, ;NULL FILE, EXIT
COMMA1: TRNN %16,EXTBIT ;DO WE HAVE A FILE NAME EXTENSION?
MOVEM %14,XE ;NO, IT WAS A FILE NAME
JRST CPOPJ1 ;GOOD EXIT
;CARRIAGE RETURN PROCESSOR
CARRTN: TRNN %16,NULBIT ;IS THIS JUST A RANDOM CR?
JRST NULFIL ;YES, RESTART COMPLETELY
TRO %16,ENDBIT ;IS THIS A NORMAL MODE COMMAND?
TRNN %16,ARWBIT ;YES, HAS A LEFT ARROW BEEN SEEN?
JRST ERRSE ;NO, SYNTAX ERROR
JRST COMMA ;YES, TREAT IT LIKE A COMMA
;THE FOLLOWING TWO ROUTINES HANDLE ALPHANUMERIC CHARACTERS
;FOUND IN THE COMMAND STRING. IN NORMAL MODE, THE CHARACTER
;IS DEPOSITED TO FORM A SIXBIT SYMBOL. IN SWITCH MODE, THE
;PROPER INSTRUCTION IS EXECUTED WITH THE AID OF A DISPATCH
;TABLE. THEN, IF SWITCH MODE WAS ENTERED WITH A SLASH, THE
;EXEC EXITS FROM SWITCH MODE.
STORE: TRO %16,INFBIT!NULBIT;TURN ON BITS FOR CR ROUTINE
SUBI %05,40 ;CONVERT SIXBIT TO ASCII
TLNE %06,770000 ;DON'T STORE IF NO ROOM FOR CHAR
IDPB %05,%06 ;PLOP THE CHARACTER INTO AC %14
JRST GETCMN ;RETURN
SLASH: ;PROCESS SWITCH
PUSHJ %17,SLAWRD ;GET WORD
CAMN %10,[SIXBIT /I/]
JRST SLASH1
CAMN %10,[SIXBIT /P/] ;/P?
JRST SLASH2 ; YES
PUSH %17,%10 ;SAVE MNEMONIC
CAIE %05,":" ;ARGUMENT?
TDZA %10,%10 ; NO, CLEAR AND SKIP
PUSHJ %17,SLAWRD ;YES, GET ARG
MOVSI %11,-SWTLEN ;SET TO SCAN TABLE
SKIPE SWTNAM(%11) ;SEARCH FOR EMPTY SLOT
AOBJN %11,.-1
POP %17,SWTNAM(%11) ;STORE NAME
MOVEM %10,SWTARG(%11) ; AND ARG
JRST SLASH3
SLASH1: TLOA %15,ISWFLG
SLASH2: TLZ %15,ISWFLG ;CLEAR /I
SLASH3: PUSHJ %17,GETTTF
JRST GETCMF ;RETURN TO MAIN STREAM
SLAWRD: MOVSI %10,0 ;CLEAR ARG
MOVE %11,[POINT 6,%10] ;SET BYTE POINTER
SLAWR1: PUSH %17,%10 ;STACK ARGS
PUSH %17,%11
PUSHJ %17,GETTTI ;GET INPUT CHAR
POP %17,%11
POP %17,%10
CAIE %05,"."
CAIN %05,"$"
JRST SLAWR2
CAIL %05,"0"
CAILE %05,"9"
CAIA
JRST SLAWR2
CAIL %05,"A"
CAILE %05,"Z"
POPJ %17, ;END
SLAWR2: SUBI %05,40 ;CONVERT TO SIXBIT
TLNE %11,770000 ;ROOM TO STORE?
IDPB %05,%11 ; YES, DO SO
JRST SLAWR1
LFTBRA: SETZM XE3 ;CLEAR NUMBER
LFTBR1: HRLZS XE3 ;COMMA, MOVE TO LEFT HALF
LFTBR2: PUSHJ %17,GETTTI ;GET NEXT CHAR
CAIN %05,"]" ;TERMINAL?
JRST GETCMN ;YES, EXIT
CAIN %05,"," ;SEPARATOR?
JRST LFTBR1 ;YES
CAIL %05,"0" ;TEST FOR OCTAL NUMBER
CAILE %05,"7"
JRST ERRIC ;IMPROPER CHARACTER
HRRZ %10,XE3 ;OK, GET PREVIOUS VALUE
IMULI %10,8
ADDI %10,-"0"(%05) ;ACCUMULATE NEW NUMBER
HRRM %10,XE3
JRST LFTBR2
;THE FOLLOWING CODE IS USED FOR PROCESSING THE COMMAND
;STRINGS FOR THE CCL COMMAND FEATURES
IFN CCLSW,<
DSKNIT: ;INIT DSK FOR CCL
IFN TEMPC,<
HRRZ %00,JOBFF ;USE JOBFF AS START OF CCL BUFFER
HRRM %00,CMDPNT ;DUMMY UP BUFFER HEADER
HRRM %00,TMPFIL+1 ;SET UP TMPCOR READ BLOCK
SOS TMPFIL+1 ;MAKE IT PROPER IOWD FORMAT
HRRI %01,(SIXBIT /P11/)
HRLM %01,TMPFIL ;SETUP NAME OF FILE TO BE READ
MOVNI %01,200 ;AND WORD COUNT
HRLM %01,TMPFIL+1 ;IN READ BLOCK
MOVE %01,[XWD 2,TMPFIL] ;SET UP AC FOR A READ
TMPCOR %01, ;READ AND DELETE "FOR" FILE
JRST TMPEND ;NO FILE IN CORE TRY DISK
ADD %00,%01 ;GET END OF FILE
MOVEM %00,JOBFF ;UPDATE JOBFF SO FILE ISN'T WIPED OUT
HRLM %00,JOBFFI ;SAVE FOR LATER
IMULI %01,5 ;CALCULATE CHARACTER COUNT
MOVEM %01,CMDCNT ;STORE IN BUFFER HEADER
MOVSI %01,(POINT 7,,) ;BYTE POINTER
HLLM %01,CMDPNT ;BUFFER HEADER NOW SETUP
SETOM TMPFLA ;MARK THAT TMPCOR UUO IN PROGRESS
JRST CPOPJ1
TMPEND:
MOVEI %00,3 ;INIT 3 DIGIT COUNTER
PJOB %02, ;GET JOB NUMBER
DSKNI1: IDIVI %02,^D10 ;GET LAST DIGIT
ADDI %03,"0"-40 ;CONVERT TO SIXBIT
LSHC %03,-6 ;SLIDE CHAR INTO AC4
SOJG %00,DSKNI1 ;3 CHARS YET?
HRRI %04,(SIXBIT /P11/) ;YES, GET FILENAME ###P11.TMP
MOVEM %04,XE ;SAVE FILE NAME IN LOOKUP DIRECTORY
MOVSI %04,(SIXBIT /TMP/) ;SET UP EXTENSION
MOVEM %04,XE1 ;SAVE EXTENSION IN LOOKUP DIRECTORY
SETZM XE3 ;ZERO PROJ,PROG #'S
MOVEI %00,ALMODE ;ASCII LINE DATA MODE
MOVSI %01,(SIXBIT /DSK/)
MOVEI %02,CMDBUF ;GET BUFFER HEADER ADDRESS
OPEN CMD,%00 ;INIT DSK OK?
JRST DSKNI2 ;NO, TYPE MESSAGE
LOOKUP CMD,XE ;LOOKUP ###FOR, TMP ON DISK
JRST DSKNI2 ;FILE NOT FOUND
INBUF CMD,1 ;ONE INPUT BUFFER
MOVE %00,JOBFF
HRLM %00,JOBFFI
JRST CPOPJ1 ;FILE FOUND, SKIP RETURN
DSKNI2: MOVE %00,JOBFF
HRLM %00,JOBFFI
JRST ERRCF1
GETCM3: MOVNI %00,5 ;SKIP OVER SEQUENCE NUMBER
ADDM %00,CMDPNT ;REDUCE COUNT BY 5 BYTES
AOS CMDPNT ;ADVANCE POINTER, FALL THROUGH
GETCMD: SOSG CMDCNT ;ANY CHARACTERS LEFT?
PUSHJ %17,GETCM1 ;NO GET ANOTHER BUFFER FULL
ILDB %05,CMDPNT ;GET CHARACTER
MOVE %00,@CMDPNT ;CHECK FOR SEQUENCE NUMBER
TRNE %00,1
JRST GETCM3 ;BY-PASS THE SEQUENCE NUMBER
CAIN %05,175 ;OLD ALTMODE?
MOVEI %05,33 ;YES, MAKE IT NEW ALTMODE
CAIL %05,140 ;IS CHARACTER LOWER CASE?
TRZ %05,40 ;YES, CHANGE TO UPPER CASE
MOVE %02,%05
POPJ %17, ;EXIT WITH CHARACTER
GETCM1:
IFN TEMPC,<
SKIPE TMPFLA ;IS A TMPCOR UUO GOING?
JRST GETCM2 ;YES, THEN WE ARE DONE?
>
IN CMD,
POPJ %17, ;NO ERRORS OR END OF FILE
STATZ CMD,IODATA!IODEV!IOBKTL
JRST ERRCMD ;DATA ERRORS
GETCM2:
JSP %10,DELFIL ;DELETE FILE
EXIT
DELFIL: SKIPE INDFLA ;DON'T DELETE IF INDIRECT FILE
JRST (%10)
CLOSE CMD,0 ;CLOSE COMMAND FILE
SETZB %04,%05
SETZB %06,%07
IFN TEMPC,<
SKIPE TMPFLA ;TMPCOR BEING USED?
JRST (%10) ;YES, DON'T RENAME FILE?
>
RENAME CMD,%04
JFCL
JRST (%10) ;RETURN
RUNUUO: ;PASS PROGRAM CONTROL TO NEXT PROGRAM (LNKX11)
SKIPN %01
MOVSI %01,(SIXBIT /SYS/) ;IF NO DEVICE, ASSUME SYS:
TRNN %16,EXTBIT ;PERIOD TYPED?
MOVEM %14,XE ;NO, THEN FILE NAME IS IN %14
TRNN %16,EXTBIT ;PERIOD TYPED?
MOVEI %14,0 ;NO, ASSUME 0 EXTENSION
HLLZM %14,XE1 ;SAVE IN DIRECTORY
JSP %10,DELFIL ;DELETE COMMAND FILE
MOVE %00,[XWD 1,%01] ;START INCREMENT,,6 WORD RUN BLOCK ADR
;%01 = DEVICE
MOVE %02,XE ;GET FILENAME
MOVE %03,XE1 ;GET EXTENSION
SETZB %04,%06
MOVE %05,XE3 ;GET PROJ,PROG
RUN %00, ;START NEXT PROGRAM
JSP %10,ERROR ;RUN FAILED
ASCIZ /LINKAGE ERROR FOR 23/
INDFIL: TRNN %16,EXTBIT ;SET UP THE FILENAME IF NECESSARY
MOVEM %14,XE
TRNN %16,ARWBIT ;NORMAL MODE
TLNN %16,BINBIT ;OR BINARY SPECIFIED?
JRST ERRIC ;YES, ILLEGAL CHARACTER
MOVE %00,[INIT CMD,ALMODE]
SKIPN %01 ;INIT CMD FOR @ FILE
MOVSI %01,(SIXBIT /DSK/)
MOVEI %02,CMDBUF
PUSHJ %17,CMDSET
XWD INBIT,1_ALMODE ;LEGAL BITS FROM DEVCHR
TRZE %16,EXTBIT ;EXTENSION?
JRST INDFI1 ;YES, DON'T TRY ASSUMPTIONS
MOVSI %14,(SIXBIT /CMD/)
HLLZM %14,XE1
LOOKUP CMD,XE
TDZA %14,%14 ;TRY NULL EXTENSION
JRST INDFI2
INDFI1: HLLZM %14,XE1
LOOKUP CMD,XE
JRST ERRCF ;CANNOT FIND COMMAND FILE
INDFI2: SETOM CCLFLA ;NON-STANDARD COMMAND STRING
SETOM INDFLA ;SET INDIRECT FLAG
INBUF CMD,1 ;SINGLE BUFFER
MOVE %14,JOBFF
HRLM %14,JOBFFI ;SAVE DATA RESTORE ADDRESS
JRST NXTCCL
>
HEADER: ;LIST HEADER
TLNE %16,TTYBIT ;TO TELETYPE?
POPJ %17, ; YES, IGNORE
PUSHJ %17,LSTCR
MOVE %00,TITLE
PUSHJ %17,LSTSIX ;LIST THE HEADER
PUSHJ %17,LST3SP
MOVE %00,SUBTTL
PUSHJ %17,LSTSIX ;LIST VERSION NUMBER
PUSHJ %17,LST3SP
MOVE %10,DATE ;FETCH THE DATE
IDIVI %10,^D31 ;ISOLATE THE DAY
ADDI %11,1
PUSHJ %17,DNC ;LIST IT
IDIVI %10,^D12 ;ISOLATE THE MONTH
MOVE %00,MONTH(%11)
PUSHJ %17,LSTSIX ;LIST IT
MOVEI %11,^D64(%10) ;ACTUAL YEAR TO %11
PUSHJ %17,DNC
PUSHJ %17,LST3SP
MOVE %11,MSTIME ;GET TIME OF DAY
IDIVI %11,^D<60*1000>
IDIVI %11,^D60
PUSH %17,%12
PUSHJ %17,DNC
MOVEI %02,":"
PUSHJ %17,LSTOUT
POP %17,%11
MOVEI %02,"0"
CAIG %11,^D9
PUSHJ %17,LSTOUT ;ALWAYS TWO DIGITS
PUSHJ %17,DNC
PUSHJ %17,LSTCR
PUSHJ %17,LSTCR
MOVEI %02,"#"
PUSHJ %17,LSTOUT
MOVE %10,[POINT 7,TTIBUF]
ILDB %02,%10
PUSHJ %17,LSTOUT
JUMPN %02,.-2
JRST LSTCR
DNC: IDIVI %11,^D10 ;RECURSIVE SUBROUTINE
HRLM %12,0(%17) ;SAVE REMAINDER ON PUSHDOWN LIST
SKIPE %11 ;ALL DONE?
PUSHJ %17,DNC ;NO, CALL DNC AGAIN
HLRZ %02,0(%17) ;RETRIEVE NUMBER FROM PD LIST
JRST LSTNUM ;LIST NUMERIC AND EXIT
LSTSIX: MOVSI %06,(POINT 6,%00,)
LSTSI1: ILDB %02,%06
JUMPE %02,CPOPJ
ADDI %02," "
PUSHJ %17,LSTOUT
TLNE %06,770000
JRST LSTSI1
POPJ %17,
MONTH: SIXBIT /-JAN-/
SIXBIT /-FEB-/
SIXBIT /-MAR-/
SIXBIT /-APR-/
SIXBIT /-MAY-/
SIXBIT /-JUN-/
SIXBIT /-JUL-/
SIXBIT /-AUG-/
SIXBIT /-SEP-/
SIXBIT /-OCT-/
SIXBIT /-NOV-/
SIXBIT /-DEC-/
;CALL: PUSHJ %17,CMDSET
; XWD BITS1,BITS2 ;LEGAL BITS ON DEVCHR
; RETURN
CMDSET: MOVE %03,%01 ;GET DEVICE NAME
DEVCHR %03,
SETCMM %03 ;COMPLEMENT BITS
TDNE %03,@(%17) ;WERE ALL BITS ONE?
JRST ERRNIT ;NO
AOS (%17) ;YES, SKIP RETURN
;FULL THROUGH
INISET: MOVE %03,[JRST ERRNA];ERROR EXIT FOR INIT
MOVSI %04,(POPJ %17,)
JRST %00
SUBTTL EXEC ERROR ROUTINES
ERRCMD: MOVEI %10,[ASCIZ /DEVICE INPUT ERROR FOR COMMAND STRING/]
JRST ERROR
ERRNIT: MOVEI %10,[ASCIZ /IMPROPER IO FOR DEVICE 2/]
JRST ERROR
IFN CCLSW,<
ERRCF1: SETZM CCLFLA ;LOOKUP FOR DSK:###P11.TMP FAILED
>
ERRCF: MOVEI %10,[ASCIZ /CANNOT FIND 234/]
JRST ERROR
ERRID: MOVEI %10,[ASCIZ /INPUT DATA ERROR 234/]
JRST ERROR
ERRBS: MOVEI %10,[ASCIZ /1 IS A BAD SWITCH/]
JRST ERROR
ERRIC: MOVEI %10,[ASCIZ /1 IS AN ILLEGAL CHARACTER/]
JRST ERROR
ERRNA: MOVEI %10,[ASCIZ /2 IS NOT AVAILABLE/]
JRST ERROR
ERRNR: MOVEI %10,[ASCIZ /NO ROOM FOR 234/]
JRST ERROR
ERRSE: MOVEI %10,[ASCIZ /SYNTAX ERROR IN COMMAND STRING/]
JRST ERROR
ERRTF: MOVEI %10,[ASCIZ /TOO MANY INPUT FILES/]
JRST ERROR
ERRTB: MOVEI %10,[ASCIZ /2 ILLEGAL FOR BINARY OUTPUT/]
JRST ERROR
ERROR: ;NON-RECOVERABLE ERROR MESSAGE
PUSH %17,%10 ;STACK MESSAGE ADDRESS
TRNE %16,MODBIT ;HAVE WE EXEC AC'S?
PUSHJ %17,ACEXCH ; NO, GET THEM
POP %17,%10 ;RESTORE MESSAGE POINTER
MOVSI %16,ERRBIT!LSTBIT!BINBIT ;FUDGE FLAGS
PUSHJ %17,LSTCR
MOVEI %02,"?"
PUSHJ %17,LSTOUT
PUSHJ %17,LSTSP ;TYPE SPACE
PUSHJ %17,LSTMSG
PUSHJ %17,LSTCR
PUSHJ %17,LSTCR
JRST START
LSTMSG: HRLI %10,(POINT 7,,) ;SET BYTE POINTER AND SKIP
CAIA
LSTMS4: PUSHJ %17,LSTOUT ;TYPE CHARACTER
LSTMS5: ILDB %02,%10 ;GET CHARACTER
JUMPE %02,CPOPJ ;TEST FOR END
CAIL %02,"1" ;TEST FOR SWITCH
CAILE %02,"5"
JRST LSTMS4 ;NO, TYPE THE CHARACTER
PUSHJ %17,@[EXP ERR1,ERR2,ERR3,ERR4,DNC]-"1"(%02)
JRST LSTMS5 ;GET NEXT CHARACTER
ERR1: MOVE %02,%05 ;GET IMPROPER CHARACTER
JRST LSTOUT ;DUMP IT
ERR2: MOVE %00,%01 ;GET DEVICE NAME
PUSHJ %17,LSTSIX ;TYPE IT
MOVEI %02,":"
JRST LSTOUT ;TYPE ":"
ERR3: MOVE %00,XE ;GET FILE NAME
JRST LSTSIX ;TYPE IT
ERR4: HLLZ %00,XE1 ;GET EXTENSION
JUMPE %00,CPOPJ ;EXIT IF NULL
MOVEI %02,"."
PUSHJ %17,LSTOUT ;TYPE "."
JRST LSTSIX
EXIT: CLOSE SRC, ;CLOSE THE SOURCE DEVICE
CLOSE LST, ;CLOSE THE LISTING FILE
CLOSE BIN, ;CLOSE THE BINARY FILE
TLON %16,LSTBIT ;WAS THERE A LISTING FILE?
PUSHJ %17,LSTTST ;YES, TEST FOR FINAL ERROR
TLON %16,BINBIT ;IS THERE A BINARY FILE?
PUSHJ %17,BINTST ;YES, TEST FOR FINAL ERROR
TRNN %16,ENDBIT ;END OF COMMAND STRING?
JRST ERRTF ; NO, MARK ERROR
IFN CCLSW,<
SKIPN CCLFLA ;RESTART IF NOT CCL MODE
JRST START
HLRZ %00,JOBFFI
MOVEM %00,JOBFF ;RESTORE DATA AREA
RELEAS LST,0
RELEAS BIN,0
RELEAS SRC,0
EXIT6: PUSHJ %17,GETCMD ;GET NEXT COMMAND CHAR
CAIL %05,12 ;THROW AWAY REST
CAILE %05,15 ;OF LAST LINE
CAIA
JRST EXIT6
MOVSI %05,070000 ;BACK UP BYTE
ADDM %05,CMDPNT ;POINTER ONE BYTE
AOS CMDCNT
JRST NXTCCL ;GO DO NEXT COMMAND
>
IFE CCLSW,<
JRST START ;BACK TO BEGINNING
>
CORSET: ;INIT DYNAMIC MEMORY
POPJ %17,
ACEXCH: ;SWAP AC'S
TRC %16,MODBIT ;TOGGLE MODE BIT
EXCH %00,AC00
EXCH %01,AC01
EXCH %02,AC02
EXCH %03,AC03
EXCH %04,AC04
EXCH %05,AC05
EXCH %06,AC06
EXCH %07,AC07
EXCH %10,AC10
EXCH %11,AC11
EXCH %12,AC12
EXCH %13,AC13
EXCH %14,AC14
POPJ %17,
;ROUTINE TO OUTPUT RELOCATABLE BINARY
BINWRD: ;OUTPUT BINARY WORD
PUSH %17,%02 ;STACK WORD
PUSHJ %17,BINOUT ;OUTPUT LOW BYTE
POP %17,%02
LSH %02,-8 ;MOVE HIGH INTO LOW
;FALL THROUGH
BINOUT: ;BINARY OUTPUT
ANDI %02,377 ;MASK TO 8 BITS
ADDM %02,CHKSUM ;UPDATE CHECKSUM
TLNE %16,BINBIT ;BINARY REQUESTED?
POPJ %17, ; NO, EXIT
TLNN %15,IOSFLG
JRST BINOU3
SOSG BINCNT
PUSHJ %17,BINDMP
IDPB %02,BINPNT
POPJ %17,
BINOU3: PUSH %17,%03
SOSLE BINPCT
JRST BINOU4
PUSHJ %17,BINDMP
MOVE %03,BINCNT
IMULI %03,4
MOVEM %03,BINPCT
BINOU4: MOVN %03,BINPCT
ANDI %03,3
JUMPN %03,BINOU5
SOS BINCNT
IBP BINPNT
BINOU5: DPB %02,BINTBL(%03)
POP %17,%03
POPJ %17,
BINDMP: OUTPUT BIN,
BINTST: STATO BIN,IODATA!IODEV!IOWRLK
POPJ %17,
MOVEI %10,[ASCIZ /BINARY OUTPUT ERROR/]
JRST ERROR ;TYPE ERROR MESSAGE
BINTBL:
POINT 8,@BINPNT,17
POINT 8,@BINPNT, 9
POINT 8,@BINPNT,35
POINT 8,@BINPNT,27
SUBTTL EXEC ROUTINES USING ASSEMBLER AC'S
LSTSYM: ;LIST SYMBOL
PUSH %17,%00
PUSHJ %17,M40SIX ;CONVERT TO SIXBIT
PUSH %17,%01 ;STACK A WORKING REGISTER
MOVSI %01,(POINT 6,%00)
LSTSY1: ILDB %02,%01
ADDI %02,40 ;CONVERT TO ASCII
PUSHJ %17,LSTOUT
TLNE %01,770000 ;TEST FOR END
JRST LSTSY1
POP %17,%01
POP %17,%00 ;RESTORE ORIGINAL
POPJ %17,
LST3SP: ;LIST SPACES
PUSHJ %17,LSTSP
LST2SP: PUSHJ %17,LSTSP
LSTSP: MOVEI %02,SPACE
JRST LSTOUT
LSTNUM: TROA %02,"0" ;LIST NUMERIC
LSTASC: ADDI %02,40 ;CONVERT SIXBIT TO ASCII
JRST LSTOUT
LSTCR: TDZA %02,%02 ;LIST CR-LF
LSTTAB: MOVEI %02,TAB ;LIST A TAB
LSTOUT: ;LISTING ROUTINE
TLNN %16,LSTBIT ;LISTING REQUESTED?
PUSHJ %17,LPTOUT ; YES
TLNE %16,ERRBIT ;ERROR LISTING?
TLNE %16,NSWBIT!TTYBIT ; YES, TO TTY?
POPJ %17, ; NO
JUMPE %02,LSTOU1 ;BRANCH IF CR-LF
OUTCHR %02 ;LIST CHARACTER
POPJ %17, ;EXIT
LSTOU1: OUTSTR [BYTE (7) CRR, LF, 0]
POPJ %17, ;CR-LF TO TTY
LPTOUT: ;OUTPUT TO LISTING DEVICE
JUMPE %02,LPTOU4 ;BRANCH IF CR-LF
CAIN %02,TAB
JRST LPTOU3 ;DON'T LIST TABS IMMEDIATELY
SKIPG TABCNT ;ANY TABS TO BE OUTPUT?
JRST LPTOU2 ; NO
PUSH %17,%02 ;YES, STACK CURRENT CHARACTER
LPTOU1: MOVEI %02,7
IORM %02,COLCNT ;FUDGE COLUMN COUNT
MOVEI %02,TAB
PUSHJ %17,LPTOU2 ;OUTPUT THE TAB
SOSE TABCNT ;DECREMENT, ANY MORE?
JRST LPTOU1 ;YES
POP %17,%02 ;NO, RESTORE CHARACTER
LPTOU2: AOSG COLCNT ;ANY COLUMNS AVAILABLE?
JRST LSTDMP ; YES
POPJ %17, ; NO, EXIT
LPTOU3: AOS TABCNT ;TAB, BUMP COUNT
POPJ %17,
LPTOU4: MOVEI %02,CRR ;CR-LF
PUSHJ %17,LSTDMP
MOVEI %02,LF
PUSHJ %17,LSTDMP
LPTINI:
MOVNI %02,COLLPT ;SET FOR COLUMN COUNT
TLNE %15,TTYFLG
MOVNI %02,COLTTY
MOVEM %02,COLCNT
SETZB %02,TABCNT ;ZERO TAB COUNT AND REGISTER
POPJ %17,
LSTDMP: SOSG LSTCNT ;DECREMENT ITEM COUNT
PUSHJ %17,LIST1 ;EMPTY ENTIRE BUFFER
IDPB %02,LSTPNT ;STORE THE CHARACTER
CAIN %02,LF ;IF LINE FEED
TLNN %16,TTYBIT ;AND LISTING IS ON TTY,
POPJ %17,
;DUMP THE BUFFER
LIST1: OUTPUT LST, ;EMPTY A BUFFER
LSTTST: STATO LST,IODATA!IODEV!IOWRLK ;CHECK FOR ERRORS
POPJ %17, ;NO, EXIT
MOVEI %10,[ASCIZ /LISTING OUTPUT ERROR/]
JRST ERROR ;TYPE MESSAGE
CHAR: SOSGE SRCCNT ;DECREMENT ITEM COUNT
JRST CHAR4 ;GET ANOTHER BUFFER IF NECESSARY
TLNE %15,ISWFLG
JRST CHAR2
SETCM %02,SRCCNT
ANDI %02,3
CAIN %02,0
IBP SRCPNT
LDB %02,BCHTBL(%02)
CAIA
CHAR2: ILDB %02,SRCPNT
JRST CPOPJ1
CHAR4: INPUT SRC, ;CALL MONITIOR FOR A BUFFER
STATZ SRC, IODATA+IODEV+IOBKTL+IOWRLK
JRST ERRID ;INPUT TRANSMISSION ERROR
STATO SRC, IOEOF ;WAS AN END OF FILE REACHED?
JRST CHAR5 ;GET NEXT CHAR
CLOSE SRC,
TLO %15,ENDFLG ;YES, FLAG END
POPJ %17,
CHAR5: MOVEI %02,4
TLNN %15,ISWFLG
IMULM %02,SRCCNT
JRST CHAR
BCHTBL:
POINT 8,@SRCPNT,17
POINT 8,@SRCPNT, 9
POINT 8,@SRCPNT,35
POINT 8,@SRCPNT,27
GETLIN: ;GET THE NEXT SOURCE LINE
MOVEI %01,@JOBUUO
MOVE %02,AC00(%01) ;GET CONTENTS OF ARG
MOVN %03,0(%02)
ASH %03,-1
HRLZS %03
HRR %03,%02
SETZM 0(%03)
AOBJN %03,.-1
MOVEI %03,0(%02)
HRLI %03,(POINT 8,,35)
GETLI1: PUSHJ %17,CHAR ;GET AN INPUT CHARACTER
JRST GETLI6
CAIE %02,0
CAIN %02,377
JRST GETLI1
SETZB %04,CHKSUM
PUSHJ %17,GETLI5
GETLI2: PUSHJ %17,CHAR
JRST GETLI6
PUSHJ %17,GETLI5
CAIE %04,4
JRST GETLI2
SUB %04,-1(%03)
MOVNM %04,-1(%03)
GETLI3: JUMPGE %04,GETLI4
PUSHJ %17,CHAR
JRST GETLI6
PUSHJ %17,GETLI5
JRST GETLI3
GETLI4: PUSHJ %17,CHAR
JRST GETLI6
ADDB %02,CHKSUM
SETZM AC00(%01)
TRNN %02,377
POPJ %17,
MOVEI %10,[ASCIZ /CHECKSUM ERROR/]
JRST ERROR
GETLI5: ADDM %02,CHKSUM
DPB %02,%03
TLCE %03,(POINT 0,,35-8)
ADDI %03,1
AOJA %04,CPOPJ
GETLI6: MOVEI %02,100
MOVEM %02,AC00(%01)
POPJ %17,
SUBTTL MEMORY MANAGEMENT
GETCOR: ;GET CORE
HRRO %01,JOBREL ;GET TOP OF CURRENT CORE
MOVEI %00,CORINC(%01) ;COMPUTE NEXT K
CORE %00, ;MAKE A REQUEST
CAIA ; NONE AVAILABLE
AOS 0(%17)
POPJ %17, ;EXIT
SIXM40: ;SIXBIT TO MOD40
PUSH %17,%01
PUSH %17,%02
PUSH %17,%03 ;STACK REGISTERS
SETZ %01,
MOVSI %03,(POINT 6,%00)
SIXM41: ILDB %02,%03 ;GET A CHARACTER
HLRZ %02,RADTBL(%02) ;MAP
IMULI %01,50
ADD %01,%02
TLNE %03,770000 ;FINISHED?
JRST SIXM41 ; NO
IDIVI %01,50*50*50 ;YES, SPLIT INTO HALVES
HRLZ %00,%01 ;HIGH ORDER
HRR %00,%02 ; AND LOW ORDER
POP %17,%03 ;RESTORE REGISTERS
POP %17,%02
POP %17,%01
POPJ %17,
M40SIX: ;MOD40 TO SIXBIT
PUSH %17,%01
PUSH %17,%02
LDB %01,[POINT 16,%00,17]
IMULI %01,50*50*50 ;MERGE
HRRZS %00
ADD %00,%01
SETZ %02, ;ACCUMULATOR
M40SI1: IDIVI %00,50
HRRZ %01,RADTBL(%01) ;MAP
LSHC %01,-6 ;MOVE INTO COLLECTOR
JUMPN %00,M40SI1 ;TEST FOR END
MOVE %00,%02
POP %17,%02
POP %17,%01
POPJ %17,
RADTBL:
XWD <$=0>, 0
XWD 0, "A"-40
XWD 0, "B"-40
XWD 0, "C"-40
XWD <$$=33>, "D"-40
XWD 0, "E"-40
XWD 0, "F"-40
XWD 0, "G"-40
XWD 0, "H"-40
XWD 0, "I"-40
XWD 0, "J"-40
XWD 0, "K"-40
XWD 0, "L"-40
XWD 0, "M"-40
XWD <$.=34>, "N"-40
XWD 0, "O"-40
XWD <$0=36>, "P"-40
XWD <$1=37>, "Q"-40
XWD <$2=40>, "R"-40
XWD <$3=41>, "S"-40
XWD <$4=42>, "T"-40
XWD <$5=43>, "U"-40
XWD <$6=44>, "V"-40
XWD <$7=45>, "W"-40
XWD <$8=46>, "X"-40
XWD <$9=47>, "Y"-40
XWD 0, "Z"-40
XWD 0, "$"-40
XWD 0, "."-40
XWD 0, 0
XWD 0, "0"-40
XWD 0, "1"-40
XWD 0, "2"-40
XWD <$A=1>, "3"-40
XWD <$B=2>, "4"-40
XWD <$C=3>, "5"-40
XWD <$D=4>, "6"-40
XWD <$E=5>, "7"-40
XWD <$F=6>, "8"-40
XWD <$G=7>, "9"-40
XWD <$H=10>, 0
XWD <$I=11>, 0
XWD <$J=12>, 0
XWD <$K=13>, 0
XWD <$L=14>, 0
XWD <$M=15>, 0
XWD <$N=16>, 0
XWD <$O=17>, 0
XWD <$P=20>, 0
XWD <$Q=21>, 0
XWD <$R=22>, 0
XWD <$S=23>, 0
XWD <$T=24>, 0
XWD <$U=25>, 0
XWD <$V=26>, 0
XWD <$W=27>, 0
XWD <$X=30>, 0
XWD <$Y=31>, 0
XWD <$Z=32>, 0
XWD 0, 0
XWD 0, 0
XWD 0, 0
XWD 0, 0
XWD 0, 0
SUBTTL IMPURE AREA
IFNDEF NONREN, <RELOC 0> ;LOW SEG
PDPSTK: BLOCK PDPLEN
PATCH: BLOCK 100
BZCOR: ;BEGINNING OF CORE TO BE INITIALIZED TO ZERO
RUNTIM: BLOCK 1 ;RUN TIME
CHKSUM: BLOCK 1 ;CHECK SUM
SWTNAM: BLOCK SWTLEN+2
SWTARG: BLOCK SWTLEN+2
AC00: BLOCK 1 ;AC EXCHANGE BLOCK
AC01: BLOCK 1
AC02: BLOCK 1
AC03: BLOCK 1
AC04: BLOCK 1
AC05: BLOCK 1
AC06: BLOCK 1
AC07: BLOCK 1
AC10: BLOCK 1
AC11: BLOCK 1
AC12: BLOCK 1
AC13: BLOCK 1
AC14: BLOCK 1
DATE: BLOCK 1 ;DATE FOR HEADER
MSTIME: BLOCK 1 ;CURRENT TIME IN MILLISECONDS
ERRCNT: BLOCK 1 ;ERROR COUNT
EXTSAV: BLOCK 1 ;FILNAM EXTENSION FOR HEADER (EXEC)
TABCNT: BLOCK 1
COLCNT: BLOCK 1
TMPFIL: BLOCK 2 ;TMPCOR UUO ARGUMENT BLOCK
TTLFLA: BLOCK 1 ;=-1 IF PROGRAM NAME TYPED
JOBFFS: BLOCK 204*NUMBUF ;SOURCE BUFFER
TTISAV: BLOCK 1 ;TTI POINTER SAVE
TTIBUF: BLOCK 200
XE: BLOCK 1 ;EXEC LOOKUP BLOCK
XE1: BLOCK 1
XE2: BLOCK 1
XE3: BLOCK 1
;BUFFER HEADER BLOCKS
TTIPNT: BLOCK 1
BINBUF: BLOCK 1
BINPNT: BLOCK 1
BINCNT: BLOCK 1
BINPCT: BLOCK 1 ;BIN COUNT FOR /P
LSTBUF: BLOCK 1
LSTPNT: BLOCK 1
LSTCNT: BLOCK 1
SRCBUF: BLOCK 1
SRCPNT: BLOCK 1
SRCCNT: BLOCK 1
EZCOR:
CCLFLA: BLOCK 1 ;CCL MODE FLAG, =-1 IF CCL MODE
TMPFLA: BLOCK 1 ;TMPCOR UUO IN PROGRESS FLAG
INDFLA: BLOCK 1 ;INDIRECT FILE IN USE FLAG
JOBFFI: BLOCK 1 ;POINT TO RESTORE JOBFF
CMDBUF: BLOCK 1 ;BUFFER HEADER FOR CMD FILE INPUT
CMDPNT: BLOCK 1 ;BYTE POINTER
CMDCNT: BLOCK 1 ;BYTE COUNT
FIRSTF: BLOCK 1 ;MESSAGE COUNT
IFNDEF NONREN, <RELOC>
END START