Google
 

Trailing-Edge - PDP-10 Archives - klad_sources - klad.sources/cnvmic.mac
There are no other files named cnvmic.mac in the archive.
SUBTTL	RAM MICRO-CODE PROCESS
S

KSMCNV:
MICCNV:	MOVE	FILNAM		;INITIALIZE FILE NAMES
	MOVEM	INNAME
	MOVEM	OUTNAM
	MOVE	[SIXBIT/MCR/]
	SKIPE	FILEXT
	MOVE	FILEXT
	MOVEM	INNAME+1
	MOVE	[SIXBIT/RAM/]
	MOVEM	OUTNAM+1	;"ASCIIZED RAM"
	SETZM	INBLK		;ASCII, 7 BIT BYTES
	GO	ININIT		;INITIALIZE I/O
	SETZM	DRMCNT#		;INITIALIZE D-RAM COUNTER
	SETZM	CRMMAX#		;CLEAR C-RAM MAX ADDRESS
	SETZM	B11CNT
	SETZM	MTITF#		;CLEAR .TITLE FOUND FLAG
	SETZM	MTITS		;CLEAR .TITLE STORAGE

	GO	INTCOR		;SETUP HICORE FOR RAM STORAGE

MICLP:	GO	CMDIN		;GET INPUT LINE
	SKIPN	COMLIN		;ANY DATA IN LINE ?
	JRST	.-2		;NO, LOOP FOR NEXT

	GO	GETWRD		;GET COMMAND LETTER/WORD
	CAIN	T1,";"
	JRST	MTIT1		;SEMICOLON, FIND .TITLE STATEMENT
	JUMPE	T3,.-3		;LOOP TILL LEADING TABS/SPACES BYPASSED
	CAMN	T3,[SIXBIT/D/]
	JRST	DRAM		;IF "D", PROCESS D-RAM WORDS
	CAMN	T3,[SIXBIT/V/]
	JRST	CRAM		;IF "V", PROCESS C-RAM WORD
	CAMN	T3,[SIXBIT/U/]
	JRST	CRAM		;IF "U", PROCESS C-RAM WORD
	CAMN	T3,[SIXBIT/END/]
	JRST	DCSHUF		;IF "END", BIT SHUFFLE AND OUTPUT
	JRST	ERRM2		;IF ANYTHING ELSE, ERROR!
DCSHUF:	GO	LSTINI		;INITIALIZE LISTING

	MOVE	DRMCNT		;GET D-RAM COUNT
	JUMPE	0,.+3		;NO D-RAM DATA
	CAIE	DRMSIZ		;PROPER NUMBER OF ADDRESSES ?
	JRST	ERRM8		;NO, ERROR !

	SKIPN	KSMICF		;KS-10 ?
	GO	FILEID		;NO, IDENTIFY OUTPUT FILE

	JRST	CSHUF		;PROCESS C-RAM

MTIT1:	SKIPE	MTITF		;HAVE WE ALREADY FOUND .TITLE ?
	JRST	MICLP		;YES

	GO	GETWRD		;GET COMMAND WORD
	JUMPE	T3,.-1		;LOOP TILL LEADING TABS/SPACES BYPASSED
	CAMN	T3,[SIXBIT/.TITLE/]
	JRST	MTIT2		;FOUND .TITLE
	GO	GETWRD		;MAY HAVE TO SKIP NUMBERS
	JUMPE	T3,.-1
	CAMN	T3,[SIXBIT/.TITLE/]
	JRST	MTIT2		;FOUND .TITLE
	JRST	MICLP		;IF HAVEN'T GOT IT NOW, GIVE UP

MTIT2:	SETOM	MTITF		;SET FOUND FLAG
	MOVE	T3,[POINT 7,MTITS]

	ILDB	T1,T2		;SEARCH FOR QUOTE
	JUMPE	T1,MTIT3	;EOL, NO .TITLE ?
	CAIE	T1,42		;42 = QUOTE "
	JRST	.-3

	IDPB	T1,T3		;STORE LEADING QUOTE
	ILDB	T1,T2
	JUMPE	T1,MTIT3	;NO TRAILING QUOTE
	CAIN	T1,42		;STORE DATA TILL TRAILING QUOTE
	JRST	.+3
	IDPB	T1,T3
	JRST	.-5

	IDPB	T1,T3		;STORE TRAILING QUOTE
MTIT3:	SETZM	T1		;END WITH NULL
	IDPB	T1,T3
	JRST	MICLP
SUBTTL	D-RAM MICRO CODE PROCESS
S

DRAM:	SKIPE	KSMICF
	JRST	MICLP		;KS-10, NO D-RAM

	GO	GETOCT		;GET D-RAM ADDRESS
	CAIL	T3,DRMSIZ	;DOES IT FIT ?
	JRST	ERRM3		;NO, INVALID D-RAM ADDRESS

	AOS	DRMCNT		;COUNT D-RAM ENTRY

	MOVEM	T3,INDX		;SETUP STORAGE INDEXER
	IMULI	INDX,2

	GO	GETWRD		;GET EXTRA SEPARATOR
	CAIE	T1," "		;BETTER BE SPACE
	JRST	ERRM5		;WASN'T, ERROR !

	GO	GETOCT		;GET LISTING 1ST WORD, A B & P

	HRLZM	T3,DRMSTR(INDX)	;PUT IN STORAGE

	GO	GETOCT		;GET LISTING 2ND WORD, J FIELD
	CAILE	T3,1777		;DOES IT FIT IN 10 BITS ?
	TRO	T3,400000	;NO, SET ERROR FLAG BIT

	HRRM	T3,DRMSTR(INDX)	;PUT IN STORAGE

	GO	GETWRD		;BYPASS EXTRA TABS/SPACES
	JUMPE	T1,ERRM5	;IF RUN OUT OF LINE, ERROR !
	CAIE	T1,";"		;TILL SEMICOLON FOUND
	JRST	.-3

	IBP	T2		;BYPASS SPACE
	GO	GETDEC		;GET LISTING SEQUENCE NUMBER
	MOVEM	T3,DRMSTR+1(INDX) ;PUT IN STORAGE

	JRST	MICLP
