VMAJOR=1. ; define a version number
VMINOR=0.
VEDIT=100.
PHDR -1,0,PH$REE!PH$REU ; define a program header
.OFINI ; define 2 variables....
.OFDEF IDDB,D.DDB ; An Input DDB for input file
.OFDEF ODDB,D.DDB ; An Output DDB for output file
.OFSIZ IMPSIZ ; IMPSIZ is 2 X 150 (octal)
GETIMP IMPSIZ,A3 ; A3 points to variables
LEA A5,IDDB(A3) ; A5 points to input file
LEA A4,ODDB(A3) ; A4 point to output file
PRTTAB -1,0 ; clear screen
PRTTAB 6,34 ; tab to here
TYPE <ENCODE utility routine>
PRTTAB 10,24 ; tab to here
TYPE <(makes sequential files unreadable)>
PRTTAB 12,20 ; tab to here
TYPE <Enter in the file to ENCODE: >
KBD ; get input file
FSPEC @A5 ; fill DDB with input filespec
MOV D.FIL(A5),D.FIL(A4) ; create same filename
MOVW #[ENC],D.EXT(A4) ; create ENC extention
INIT @A5 ; initialize both files
INIT @A4
LOOKUP @A5 ; if input file not found
JNE BOOBOO ; error
LOOKUP @A4 ; if output file found
JEQ BOOBOO ; error
OPENI @A5 ; open them
OPENO @A4
PRTTAB 15,1 ; tab to here
TYPE <Working..> ; gizmo effects!
BYB: FILINB @A5 ; get a byte
TST IDDB+D.SIZ(A3) ; eof?
BEQ EOF ; yup
CMPB D1,#15 ; at a CR?
BNE 10$ ; nope
TYPE <.> ; yes, gizmo effects
10$: COMB D1 ; flip the bits
FILOTB @A4 ; write out the flipped character
BR BYB ; goto top
BOOBOO: PRTTAB 15,23 ; error routine
TYPE <File spec error or file already exists>
MOV #7,D1 ; get a bell
TTY ; beep!
BR EXIT ; back to dot
EOF: CLOSE @A5 ; eof, close both files
CLOSE @A4
EXIT: TYPECR <!> ; gizmo!
EXIT ; back to dot
END ; end of source file