Google
 

Trailing-Edge - PDP-10 Archives - klad_sources - klad.sources/cnvsub.mac
There are no other files named cnvsub.mac in the archive.
SUBTTL	MISCELLANEOUS SUBROUTINES

S
;*GETWRD -- SUBROUTINE TO RETURN NEXT SIXBIT FIELD
;*	MOVE	T2,BYTE POINTER FOR INPUT
;*	GO	GETWRD
;*	RETURNS WITH FIELD IN T3
;*	BREAKS ARE NON-ALPHANUMERIC OR GT 6 CHARS
S

GETWRD:	MOVE	T4,[POINT 6,T3]
	MOVEI	T3,0
GETWD1:	ILDB	T1,T2
	GO	ALPH		;GET ALPHANUMERIC
	RTN			;BREAK FOUND
	TRC	T1,40
	TRNE	T3,77
	RTN			;RETURN IF GT 6 CHARS
	IDPB	T1,T4
	JRST	GETWD1

S
;*ALPH -- SUBROUTINE TO CHECK CHARACTER
;*	RETURNS IF NON-ALPHANUMERIC
;*	SKIP-RETURN IF ALPHANUMERIC, $, % OR .
;*	ENTER WITH CHAR IN T1
;*	DISTURBS NO REGISTER
S

ALPH:	CAIN	T1,"$"
	JRST	ALPH1
	CAIN	T1,"%"
	JRST	ALPH1
	CAIN	T1,"."
	JRST	ALPH1
	CAIL	T1,"0"
	CAILE	T1,"Z"
	RTN
	CAILE	T1,"9"
	CAIL	T1,"A"
ALPH1:	AOS	(P)
	RTN
S
;*GETDEC -- SUBROUTINE TO GET A DECIMAL INTERGER
;*	MOVE	T2,BYTE POINTER FOR INPUT
;*	GO	GETDEC
;*	RETURNS WITH FIELD IN T3
;*	BREAKS ARE ANY NON-DECIMAL CHAR, RETURNED IN T1
S

GETDEC:	SETZ	T3,
GETDC1:	ILDB	T1,T2		;GET NEXT CHAR
	CAIL	T1,"0"
	CAILE	T1,"9"
	RTN			;NON-DECIMAL
	TLNE	T3,700000
	RTN			;OVERFLOW
	IMULI	T3,^D10		;MULT RESULT BY 10
	ADDI	T3,-"0"(T1)	;ADD IN THIS DIGIT
	JRST	GETDC1		;LOOP

S
;*GETOCT -- SUBROUTINE TO GET AN OCTAL INTERGER
;*	MOVE	T2,BYTE POINTER FOR INPUT
;*	GO	GETOCT
;*	RETURNS WITH FIELD IN T3
;*	BREAKS ARE ANY NON-OCTAL CHAR, RETURNED IN T1
S

GETOCT:	SETZ	T3,
GETOC1:	ILDB	T1,T2		;GET NEXT CHAR
	CAIL	T1,"0"
	CAILE	T1,"7"
	RTN
	TLNE	T3,700000
	RTN			;OVERFLOW
	LSH	T3,3		;MULTIPY BY 8
	ADDI	T3,-"0"(T1)	;ADD IN THIS DIGIT
	JRST	GETOC1		;LOOP
S
;*CMDIN -- SUBROUTINE TO GET COMMAND LINE
;*	RETURNS ASCIZ STRING BYTE POINTER IN T2
;*	EATS CR, RUBOUT, NULL, BREAK IS LF,VT,FF
S

CMDIN:	SETZM	COMLIN		;CLEAR COMMAND LINE BUFFER
	MOVE	T2,[COMLIN,,COMLIN+1]
	BLT	T2,COMLIN+^D29
	MOVE	T2,[POINT 7,COMLIN]
	MOVEI	T3,^D28*5	;SET MAX LINE LENGTH
CMDIN1:	GO	CMDGET
	JRST	CMDIN2		;BREAK
	SOJL	T3,CMDIN2	;PROTECT LENGTH OF LINE
	IDPB	T1,T2		;STORE CHAR
	JRST	CMDIN1		;LOOP
CMDIN2:	MOVEI	T1,0		;NULL ENDS STRING
	IDPB	T1,T2
	IDPB	T1,T2
	IDPB	T1,T2
	MOVE	T2,[POINT 7,COMLIN]
	RTN

S
;*CMDGET -- SUBROUTINE TO GET NEXT COMMAND LINE CHARACTER
;*	GO	CMDGET
;*	BREAK RETURN
;*	NO BREAK RETURN
;*	EATS CR, RUBOUT, NULL, BREAK IS LF, VT, FF
S

