Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-02 - 43,50234/load8.mac
There are 2 other files named load8.mac in the archive. Click here to see a list.
	TITLE LOAD8   PDP-8 LOADER USING TMSR
	ENTRY LOAD8

	DEFINE ERRMES(A)
<
	JRST [TTCALL 3,[ASCIZ/A/]
		JRST LOAD8]>

	DEFINE EXMES(A)
<
	JRST [TTCALL 3,[ASCIZ/A/]
		EXIT]>

LOAD8:	RESET
	SETZB 10,11
	SETZM CHKSUM#
	TTCALL 3,[ASCIZ/
FILE TO BE LOADED?   /]
	TTCALL 4,1
	MOVE 4,[POINT 6,10]
NEXTCH:	CAIN 1,15		;READ FILE NAME
	JRST START
	CAIN 1,"."
	MOVE 4,[POINT 6,11]
	SUBI 1,40
	CAIE 1,"."-40
	IDPB 1,4
	TTCALL 2,1
	ERRMES (<THE FORMAT IS:   FILE.EXT>)
	JRST NEXTCH

START:	TTCALL 11,		;INIT FILE NAME
	SETZB 12,13
	SETZB 14,15
	INIT 1,10
	SIXBIT/DSK/
	IBUF
	ERRMES (<DSK NOT AVAILABLE>)
	LOOKUP 1,10
	ERRMES (<FILE NOT FOUND ON DSK>)
	PJOB 1,
	TRMNO. 1,
	EXMES (<TRMNO. UUO NOT IMPLEMENTED>)
	MOVEI 2010
	MOVEI 2,1
	HRLZI 3,3
	TRMOP. 3,
	EXMES(<TRMOP. UUO NOT IMPLEMENTED>)
	JSP 17,GETWRD
	JSP 17,GETWRD
	CAIE 200
	ERRMES(<ILLEGALLY FORMATED FILE>)
	JSP 17,GETWRD
	CAIN 200
	JRST .-2
	TTCALL 1,[202]
	JRST NXTWD1

NXTWRD:	JSP 17,GETWRD
NXTWD1:	MOVE 1,0
	JSP 17,GETWRD
	MOVE 2,DELAY
	CAIN 2,200		;LEADER OR TRAILER?
	JRST DONE		;YES, GO READ THE CHECKSUM
	CAIN 1,377
	JRST RUBOU1
	CAIL 1,300		;FIELD CHANGE
	JRST MEMCHG
	CAIL 1,100
	JRST ORIGIN
	JRST SEND

RUBOUT:	JSP 17,GETWRD
RUBOU1:	CAIE 377
	JRST .-2
	JRST NXTWRD

ORIGIN:	TTCALL 1,[140]
	MOVEI 2,140
	ADDM 2,CHKSUM
SEND:	ANDI 1,77
	ADDI 1,40
	TTCALL 1,1
	ADDM 1,CHKSUM
	ANDI 77
	ADDI 40
SEND1:	TTCALL 1,0
	ADDM CHKSUM
	JRST NXTWRD

MEMCHG:	ANDI 1,70
	LSH 1,-3
	ADDI 1,150
	TTCALL 1,1
	ADDM 1,CHKSUM
	JRST NXTWD1

DONE:	TTCALL 3,LOADMP		;FINISH LOAD AND DUMP CHECKSUM
	TTCALL 0		;READ FIRST CHAR OF CHECKSUM
	ANDI 177
	TTCALL 1		;READ SECOND CHAR OF CHECKSUM
	ANDI 1,177
	SUBI 40
	SUBI 1,40
	LSH 6
	ADD 1
	MOVE 1,CHKSUM
	ADDI 1,1300		;ADD SUM OF CHARACTERS IN LOADMP
	ANDI 1,7777
	CAME 0,1
	ERRMES (<CHECKSUM ERROR, TRY AGAIN>)
	TTCALL 3,[ASCIZ/
LOAD COMPLETED!/]
	TTCALL 0		;WAIT FOR DUMP CHECKSUM
	TTCALL 0
	PJOB 1,
	TRMNO. 1,
	EXMES (<TRMNO. UUO NOT IMPLEMENTED>)
DONE1:	MOVEI 2			;WAIT FOR ALL TYPING TO STOP
	MOVSI 3,2
	TRMOP. 3,
	JRST DONE2
	MOVEI 100
	HIBER
	EXMES(<HIBERNATE UUO NOT IMPLEMENTED>)
	JRST DONE1

DONE2:	MOVEI 2010
	SETZ 2,
	HRLZI 3,3
	TRMOP. 3,
	EXMES(<TRMOP. UUO NOT IMPLEMENTED>)
	EXIT 1,
	JRST LOAD8

LOADMP:	BYTE (7) 150,140,134,40,40,40,136,40,137,137,2,5,0

GETWRD:	SOSGE IBUF+2
	JRST GETBF
	ILDB IBUF+1
	EXCH DELAY#
	JRST (17)

GETBF:	IN 1,
	JRST GETWRD
	GETSTS 1,
	TRNN 74B23
	JRST GETBFE
	TTCALL 1,[202]
	ERRMES (<ERROR READING DISK FILE>)

GETBFE:	TRNN 1B22
	JRST GETWRD
	TTCALL 1,[202]
	ERRMES (<PREMATURE END OF FILE ON DISK>)

IBUF:	BLOCK 3

	END LOAD8