Trailing-Edge
-
PDP-10 Archives
-
BB-L288A-RM
-
swskit-utilities/typvf7.mac
There are 5 other files named typvf7.mac in the archive. Click here to see a list.
;<ZIMA.SWSKIT>TYPVF7.MAC.3, 17-Feb-80 15:11:47, EDIT BY ZIMA
;Trivial cleanups
TITLE TYPVF7 - TYPE A VFU FILE
SEARCH MACSYM,MONSYM
.REQUIRE SYS:MACREL
.DIRECT FLBLST
SALL
;ACCUMULATORS:
T1=1
T2=2
T3=3
T4=4
P1=10
P2=11
P3=12
P=17
TYPVF7: RESET
MOVE P,[IOWD PDLLEN,PDL] ;SET UP PDL
SETZM GETFLG ;CLEAR BYTE FLAG
TMSG <VFU FILE: >
MOVE T1,[GJ%OLD+GJ%IFG+GJ%FNS+GJ%SHT]
MOVE T2,[.PRIIN,,.PRIOU]
GTJFN ;GET JFN FOR FIRST VFU FILE
JRST [JSERR
JRST TYPVF7] ;IF ERROR, RESTART
MOVEM T1,INJFN ;SAVE INPUT JFN
TMSG <OUTPUT TO FILE: >
MOVE T1,[GJ%FOU+GJ%FNS+GJ%SHT]
MOVE T2,[.PRIIN,,.PRIOU]
GTJFN ;GET OUTPUT JFN
JRST [JSERR
JRST TYPVF7]
MOVEM T1,OUTJFN ;SAVE OUTPUT JFN
MOVE T2,[FLD(7,OF%BSZ)+OF%WR]
OPENF ;OPEN OUTPUT FILE
JRST [JSERR
JRST TYPVF7]
;...
;BEGIN PROCESSING A VFU FILE
MLOOP: HRRZ T1,INJFN ;OPEN INPUT FILE
MOVE T2,[FLD(^D8,OF%BSZ)+OF%RD] ;READ 8-BIT BYTES
OPENF
JRST [JSERR
JRST TYPVF7]
MOVE T1,OUTJFN ;NOW LEAVE OUTJFN IN T1
HRROI T2,[ASCIZ/
VFU FILE: /]
SETZ T3,
SOUT ;WRITE ASCIZ HEADER
HRRZ T2,INJFN
JFNS ;WRITE FILE NAME
HRROI T2,[ASCIZ/
/]
SETZ T3,
SOUT ;FORMAT THE HEADER
;...
;TYPE LINES PER INCH
CALL GETBYT ;GET THE FIRST BYTE
MOVE T1,OUTJFN ;RESTORE OUT-JFN
CK6: CAIE T2,354 ;IS IT 6 LPI
JRST CK8 ;NO
MOVEI T2,"6" ;YES, TYPE 6
BOUT
JRST ENDLPI
CK8: CAIE T2,355 ;IS IT 8 LPI
JRST CK0
MOVEI T2,"8" ;YES, TYPE 8
BOUT
JRST ENDLPI
CK0: CAIE T2,356 ;IS IT SWITCH DEFINED
JRST NOTLPI ;NO
HRROI T2,[ASCIZ /SWITCH DEFINES/]
SETZ T3,
SOUT
JRST ENDLPI
NOTLPI: HRROI T2,[ASCIZ /%UNKNOWN FORMAT!!
/]
SOUT
JRST DONE ;GIVE UP WITH THIS FILE
ENDLPI: HRROI T2,[ASCIZ/ LINES PER INCH
LINE CHANNELS
NO 1 2 3 4 5 6 7 8 9 10 11 12
/]
SETZ T3, ;ASCIZ STRING
SOUT ;COMPLETE HEADER
;...
;TYPE A CHANNEL TAPE
MOVEI P1,1 ;P1: LINE NO.
LINENO: CALL GETBYT ;MAKE SURE WE HAVE MORE LINES
CAIN T2,357 ;ARE WE DONE
JRST DONE ;YES
MOVE P3,T2 ;P3: 8-BIT BYTE
MOVE T2,P1 ;GET LINE NO.
MOVE T3,[NO%LFL+<FLD(3,NO%COL)>+^D10]
NOUT ;TYPE LINE NO.
JSERR
HRROI T2,[ASCIZ / /]
SETZ T3,
SOUT ;TYPE SPACES TO FORMAT
MOVEI P2,1 ;P2: CHANNEL NO.
CH1.6: ROT P3,-1 ;ROTATE RIGHT 1 BIT
JUMPGE P3,SP1.6 ;IF BIT OFF, TYPE SPACES
MOVE T2,P2 ;IF ON, TYPE CHANNEL NO.
MOVE T3,[NO%LFL+<FLD(3,NO%COL)>+^D10]
NOUT
JSERR
JRST EN1.6
SP1.6: HRROI T2,[ASCIZ / /] ;TYPE 3 SPACES
SETZ T3,
SOUT
EN1.6: AOS P2 ;INCREMENT THE CHANNEL NO.
CAIGE P2,7 ;END OF FIRST BYTE?
JRST CH1.6 ;NO
CALL GETBYT ;GET SECOND BYTE IN LINE
CAIN T2,357 ;CHECK FOR END (SHOULD FAIL)
JRST DONE
MOVE P3,T2 ;SAVE BYTE
CH7.12: ROT P3,-1 ;ROTATE LEFT 1 BIT
JUMPGE P3,SP7.12 ;JUMP IF NOT SET
MOVE T2,P2 ;TYPE CHANNEL NO.
MOVE T3,[NO%LFL+<FLD(3,NO%COL)>+^D10]
NOUT
JSERR
JRST EN7.12
SP7.12: HRROI T2,[ASCIZ / /] ;TYPE 3 SPACES
SETZ T3,
SOUT
EN7.12: AOS P2 ;INCREMENT CHANNEL NO.
CAIGE P2,^D13 ;DONE WITH BYTE?
JRST CH7.12 ;NO
HRROI T2,[ASCIZ/
/] ;COMPLETE THE LINE
SETZ T3,
SOUT
AOJA P1,LINENO ;GO BACK FOR NEXT LINE NO.
;GETBYT - GET NEXT BYTE FROM VFU FILE
GETBYT: SKIPE GETFLG ;SKIP IF WE HAVE NO BYTE IN BUFFER
JRST GOTBYT
HRRZ T1,INJFN
BIN ;GET A BYTE
MOVEM T2,BYTE2 ;BYTES SWAPPED, SO SAVE THIS ONE
BIN ;GET NEXT BYTE
SETOM GETFLG ;AND SET FLAG
MOVE T1,OUTJFN ;RESTORE OUT-JFN
RET ;RETURN
GOTBYT: MOVE T2,BYTE2 ;GET SAVED BYTE
SETZM GETFLG ;CLEAR FLAG
MOVE T1,OUTJFN ;RESTORE OUT-JFN
RET ;RETURN
DONE: HRLI T1,(CO%NRJ) ;KEEP THE JFN
HRR T1,INJFN
CLOSF ;CLOSE THE VFU FILE
JSERR
MOVE T1,INJFN
GNJFN ;GET NEXT VFU FILE JFN
JRST ALLDON ;JUMP IF NO MORE
MOVE T1,OUTJFN
MOVEI T2,14
BOUT ;MORE, SO TYPE <FF>
JRST MLOOP ;AND LOOP
ALLDON: MOVE T1,OUTJFN
CLOSF ;CLOSE OUTPUT FILE
JSERR
HALTF ;STOP
JRST TYPVF7 ;RESTART IF CONTINUED
;IMPURE STORAGE
PDL: BLOCK <PDLLEN==100> ;STACK
INJFN: BLOCK 1 ;INPUT JFN
OUTJFN: BLOCK 1 ;OUTPUT JFN
GETFLG: BLOCK 1 ; =0, NO BYTE IN BUFFER
; =-1, BYTE IN BUFFER
BYTE2: BLOCK 1 ;BUFFER FOR SWAPPED BYTE
END TYPVF7