CMDGET:	GO	RINP		;GET INPUT CHAR
	JRST	ERRS1		;END OF FILE, NO 'END' STATEMENT
	MOVE	T1,CHR
	JUMPE	T1,CMDGET	;IGNORE NULLS
	CAIL	T1,"A"+40
	CAILE	T1,"Z"+40
	SKIPA
	SUBI	T1,40		;CONVERT LOWER CASE TO UPPER
	CAIE	T1,177		;RUBOUT
	CAIN	T1,15		;CR
	JRST	CMDGET		;LOOP
	CAIL	T1,12
	CAILE	T1,14
	AOS	(P)		;NO BREAK
	RTN			;BREAK
S
;*RINP -- INPUT FILE READ ROUTINE
S

RINP:	SOSLE	IBF+2		;DECREMENT BYTE COUNT
	JRST	RINP1
	IN	ICHAN,		;GET NEXT BUFFER
	JRST	RINP1-1
	STATZ	ICHAN,740000
	JRST	ERRS2		;ERROR
	RTN			;EOF, RETURN
	AOS	BLKCNT		;INCREMENT INPUT BLOCK COUNT
RINP1:	ILDB	CHR,IBF+1	;GET CHAR FROM BUFFER
CPOPJ1:	AOS	(P)
CPOPJ:	RTN			;RETURN +1

S
;*INTCOR -- INITIALIZE HI-CORE FOR RAM STORAGE
S

INTCOR:	MOVSI	0,1		;DELETE ANY PREVIOUS HIGH CORE
	CORE	0,		;	(IF A RESTART)
	JRST	ERRCOR
	MOVSI	0,HICORE+CRMSIZ*4-1
	CORE	0,		;GET HIGH CORE
	JRST	ERRCOR
	SETZM
	SETUWP	0,		;MAKE IT WRITABLE
	JRST	ERRCOR
	RTN

