Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-07 - 43,50446/gtload.p11
There are 2 other files named gtload.p11 in the archive. Click here to see a list.
	.TITLE	GTLOAD GT40 LOAD HANDLER
CHAR=%0
CSUM=%1
BYTECT=%2
LOADDR=%3
SP=%6
PC=%7
	;
GTIS=175610	; GT40 INPUT STATUS
GTIB=175612	; GT40 INPUT BUFFER
GTOS=175614	; GT40 OUTPUT STATUS
GTOB=175616	; GT40 OUTPUT BUFFER
	;
	; THIS IS THE GT40 RESIDENT HANDLER DURING
	; A LOAD. THIS PROGRAM WOULD BE LOADED
	; BY THE GT40 BOOTSTRAP (A SIX BIT LOADER)
	; THIS IS AN EIGHT HANDLER SO TRANSFER
	; IS SPEEDED UP. THE SECOND ADVANTAGE OF
	; THIS HANDLER IS THAT IT RETURNS INFORMATION
	; ABOUT EACH BLOCK, ALLOWING THE HOST (I.E. PDP 10)
	; BETTER MONITORING OF BLOCK TRANSFERS
	;
	.=37534			; FOR 8K GT40
	;
START:	MOV	#START,SP		; SET UP STACK
READY:	MOVB	#'R,CHAR		; 'R'
	JSR	PC,SEND			; FOR READY
GETBLK:	CLR	CSUM			; CLEAR THE CHECKSUM
	JSR	PC,GET			; GET THE FIRST BYTE
	DEC	CHAR			; IF NOT A 1 THEN
	BNE	GETBLK			; LOOK FOR START
	JSR	PC,GET			; GET THE SECOND BYTE
	TSTB	CHAR			; IF NOT A NULL THEN
	BNE	GETBLK			; LOOK FOR START
	;
	; START PROCESSING A VALID BLOCK
	;
	JSR	PC,GET			; GET LOW ORDER BYTE COUNT
	MOV	CHAR,BYTECT		; AND SAVE
	JSR	PC,GET			; GET HIGH ORDER BYTE COUNT
	SWAB	CHAR			; MAKE HIGH ORDER
	BIS	CHAR,BYTECT		; FORM COMPLETE BYTE COUNT
	JSR	PC,GET			; GET LOW ORDER LOAD ADDRESS
	MOV	CHAR,LOADDR		; AND SAVE
	JSR	PC,GET			; GET HIGH ORDER LOAD ADDRESS
	SWAB	CHAR			; MAKE HIGH ORDER
	BIS	CHAR,LOADDR		; FORM COMPLETE LOAD ADDRESS
	;
	; IF BYTECT > 6 THEN INTERMEDIATE BLOCK
	; IF BYTECT = 6 THEN LAST BLOCK
	; IF BYTECT < 6 THEN ERROR
	;
	SUB	#6,BYTECT		; UPDATE BYTE COUNT
	BLT	ERROR			; BAD COUNT
	BEQ	LAST			; LAST BLOCK
	;
	; PROCESS INTERMEDIATE BLOCK
	;
NORMAL:	JSR	PC,GET			; GET THE NEXT BYTE
	MOVB	CHAR,(LOADDR)+		; SAVE THE BYTE, INCREMENT ADDRESS
	DEC	BYTECT			; DECREMENT THE BYTE COUNT
	BGT	NORMAL			; AND LOOP FOR ENTIRE BLOCK
	JSR	PC,GET			; GET THE CHECKSUM
	TSTB	CSUM			; IS CHECKSUM ZERO
	BEQ	READY			; IF SO CONTINUE WITH NEXT BLOCK
	;
	; CHECKSUM ERROR OR BAD BYTE COUNT
	;
ERROR:	MOVB	#'E,CHAR		; 'E'
	JSR	PC,SEND			; FOR ERROR
	BR	GETBLK			; TRY THE BLOCK AGAIN
	;
LAST:	JSR	PC,GET			; GET THE CHECKSUM
	TSTB	CSUM			; WAS IT GOOD ?
	BNE	ERROR			; CHECKSUM ERROR
	;
	; SELF START OR HALT
	;
	BIT	#1,LOADDR		; EVEN ADDRESS ?
	BEQ	TRANSF			; YES
	MOVB	#'H,CHAR		; IF ODD THEN 'H'
	JSR	PC,SEND			; FOR HALT
	HALT
TRANSF:	MOVB	#'S,CHAR		; EVEN ADDRESS SO 'S'
	JSR	PC,SEND			; FOR SELF-START
	JMP	@LOADDR			; START USERS PROGRAM
	.PAGE
GET:	TSTB	@#GTIS			; TEST STATUS - READY ?
	BPL	GET			; WAIT UNTIL READY
	MOVB	@#GTIB,CHAR		; GET THE CHARACTER
	BIC	#177400,CHAR		; CLEAR THE TOP BYTE
	ADD	CHAR,CSUM		; AND ADD INTO CHECKSUM
	RTS	PC			; RETURN TO CALLER
	;
SEND:	BIC	#177400,CHAR		; CLEAR TOP BYTE OF CHARACTER
	MOVB	CHAR,@#GTOB		; SEND THE CHARACTER
WAIT:	TSTB	@#GTOS			; WAIT UNTIL CHARACTER
	BPL	WAIT			; HAS BEEN SENT
	RTS	PC			; RETURN TO CALLER
	;
	.END	START