
	.TITLE	HRMPUN   HARDWARE READ-IN-MODE PUNCHER.
/COPYRIGHT 1969, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/
/	HRM PUNCHER ---	SELF RELOCATING
/
/
/	THERE ARE TWO ASSEMBLY PARAMETERS (ALL VALUES OCTAL)
/
/	V2:	DEFINED=PUNCH LEADER, TRAILER.
/		UNDEFINED=DON'T PUNCH LEADER, TRAILER.
/
/	SLOW:	DEFINED=USE SLOW PUNCH
/		UNDEFINED=USE FAST PUNCH
/
/	ALL 4 VERSIONS USE LOC.0. AND 7770-7777(17770-17777 IN 8K).
/
/	IF SLOW AND V2 UNDEFINED, THE BODY IS 73 LOCS.
/		V2 DEFINED RAISES THE 73 TO 115 LOCS.
/
/	IF SLOW IS DEFINED AND V2 IS UNDEFINED, THE BODY IS 102 LOCS.
/	IF SLOW AND V2 ARE DEFINED, THE BODY IS 124 LOCS.
/
/
	.FULL
	.LOC 7000		/DUMMY. HRM PUNCHER MAY BE LOADED ANYWHERE.
/PARAMETER
TSF=700401
TLS=700406
PSA=700204
PSF=700201
PSB=700244
PZ=0		/TEMP STORE AND FRAME COUNTER.
	.IFDEF	SLOW
PSA=TLS		/FOR SLOW PUNCH, CHANGE PSA TO A TLS.
PSF=TSF		/CHANGE PSF TO A TSF
	.ENDC
TMP=17777		/8K VERSION.
PSTRT=TMP-1	/START OF DUMP.
N=PSTRT-1		/# OF WORDS TO DUMP
PRET=N-1		/SUBR RETURN STORAGE
PWAIT=PRET-1	/POINTS TO WAIT SUBR.
PA2=PWAIT-1	/POINTS TO A2
PA5=PA2-1		/POINTS TO A5
PA6=PA5-1		/POINTS TO A6
	.IFDEF V2
PPL=PA6-1		/POINTS TO PL SUBR. PUNCHES LEADER, TRAILER
PPL1=PPL-1	/POINTS TO PL1
	.ENDC
/
/	RELOCATE!!
/
	STL		/SET LINK
	LAW 3777
	RTL
	RCL		/FORMS A 'JMP* 17776'
	DAC TMP		/STORE AT 7777.
	JMS TMP-1		/JMS TO 17776. PUTS ADR(A) IN 17776.
A	LAW A5-A
	TAD TMP-1
	DAC PA5		/POINTER TO A5
	LAW WAIT-A
	TAD TMP-1
	DAC PWAIT		/POINTER TO WAIT
	LAW A2-A
	TAD TMP-1
	DAC PA2		/POINTER TO A2
	LAW A6-A
	TAD TMP-1
	DAC PA6		/POINTER TO A6
	.IFDEF V2
	LAW PL-A
	TAD TMP-1
	DAC PPL		/POIMTER TO PL
	LAW PL1-A
	TAD TMP-1
	DAC PPL1		/POINTER TO PL1
	.ENDC
/
/	GET START AND STOP ADDRESSES
/
	HLT
	LAS		/READ START ADR.
	DAC PSTRT		/SET START ADR.
	HLT
	LAS		/READ STOP ADR
	CMA
	TAD PSTRT		/-(STOP-START+1)
	DAC N		/# OF WORDS TO PUNCH
/
/	START PUNCHING
/
	PSA+10		/INITIATE PUNCH
	.IFDEF V2
	JMS* PPL		/PUNCH LEADER
	.ENDC
/
/	PUNCH WORD LOOP
/
A5	LAW -3
	DAC PZ		/3 FRAME COUNT
	LAC* PSTRT	/GET A WORD
	ISZ PSTRT		/INC POINTER
	RCL		/PREPARE FOR EXTRACTING FRAMES
/
/	PUNCH FRAME LOOP
	.IFUND SLOW
A2	RTL
	RTL
	RTL		/GET 6 BITS
	JMS* PWAIT	/WAIT FOR FLAG
	PSB		/PUNCH.
	.ENDC
	.IFDEF SLOW
	DAC TMP		/SAVE CHAR
A2	JMS* PWAIT	/WAIT FOR FLAG
	LAC TMP
	RTL
	RTL
	RTL		/ROTATE FRAME INTO LOW AC.
	DAC TMP		/STORE
	LAW 77
	AND TMP
	DAC* PWAIT	/KEEP 6 BITS
	LAW 200
	XOR* PWAIT	/ADD IN CHANNEL 8
	TLS		/PUNCH
	.ENDC
	ISZ PZ		/DONE 3 FRAMES?
	JMP* PA2		/NO-DO ANOTHER FRAME.
	ISZ N		/YES -- DONE N WORDS?
	JMP* PA5		/NO - DO ANOTHER WORD.
			/YES - PUNCH HRI HALT WORD.
	JMS* PWAIT	/WAIT FOR FLAG
	LAW 274
	PSA		/740000
	JMS* PWAIT	/PLUS
	.IFUND SLOW
	PSB+10		/000000
	.ENDC
	.IFDEF SLOW
	LAW 200
	TLS		/000000
	.ENDC
	JMS* PWAIT	/PLUS
	LAW 340		/000340
	PSA		/=HLT WITH CHAN 7 ON IN LAST FRAME.
	.IFDEF V2
	JMS* PPL		/PUNCH TRAILER.
	.ENDC
	HLT		/DONE!!
/
/	WAIT FOR FLAG
/
WAIT	0
	.IFUND SLOW
	DAC TMP		/SAVE CHAR.
	.ENDC
A6	PSF		/IS FLAG ON?
	JMP* PA6		/NO - WAIT
	LAC* PWAIT	/YES - GET RETURN ADR
	DAC PRET		/STORE
	.IFUND SLOW
	LAC TMP		/RESTORE CHAR
	.ENDC
	JMP* PRET
/
/	PUNCH LEADER, TRAILER.
	.IFDEF V2
PL	0
	LAW -265
	DAC PZ		/SET COUNTER
PL1	JMS* PWAIT	/WAIT FOR FLAG
	PSA+10
	ISZ PZ		/DONE?
	JMP* PPL1		/NO
	LAC* PPL		/YES - GET RETURN ADR
	DAC PZ		/STORE
	JMP* PZ		/RETURN
	.ENDC
	.ENDC
	.ENDC
	.END