ERRCOR:	MOVEI	[ASCIZ/
CAN'T GET HI-CORE FOR RAM STORAGE/]
	JRST	ERRX

SUBTTL	LISTING FILE INITIALIZATION
S

LSTINI:	SKIPE	MNOLST
	JRST	LSTINO		;NO LISTING
	MOVE	FILNAM
	MOVEM	PNTNAM
	SETZM	LSTSRT#
	MOVSI	(SIXBIT/DSK/)
	MOVEM	$INTDV+7	;SETUP ERROR FILE ON DISK
	MOVEI	^D10
	HRRM	$INTD2		;USE 10 LISTING BUFFERS
	MOVEI	LSTNM
	HRRM	$INTD2+1	;USE EXTENDED ENTER
	MOVE	FILNAM
	MOVEM	LSTNAM		;SETUP FILE NAME
	MOVSI	(SIXBIT/MCL/)
	MOVEM	LSTNAM+1	;SETUP FILE EXT
	MOVE	INNAME+1
	ANDI	700000
	HRRM	LSTNAM+1
	MOVE	INNAME+2
	AND	[37,,-1]
	MOVEM	LSTNAM+2
	MOVE	INNAME+4
	MOVEM	LSTNAM+4
	MOVSI	PNTLPT
	MOVEM	SWTEXR		;SET PRINT ON LOGICAL DEVICE SWITCH
	GO	TIME		;CREATE HEADER LINE AND TITLE PAGE
	RTN

LSTINO:	MOVSI	NOPNT
	MOVEM	SWTEXR
	RTN

LSTNM:	6
	0
LSTNAM:	SIXBIT/NAME/
	SIXBIT/MCL/
	BLOCK	5
PAGHDR:	SKIPE	MNOLST
	RTN
	GO	PAGNBR		;NUMBER PAGE
	MOVSI	1,-^D22		;PRINT TOP LINE OF IMAGE BUFFER
	MOVE	0,IMAGEA(1)
	GO	SIXPNT		;PRINT 6BIT WORD IN AC0
	AOBJN	1,.-2		;DONE ENTIRE LINE ?
	MOVEI	CRLF
	PNTA
	MOVSI	1,-^D10		;PRINT 2ND LINE, IDENTIFY INPUT FILE
	MOVE	0,IMAGEB(1)
	GO	SIXPNT
	AOBJN	1,.-2		;DONE ENTIRE LINE ?
	MOVEI	CRLF2		;YES, DO DOUBLE CRLF
	PNTA
	RTN

SIXPNT:	MOVEM	1,SIXAC1#	;PRINT 6BIT WD IN AC0
	MOVE	1,0		;PUT WORD IN AC1
	MOVEI	2,6		;6 CHARS PER WORD

SIXPN1:	MOVEI	0,0
	LSHC	0,6		;PUT CHAR INTO AC0
	ADDI	0,40		;CONVERT TO ASCII
	PNTCHR			;PRINT
	SOJG	2,SIXPN1	;DONE 6 CHARS ?
	MOVE	1,SIXAC1	;YES
	RTN
SUBTTL	CONVERT TITLE AND PAGE HEADER PROCESS
S

TIME:	SETZM	IMAGEA
	MOVE	0,[IMAGEA,,IMAGEA+1]
	BLT	0,IMAGEA+^D34	;CLEAR TITLE LINE STORAGE

	GO	PTITLE		;PUT TITLE IN

	MOVE	BPNT,[POINT 6,IMAGEA+^D15]
	IBP	BPNT
	IBP	BPNT
	DATE	AC2,
	IDIVI	AC2,^D31
	ADDI	AC3,1
	GO	LSTNUM		;OUTPUT DAY
	IDIVI	AC2,^D12
	MOVEI	T2,DATETB(AC3)
	GO	LSTSTR		;OUTPUT MONTH
	MOVEI	AC3,^D64(AC2)
	MOVEM	AC3,YEAR#
	GO	LSTNUM		;OUTPUT YEAR
	IBP	BPNT
	MSTIME	AC2,
	IDIVI	AC2,^D1000
	CAIL	AC3,^D500
	ADDI	AC2,1
	IDIVI	AC2,^D3600
	EXCH	AC2,AC3
	GO	LSTNUM		;OUTPUT HOURS
	MOVEI	T1,32
	IDPB	T1,BPNT		;:
	IDIVI	AC2,^D60
	EXCH	AC2,AC3
	GO	LSTNUM		;OUTPUT MINUTES
	IBP	BPNT
	IBP	BPNT
	IBP	BPNT
	MOVEI	T2,[SIXBIT/PAGE/]
	GO	LSTSTR		;OUTPUT 'PAGE'
	IBP	BPNT
	MOVEM	BPNT,SVBPNT#	;SAVE FOR PAGE NUMBERING

TIME1:	MOVE	[SIXBIT/CONVRT/]
	MOVEM	IMAGEA+^D12
	MOVE	[SIXBIT/ VER/]
	MOVEM	IMAGEA+^D13
	MOVE	BPNT,[POINT 6,IMAGEA+^D14]
	HLRZ	AC3,JOBVER
	GO	LSTOCT		;OUTPUT MCN LEVEL
	MOVEI	T2,16
	IDPB	T2,BPNT		;.
	HRRZ	AC3,JOBVER
	GO	LSTOCT		;OUTPUT DEC VERSION

	GO	IDENT		;IDENTIFY INPUT FILE

	SETZM	PAGCNT#
	GO	PAGHDR		;PUT HEADER ON PAGE

	MOVEI	AC1,^D20
	MOVEI	CRLF
	PNTA
	SOJG	AC1,.-2		;STEP DOWN 20 LINES

	MOVEI	STRLIN
	PNTAL			;PUT IN STAR LINE
	MOVEI	AC1,^D39*2	;CENTER IS 39 CHARACTERS
	SUB	AC1,TTCNT
	ASH	AC1,-1
	MOVEI	" "
	PNTCHR			;OUTPUT JUSTIFING SPACES
	SOJG	AC1,.-2
	MOVEI	MTITS
	SKIPN	MTITS
	MOVEI	TLINE
	PNTAL			;PRINT TITLE
	MOVEI	CRLF
	PNTA
	MOVEI	STRLIN
	PNTAL			;PUT IN STAR LINE
	MOVEI	AC1,^D16
	MOVEI	CRLF
	PNTA
	SOJG	AC1,.-2		;STEP DOWN 16 LINES

	MOVEI	CRLINE
	PNTAL			;'COPYRIGHT 19'
	MOVE	AC3,YEAR
	IDIVI	AC3,^D10
	MOVEI	0,60(AC3)
	PNTCHR			;APPEND YEAR
	MOVEI	0,60(AC4)
	PNTCHR
	MOVEI	CRLIN1
	PNTAL			;REST OF COPYRIGHT
	RTN			;DONE

PAGNBR:	AOS	AC3,PAGCNT	;INCREMENT PAGE COUNT
	MOVE	BPNT,SVBPNT
	GO	LSTNUM		;PUT PAGE NUMBER IN HEADER LINE
	RTN

LSTNUM:	IDIVI	AC3,^D10	;SEPARATE DIGITS
	MOVEI	T1,20(AC3)	;GET TENS
	IDPB	T1,BPNT		;OUTPUT
	MOVEI	T1,20(AC4)
	IDPB	T1,BPNT		;OUTPUT UNITS
	RTN

LSTOCT:	IDIVI	AC3,^D8		;SEPARATE OCTAL DIGITS
	JRST	LSTNUM+1

LSTSTR:	TLOA	T2,440600	;CONVERT TO POINTER
LSTST1:	IDPB	T1,BPNT		;OUTPUT CHAR
	ILDB	T1,T2		;FETCH NEXT CHAR
	JUMPN	T1,LSTST1	;LOOP TO NULL
	RTN
S
;*PTITLE -- PUT TITLE LINE IN HEADER STORAGE
S

PTITLE:	MOVE	T2,[POINT 7,MTITS]
	SKIPN	MTITS
	MOVE	T2,[POINT 7,TLINE]
	MOVE	T1,[POINT 6,IMAGEA]
	SETZM	TTCNT#

TLOOP:	ILDB	0,T2		;GET CHAR FROM TLINE
	JUMPE	0,TEND		;IF NULL, DONE
	AOS	TTCNT		;COUNT IT
	TRC	0,40		;MAKE SIXBIT
	IDPB	0,T1		;DEPOSIT IN HEADER LINE STORAGE
	JRST	TLOOP

TEND:	RTN

DATETB:	SIXBIT/-JAN-/
	SIXBIT/-FEB-/
	SIXBIT/-MAR-/
	SIXBIT/-APR-/
	SIXBIT/-MAY-/
	SIXBIT/-JUN-/
	SIXBIT/-JUL-/
	SIXBIT/-AUG-/
	SIXBIT/-SEP-/
	SIXBIT/-OCT-/
	SIXBIT/-NOV-/
	SIXBIT/-DEC-/
S
;*IDENT -- IDENTIFY INPUT FILE USED ON LISTING 2ND LINE
S

IDENT:	MOVE	BPNT,[POINT 6,IMAGEB]
	MOVE	INNAME
	MOVEM	SIXSTR
	MOVEI	T2,SIXSTR
	GO	LSTSTR		;PUT NAME IN STORAGE
	MOVEI	T1,16
	IDPB	T1,BPNT		;"."
	HLLZ	INNAME+1
	MOVEM	SIXSTR
	MOVEI	T2,SIXSTR
	GO	LSTSTR		;PUT EXT IN STORAGE

IDENT1:	MOVE	BPNT,[POINT 6,IMAGEB+3]
	
	LDB	AC1,[POINT 12,INNAME+2,35]	;GET LOW PART OF DATE
	LDB	AC2,[POINT 3,INNAME+1,20]	;GET HIGH PART OF DATE
	DPB	AC2,[POINT 3,AC1,23]		;PUT THE TWO TOGETHER
	JUMPE	AC1,CPOPJ		;IF 0, SUPPRESS DATE & TIME

	PUT	AC1		;SAVE DATE
	LDB	AC2,[POINT 11,INNAME+2,23]
	IDIVI	AC2,^D60
	EXCH	AC2,AC3
	GO	LSTNUM		;OUTPUT HOURS
	MOVEI	T1,32
	IDPB	T1,BPNT		;":"
	EXCH	AC2,AC3
	GO	LSTNUM		;OUTPUT MINUTES
	IBP	BPNT
	IBP	BPNT
	IBP	BPNT

	GET	AC2		;GET DATE BACK
	IDIVI	AC2,^D31
	ADDI	AC3,1
	GO	LSTNUM		;OUTPUT DAY
	IDIVI	AC2,^D12
	MOVEI	T2,DATETB(AC3)
	GO	LSTSTR		;OUTPUT MONTH
	MOVEI	AC3,^D64(AC2)
	GO	LSTNUM		;OUTPUT YEAR
	RTN
TLINE:	ASCIZ/DECSYSTEM KL10 MICRO-CODE LIST/

STRLIN:	ASCIZ/				**************
/

CRLINE:	ASCIZ/
		    COPYRIGHT (C) 19/

CRLIN1:	ASCIZ/
		    DIGITAL EQUIPMENT CORPORATION
		    MARLBORO, MASS. 01752
/
SUBTTL	BUFFERS

S
;*COMLIN -- COMMAND LINE BUFFER
S

COMLIN:	BLOCK	^D28
	0
	0
	0

S
;*IMAGEA -- LINE PRINTER IMAGE BUFFER
S

IMAGEA:	BLOCK	^D22		;TOP LINE
	0
	0
IMAGEB:	BLOCK	^D10		;SECOND LINE
	0
	0

SIXSTR:	0		;STORAGE FOR SIXBIT PRINT
	0		;MUST BE ZERO

S
;*MTITS -- MICRO .TITLE BUFFER
S

MTITS:	BLOCK	^D28