Trailing-Edge
-
PDP-10 Archives
-
mit_emacs_170_teco_1220
-
emacs/shrink.mac
There are no other files named shrink.mac in the archive.
; Program to extract Tecoable portion of an EXE file
SEARCH MONSYM,MACSYM
.REQUIRE SYS:MACREL
T1=1
T2=2
T3=3
T4=4
T5=5
T6=6
START: RESET ; I/O reset
MOVE 17,[IOWD 50,PDL] ; Init stack
INFIL: HRROI T1,[ASCIZ/Input file: /] ; Prompt for Input
PSOUT ; Type it
MOVSI T1,(GJ%OLD+GJ%FNS+GJ%SHT) ; Ask for
MOVE T2,[.PRIIN,,.PRIOU] ; an Input
GTJFN ; file
JRST [PUSHJ 17,WARN ; Errors non-fatal
JRST INFIL]
HRRM T1,IJFN ; Save JFN
OTFIL: HRROI T1,[ASCIZ/
Output file: /] ; Output file
PSOUT
MOVSI T1,(GJ%FOU+GJ%MSG+GJ%CFM+GJ%SHT+GJ%FNS)
MOVE T2,[.PRIIN,,.PRIOU] ; Do the
GTJFN ; Right stuff to get a JFN
JRST [PUSHJ 17,WARN
JRST OTFIL]
HRRM T1,OJFN ; Save JFN
HRRZ T1,IJFN ; Now we read the input file
MOVE T2,[44B5+OF%RD+OF%PLN]
OPENF ; Open it
JRST FATAL ; Fatal error if open doesn't work
HRRZ T1,OJFN ; Otherwise
MOVE T2,[44B5+OF%WR+OF%PLN] ; Open the other
OPENF ; One
JRST FATAL
MOVE T4,STNM ; Get starting name
SETZ T5, ; Set flag
LOOP: MOVE T1,IJFN ; Read a word
BIN ; From the input file
MOVEM T2,T3 ; Save it away
GTSTS ; Check
TLNE T2,(GS%EOF) ; For EOF
JRST EOF ; Processing done
JUMPE T5,NOWRIT ; See if we need to write
CAMN T4,T3 ; Yes, See if we are done
JRST EOF ; Yes
MOVE T1,OJFN ; No, Write
MOVE T2,T3 ; out the word
BOUT ; as given
JRST LOOP ; process next character
NOWRIT: CAME T4,T3 ; Not writing yet, see if we are ready
JRST LOOP ; No, process next character
SETO T5, ; Yes, set flag
MOVE T4,STOPNM ; Get new name to compare
JRST LOOP ; Process next
EOF: MOVE T1,IJFN ; All done
CLOSF ; close input file
JRST FATAL
MOVE T1,OJFN ; and
CLOSF ; output file
JRST FATAL
ZAP: HALTF ; stop the world
HALT
FATAL: HRROI T1,[ASCIZ / ; Fatal errors begin with ?
?/]
PUSHJ 17,ERROR
JRST ZAP
WARN: HRROI T1,[ASCIZ / ; Warnings with %
%/]
ERROR: PSOUT ; Write prefix (% or ?)
MOVE T1,[.PRIOU]
MOVE T2,[.FHSLF,,-1]
SETZ T3,
ERSTR ; Write the error message
JFCL ; ignore errors in error
JFCL ; again
POPJ 17, ; Return
OJFN: BLOCK 1 ;
IJFN: BLOCK 1
STNM: ASCII /Start/
STOPNM: ASCII /Stop/
PDL: BLOCK 50
END START