
FOTS TAPE 1 PART 2
/UNEXPECTED IO ERRORS COME HERE
IOERR,	0
	LAM -7
	DAC EC#O		/PREPARE TO PRINT 8 TIMES
	LAW 330		/LETTER X TYPE 33
	703301
	LAW 27		/LETTER X OR FIGURE SLASH TYPE 28
	TLS
	TSF
	JMP .-1
	ISZ ECO		/REPEAT COUNT
	JMP .-4
	LAC IOERR
	HLT		/HALT WITH ERROR ADDRESS IN AC
	JMP .-1

CHECK,	LAC I ARGIND	/END OF FORMAT TABLE ENCOUNTERED
	SAD (ENDIO
	JMP ENDIO	/ARGUMENT LIST EXHAUSTED ALSO
	LAC P#TEM
	DAC FORIND	/RETURN TO LAST LEFT PAREND
	LAC ARGIND
	ADD (-1
	DAC ARGIND	/RESET ARGUMENT LIST INDEX
	JMS ARGSLS
	JMP GEN1		/CONTINUE FORMAT PROCESSING

SLASH,	LAC IO		/END OF RECORD REQUEST
	SNA
	XCT EMP2		/SLASH RESPONSE ON READ
	SZA
	JMS DUMP
	JMS ARGSLS		/LOOK FOR EXECUTABLE ARGUMENTS
	LAC ACCTEM
	AND (377777
	SNA
	JMP GEN1		/SLASH PUNCTUATION ALONE
	JMP GEN21	/CONTINUE

LEFPAR,	LAC FORIND
	ADD (-1
	DAC PTEM		/FORMAT TABLE POINTER FOR LEFT PAREND
	LAC ACCTEM
	SAD (LAC
	JMP GEN1		/LEFT PAREND ONLY
	JMP GEN21	/CONTINUE

BUFILL,	0
	XX
	LAC FUBNI
	DAC AUTO
	JMP I BUFILL

ARGCHK,	0		/LOOK FOR EXECUTABLE ARGUMENTS
	JMS ARGSLS
	SAD (ENDIO
	JMP GEN1		/CHECK FOR ARGUMENT INDEPENDENT FORMAT
	JMP I ARGCHK

ARGSLS,	0
	LAC ARGIND
	ADD (1
	DAC TEMZER
	LAC I TEMZER	/NEXT ARGUMENT
	SAD (ENDIO
	JMP I ARGSLS	/EXIT IF EXHAUSTED
	AND (NOP
	SAD (ARF
	JMP I ARGSLS
	SAD (ARX
	JMP I ARGSLS
	JMP I TEMZER	/IF NOT ARGUMENT, SHOULD EXECUTE

DUMP,	0		/WRITE OUT THE BUFFER
	LAC AUTO
	SAD FUBNI
	JMP DUMPA
DUMPB,	CLC
	DAC I AUTO	/SET END OF RECORD
	LAC AUTO
	DAC AUTTEM	/SAVE END ENTRY POINTER
	LAC FUBNI
	DAC AUTO		/INITIALIZE BUFFER INDEX
EMP1,	XX		/SET BY I/O SUBROUTINES
EMP2,	XX
	JMS BUFSET	/CLEAR BUFFER BOTTOM
	JMP I DUMP
DUMPA,	LAC ACCTEM
	SAD (JMP
	JMP I DUMP
	JMP DUMPB

ENDIO,	ISZ ARGIND	/EXIT FROM I/O PROCESSOR
	LAC ARGIND
	AND (17777
	DAC TEMZER
	POPUP
	AND (400000
	XOR TEMZER
	PUSH		/SET NEW CAL EXIT
	LAC IO
	SZA
	JMS DUMP		/EMPTY BUFFER, IF OUTPUT
	RETWR		/EXIT TO CAL HANDLER

FECOMO,	0
	EFM
	LAC I TEMPD
	LFM
	JMS FOP
	LAC D
	DAC FR#ADIG
	JMP I FECOMO

GETSGN,	0
	SZA
	LAC (54
	JMP I GETSGN

PCKARG,	0
	LAC I ARGIND
	DAC TE#MPD
	AND (I
	SNA
	JMP PCK2
	LAC TEMPD
	AND (17777
	DAC TEMPD
	LAC I TEMPD
PCK3,	DAC TEMPD
	LAC I TEMPD
	DAC PR#NTEM
	JMP I PCKARG
PCK2,	LAC TEMPD
	AND (77777
	XOR OLDMOD
	JMP PCK3

WRSET,	0		/BREAK OUT R,W,D
	LAC ITER		/REPETITION INDICATOR
	SZA
	JMP WRS2		/RESET FIELD WIDTH COUNTER ONLY
	LAC ACCTEM
	AND (37
	DAC #W		/FIELD WIDTH
	JMS WCT
	LAC ACCTEM
	JMS R9R
	AND (17
	SNA
	LAC (1
	CMA
	ADD (1
	DAC RCNT		/REPETITION COUNT
	LAC ACCTEM
	RR6
	RAL
	AND (17
	CMA
	DAC #D		/FRACTIONAL FIELD, COMPLEMENTED

WRS3,	LAC ACCTEM
	AND (DZM I	/RESTORE FORMAT TYPE TO AC
	JMP I WRSET
WRS2,	JMS WCT
	JMP WRS3
WCT,	0
	LAC W
	CMA
	ADD (1
	DAC W#CNT		/SET FIELD WIDTH COUNTER
	DAC FLDLNG
	JMP I WCT

HOI,	LAC IO		/HOLLERITH PROCESSOR I/O SWITCH
	SZA
	JMP OUTPTH	/IO NON-ZERO INPLIES WRITE
	LAC RCNT
	DAC FLDLNG
	JMS BUFILL	/NEXT ITEM TO BUFFER
	DZM FIOCAS	/INITIAL LOWER CASE
	LAC AUTO		/TRANSLATE ANELEX TO FIODEC
	DAC AUTOI2	/AUTO POINTS OT BUFFER BEGINNING
BUFFIO,	LAC I AUTO
	SAD (13
	JMP FDTAB	/FOUND TAB
	SPA
	JMP FDCR		/FOUND END OF RECORD
	ANAFIO		/ANELEX TO FIODEC
FIO2,	DAC I AUTOI2
	JMP BUFFIO
FDTAB,	LAC (36
	JMP FIO2	/FIODEC TAB CODE, CONTINUE
FDCR,	LAC FUBNI
	DAC AUTO		/RESTORE BUFFER INDEX
	DZM I AUTOI2		/ZERO FOR RECORD END
INPUTH,HOL1,	DZM H#OLER	/'H' INPUT
	LAM -2
	DAC C#NT
	LAC HOLER
HOL2,	RL6		/PREPARE TO PACK NEXT CHARACTER
	DAC HOLER
	LAC I AUTO
	SPA!CLL
	CML		/UPPER CASE (SET BY ANAFIO)
	AND (77
	DAC TEMZER
	CLA!RAL
	XOR FIOCAS
	SZA
	JMP CASET	/FIODEC CASE CHANGE
	LAC TEMZER
	ADD HOLER
	ISZ RCNT		/CHARACTER COUNT
	SKP

	JMP HOLFIN	/FINISHED
HOL3,	ISZ CNT		/CHARACTER PER WORD COUNT
	JMP HOL2		/CONTINUE PACKING
	DAC I FORIND	/WORD TO FORMAT LIST
	JMP HOL1
HOLFIN,	ISZ CNT
	SKP
	JMP FIN
	RL6
	ADD (13		/HOLLERITH FILLER CODE (FIODEC)
	JMP HOLFIN
FIN,	DAC I FORIND
	AND (77
	SAD (13
	SKP
	ISZ FORIND
	JMP GEN4

CASET,	LAC AUTO
	ADD (-1
	DAC AUTO		/RESTORE PICK-UP ADDRESS
	LAC FIOCAS	/SET NEW FIODEC CASE
	RAR
	DZM FIOCAS
	SNL
	ISZ FIOCAS
	LAC (72
	SNL
	LAC (74		/LINK SENSE OPPOSITE OF NEW CASE
	ADD HOLER
	JMP HOL3

OUTPTH,	LAC (NOP
	DAC TOCX
	LAC FORIND
	ADD (1
	TOC		/OUTPUT TEXT ROUTINE
	LAC TO#CTEM
	DAC FORIND
	JMP GEN1

XOI,	LAC IO		/'X' FORMAT PROCESSOR
	SZA
	JMP OUTPTX	/NON-ZERO IMPLIES WRITE
XI2,	XX		/'X' INPUT PRESET
	ISZ RCNT		/TWO#S COMPLEMENT COLUMN COUNT
	JMP XI2
	JMP GEN4

OUTPTX,	CLA
	STASH		/BLANK TO OUTPUT BUFFER
	ISZ RCNT
	JMP OUTPTX
	JMP GEN1

/RESET ROUTINE WHEN FINISHED WITH CURRENT ARRAY
DONE,	0
	DZM ARGUE	/ARRAY VARIABLE INDICATOR CLEAR
	LAC DONE
	ADD (-1
	DAC ARGIND	/RESET I/O LIST INDEX
	LAC ITER		/REPETITION COUNT
	SZA
	JMP GEN3-1	/DO NOT PICK UP NEW FORMAT WORD
	LAC I DONE
	AND (17777
	SAD (ENDIO
	JMP XDON
	LAC IO
	RAR
	LAC ACCTEM
	SAD (JMP
	SKP
	AND (377777
	SNA
	JMP YDON
	SZL
	JMP GEN1+3
	JMS BUFSET
	LAC ACCTEM
	AND (377777
	JMP GEN1+3


/INTERMEDIATE PROCESSOR FOR ARRAY VARIABLE I/O
XARAD,	0
	LAC (ARX I TEMAD	/ELEMENT ACCESS ADDRESS
	JMP XARFAR
FARAD,	0
	LAC TEMAD	/CONTAINS ELEMENT ACCESS ADDRESS
	AND (77777
	XOR FARMOD	/INCLUDE DATA MODE
	DAC TEMAD
	LAC (ARF I TEMAD
XARFAR,	DAC XELF
	LAC (XELF-1
	DAC ARGIND	/SET PSEUDO IN I/O LIST INDEX
	ISZ ARGUE
	LAC ACCTEM
	AND (177777
	SNA
	JMP GEN1
	LAC ITER
	SZA
	JMP GEN2		/ALREADY IN PROCESS
	JMP GEN21	/SET UP FOR POSSIBLE H,X
XELF,	0

XDON,	ISZ ARGIND
	JMP ENDIO

YDON,	SNL
	JMP GEN4
	JMP GEN1
START
