REL. ASSEMBLER PART 4 7-2-63

/ROUTINE TO PUNCH START BLOCK

PSTART,	0
	JMS PUNSTA
	LAC SECO#ND
	SZA
	JMP PSTA5
	LAC (JMP FUNBEG
	JMS P1B
	LAC INPUT
	SNA
	JMP PFUN
PSTR1,	LAM -20
	JMS FEED
	JMS PTITLE
	LAM -400
	JMS FEED
	JMP I PSTART

/INITIALIZE PUNCH

INITP,	0
	LAM -200
	JMS FEED
	CLA
	JMS P1B
	LAC (SKP
	JMS P1B
	LAM -6
	JMS FEED
	DZM CNT
	DZM CKS
	JMP I INITP

PUNSTA,	0
	ISZ DCNT
	JMS PBK
	LAM -6
	JMS FEED
	LAC CAI
	SZA
	TAD (777777
	XOR RELABS
	JMS P1B
	LAM -6
	JMS FEED
	JMP I PUNSTA
PSTA5,	LAC (JMP FUNSEC
	JMS P1B
	JMP PSTR1


/START COMES HERE

PPAUSE,
PSTAR,	LAC (JMP INIT1
	DAC INIT
	CLC
	DAC RON
	RRB
	CLC!HLT
	JMS APSYM
	JMS PSTART
PSTA4,	JMS WAIT
	LAC (JMP INIT0
	DAC INIT
	CLC!HLT

PSTA2,	LAT
	RAR
	SNL
	JMP . 3
	JMS TCR
	JMS PRALP
	LAT
	RTR
	SNL
	JMP . 3
	JMS TCR
	JMS PRNUM

PSTA2A,	LAT
	AND (4
	SNA
	JMP PSTA3
	LAC (NOP
	DAC INIT

PSTA3,	LAC FSYM
	CMA
	DAC LSYM
	HLT!CLA
	LAC (NOP
	DAC INIT
	LAC (400000
	JMP CONTIN 1


/PUNCH THE WORD REQUESTED

PPUNCH,	JMS PBK
	JMS NWD
	LAC UNC
	SZA
	JMP PUNCHE
	LAM -6
	JMS FEED
	LAC CON
	JMS P1B
	LAM -6
	JMS FEED
	JMP GO

PUNCHE,	JMS ERRA
	FLEX UPN
	LAC UNDT
	JMS PSYM
	JMS TCR
	JMP GO


/DISPATCH TABLE FOR LOADER TO READ SYMBOL DEFS

SDSP,	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	JMS PCODE0
	DAC I INDEX
	DAC I INDEX
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP


SETLOD,	0		/SET LOADER TO READ SYMBOLS
	LAC (SDSP
	DAC FUNCDS
	LAC I SETLOD
	DAC FUNDON
	ISZ SETLOD
	JMP I SETLOD

/RESTORE LOADER FOR PUNCHING

RESLOD,	0
	LAC (FUNDSP
	DAC FUNCDS
	LAC (FUNCEN
	DAC FUNDON
	JMP I RESLOD

/READ TITLE AND PRINT

RTITLE,	0
	JMS TSET
	LAC (STITLE-1
	DAC INDEX
	JMS GCT
	JMS SCRO
	JMP . 4
	JMP .-3
RT1,	JMS TSET
	JMS GCT
	LAC TC#HR
	RAR
	JMS TY1
	LAC RTITLE
	RAL
	JMS SCRO
	JMP RT2
	SML
	JMP . 5
	LAC NUM
	DAC I INDEX
	LAC INDEX
	DAC ETITLE
	JMS TCR
	JMP I RTITLE

RT2,	SML
	JMP RT1 1
	LAC FCHR
	AND (77
	JMS DOCHAR
	JMP RT1 1
	DAC I INDEX
	JMP RT1


/PUNCH TITLE

PTITLE,	0
	LAM -2
	DAC C#NT2
	LAC I ET#ITLE
	JMP . 3
PT1,	LAC T#EM2
	JMS RR6
	DAC TEM2
	AND (77
	RCL
	ADD (LAC TITLE
	DAC . 3
	LAC (-1
	DAC CNT#1
PT2,	XX
	DAC TEM#1
	LAC (-2
	DAC CNT
PT3,	LAC TEM1
	JMS RL6
	DAC TEM1
	RAL
	AND (77
	JMS IPB
	ISZ CNT
	JMP PT3
	ISZ PT2
	ISZ CNT1
	JMP PT2
	ISZ CNT2
	JMP PT1
	LAC ETITLE
	ADD (-1
	DAC ETITLE
	SAD (STITLE-1
	JMP I PTITLE
	JMP PTITLE 1


/PUNCH FUNNY LOADER

PFUN,	LAM FUNBEG-FUNEND-1
	DAC FUNCNT
	DAC CNT
	LAC (DAC FUNBEG-1
	DAC FUNDAC
	JMS RESLOD
	ISZ CNT
	LAW FUNEND-1

PFUN1,	DAC TEM2
	LAC I TEM2
	JMS P1B
	LAC TEM2
	ADD (-1
	ISZ CNT
	JMP PFUN1
	LAC (DAC FUNLOD-1
	DAC INDEX
	LAM -5
	DAC CNT
	LAC (JMP FUNLDS
	JMS P1B

PFUN2,	LAC I INDEX
	JMS P1B
	LAC INDEX
	JMS P1B
	ISZ CNT
	JMP PFUN2
	JMS SETLOD
	JMP BEGIN1
	JMP PSTR1

/PSEUDO NOINPUT

PNOINP,	ISZ INPUT
	JMP RETC

/PSEUDO-OP SHIFT

SHFT,	LAC CON
	JMS RL9
	AND (777000
	DAC CON
	JMP RETC

/FIX THE PRESENT SYMBOL TABLE

PFIX,	LAC FSYM
	DAC NLSYM
	JMP RETC

/DECIMAL AND OCTAL PSUEDO INSTS

DECIM,	LAC (ADD NUM
	DAC DOC
	JMP RETC

OCTA,	LAC (NOP
	JMP DECIM 1

/DISPATCH

DSP,	0
	ADD DSP
	DAC DSP
	JMP I DSP

/SKIP ON CARRIAGE RETURN

SCRO,	0
	LAC FCHR
	SAD (277
	ISZ SCRO
	JMP I SCRO

SCR,	0
	LAC FCHR
	SAD (277
	ISZ SCR
	SAD (236
	ISZ SCR
	JMP I SCR


/INPUT PSEUDO INSTRUCTION

DOCHAR,	0
	XCT RTBLE
	ADD NUM
	DAC NUM
	ISZ DOCHAR 1
	ISZ CC#NT
	JMP I DOCHAR
	ISZ DOCHAR
	JMP I DOCHAR

RTBLE,	JMS RR7
	JMS RL6
	NOP

TSET,	0
	DZM NUM
	LAC (XCT RTBLE
	DAC DOCHAR+1
	LAM -2
	DAC CCNT
	JMP I TSET

/PSEUDO-INSTS FOR MODE CONTROL

PTELE,	DZM ENDCOD	/ALL CHARACTERS TO TELETYPE CODE
	LAC (GCT
	JMP PFIO 3
PANA,	DZM ENDCOD	/ALL CHARACTERS TO ANELEX CODE
	LAC (GCA
	JMP PFIO 3
PFIO,	LAC (13		/ALL AS THEIR FIO-DEC CODE
	DAC ENDCOD
	LAC (GCC
	DAC GCI
	JMP RETC

ENDCOD,	0
GCI,	GCT
START