D16SHF:	SETZM	JSZERR#
	SETZM	JCMERR#
	SETZM	J05ERR#
	TRNN	T3,17		;MULTIPLE OF 16 ADDRESS ?
	GO	DHEADR		;YES, DO HEADER PROCESS

	SKIPN	MNOLST		;NO LISTING ?
	GO	PDADR		;PRINT D-RAM ADDRESS

	LDB	0,[POINT 3,DRMSTR(INDX),8]	;DO A FIELD
	DPB	0,[POINT 3,B11DAT(CNT),24]
	SKIPN	MNOLST		;NO LISTING ?
	PNT1

	LDB	0,[POINT 3,DRMSTR(INDX),11]	;DO B FIELD
	DPB	0,[POINT 3,B11DAT(CNT),27]
	SKIPN	MNOLST		;NO LISTING ?
	PNT1

	LDB	0,[POINT 1,DRMSTR(INDX),17]	;DO PARITY FIELD
	DPB	0,[POINT 1,B11DAT(CNT),30]
	SKIPN	MNOLST		;NO LISTING ?
	PNT1

	LDB	T3,[POINT 18,DRMSTR(INDX),35]	;DO J FIELD
	TRZE	T3,400000		;J SIZE ERROR ?
	SETOM	JSZERR			;YES, SET FLAG

	MOVE	0,T3
	SKIPN	MNOLST		;NO LISTING ?
	PNT4			;PRINT J FIELD EVEN

	LDB	0,[POINT 4,T3,35]	;DO EVEN PART OF J FIELD
	DPB	0,[POINT 4,B11DAT(CNT),35]

	LDB	0,[POINT 6,T3,31]	;DO COMMON PART OF J FIELD
	MOVEM	0,JEVNCMN#	;SAVE FOR COMMON CHECK
	TRNE	0,2		;J FIELD BIT 05 = 0 ?
	SETOM	J05ERR		;NO, ERROR
	MOVEI	[ASCIZ/	; /]
	SKIPN	MNOLST		;NO LISTING ?
	PNTAL

	MOVE	0,DRMSTR+1(INDX)
	SKIPN	MNOLST		;NO LISTING ?
	PNTDEC			;PRINT LISTING SEQUENCE NUMBER

	MOVEI	[ASCIZ/		/]
	SKIPN	MNOLST		;NO LISTING ?
	PNTAL

D16SHO:	AOS	DRMADR		;SETUP FOR ODD ADDRESS OF PAIR
	ADDI	INDX,2

	SKIPN	MNOLST		;NO LISTING ?
	GO	PDADR		;PRINT D-RAM ADDRESS

	LDB	0,[POINT 3,DRMSTR(INDX),8]	;DO A FIELD
	DPB	0,[POINT 3,B11DAT+1(CNT),24]
	SKIPN	MNOLST		;NO LISTING ?
	PNT1

	LDB	0,[POINT 3,DRMSTR(INDX),11]	;DO B FIELD
	DPB	0,[POINT 3,B11DAT+1(CNT),27]
	SKIPN	MNOLST		;NO LISTING ?
	PNT1
	LDB	0,[POINT 1,DRMSTR(INDX),17]	;DO PARITY FIELD
	DPB	0,[POINT 1,B11DAT+1(CNT),30]
	SKIPN	MNOLST		;NO LISTING ?
	PNT1

	LDB	T3,[POINT 18,DRMSTR(INDX),35]	;DO J FIELD
	TRZE	T3,400000		;J SIZE ERROR ?
	SETOM	JSZERR		;YES, SET J SIZE ERROR

	MOVE	0,T3
	SKIPN	MNOLST		;NO LISTING ?
	PNT4			;PRINT J FIELD

	LDB	0,[POINT 4,T3,35]	;DO ODD PART OF J FIELD
	DPB	0,[POINT 4,B11DAT+1(CNT),35]

	LDB	0,[POINT 6,T3,31]	;GET COMMON PART OF J FIELD
	MOVE	1,0
	LSH	0,-2
	DPB	0,[POINT 4,B11DAT+2(CNT),35]
	CAME	1,JEVNCMN		;ARE EVEN & ODD COMMON THE SAME ?
	SETOM	JCMERR			;NO, SET J COMMON ERROR
	TRNE	1,2		;J 05 SET ?
	SETOM	J05ERR		;YES, ERROR

	MOVEI	[ASCIZ/	; /]
	SKIPN	MNOLST		;NO LISTING ?
	PNTAL
	MOVE	0,DRMSTR+1(INDX)
	SKIPN	MNOLST		;NO LISTING ?
	PNTDEC			;PRINT SEQUENCE NUMBER

	ADDI	INDX,2		;STEP UP TO NEXT ADDRESS PAIR
	ADDI	CNT,3		;INCREMENT 11 DATA STOR INDEX
	MOVEM	CNT,B11CNT	;UPDATE STORAGE COUNT
	CAIN	CNT,^D30	;FILLED OUTPUT BLOCK ?
	GO	DRMBST		;YES, ASCIIZE AND OUTPUT
DRMCMN:	SKIPE	MNOLST		;NO LISTING ?
	RTN
	SKIPE	J05ERR
	JRST	DRMCM1
	SKIPE	JSZERR
	JRST	DRMCM1
	SKIPE	JCMERR
	JRST	DRMCM1

DRMCM2:	MOVEI	CRLF
	PNTA
	RTN

DRMCM1:	MOVEI	TAB
	PNTA
	MOVEI	[ASCIZ/J SIZE /]
	SKIPE	JSZERR
	PNTAL
	MOVEI	[ASCIZ/J CMN   /]
	SKIPE	JCMERR
	PNTAL
	MOVEI	[ASCIZ/J05 ERR /]
	SKIPE	J05ERR
	PNTAL
	JRST	DRMCM2
DSHUF:	SKIPN	DRMCNT		;ANY D-RAM DATA ?
	JRST	DRMDON+1	;NO
	SETZM	INDX		;START AT D-RAM ADDRESS 0
	SETZM	B11CNT
	GO	DRMBST		;SETUP FOR BLOCK START

DSHUF1:	MOVE	T3,INDX
	IDIVI	T3,2
	MOVEM	T3,DRMADR	;SETUP EVEN ADDRESS OF PAIR

	GO	D16SHF		;PROCESS AND OUTPUT D-RAM

	CAIE	INDX,DRMSIZ*2	;ARE WE DONE ?
	JRST	DSHUF1		;NO, DO NEXT D-RAM PAIR

	JRST	DRMDON		;FINISH D-RAM

