home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
pcmagazi
/
1991
/
14
/
deb2scr.scr
< prev
next >
Wrap
Text File
|
1991-02-04
|
3KB
|
78 lines
N DEB2SCR.COM
A
MOV DX,0187 ; address of buffer
MOV CX,F000 ; size of buffer
XOR BX,BX
MOV AH,3F ; read text into buffer
INT 21
OR AX,AX ; number of bytes read = 0 ?
JNZ 0112 ; no --> PROCEED
;<0110> FINISH:
INT 20 ; end
;<0112> PROCEED:
MOV CX,AX
ADD CX,DX ; CX = end of data in buffer
MOV SI,DX ; SI = address of byte read from buffer
;<0118> NEWLINE:
CMP SI,CX ; end of data reached ?
JNB 0110 ; yes --> FINISH
MOV AL,[SI] ; read character from buffer
CMP AL,2D ; is it a '-' ?
JNZ 0125 ; no --> CONTINUE1
INC SI ; skip the '-'
JMP 016E ; --> OUTPUTLINE
;<0125> CONTINUE1:
CMP AL,3A ; is it a ':' ?
JNZ 012C ; no --> CONTINUE2
INC SI ; skip the ':'
JMP 016E ; --> OUTPUTLINE
;<012C> CONTINUE2:
CMP AL,43 ; is it a 'C' ?
JNZ 0135 ; no --> CONTINUE3
ADD SI,09 ; skip 'CX XXXX',CR,LF
JMP 0118 ; --> NEWLINE
;<0135> CONTINUE3:
CMP AL,57 ; is it a 'W' ?
JNZ 013E ; no --> CONTINUE4
ADD SI,14 ; skip 'Writing XXXX bytes',CR,LF
JMP 0118 ; --> NEWLINE
;<013E> CONTINUE4:
CMP BYTE PTR [SI+04],3A ; line begins with address ? (XXXX:YYYY)
JNZ 016B ; no --> CONTINUE5
CMP BYTE PTR [SI+0A],3B ; does a comment follow ? (XXXX:YYYY ;)
JNZ 016B ; no --> CONTINUE5
CMP BYTE PTR [SI+0B],3C ; does comment contain address ? (XXXX:YYYY ;<)
JZ 015F ; yes --> CHANGEADDRESS
MOV WORD PTR [SI+03],3C3B; write ';<' before 'YYYY'
MOV WORD PTR [SI+09],203E; write '> ' after 'YYYY'
ADD SI,03 ; skip 'XXX'
JMP 016E ; --> OUTPUTLINE
;<015F> CHANGEADDRESS:
MOV AX,[SI+05] ; replace address in comment
MOV [SI+0C],AX
MOV AX,[SI+07]
MOV [SI+0E],AX
;<016B> CONTINUE5:
ADD SI,0A ; skip 'XXXX:YYYY '
;<016E> OUTPUTLINE:
CLD
LODSB ; read character and increment SI
MOV DL,AL
CMP DL,0D ; is it a CR ?
JNZ 017C ; no --> CONTINUE6
CMP [SI],DL ; a second CR follows ?
JNZ 017C ; no --> CONTINUE6
INC SI ; skip it
;<017C> CONTINUE6:
MOV AH,02 ; output character
INT 21
CMP DL,0A ; was it a LF ?
JNZ 016E ; no --> OUTPUTLINE
JMP 0118 ; yes --> NEWLINE
;<0187> BUFFER:
RCX
87
W
Q