home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1995 October
/
Simtel-MSDOS-Oct1995-CD2.iso
/
starter
/
bin2as.mac
< prev
next >
Wrap
Text File
|
1983-08-12
|
2KB
|
105 lines
TITLE BIN2AS - Convert 8-bit byte file to HEX ASCII file
SEARCH MONSYM
;
; BIN2AS PROGRAM
; DICK GILLMANN, JUNE 1982
;
P=17
; MAIN PROGRAM
START: RESET
MOVE P,[IOWD PDLEN,PDLIST]
; OPEN INPUT FILE (8 BIT)
OOPS1: HRROI 1,[ASCIZ/Input file: /]
PSOUT
MOVSI 1,(GJ%OLD!GJ%SHT!GJ%FNS!GJ%CFM)
MOVE 2,[.PRIIN,,.PRIOU]
GTJFN
ERJMP OOPS1
MOVEM 1,IJFN
HRRZ 1,1
MOVE 2,[100000,,OF%RD]
OPENF
ERJMP OOPS1
; OPEN OUTPUT FILE (7 BIT BYTES)
OOPS2: HRROI 1,[ASCIZ/Output file: /]
PSOUT
MOVSI 1,(GJ%FOU!GJ%FNS!GJ%SHT!GJ%CFM)
MOVE 2,[.PRIIN,,.PRIOU]
GTJFN
ERJMP OOPS2
MOVEM 1,OJFN
HRRZ 1,1
MOVE 2,[070000,,OF%WR]
OPENF
ERJMP OOPS2
XOR 5,5
XOR 6,6
; MAIN LOOP
PRE: MOVEI 4,^D20
LOOP: HRRZ 1,IJFN
BIN
ERJMP EOF
AOS 5
ADD 6,2
IDIVI 2,^D16
ORI 2,"0"
CAILE 2,"9"
ADDI 2,"A"-"9"-1
HRRZ 1,OJFN
BOUT
MOVE 2,3
ORI 2,"0"
CAILE 2,"9"
ADDI 2,"A"-"9"-1
BOUT
SOJE 4,EOL
MOVEI 2," "
BOUT
JRST LOOP
EOL: MOVEI 2,15
BOUT
MOVEI 2,12
BOUT
JRST PRE
EOF: HRRZ 1,OJFN
MOVEI 2,15
BOUT
MOVEI 2,12
BOUT
HRRZ 1,IJFN
CLOSF
NOP
HRRZ 1,OJFN
CLOSF
NOP
HRROI 1,[ASCIZ/End of File Reached.
/]
PSOUT
HRROI 1,[ASCIZ/Character count = /]
PSOUT
MOVEI 1,.PRIOU
MOVE 2,5
MOVEI 3,^D10
NOUT
NOP
HRROI 1,CRLF
PSOUT
HRROI 1,[ASCIZ/16-bit checksum = /]
PSOUT
MOVEI 1,.PRIOU
MOVE 2,6
ANDI 2,177777
NOUT
HRROI 1,CRLF
PSOUT
HALTF
JRST START
; DATA
PDLEN==100
PDLIST: BLOCK PDLEN
IJFN: 0
OJFN: 0
CRLF: ASCIZ /
/
END START