DRMBST:	SKIPE	B11CNT		;ANY DATA IN STORAGE ?
	GO	DRMAO		;YES, ASCIIZE & OUTPUT
	MOVE	T3,INDX
	IDIVI	T3,2
	MOVEM	T3,B11ADR	;SETUP BLOCK START ADDRESS
	SETZB	CNT,B11CNT	;CLEAR STORAGE INDEXER

	MOVE	T1,[B11DAT,,B11DAT+1]
	SETZM	B11DAT		;CLEAR STORAGE AREA
	BLT	T1,B11DAT+AWC11
	RTN

DHEADR:	SKIPE	MNOLST		;NO LISTING ?
	RTN
	TRNE	T3,17		;MULTIPLE OF 20 ADDRESS ?
	RTN
	TRNN	T3,77		;MULTIPLE OF 100 ADDRESS ?
	GO	DNEWPG		;YES, DO NEW PAGE
	MOVEI	DHEAD
	PNTAL			;PRINT HEADER
	RTN
DNEWPG:	MOVEI	14		;FORM-FEED
	PNTCHR
	GO	PAGHDR		;PUT HEADER ON PAGE
	RTN

DHEAD:	ASCIZ?
ADR/ A B P    J		(SEQ#)		ADR/ A B P    J		(SEQ#)

?

PDADR:	SETZM	PNTSPC
	MOVE	0,DRMADR#
	PNT3			;PRINT D-RAM ADDRESS
	SETOM	PNTSPC
	MOVEI	[ASCIZ?/ ?]
	PNTAL
	RTN
DRMAO:	MOVEM	T1,SAVT1#
	MOVEM	T2,SAVT2#
	MOVEM	T3,SAVT3#

	GO	PUTDSP		;LINE STARTS WITH "D" & "SPACE"

	GO	C11CNV		;ASCIIZE AND OUTPUT

	MOVE	T1,SAVT1
	MOVE	T2,SAVT2
	MOVE	T3,SAVT3
	RTN

DRMDON:	GO	DRMAO		;ASCIIZE AND OUTPUT LAST BLOCK

	SETZM	B11CNT		;WC=0, IS FINISH BLOCK
	SETZM	B11ADR		;ADDR=0, NO START ADDRESS
	GO	DRMAO		;ASCIIZE AND OUTPUT

	SKIPE	MNOLST		;NO LISTING ?
	JRST	.+4
	MOVEI	14
	PNTCHR			;FINISH LISTING WITH FORM FEED

	DROPDV			;CLOSE OUT LISTING

	SETZM	SWTEXR		;CLEAR SWITCHES

	JRST	C11DON		;CLOSE OUT REST
SUBTTL	C-RAM MICRO-CODE PROCESS
S

CRAM:	GO	GETOCT		;GET C-RAM ADDRESS
	CAIL	T3,CRMSIZ	;DOES IT FIT IN C-RAM ?
	JRST	ERRMC1		;NO, ERROR !
	CAMLE	T3,CRMMAX	;IS THIS GREATEST SO FAR ?
	MOVEM	T3,CRMMAX	;YES, SAVE AS MAXIMUM
	MOVEM	T3,INDX
	IMULI	INDX,4		;SETUP STORAGE INDEXER

	GO	GETWRD		;GET EXTRA SEPARATOR
	CAIE	T1," "		;BETTER BE SPACE
	JRST	ERRMC2		;WASN'T, ERROR !

	GO	GETOCT		;GET LISTING BITS 00-11
	LSH	T3,^D24		;POSITION
	MOVEM	T3,AC		;SAVE TILL FULL WORD FORMED

	GO	GETOCT		;GET LISTING BITS 12-23
	LSH	T3,^D12		;POSITION
	ORM	T3,AC		;SAVE

	GO	GETOCT		;GET LISTING BITS 24-35
	ORM	T3,AC		;SAVE

	MOVEM	AC,HICORE(INDX)	;PUT IN C-RAM STORAGE
	GO	GETOCT		;GET LISTING BITS 36-47
	LSH	T3,^D24		;POSITION
	MOVEM	T3,AC

	GO	GETOCT		;GET LISTING BITS 48-59
	LSH	T3,^D12		;POSITION
	ORM	T3,AC

	GO	GETOCT		;GET LISTING BITS 60-71
	ORM	T3,AC

	MOVEM	AC,HICORE+1(INDX)	;PUT IN C-RAM STORAGE

	GO	GETOCT		;GET LISTING BITS 72-83
	LSH	T3,^D24
	MOVEM	T3,AC

	SKIPE	KSMICF
	GO	KSCRAM		;KS-10, DO LISTING BITS 84-107

	MOVEM	AC,HICORE+2(INDX)	;PUT IN C-RAM STORAGE

	GO	GETWRD		;ADDITIONAL FORMAT CHECK
	JUMPE	T1,ERRMC2	;BYPASS EXTRA FIELD, TABS/SPACES
	CAIE	T1,";"		;TILL SEMICOLON
	JRST	.-3		;IF RUN OUT OF LINE, ERROR !

	IBP	T2		;BYPASS SPACE
	GO	GETDEC		;GET LISTING SEQ NUMBER
	MOVEM	T3,HICORE+3(INDX)	;PUT IN C-RAM STORAGE

	JRST	MICLP		;LOOP FOR NEXT

KSCRAM:	GO	GETOCT		;GET LISTING BITS 84-95
	LSH	T3,^D12
	ORM	T3,AC

	GO	GETOCT		;GET LISTING BITS 96-107
	ORM	T3,AC
	RTN
CSHUF:	SKIPE	KSMICF
	JRST	KSSHUF		;KS-10 MICRO-CODE
	SKIPN	HICORE+3	;C-RAM LOC 0 LOADED ?
	JRST	CSHUF2		;NO, NO "Z" BLOCK
	SETZM	B11ADR		;CREATE C-RAM ZERO BLOCK
	MOVE	CRMMAX		;CLEAR UP TO MAX USED
	MOVEM	B11DAT
	MOVEI	1
	MOVEM	B11CNT		;ONE DATA WORD

	GO	PUTZSP		;LINE STARTS WITH "Z" & "SPACE"

	GO	C11CNV		;ASCIIZE & OUTPUT

CSHUF2:	SETZM	INDX		;START AT C-RAM ADDRESS 0
	SETZM	B11CNT
	SETOM	CLCNT#		;INIT C-RAM LISTING COUNT
	SETOM	CRMPRV#		;INIT C-RAM PREVIOUS ADDRESS

CSHUF1:	MOVE	INDX
	IDIVI	4
	MOVEM	CRMADR#

	GO	C16SHF		;PROCESS AND OUTPUT C-RAM

	ADDI	INDX,4		;STEP TO NEXT ADDRESS
	CAIE	INDX,CRMSIZ*4	;ARE WE DONE ?
	JRST	CSHUF1		;NO, DO NEXT ADDRESS

	SKIPN	B11CNT		;ANY DATA IN STORAGE
	JRST	.+3		;NO
	GO	PUTCSP		;OUTPUT LAST BLOCK
	GO	C11CNV

	SETZM	B11CNT		;WC=0 IS FINISH BLOCK
	SETZM	B11ADR		;ADDR=0, NO START ADDRESS
	GO	PUTCSP		;LINE STARTS WITH "C" & "SPACE"
	GO	C11CNV		;ASCIIZE AND OUTPUT FINISH BLOCK

	JRST	DSHUF		;NOW GO DO D-RAM
C16SHF:	SKIPN	HICORE+3(INDX)	;ANYTHING FOR THIS ADDRESS ?
	RTN			;NO, NO SEQUENCE NUMBER

	AOS	CRMPRV		;+1 TO PREVIOUS ADDRESS
	MOVE	CRMPRV
	CAME	CRMADR		;ARE ADDRESSES SEQUENTIAL ?
	GO	CRMOUT		;NO, OUTPUT PREVIOUS BLOCK
	MOVE	AC,INDX		;MULTIPLE OF 5 ADDRESSES ?
	IDIVI	AC,^D5*4
	SKIPN	AC+1
	GO	CRMOUT		;YES, SETUP FOR BLOCK START
	MOVE	CRMADR		;UPDATE PREVIOUS ADDRESS
	MOVEM	CRMPRV		;TO THIS ONE
	SETZM	CNT		;CLEAR OUTPUT BIT COUNTER
	SETZM	CRM16		;CLEAR ACTUAL C-RAM STORE
	SETZM	CRM16+1
	SETZM	CRM16+2
	SETZM	CRM16+3
	SETZM	CRM16+4
	SETZM	CRM16+5
	SETZM	CRM16-1		;CLEAR UNUSED BIT STORAGE

	MOVE	T1,[POINT 1,HICORE(INDX)]	;LOAD POINTER

C16SHL:	ILDB	T2,T1		;GET 1 BIT FROM STORAGE

	DPB	T2,CRAMPT(CNT)	;DEPOSIT IN ACTUAL C-RAM 16 BIT WORDS

	ADDI	CNT,1		;ADVANCE TO NEXT BIT
	CAIE	CNT,^D84	;ALL BITS DONE ?
	JRST	C16SHL		;NO, DO NEXT BIT

	SKIPE	CRM16-1		;ANY UNUSED BITS SET ?
	GO	CRMUNB		;YES, ERROR !

	MOVE	CRM16		;TRANSFER 6 WORDS TO OUTPUT BUFFER
	MOVEM	B11DAT(T4)
	MOVE	CRM16+1
	MOVEM	B11DAT+1(T4)
	MOVE	CRM16+2
	MOVEM	B11DAT+2(T4)
	MOVE	CRM16+3
	MOVEM	B11DAT+3(T4)
	MOVE	CRM16+4
	MOVEM	B11DAT+4(T4)
	MOVE	CRM16+5
	MOVEM	B11DAT+5(T4)

	MOVEI	AC,6		;6 ELEVEN WORDS PER C-RAM WORD
	ADDM	AC,B11CNT
	ADDM	AC,T4		;ADD 6 TO OUTPUT BUFFER INDEXER

	SKIPN	MNOLST		;DO LISTING ?
	GO	CRMLST		;DO C-RAM LISTING LINE

	RTN			;LOOP FOR NEXT C-RAM WORD

CRMUNB:	MOVEI	[ASCIZ/ERROR! CRAM UNUSED BITS
/]
	PNTAL
	RTN
CRMOUT:	SKIPE	B11CNT		;ANY WORDS IN OUTPUT BUFFER

	GO	CRMCNV		;YES, ASCIIZE & OUTPUT

	MOVE	AC,INDX		;PICKUP ADDRESS
	IDIVI	AC,4		;DIVIDED BY 4
	MOVEM	AC,B11ADR	;IS BLOCK START ADDRESS
	SETZB	T4,B11CNT	;CLEAR STORAGE INDEXER
	RTN

CRMCNV:	GO	PUTCSP		;LINE STARTS WITH "C" & "SPACE"

	GO	C11CNV		;ASCIIZE & OUTPUT

	RTN
CRMLST:	AOS	CLCNT		;INCREMENT C-RAM LINE COUNT
	MOVE	CLCNT
	TRNN	7		;MULTIPLE OF 10 LINES ?
	GO	CHEADR		;YES, PUT HEADER IN

	GO	PCADR		;PRINT C-RAM ADDRESS

	MOVE	CRM16+4
	PNT6			;PRINT ACTUAL BITS 00-15
	MOVE	CRM16+3
	PNT6			;PRINT ACTUAL BITS 16-31
	MOVE	CRM16+2
	PNT6			;PRINT ACTUAL BITS 32-47
	MOVE	CRM16+1
	PNT6			;PRINT ACTUAL BITS 48-63
	MOVE	CRM16
	PNT6			;PRINT ACTUAL BITS 64-79
	MOVEI	" "
	PNTCHR
	LDB	[POINT 6,CRM16+5,35]
	PNT2			;PRINT ACTUAL BITS, SPEC 0-5

	MOVEI	TAB
	PNTA
	MOVEI	";"
	PNTCHR
	MOVEI	" "
	PNTCHR
	MOVE	HICORE+3(INDX)
	PNTDEC			;PRINT LISTING SEQ # FOR THIS WORD
	MOVEI	TAB
	PNTA

	GO	PCADR		;PRINT C-RAM ADDRESS

	LDB	[POINT 11,HICORE(INDX),11]
	PNT4			;PRINT J FIELD

	LDB	[POINT 2,HICORE+1(INDX),19]
	PNT1			;PRINT T FIELD

	LDB	AC,[POINT 3,HICORE(INDX),29]
	LSH	AC,3
	LDB	0,[POINT 3,HICORE(INDX),26]
	OR	0,AC
	PNT2			;PRINT AR FIELD
	LDB	AC,[POINT 2,HICORE(INDX),23]
	LSH	AC,^D9
	MOVE	0,AC
	LDB	AC,[POINT 3,HICORE(INDX),20]
	LSH	AC,6
	OR	0,AC
	LDB	AC,[POINT 6,HICORE(INDX),17]
	OR	0,AC
	PNT4			;PRINT AD FIELD

	LDB	AC,[POINT 1,HICORE(INDX),31]
	LSH	AC,1
	LDB	0,[POINT 1,HICORE(INDX),30]
	OR	0,AC
	PNT1			;PRINT BR FIELD

	MOVEI	" "
	PNTCHR
	LDB	[POINT 1,HICORE(INDX),32]
	PNT1			;PRINT MQ FIELD

	MOVEI	" "
	PNTCHR
	LDB	[POINT 3,HICORE(INDX),35]
	PNT1			;PRINT FM FIELD

	MOVEI	" "
	PNTCHR
	LDB	AC,[POINT 2,HICORE+1(INDX),8]
	LSH	AC,6
	MOVE	0,AC
	LDB	AC,[POINT 3,HICORE+1(INDX),5]
	LSH	AC,3
	OR	0,AC
	LDB	AC,[POINT 3,HICORE+1(INDX),2]
	OR	0,AC
	PNT3			;PRINT SCAD FIELD

	MOVEI	" "
	PNTCHR
	LDB	[POINT 1,HICORE+1(INDX),10]
	PNT1			;PRINT SC FIELD

	MOVEI	" "
	PNTCHR
	LDB	[POINT 1,HICORE+1(INDX),11]
	PNT1			;PRINT FE FIELD
	MOVEI	" "
	PNTCHR
	LDB	[POINT 2,HICORE+1(INDX),14]
	PNT1			;PRINT SH FIELD

	LDB	[POINT 9,HICORE+2(INDX),11]
	PNT3			;PRINT # FIELD

	MOVEI	" "
	PNTCHR
	LDB	[POINT 2,HICORE+1(INDX),17]
	PNT1			;PRINT VMA FIELD

	MOVEI	" "
	PNTCHR
	LDB	[POINT 4,HICORE+1(INDX),23]
	PNT2			;PRINT MEM FIELD

	MOVEI	" "
	PNTCHR
	MOVEI	" "
	PNTCHR
	LDB	[POINT 6,HICORE+1(INDX),29]
	PNT2			;PRINT COND FIELD

	MOVEI	" "
	PNTCHR
	MOVEI	" "
	PNTCHR
	LDB	[POINT 6,HICORE+1(INDX),35]
	PNT2			;PRINT SPEC FIELD

	LDB	[POINT 1,HICORE+2(INDX),2]
	PNT1			;PRINT MARK BIT

	MOVEI	CRLF
	PNTA			;THATS THE END OF THE LINE !!
	RTN

PCADR:	SETZM	PNTSPC
	MOVE	CRMADR
	PNT4			;PRINT C-RAM ADDRESS
	SETOM	PNTSPC
	MOVEI	"/"
	PNTCHR
	RTN
CHEADR:	TRNN	37		;MULTIPLE OF 40 ADDRESSES ?
	GO	CNEWPG		;YES, DO NEW PAGE

	MOVEI	CHEAD
	PNTAL			;PRINT HEADER
	RTN

CNEWPG:	MOVEI	14
	PNTCHR			;PRINT FORM-FEED
	GO	PAGHDR		;PUT HEADER ON PAGE
	RTN

CHEAD:	ASCIZ?
 ADR/00--15 16--31 32--47 48--63 64--79 0-5	(SEQ#)	 ADR/  J  T AR  AD BR MQ FM SCAD SC FE SH  # VMA MEM COND SPEC M

?

PUTDSP:	MOVEI	CHR,"D"
	JRST	PUTTSP+1

PUTCSP:	MOVEI	CHR,"C"
	JRST	PUTTSP+1
CRAMPT:	POINT	1,CRM16-1,35	;UNUSED		0
	POINT	1,CRM16+4,25	;J00
	POINT	1,CRM16+4,26	;J01
	POINT	1,CRM16+4,27	;J02
	POINT	1,CRM16+4,28	;J03
	POINT	1,CRM16+4,29	;J04
	POINT	1,CRM16+4,30	;J05
	POINT	1,CRM16+4,31	;J06
	POINT	1,CRM16+4,32	;J07
	POINT	1,CRM16+4,33	;J08
	POINT	1,CRM16+4,34	;J09		10
	POINT	1,CRM16+4,35	;J10
	POINT	1,CRM16+0,30	;AD CRY
	POINT	1,CRM16+3,28	;AD BOOLE
	POINT	1,CRM16+3,24	;AD SEL 8
	POINT	1,CRM16+3,25	;AD SEL 4
	POINT	1,CRM16+3,26	;AD SEL 2
	POINT	1,CRM16+3,27	;AD SEL 1
	POINT	1,CRM16+3,29	;ADA DIS
	POINT	1,CRM16+3,30	;ADA SEL 2
	POINT	1,CRM16+3,31	;ADA SEL 1	20
	POINT	1,CRM16-1,34	;UNUSED
	POINT	1,CRM16+3,32	;ADB SEL 2
	POINT	1,CRM16+2,20	;ADB SEL 1
	POINT	1,CRM16+2,33	;ARM SEL 4
	POINT	1,CRM16+0,20	;ARM SEL 2
	POINT	1,CRM16+0,22	;ARM SEL 1
	POINT	1,CRM16+2,24	;ARXM SEL 4
	POINT	1,CRM16+0,24	;ARXM SEL 2
	POINT	1,CRM16+0,26	;ARXM SEL 1
	POINT	1,CRM16+1,24	;BR LOAD	30
	POINT	1,CRM16+1,26	;BRX LOAD
	POINT	1,CRM16+3,20	;MQ SEL
	POINT	1,CRM16+1,28	;FM ADR SEL 4
	POINT	1,CRM16+1,29	;FM ADR SEL 2
	POINT	1,CRM16+1,30	;FMADR SEL 1	35
	POINT	1,CRM16+4,21	;SCAD 4		36
	POINT	1,CRM16+4,22	;SCAD 2
	POINT	1,CRM16+4,23	;SCAD 1
	POINT	1,CRM16+4,20	;SCADA DIS
	POINT	1,CRM16+2,28	;SCADA SEL 2	40
	POINT	1,CRM16+2,29	;SCADA SEL 1
	POINT	1,CRM16-1,33	;UNUSED
	POINT	1,CRM16+2,30	;SCADB SEL 2
	POINT	1,CRM16+1,32	;SCADB SEL 1
	POINT	1,CRM16-1,32	;UNUSED
	POINT	1,CRM16+1,34	;SCM SEL 2
	POINT	1,CRM16+4,24	;FE LOAD
	POINT	1,CRM16-1,31	;UNUSED
	POINT	1,CRM16+2,34	;ARMM SEL 2
	POINT	1,CRM16+2,35	;ARMM SEL 1	50
	POINT	1,CRM16-1,30	;UNUSED
	POINT	1,CRM16+2,32	;VMAM SEL 2
	POINT	1,CRM16+0,28	;VMAM SEL 1
	POINT	1,CRM16+0,32	;T00
	POINT	1,CRM16+0,34	;T01
	POINT	1,CRM16+1,20	;MEM 00
	POINT	1,CRM16+1,21	;MEM 01
	POINT	1,CRM16+1,22	;MEM 02
	POINT	1,CRM16+1,23	;MEM 03
	POINT	1,CRM16+3,21	;COND 00	60
	POINT	1,CRM16+3,22	;COND 01
	POINT	1,CRM16+3,23	;COND 02
	POINT	1,CRM16+1,25	;COND 03
	POINT	1,CRM16+1,27	;COND 04
	POINT	1,CRM16+1,31	;COND 05
	POINT	1,CRM16+5,30	;CALL (EXTENDED ADDRESSING)
	POINT	1,CRM16+5,31	;SPEC 00
	POINT	1,CRM16+5,32	;SPEC 01
	POINT	1,CRM16+5,33	;SPEC 02
	POINT	1,CRM16+5,34	;SPEC 03	70
	POINT	1,CRM16+5,35	;SPEC 04	71
	POINT	1,CRM16-1,28	;UNUSED		72
	POINT	1,CRM16-1,27	;UNUSED
	POINT	1,CRM16+2,31	;MARK
	POINT	1,CRM16+3,33	;# 00
	POINT	1,CRM16+3,34	;# 01
	POINT	1,CRM16+3,35	;# 02
	POINT	1,CRM16+2,21	;# 03
	POINT	1,CRM16+2,22	;# 04
	POINT	1,CRM16+2,23	;# 05		80
	POINT	1,CRM16+2,25	;# 06
	POINT	1,CRM16+2,26	;# 07
	POINT	1,CRM16+2,27	;# 08		83
;*KS-10 MICRO-CODE PROCESS

KSSHUF:	SETZM	INDX
	SETOM	CLCNT
	SETOM	CRMPRV

KSSHF1:	MOVE	INDX
	IDIVI	4
	MOVEM	CRMADR		;SETUP C-RAM ADDRESS

	GO	KSSHF3		;PROCESS & OUTPUT C-RAM

	ADDI	INDX,4		;STEP TO NEXT ADDRESS
	CAIE	INDX,CRMSIZ*4	;ARE WE DONE ?
	JRST	KSSHF1		;NO, DO NEXT ADDRESS

	MOVEI	14
	PNTCHR			;FINISH LISTING WITH FORM-FEED

	DROPDV			;CLOSE OUT LISTING

	GO	RSQSHF		;DO SEQUENCE NUMBER FILE

	SETZM	SWTEXR
	JRST	C11DON+1	;CLOSE OUT REST

KSSHF3:	SETZ	CNT,
	SETZB	6,7
	SETZB	10,11
	SKIPN	HICORE+3(INDX)	;ANYTHING FOR THIS ADDRESS ?
	JRST	KSXX		;NO, NO SEQUENCE NUMBER

	MOVE	T3,[POINT 1,HICORE(INDX)]
	MOVE	0,[ILDB	T4,T3]
	MOVE	1,[DPB	T4,KSCRMP(CNT)]
	MOVE	2,[ADDI	CNT,1]
	MOVE	3,[CAIE	CNT,^D108]
	MOVE	4,[JRST	0]
	MOVE	5,[JRST KSXX]
	JRST	0		;CONVERT CRAM BITS
KSXX:	MOVEM	6,CRM36-1

	MOVE	T3,[POINT 1,7]
	MOVEI	0,^D36
	SETZ	1,
	MOVE	2,[ILDB	6,T3]
	MOVE	3,[ADD	1,6]
	MOVE	4,[SOJG	0,2]
	MOVE	5,[JRST	KSXX1]
	JRST	2		;COMPUTE CRAM PARITY "CRA"

KSXX1:	TDC	1,KSPARF
	DPB	1,PB.CRA

	MOVEI	0,^D60
	SETZ	1,
	MOVE	5,[JRST	KSXX2]
	JRST	2		;COMPUTE CRAM PARITY "CRM"

KSXX2:	TDC	1,KSPARF
	DPB	1,PB.CRM

	MOVEM	7,CRM36		;STORE CONVERTED CRAM BITS
	MOVEM	10,CRM36+1
	MOVEM	11,CRM36+2

	SKIPE	CRM36-1		;ANY UNUSED BITS SET ?
	GO	CRMUNB		;YES, ERROR
KSSHF5:	MOVE	CHR-1,CRM36+1
	MOVE	CHR,CRM36+2
	LSHC	CHR-1,-^D12
	GO	PUT1		;OUTPUT BITS 60-95

	MOVE	CHR-1,CRM36
	MOVE	CHR,CRM36+1
	LSHC	CHR-1,-^D12
	GO	PUT1		;OUTPUT BITS 24-59

	MOVE	CHR,CRM36
	LSH	CHR,-^D12
	GO	PUT1		;OUTPUT BITS 0-23

	SKIPE	HICORE+3(INDX)	;ANYTHING FOR THIS ADDRESS ?
	GO	KSCLST		;YES, DO C-RAM LISTING LINE

	RTN

KSPARF:	0			;KS-10 PARITY SENSE, 0=EVEN -1=ODD
	0
CRM36:	0
	0
	0
KSCLST:	AOS	CLCNT		;INCREMENT C-RAM LINE COUNT
	MOVE	CLCNT
	TRNN	7		;MULTIPLE OF 8 LINES ?
	GO	KHEADR		;YES, PUT HEADER IN

	GO	PCADR		;PRINT C-RAM ADDRESS

	SETZM	PNTSPC

	MOVE	CRM36
	PNTOCT			;PRINT BITS 00-35

	MOVE	CRM36+1
	PNTOCT			;PRINT BITS 36-71

	MOVE	CRM36+2
	LSH	^D-12
	PNTADR			;PRINT BITS 72-95

	MOVEI	TAB
	PNTA
	MOVEI	";"
	PNTCHR
	MOVEI	" "
	PNTCHR

	MOVE	HICORE+3(INDX)
	PNTDEC			;PRINT LISTING SEQ # FOR THIS WORD

	MOVEI	TAB
	PNTA
	SETOM	PNTSPC

	LDB	[POINT 1,HICORE+2(INDX),8]
	PNT1			;PRINT "CALL"

	LDB	[POINT 12,HICORE(INDX),11]
	PNT4			;PRINT "J"

	LDB	[POINT 18,HICORE+2(INDX),35]
	PNT6			;PRINT "#"

	LDB	[POINT 3,HICORE(INDX),14]
	PNT1			;PRINT "ALU"

	LDB	[POINT 9,HICORE(INDX),23]
	PNT3			;PRINT "S/D"

	LDB	AC,[POINT 4,HICORE(INDX),29]
	LSH	AC,-6
	LDB	[POINT 4,HICORE(INDX),35]
	OR	0,AC
	PNT4			;PRINT "A/B"

	SETZM	PNTSPC

	LDB	[POINT 3,HICORE+1(INDX),2]
	PNT1			;PRINT "RAMADR"

	LDB	[POINT 2,HICORE+1(INDX),5]
	PNT1			;PRINT "DBUS"

	LDB	[POINT 3,HICORE+1(INDX),8]
	PNT1			;PRINT "DBM SEL"

	SETOM	PNTSPC
	MOVEI	[ASCII/   /]
	PNTA
	LDB	[POINT 6,HICORE+1(INDX),20]
	PNT2			;PRINT "SPEC"

	MOVEI	[ASCII/  /]
	PNTA

	LDB	[POINT 6,HICORE+1(INDX),26]
	PNT2			;PRINT "DISP"

	MOVEI	[ASCII/  /]
	PNTA

	LDB	[POINT 6,HICORE+1(INDX),32]
	PNT2			;PRINT "SKIP"

	LDB	[POINT 2,HICORE+1(INDX),35]
	PNT1			;PRINT "TIME"

	LDB	[POINT 1,HICORE+2(INDX),0]
	PNT1			;PRINT "CARRY"

	MOVEI	" "
	PNTCHR

	LDB	[POINT 1,HICORE+2(INDX),1]
	PNT1			;PRINT "LOAD SC"

	MOVEI	" "
	PNTCHR

	LDB	[POINT 1,HICORE+2(INDX),2]
	PNT1			;PRINT "LOAD FE"

	MOVEI	" "
	PNTCHR
	LDB	[POINT 1,HICORE+2(INDX),3]
	PNT1			;PRINT "FM WRITE"

	MOVEI	" "
	PNTCHR

	LDB	[POINT 1,HICORE+2(INDX),4]
	PNT1			;PRINT "MEM CYCLE"

	MOVEI	" "
	PNTCHR

	LDB	[POINT 1,HICORE+2(INDX),5]
	PNT1			;PRINT "DIVIDE"

	MOVEI	" "
	PNTCHR

	LDB	[POINT 2,HICORE+2(INDX),7]
	PNT1			;PRINT "MULTI PREC & MULTI SHIFT"

	MOVEI	" "
	PNTCHR

	LDB	[POINT 3,HICORE+1(INDX),11]
	PNT1			;PRINT "CLK/GEN/CHK LEFT"

	LDB	[POINT 3,HICORE+1(INDX),14]
	PNT1			;PRINT "CLK/GEN/CHK RIGHT"

	MOVEI	CRLF
	PNTA
	RTN
KHEADR:	TRNN	37		;MULTIPLE OF 40 ADDRESSES ?
	GO	KNEWPG		;YES, DO NEW PAGE

	MOVEI	KHEAD
	PNTAL			;PRINT HEADER
	RTN

KNEWPG:	MOVEI	14
	PNTCHR			;PRINT FORM-FEED
	GO	PAGHDR		;PUT HEADER ON PAGE
	RTN

KHEAD:	ASCIZ?
 ADR/00--                        --95   ; SEQ#  C    J   #  ALU S/D  A/B RBM SPEC DISP SKIP T C SC FE FM MC DV MP C/LR

?
	SALL
DEFINE	CRMUNU(BIT),<
	POINT 1,6,BIT>
DEFINE	CRMBIT(BIT),<
  IFL BIT-^D36,<
	POINT	1,7,BIT
  >
  IFGE BIT-^D36,<
    IFL BIT-^D72,<
	POINT	1,7+1,BIT-^D36
    >
    IFGE BIT-^D72,<
	POINT	1,7+2,BIT-^D72
    >
  >
>
DEFINE	CRMRNG(FROM,TO),<
	ZZ..==FROM
  REPEAT TO-FROM+1,<
	CRMBIT	\ZZ..
	ZZ..==ZZ..+1
  >
>
	RADIX	10
KSCRMP:	CRMRNG	0,11		;J
	CRMRNG	60,68		;ALU LSRC RSRC
	CRMRNG	87,89		;DEST
	CRMUNU	0
	CRMUNU	1
	CRMRNG	74,77		;A
	CRMUNU	2
	CRMUNU	3
	CRMRNG	80,83		;B
	CRMRNG	84,86		;RAMADR
	CRMUNU	4
	CRMRNG	72,73		;DBUS
	CRMRNG	69,71		;DBM
	CRMBIT	78		;DP HOLD L
	CRMBIT	50		;PAR EN L
	CRMBIT	92		;PAR CK L
	CRMBIT	79		;DP HOLD R
	CRMBIT	51		;PAR EN R
	CRMBIT	93		;PAR CK R
	CRMRNG	18,20		;SPEC
	CRMRNG	30,32
	CRMRNG	21,23		;DISP
	CRMRNG	27,29
	CRMRNG	15,17		;SKIP
	CRMRNG	33,35
	CRMUNU	5
	CRMRNG	12,13		;T
	CRMBIT	25		;CRY 38
	CRMBIT	90		;SC
	CRMBIT	91		;FE
	CRMBIT	48		;FM WRITE
	CRMBIT	26		;MEM F
	CRMBIT	52		;DIVIDE
	CRMBIT	53		;MULTI PRECISION
	CRMBIT	49		;MULTI SHIFT
	CRMBIT	14		;CALL
	CRMUNU	6
	CRMUNU	7
	CRMUNU	8
	CRMUNU	9
	CRMUNU	10
	CRMUNU	11
	CRMUNU	12
	CRMUNU	13
	CRMUNU	14
	CRMRNG	54,59		;#
	CRMRNG	36,47

PB.CRA:	CRMBIT	24
PB.CRM:	CRMBIT	94
MARKPT:	CRMBIT	95
	RADIX	8
	LALL
;*RSQSHF, CREATE KS-10 SEQUENCE NUMBER FILE

RSQSHF:	GO	RSQINI		;INIT OUTPUT FILE

	SETZM	INDX

	HRLZ	CHR,HICORE+3(INDX)	;GET EVEN SEQ #

	ADDI	INDX,4

	HRR	CHR,HICORE+3(INDX)	;GET ODD SEQ #

	GO	RSQPUT		;OUTPUT WORD

	ADDI	INDX,4
	CAIE	INDX,CRMSIZ*4
	JRST	RSQSHF+2

	OUTPUT	RSQ,
	CLOSE	RSQ,
	RELEAS	RSQ,

	RTN
RSQINI:	MOVEI	13
	MOVEM	RSQBLK

	OPEN	RSQ,RSQBLK
	 JRST	ERR8

	OUTBUF	RSQ,^D2

	MOVE	FILNAM
	MOVEM	RSQNAM
	MOVSI	(SIXBIT/RSQ/)
	MOVEM	RSQNAM+1
	MOVE	INNAME+1
	ANDI	700000
	HRRM	RSQNAM+1
	MOVE	INNAME+2
	AND	[37,,-1]
	MOVEM	RSQNAM+2
	MOVE	INNAME+4
	MOVEM	RSQNAM+4

	ENTER	RSQ,RSQNM
	 JRST	ERR9

	RTN

RSQBLK:	13
	SIXBIT/DSK/
	RSQBF,,0
RSQBF:	BLOCK	3

RSQNM:	6
	0
RSQNAM:	SIXBIT/NAME/
	SIXBIT/RSQ/
	BLOCK	5

RSQPUT:	SOSG	RSQBF+2		;ADVANCE BYTE COUNTER
	JRST	.+3
	IDPB	CHR,RSQBF+1	;DEPOSIT WORD
	RTN
	OUT	RSQ,		;DUMP BUFFER
	JRST	.-3
	JRST	ERR6
ERRS1:	MOVEI	[ASCIZ/
NO END STATEMENT IN MICRO FILE/]
	JRST	ERRX

ERRS2:	MOVEI	[ASCIZ/
ERROR ON INPUT/]
	JRST	ERRX

ERRM1:	MOVEI	[ASCIZ/
MICRO END BEFORE V OR U/]
	JRST	ERRX1

ERRM2:	MOVEI	[ASCIZ/
MICRO COMMAND WORD ERROR/]
	JRST	ERRX1

ERRM3:	MOVEI	[ASCIZ/
INVALID D-RAM ADDRESS/]
	JRST	ERRX1

ERRM4:	MOVEI	[ASCIZ/
NON-SEQUENTIAL D-RAM ADDRESS/]
	JRST	ERRX1

ERRM5:	MOVEI	[ASCIZ/
MICRO FORMAT ERROR/]
	JRST	ERRX1

ERRM6:	MOVEI	[ASCIZ/
INVALID C-RAM ADDRESS/]
	JRST	ERRX1

ERRM8:	MOVEI	[ASCIZ/
D-RAM ADDRESS ERROR/]
	JRST	ERRX1

ERRX1:	PNTALF			;PRINT ERROR
	MOVEI	CRLF
	PNTALF
	MOVEI	COMLIN
	PNTALF			;PRINT OFFENDING LINE
	MOVEI	CRLF
	PNTALF
	JRST	REENTR		;CLOSE OUT AND EXIT
ERRMC1:	MOVEI	[ASCIZ/
INVALID C-RAM ADDRESS/]
	JRST	ERRX2

ERRMC2:	MOVEI	[ASCIZ/
MICRO FORMAT ERROR/]
	JRST	ERRX2

ERRX2:	SKIPE	NOERRP
	JRST	ERRX3		;DON'T PRINT ERRORS ON TTY
	PNTALF			;PRINT ERROR
	MOVEI	CRLF
	PNTALF
	MOVEI	COMLIN
	PNTALF			;PRINT OFFENDING LINE
	MOVEI	CRLF
	PNTALF
	JRST	MICLP		;CLOSE OUT AND EXIT

ERRX3:	PNTAL			;PRINT ERROR
	MOVEI	CRLF
	PNTAL
	MOVEI	COMLIN
	PNTAL			;PRINT OFFENDING LINE
	MOVEI	CRLF
	PNTAL
	JRST	MICLP		;CLOSE OUT AND EXIT
ERRTTY:	SKIPE	NOERRP
	RTN
	SKIPE	J05ERR
	JRST	ERTTY1
	SKIPE	JSZERR
	JRST	ERTTY1
	SKIPE	JCMERR
	JRST	.+2
	RTN			;NO ERRORS

	MOVE	DRMADR		;IS THIS 255(JFCL) COMMON
	CAIN	255
	RTN			;YES, COMMON ERR IS OK

ERTTY1:	OUTSTR	[ASCIZ/ERROR! D-RAM /]
	SKIPE	JSZERR
	OUTSTR	[ASCIZ/J FIELD SIZE /]
	SKIPE	JCMERR
	OUTSTR	[ASCIZ/J FIELD COMMON /]
	SKIPE	J05ERR
	OUTSTR	[ASCIZ/J05 ERR /]

	OUTSTR	COMLIN		;OUTPUT OFFENDING LINE

	OUTSTR	[ASCIZ/
/]
	RTN


	0
CRM16:	0
	0
	0
	0
	0
	0