Trailing-Edge
-
PDP-10 Archives
-
klad_sources
-
klad.sources/cnvsav.mac
There are no other files named cnvsav.mac in the archive.
SUBTTL PDP-10 '.A10' BACK TO '.SAV' CONVERSION
SAVCNV: MOVE FILNAM ;INITIALIZE FILE NAMES
MOVEM INNAME
MOVEM OUTNAM
MOVE [SIXBIT/A10/]
SKIPE FILEXT
MOVE FILEXT
MOVEM INNAME+1
MOVE [SIXBIT/SAV/]
MOVEM OUTNAM+1
MOVEI 13 ;INPUT IMAGE BINARY
MOVEM INBLK
GO ININIT ;INITIALIZE I/O
MOVEI BPNT,5 ;SET LDACHR BYTE COUNTER
JRST LDA10 ;PROCESS '.A10' FILE
;*LDACHR - ASCII CHARACTER PROCESS
LDACHR: CAIE BPNT,5 ;USED ALL OF THIS 36 BIT WORD ?
JRST LDACH1 ;NOT YET
SETZ BPNT,
GO RINP ;YES, READ NEXT 36 BIT WORD
JRST LDAEOF ;EOF
MOVEM CHR,CHRSAV
LDACH1: LDB 16,[POINT 7,CHRSAV,6
POINT 7,CHRSAV,13
POINT 7,CHRSAV,20
POINT 7,CHRSAV,27
POINT 7,CHRSAV,34](BPNT) ;GET ASCII BYTE
AOS BPNT ;COUNT IT
LDACH2: JUMPE 16,LDACHR ;IF NULL, IGNORE
AOS (P) ;SKIP RETURN
RTN
LDAEOF: RTN
SUBTTL LDA10 - LOAD PDP-10 ASCIIZED ".A10" FILE
;*LDPROC - FORMAT CONTROL PROCESS
LDA10:
LDPROC: SETZM LDOCTF#
SETZM LDZBLK#
GO LDACHR ;GET FILE TYPE CHAR
GO ERR2 ;EOF
CAIN 16,";"
JRST LDCMNT ;LINE STARTS WITH ;, COMMENT
SETZM LDTBLK#
CAIN 16,"A" ;A, PDP-10 SUPER ".A10" FILE
JRST .+6
CAIN 16,"T" ;T, PDP-10 ".A10" FILE
JRST [SETOM LDTBLK
JRST .+4]
CAIE 16,"Z" ;Z, ".A10" CORE ZERO
GO LERR3
SETOM LDZBLK
GO LDACHR ;GET FORMAT CHAR
GO ERR2 ;EOF
CAIN 16," " ;SPACE, ASCIIZED
JRST .+4
CAIE 16,"O" ;O, OCTAL
GO LERR4
SETOM LDOCTF
MOVE 16,[LDCNT,,LDCNT+1]
SETZM LDCNT
BLT 16,LDATAE ;CLEAR LOAD STORAGE
MOVEI 13,LDCNT ;SETUP CONVERTED STORAGE POINTER
;*LDCNV - CONVERT ASCIIZED BACK INTO BITS
LDCNV: SETZM 14 ;CLEAR CONVERTED WORD FORMER
LDCNV1: GO LDACHR ;LOAD AN ASCII CHAR
GO ERR2 ;EOF
CAIN 16,15 ;CR, IGNORE
JRST LDCNV1
CAIN 16,12 ;LF, END OF LINE
JRST LDEOL
CAIN 16,54 ;COMMA, FIELD SEPARATOR
JRST LDCMA
SKIPE LDOCTF
JRST LDCNV3 ;LOADING OCTAL FORMAT
CAIL 16,"5" ;5 TO : ?
CAILE 16,":"
JRST .+6 ;NO
SUBI 16,"5" ;YES, INSERT SUPPRESSED ONES
LSH 14,6
TRO 14,77
SOJGE 16,.-2
JRST LDCNV1
CAIL 16,"0" ;0 TO 4 ?
CAILE 16,"4"
JRST .+5 ;NO
ANDI 16,7 ;YES, INSERT SUPPRESSED ZEROS
LSH 14,6
SOJGE 16,.-1
JRST LDCNV1
LSH 14,6 ;SHIFT WORD FORMER LEFT 6
ANDI 16,77 ;KEEP ASCIIZED OIT BITS
LDCNV2: OR 14,16 ;INSERT NEW OIT
JRST LDCNV1
LDCNV3: LSH 14,3 ;SHIFT WORD FORMER LEFT 3, OCTAL
ANDI 16,7 ;KEEP OCTAL OIT BITS
JRST LDCNV2
LDCMA: MOVEM 14,(13) ;STORE CONVERTED WORD
AOJA 13,LDCNV ;COUNT AND GO FOR NEXT WORD
;*LDEOL - END OF LINE, CHECKSUM LOAD LINE
LDEOL: MOVEM 14,(13) ;STORE CHECKSUM
SKIPE LDOCTF
JRST LDTEN ;OCTAL, NO CHECKSUM
MOVEI 13,LDCNT ;CHECKSUM LOAD STORAGE
SETZM 14
ADD 14,(13)
CAIE 13,LDATAE
AOJA 13,.-2
TRNE 14,177777 ;16 BIT CHECKSUM = 0 ?
GO LERR5 ;NO, CHECKSUM ERROR
;*LDTEN - CREATE LOAD ADDRESS AND WORD COUNT
LDTEN: LDB 13,[POINT 2,LDCNT,27]
LSH 13,^D16
OR 13,LDADR ;CREATE PDP-10 LOAD ADDRESS
LDB 14,[POINT 8,LDCNT,35] ;WORD COUNT
SKIPN LDZBLK
JRST LDTEN1 ;LOAD TEN DATA WORDS
;*LDTENZ - CLEAR TEN CORE, JOB START TO JOB FIRST FREE
LDTENZ: JRST LDPROC ;NO-OP ON RECONVERSION
;*LDTEN1 - TRANSFER TEN WORDS TO MEMORY
LDTEN1: SKIPN LDTBLK
MOVE 13,LDADR
JUMPE 14,LDDONE ;WC=0, TRANSFER BLOCK
MOVEI 15,LDATA ;SETUP PICKUP POINTER
SOS 13 ;MAKE IOWD ADR
MOVE 0,14
SKIPE LDTBLK
IDIVI 0,3 ;MAKE IOWD WC
MOVN 0,0
HRL 13,0 ;CREATE IOWD
MOVE CHR,13
GO PUT1 ;OUTPUT IOWD
LDTEN2: MOVE 16,(15) ;GET 36 BIT WORD
SKIPN LDTBLK
JRST .+6
MOVE 16,2(15) ;BITS 0 TO 7
LSH 16,^D16
OR 16,1(15) ;BITS 8 TO 23
LSH 16,^D16
OR 16,0(15) ;BITS 24 TO 35
MOVE CHR,16
GO PUT1 ;OUTPUT DATA WORD
AOS 13 ;INCREMENT PDP-10 ADDRESS
ADDI 15,1 ;BUMP PICKUP POINTER
SKIPE LDTBLK
ADDI 15,2
SUBI 14,1 ;DECREMENT WORD COUNT
SKIPE LDTBLK
SUBI 14,2
JUMPG 14,LDTEN2 ;DO TILL ALL WORDS USED
JRST LDPROC ;CONTINUE TILL TRANSFER BLOCK
;*LDDONE - COMPLETED, OUTPUT XFER WORD
LDDONE: HRLI 13,(JRST) ;MAKE XFER WORD
MOVE CHR,13
GO PUT1
JRST C11DON+1 ;DONE
;*LDCMNT - LOAD FILE COMMENT LINE
LDCMNT: GO CMNPNT
JRST LDPROC ;NO-OP ON RECONVERSION
CMNPNT: GO LDACHR
JRST ERR2
CAIE 16,12
JRST CMNPNT
RTN
LDCNT: 0 ;A10 LOAD COUNT
LDADR: 0 ;A10 LOAD ADDRESS
LDATA: BLOCK ^D34 ;A10 DATA STORAGE
LDATAE: 0
0
LERR3: MOVEI [ASCIZ/
FILE TYPE ERROR/]
JRST ERRX
LERR4: MOVEI [ASCIZ/
FORMAT ERROR/]
JRST ERRX
LERR5: MOVEI [ASCIZ/
CHECKSUM ERROR/]
JRST ERRX