home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
sigm
/
sigmv010.ark
/
REZ.Z80
< prev
next >
Wrap
Text File
|
1984-04-29
|
36KB
|
2,830 lines
TITLE 'Z-80 Disassembler for 8080A'
ORG 0100H
BDOS: EQU 05H
CTLTBL: EQU 1C00H
FCB: EQU 5CH
STACK: EQU 1BFDH
SYMTBL: EQU 2200H
TBUF: EQU 80H
;
START: CALL ENTRY
DEFB 'RESOURCE by Ward Christensen'
DEFB 0DH,0AH,'(AS OF 07/31/80)'
DEFB 0DH,0AH,'Z-80 Version 2'
DEFB 0DH,0AH,'$Copyright 1980'
ENTRY: POP DE
LD C,9
CALL BDOS
LD HL,0
ADD HL,SP
LD (STACK),HL
LD SP,STACK
CALL PRTSTR
DEFB 0DH,0AH,'Memory open to '
DEFB 0
LD HL,(6)
DEC HL
CALL PRWORD
CALL CRLF
CALL CRLF
L0174: CALL INITBL
NXCMD: XOR A
LD (WFIFLG),A
LD (QUIFLG),A
LD SP,STACK
CALL GTCMD
L0184: LD HL,CMDBUF+2
LD A,(HL)
CP 0DH
JP Z,NXCMD
CP ';'
JP Z,CMCMNT
CP 'A'
JP Z,CMATMT
CP 'B'
JP Z,CMBLD
CP 'C'
JP Z,CMCTL
CP 'D'
JP Z,CMDUMP
CP 'E'
JP Z,CMENTR
CP 'F'
JP Z,CMFIND
CP 'K'
JP Z,CMKILL
CP 'L'
JP Z,CMLIST
CP 'O'
JP Z,CMOFST
CP 'P'
JP Z,CMPRLG
CP 'Q'
JP Z,CMQIET
CP 'R'
JP Z,CMREAD
CP 'S'
JP Z,CMSAVE
CP 'T'
JP Z,CMTRIM
CP 'U'
JP Z,CMUSEC
CP 'X'
JP Z,CMPURG
CP 'Z'
JP Z,CMEOF
CP '?'
JP Z,CMSTTS
CMERR: XOR A
LD (WFIFLG),A
LD (QUIFLG),A
CALL PRTSTR
DEFB '?',0DH,0AH,0
JP NXCMD
;
CMTRIM: LD A,(TRMFLG)
CPL
LD (TRMFLG),A
OR A
JP Z,TRMOF
CALL PRTSTR
DEFB 'Trim On',0DH,0AH,0
JP NXCMD
;
TRMOF: CALL PRTSTR
DEFB 'Trim Off',0DH,0AH,0
JP NXCMD
;
CMPURG: CALL PRTSTR
DEFB 'Y/N purge all symbols & '
DEFB 'CTL?',0
CALL GTCMD
LD A,(CMDBUF+2)
CP 'Y'
JP Z,L0174
CP 'N'
JP Z,NXCMD
JP CMPURG
;
CMPRLG: LD HL,CMDBUF+3
LD A,(HL)
CP 0DH
JP Z,CMERR
CALL GTVAL
CP ' '
JP Z,L0241
CP ','
JP NZ,CMERR
L0241: INC HL
PUSH DE
PUSH HL
LD A,1
LD (WFIFLG),A
CALL L1A7E
DEFB 9,'.LOC',9,0
POP HL
POP DE
LD A,D
CALL XO0
LD A,E
CALL XO
LD A,'H'
CALL TYPE
CALL CRLF
PUSH DE
CALL GTVAL
CP 0DH
JP NZ,CMERR
POP BC
LD HL,SYMTBL
L0272: INC HL
INC HL
LD A,(HL)
OR A
JP Z,NXCMD
DEC HL
DEC HL
LD A,(HL)
SUB C
INC HL
LD A,(HL)
SBC B
JP C,L028C
DEC HL
LD A,(HL)
SUB E
INC HL
LD A,(HL)
SBC D
JP C,L02D9
L028C: PUSH HL
PUSH BC
INC HL
LD B,(HL)
PUSH HL
INC HL
LD A,(HL)
DEC HL
CP 'A'
JP C,L02E5
L0299: INC HL
LD A,(HL)
CP '+'
JP Z,L02E5
CP '-'
JP Z,L02E5
DEC B
JP NZ,L0299
POP HL
LD B,(HL)
LD A,1
LD (WFIFLG),A
L02B0: INC HL
LD A,(HL)
CALL TYPE
DEC B
JP NZ,L02B0
CALL L1A7E
DEFB 9,'=',9,0
POP BC
POP HL
LD A,(HL)
OR A
CALL NZ,XO0
DEC HL
LD A,(HL)
CALL XO
LD A,'H'
CALL TYPE
CALL CRLF
XOR A
LD (WFIFLG),A
INC HL
L02D9: INC HL
LD A,(HL)
CALL ADDF
INC HL
CALL L1ABF
JP L0272
;
L02E5: POP HL
POP BC
POP HL
JP L02D9
;
CMQIET: LD A,1
LD (QUIFLG),A
LD DE,CMDBUF+2
LD HL,CMDBUF+3
L02F6: LD A,(HL)
LD (DE),A
INC HL
INC DE
CP 0DH
JP NZ,L02F6
JP L0184
;
DEFB 'Congratulations, you found '
DEFB 'the patch area!'
CMDUMP: LD HL,(L1B1B)
PUSH HL
EX DE,HL
LD HL,(DMPCNT)
ADD HL,DE
LD (L1B1D),HL
POP DE
LD HL,CMDBUF+3
LD A,(HL)
CP 0DH
JP Z,L038B
CP 'S'
JP Z,DUSYMT
CP '='
JP Z,SDUCNT
CP ','
JP Z,L035D
L0351: CALL GTVAL
PUSH HL
LD HL,(DMPCNT)
ADD HL,DE
LD (L1B1D),HL
POP HL
L035D: CP 0DH
JP Z,L0376
CP ' '
JP Z,L036C
CP ','
JP NZ,CMERR
L036C: INC HL
PUSH DE
CALL GTVAL
EX DE,HL
LD (L1B1D),HL
POP DE
L0376: LD HL,(OFFSET)
PUSH HL
ADD HL,DE
LD (L1B1B),HL
LD HL,(L1B1D)
POP DE
ADD HL,DE
LD (L1B1D),HL
CP 0DH
JP NZ,CMERR
L038B: LD HL,(L1B1B)
L038E: CALL L1ABF
PUSH HL
CALL L087C
CALL PRWORD
POP HL
PUSH HL
CALL PRSPC
L039D: LD A,(HL)
CALL XO
INC HL
LD A,L
AND 3
CALL Z,PRSPC
LD A,L
AND 7
CALL Z,PRSPC
LD A,L
AND 0FH
JP NZ,L039D
CALL PSTAR
POP HL
L03B8: LD A,(HL)
CP ' '
JP C,L03C3
CP 7FH
JP C,L03C5
L03C3: LD A,'.'
L03C5: CALL TYPE
INC HL
LD A,L
AND 0FH
JP Z,L03D7
AND 7
CALL Z,PRSPC
JP L03B8
;
L03D7: CALL PSTAR
CALL CRLF
LD (L1B1B),HL
LD A,(L1B1D)
SUB L
LD A,(L1B1D+1)
SBC H
JP NC,L038E
JP NXCMD
;
SDUCNT: INC HL
CALL GTVAL
INC HL
DEC DE
EX DE,HL
LD (DMPCNT),HL
EX DE,HL
CP ','
JP Z,L0351
CP ' '
JP Z,L0351
CP 0DH
JP Z,NXCMD
JP CMERR
;
DUSYMT: LD HL,CMDBUF+4
LD A,(HL)
CP '.'
JP NZ,L0423
CALL L1872
CALL L1798
JP NC,L0426
LD HL,(L1B4B)
JP L0426
;
L0423: LD HL,SYMTBL
L0426: LD E,(HL)
INC HL
LD D,(HL)
INC HL
LD A,(HL)
OR A
JP Z,NXCMD
EX DE,HL
CALL PRWORD
EX DE,HL
LD B,(HL)
INC HL
L0436: LD A,(HL)
CALL TYPE
INC HL
DEC B
JP NZ,L0436
CALL CRLF
CALL L1ABF
JP L0426
;
L0448: LD HL,(OFFSET)
CALL PRWORD
CALL CRLF
JP NXCMD
;
CMOFST: LD HL,CMDBUF+3
LD A,(HL)
CP 0DH
JP Z,L0448
CALL GTVAL
CP 0DH
JP NZ,CMERR
EX DE,HL
LD (OFFSET),HL
JP NXCMD
;
GFNAM: LD A,(WRTFLG)
OR A
JP NZ,RRQERR
LD (FCB),A
LD (FCB+12),A
LD HL,CMDBUF+3
LD A,(CMDBUF+4)
CP ' '
JP Z,CMERR
CP ':'
JP NZ,L0493
LD A,(CMDBUF+3)
SUB '@'
LD (FCB),A
INC HL
INC HL
L0493: LD DE,FCB+1
LD B,8
CALL L04A1
LD B,3
CALL L04A1
RET
;
L04A1: LD A,(HL)
CP 0DH
JP Z,L04BE
INC HL
CP '.'
JP Z,L04BE
LD (DE),A
INC DE
DEC B
JP NZ,L04A1
L04B3: LD A,(HL)
CP 0DH
RET Z
CP '.'
INC HL
RET Z
JP L04B3
;
L04BE: LD A,' '
LD (DE),A
INC DE
DEC B
JP NZ,L04BE
RET
;
CMATMT: LD A,1
LD (L1B4F),A
XOR A
LD (SYBFLG),A
JP L04E2
;
CMBLD: LD A,1
LD (SYBFLG),A
JP L04E2
;
CMLIST: XOR A
LD (SYBFLG),A
LD (L1B4F),A
L04E2: XOR A
LD (WFIFLG),A
LD A,(LISCNT)
LD (LISCNT+1),A
LD (L1B35),A
LD HL,CMDBUF+3
LD A,(HL)
CP 0DH
JP Z,L052A
CP ','
JP Z,L051E
CP ' '
JP Z,L051E
CP '='
JP Z,SLICNT
L0507: CALL GTVAL
EX DE,HL
LD (PCNTR),HL
EX DE,HL
CP 0DH
JP Z,L052A
CP ' '
JP Z,L051E
CP ','
JP NZ,CMERR
L051E: INC HL
CALL GTVAL
EX DE,HL
LD (L1B25),HL
XOR A
LD (L1B35),A
L052A: CALL L1ABF
LD A,(L1B35)
OR A
JP Z,L053E
LD A,(LISCNT+1)
DEC A
JP M,NXCMD
JP L054C
;
L053E: LD HL,(L1B25)
LD A,(PCNTR)
SUB L
LD A,(PCNTR+1)
SBC H
JP NC,NXCMD
L054C: LD A,(L1B4F)
OR A
JP Z,L0586
LD HL,(PCNTR)
EX DE,HL
LD HL,(OFFSET)
ADD HL,DE
LD B,8
L055D: LD A,(HL)
CALL L1AFE
JP C,L0586
INC HL
DEC B
JP NZ,L055D
L0569: LD A,(HL)
CALL L1AFE
INC HL
JP NC,L0569
DEC HL
CALL L087C
EX DE,HL
PUSH DE
LD HL,(PCNTR)
EX DE,HL
LD A,'B'
CALL L0B9E
POP DE
LD A,'I'
CALL L0B9E
L0586: LD HL,(DOCTBL)
LD A,H
OR L
JP Z,L05C0
LD HL,(PCNTR)
EX DE,HL
CALL L0D87
JP C,L05C0
INC HL
INC HL
LD B,(HL)
L059B: LD A,1
LD (WFIFLG),A
CALL SEMIC
XOR A
OR B
JP Z,L05BD
L05A8: INC HL
LD A,(HL)
CP 5CH
JP NZ,L05B6
CALL CRLF
DEC B
JP L059B
;
L05B6: CALL TYPE
DEC B
JP NZ,L05A8
L05BD: CALL CRLF
L05C0: LD HL,(PCNTR)
EX DE,HL
CALL L0C51
DEC HL
JP C,L05CE
INC HL
INC HL
INC HL
L05CE: LD A,(HL)
CP 'I'
JP Z,L061E
CP 'E'
JP Z,CMEOF
PUSH AF
INC HL
LD E,(HL)
INC HL
LD D,(HL)
PUSH DE
LD HL,(PCNTR)
EX DE,HL
CALL L0EB4
POP HL
LD (L1B48),HL
EX DE,HL
XOR A
LD (WFIFLG),A
POP AF
CP 'S'
JP Z,L0648
CP 'B'
JP Z,L06A9
CP 'W'
JP Z,L067B
CALL TYPE
CALL PRTSTR
DEFB ': INVALID CTL ENTRY'
DEFB 0DH,0AH,0
JP NXCMD
;
L061E: CALL DLINE
XOR A
LD (WFIFLG),A
JP L052A
;
SLICNT: INC HL
CALL GTVAL
LD A,E
OR A
JP Z,CMERR
LD (LISCNT),A
LD A,(HL)
INC HL
CP ','
JP Z,L0507
CP ' '
JP Z,L0507
CP 0DH
JP Z,NXCMD
JP CMERR
;
L0648: PUSH DE
LD A,(PCNTR)
CPL
LD L,A
LD A,(PCNTR+1)
CPL
LD H,A
INC HL
ADD HL,DE
LD A,1
LD (WFIFLG),A
CALL L1A7E
DEFB '.BLKB',9,0
LD A,H
CALL XO0
LD A,L
CALL XO
LD A,'H'
CALL TYPE
CALL CRLF
POP HL
LD (PCNTR),HL
JP L052A
;
L067B: LD A,1
LD (WFIFLG),A
CALL L1A7E
DEFB '.WORD',9,0
LD HL,(PCNTR)
EX DE,HL
LD HL,(OFFSET)
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
CALL L106E
LD HL,(PCNTR)
INC HL
INC HL
LD (PCNTR),HL
JP L052A
;
L06A3: CALL CRLF
JP L052A
;
L06A9: LD A,1
LD (WFIFLG),A
L06BB: LD HL,(PCNTR)
EX DE,HL
LD HL,(OFFSET)
ADD HL,DE
LD A,(HL)
CP ' '
JP C,NPRTC ;NOT PRINTABLE
CP 7FH
JP C,L0722 ;VISIBLE ASCII
NPRTC: CALL L1A7E
DEFB '.BYTE',9,0
XOR A
LD (L1B4A),A
MORINV: LD A,(HL) ;RESTORE BYTE
CP 0AH
JP C,L06E6
L06D3: CALL XO0
LD A,'H'
CALL TYPE
LD A,(L1B4A)
ADD 2
LD (L1B4A),A
JP L06EB
;
L06E6: OR '0'
CALL TYPE
L06EB: INC HL
EX DE,HL
LD HL,(PCNTR)
INC HL
LD (PCNTR),HL
EX DE,HL
L06F5: LD A,(L1B48)
CP E
JP NZ,L0703
LD A,(L1B49)
CP D
JP Z,L078D
L0703: LD HL,(PCNTR)
EX DE,HL
CALL L17EA
JP NC,L06A3
LD A,(L1B4A)
ADD 2
LD (L1B4A),A
CP 19H
JP NC,L06A3
LD HL,(PCNTR)
EX DE,HL
LD HL,(OFFSET)
ADD HL,DE
LD A,(HL)
CP ' '
JP C,NXINV
CP 7FH
JP C,L06A3
NXINV: LD A,','
CALL TYPE
JP MORINV
;
L0722: CALL L1A7E
DEFB '.ASCII',9,0
XOR A
LD (L1B4A),A
LD A,27H
CALL TYPE
LD A,(L1B4A)
INC A
LD (L1B4A),A
LD A,(HL)
L072F: CALL TYPE
LD A,(HL)
CP 27H
CALL Z,TYPE
INC HL
EX DE,HL
LD HL,(PCNTR)
INC HL
LD (PCNTR),HL
EX DE,HL
LD A,(L1B48)
CP E
JP NZ,L0750
LD A,(L1B49)
CP D
JP Z,L0788
L0750: PUSH HL
LD HL,(PCNTR)
EX DE,HL
CALL L17EA
POP HL
JP NC,L0788
LD A,(L1B4A)
INC A
LD (L1B4A),A
CP '#'
JP NC,L0780
CP 19H
JP C,L0775
DEC HL
LD A,(HL)
INC HL
CP ' '
JP Z,L0788
L0775: LD A,(HL)
CP ' '
JP C,L0780
CP 7FH
JP C,L072F
L0780: LD A,27H
CALL TYPE
JP L06A3
;
L0788: LD A,27H
CALL TYPE
L078D: CALL CRLF
JP L052A
;
CMSTTS: CALL PRTSTR
DEFB 'SYMTBL=',0
LD HL,SYMTBL
CALL PRWORD
LD HL,(SYMTP)
CALL PRWORD
CALL CRLF
CALL PRTSTR
DEFB 'PC =',0
LD HL,(PCNTR)
CALL PRWORD
CALL CRLF
CALL PRTSTR
DEFB 'OFFSET=',0
LD HL,(OFFSET)
CALL PRWORD
CALL CRLF
LD HL,(DOCTBL)
LD A,H
OR L
JP Z,NODOCT
CALL PRTSTR
DEFB 'COMNTS=',0
LD HL,(DOCTBL)
CALL PRWORD
LD HL,(DOCEND)
CALL PRWORD
CALL CRLF
NODOCT: CALL PRTSTR
DEFB 'CTLTBL=',0
LD HL,CTLTBL
CALL PRWORD
L0808: LD A,(HL)
INC HL
AND (HL)
INC HL
INC HL
INC A
JP NZ,L0808
DEC HL
DEC HL
DEC HL
CALL PRWORD
CALL CRLF
JP NXCMD
;
CMFIND: LD HL,CMDBUF+3
LD A,(HL)
CP 0DH
JP Z,L0853
CALL GTVAL
EX DE,HL
LD (L1B2F),HL
LD HL,(OFFSET)
LD (L1B2D),HL
EX DE,HL
CP 0DH
JP Z,L0853
CP ' '
JP Z,L0843
CP ','
JP NZ,CMERR
L0843: INC HL
CALL GTVAL
CP 0DH
JP NZ,CMERR
LD HL,(OFFSET)
ADD HL,DE
LD (L1B2D),HL
L0853: LD HL,(L1B2F)
EX DE,HL
L0857: CALL L1ABF
LD HL,(L1B2D)
LD A,(HL)
INC HL
LD (L1B2D),HL
CP E
JP NZ,L0857
LD A,(HL)
CP D
JP NZ,L0857
PUSH HL
PUSH DE
CALL L087C
DEC HL
CALL PRWORD
POP DE
POP HL
CALL PRSPC
JP L0857
;
L087C: LD A,(OFFSET)
CPL
LD E,A
LD A,(OFFSET+1)
CPL
LD D,A
INC DE
ADD HL,DE
RET
;
CMEOF: CALL L0EB4
LD A,1
LD (WFIFLG),A
CALL L1A7E
DEFB '.END',0DH,0AH,0
XOR A
LD (WFIFLG),A
LD A,(WRTFLG)
OR A
JP Z,NXCMD
LD A,1AH
CALL L19E6
CALL L19A7
XOR A
LD (WRTFLG),A
CALL PRTSTR
DEFB '++ASM FILE CLOSED++',0DH
LD A,(BC)
NOP
JP NXCMD
;
CMREAD: CALL GFNAM
LD A,(WRTFLG)
OR A
JP NZ,RRQERR
LD HL,FCB+9
LD DE,SYMLIT
LD C,3
CALL CMPSTR
JP NZ,L08F6
LD HL,SYMTBL
CALL L09C9
LD (SYMTP),HL
INC HL
INC HL
LD (HL),0
JP CMSTTS
;
L08F6: LD HL,FCB+9
LD DE,COMLIT
LD C,3
CALL CMPSTR
JP NZ,L0947
CALL FOPEN
LD HL,(OFFSET)
LD A,H
CP 1EH
JP C,L097A
LD DE,START
ADD HL,DE
L0914: PUSH HL
EX DE,HL
LD C,1AH
CALL BDOS
LD DE,FCB
LD C,14H
CALL BDOS
OR A
JP NZ,L092F
POP HL
LD DE,TBUF
ADD HL,DE
JP L0914
;
L092F: POP HL
CALL PRWORD
CALL L087C
CALL PRWORD
CALL CRLF
LD DE,TBUF
LD C,1AH
CALL BDOS
JP NXCMD
;
L0947: LD HL,FCB+9
LD DE,CTLLIT
LD C,3
CALL CMPSTR
JP NZ,L0958
JP L0CF1
;
L0958: LD HL,FCB+9
LD DE,DOCLIT
LD C,3
CALL CMPSTR
JP NZ,CMERR
CALL L0DFB
LD HL,(DOCTBL)
CALL L09C9
LD (DOCEND),HL
LD (HL),0FFH
INC HL
LD (HL),0FFH
JP CMSTTS
;
L097A: CALL PRTSTR
DEFB '++NO, THAT WOULD OVERLAY '
DEFB 'THE DISASSEMBLER',0DH,0AH
DEFB 'BECAUSE OFFSET IS TOO SMALL: '
DEFB 0
JP L0448
;
L09C9: CALL FOPEN
L09CC: CALL RDFCHR
CP 1AH
RET Z
CP 9
JP Z,L09CC
CP 0DH
JP Z,L09CC
CP 0AH
JP Z,L09CC
CALL L0A05
LD (HL),E
INC HL
LD (HL),D
INC HL
PUSH HL
INC HL
LD B,0
L09EC: CALL RDFCHR
CP 9
JP Z,L09FF
CP 0DH
JP Z,L09FF
LD (HL),A
INC HL
INC B
JP L09EC
;
L09FF: EX (SP),HL
LD (HL),B
POP HL
JP L09CC
;
L0A05: LD DE,0
L0A08: CP ' '
RET Z
CP 1AH
L0A0D: JP Z,L0B62
CP ':'
JP C,L0A17
SUB 7
L0A17: SUB '0'
EX DE,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD L
LD L,A
EX DE,HL
CALL RDFCHR
CP 1AH
JP Z,L0B62
JP L0A08
;
CMSAVE: CALL GFNAM
LD A,(WRTFLG)
OR A
JP NZ,RRQERR
LD HL,FCB+9
LD DE,SYMLIT
LD C,3
CALL CMPSTR
JP NZ,L0A9A
LD HL,SYMTBL
L0A47: CALL L1986
L0A4A: LD E,(HL)
INC HL
LD D,(HL)
INC HL
LD A,(HL)
INC HL
LD B,A
OR A
JP Z,L0A73
CALL L0A7E
LD A,' '
CALL L19E6
L0A5D: LD A,(HL)
CALL L19E6
INC HL
DEC B
JP NZ,L0A5D
LD A,0DH
CALL L19E6
LD A,0AH
CALL L19E6
JP L0A4A
;
L0A73: LD A,1AH
CALL L19E6
CALL L19A7
JP NXCMD
;
L0A7E: LD A,D
CALL HEXL
CALL L19E6
LD A,D
CALL HEXR
CALL L19E6
LD A,E
CALL HEXL
CALL L19E6
LD A,E
CALL HEXR
JP L19E6
;
L0A9A: LD HL,FCB+9
LD DE,CTLLIT
LD C,3
CALL CMPSTR
JP Z,SAVCTL
LD HL,FCB+9
LD DE,DOCLIT
LD C,3
CALL CMPSTR
JP Z,SAVDOC
LD HL,FCB+9
LD DE,ASMLIT
LD C,3
CALL CMPSTR
JP NZ,CMERR
LD A,1
LD (WRTFLG),A
XOR A
LD (WFIFLG),A
CALL L1986
CALL PRTSTR
DEFB '++WRITING .ASM ENABLED'
DEFB 0DH,0AH,'USE Z COMMAND OR '
DEFB 'E CONTROL TO CLOSE FILE++'
DEFB 0DH,0AH,0
JP NXCMD
;
SAVDOC: CALL L0DFB
LD HL,(DOCEND)
INC HL
INC HL
LD (HL),0
LD HL,(DOCTBL)
JP L0A47
;
RRQERR: CALL PRTSTR
DEFB '++NO FILE ACCESSES PERMITTED '
DEFB 'UNTIL .ASM CLOSED',0DH,0AH
DEFB 0
JP NXCMD
;
L0B62: CALL PRTSTR
DEFB '++UNEXPECTED EOF',0DH,0AH
DEFB 0
JP NXCMD
;
CMCTL: LD HL,CMDBUF+3
LD A,(HL)
CP 0DH
JP Z,L0C73
CALL GTVAL
CP 0DH
JP Z,L0C6D
CP ' '
JP Z,L0B96
CP ','
JP NZ,CMERR
L0B96: INC HL
LD A,(HL)
CALL L0BB0
JP NXCMD
;
L0B9E: PUSH HL
PUSH DE
PUSH AF
CALL L0C51
DEC HL
JP C,L0BAB
INC HL
INC HL
INC HL
L0BAB: POP AF
POP DE
CP (HL)
POP HL
RET Z
L0BB0: LD (INTYP),A
CALL L0C51
JP C,L0BFB
LD A,(INTYP)
CP 'I'
JP Z,L0C4D
CP 'W'
JP Z,L0C4D
CP 'B'
JP Z,L0C4D
CP 'S'
JP Z,L0C4D
CP 'E'
JP Z,L0C4D
CP 'K'
JP NZ,CMERR
EX DE,HL
LD HL,3
ADD HL,DE
EX DE,HL
L0BE0: LD A,(HL)
INC HL
AND (HL)
DEC HL
INC A
JP Z,L0BF5
LD B,3
L0BEA: LD A,(DE)
LD (HL),A
INC DE
INC HL
DEC B
JP NZ,L0BEA
JP L0BE0
;
L0BF5: DEC HL
DEC HL
DEC HL
JP NODOCT
;
L0BFB: LD A,(INTYP)
CP 'K'
JP Z,CMERR
CP 'E'
JP Z,L0C1C
CP 'B'
JP Z,L0C1C
CP 'W'
JP Z,L0C1C
CP 'I'
JP Z,L0C1C
CP 'S'
JP NZ,CMERR
L0C1C: PUSH DE
PUSH HL
LD HL,CTLTBL
L0C21: LD A,(HL)
INC HL
AND (HL)
INC HL
INC HL
INC A
JP NZ,L0C21
INC HL
INC HL
INC HL
EX DE,HL
LD HL,-3
ADD HL,DE
POP BC
L0C33: DEC HL
DEC DE
LD A,(HL)
LD (DE),A
LD A,E
CP C
JP NZ,L0C33
LD A,D
CP B
JP NZ,L0C33
LD H,B
LD L,C
POP DE
LD (HL),E
INC HL
LD (HL),D
INC HL
LD A,(INTYP)
LD (HL),A
RET
;
L0C4D: INC HL
INC HL
LD (HL),A
RET
;
L0C51: LD HL,CTLTBL
L0C54: LD A,(HL)
INC HL
AND (HL)
DEC HL
INC A
SCF
RET Z
INC HL
LD A,D
CP (HL)
DEC HL
RET C
JP NZ,L0C67
LD A,E
CP (HL)
RET Z
RET C
L0C67: INC HL
INC HL
INC HL
JP L0C54
;
L0C6D: CALL L0C51
JP L0C76
;
L0C73: LD HL,CTLTBL
L0C76: CALL L1ABF
LD E,(HL)
INC HL
LD D,(HL)
INC HL
LD A,D
AND E
INC A
JP NZ,L0C86
JP NODOCT
;
L0C86: PUSH DE
PUSH HL
CALL L17EA
JP C,L0C9F
L0C8E: LD A,(HL)
CALL TYPE
INC HL
DEC B
JP NZ,L0C8E
LD A,':'
CALL TYPE
CALL CRLF
L0C9F: POP HL
POP DE
CALL PRSPC
CALL PRSPC
EX DE,HL
CALL PRWORD
LD A,','
CALL TYPE
EX DE,HL
LD A,(HL)
CALL TYPE
CALL CRLF
INC HL
JP L0C76
;
SAVCTL: CALL L1986
LD HL,CTLTBL
L0CC2: LD E,(HL)
INC HL
LD D,(HL)
INC HL
LD A,D
AND E
INC A
JP Z,L0CE6
CALL L0A7E
LD A,','
CALL L19E6
LD A,(HL)
CALL L19E6
LD A,0DH
CALL L19E6
LD A,0AH
CALL L19E6
INC HL
JP L0CC2
;
L0CE6: LD A,1AH
CALL L19E6
CALL L19A7
JP NXCMD
;
L0CF1: CALL FOPEN
LD HL,CTLTBL
L0CF7: CALL RDFCHR
LD DE,0
L0CFD: CP 1AH
JP Z,L0D2A
CP ','
JP Z,L0D1E
CP ':'
JP C,L0D0E
SUB 7
L0D0E: SUB '0'
EX DE,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD L
LD L,A
EX DE,HL
CALL RDFCHR
JP L0CFD
;
L0D1E: LD (HL),E
INC HL
LD (HL),D
INC HL
CALL RDFCHR
LD (HL),A
INC HL
JP L0CF7
;
L0D2A: LD (HL),0FFH
INC HL
LD (HL),0FFH
JP NODOCT
;
CMCMNT: CALL L0DFB
LD HL,CMDBUF+3
LD A,(HL)
CP 0DH
JP Z,L0DAB
CALL GTVAL
INC HL
CP 0DH
JP Z,L0DA5
CP ' '
JP Z,L0D51
CP ','
JP NZ,CMERR
L0D51: PUSH HL
CALL L0D87
JP C,L0D63
CALL L0DD6
POP HL
PUSH HL
LD A,(HL)
CP 0DH
JP Z,NXCMD
L0D63: LD HL,(DOCEND)
LD (HL),E
INC HL
LD (HL),D
INC HL
POP DE
LD B,0
PUSH HL
L0D6E: INC HL
LD A,(DE)
LD (HL),A
INC DE
INC B
LD A,(DE)
CP 0DH
JP NZ,L0D6E
INC HL
LD (DOCEND),HL
LD (HL),0FFH
INC HL
LD (HL),0FFH
POP HL
LD (HL),B
JP NXCMD
;
L0D87: LD HL,(DOCTBL)
L0D8A: LD A,(HL)
INC HL
AND (HL)
DEC HL
INC A
SCF
RET Z
INC HL
LD A,D
CP (HL)
DEC HL
JP NZ,L0D9B
LD A,E
CP (HL)
RET Z
L0D9B: INC HL
INC HL
LD A,(HL)
CALL ADDF
INC HL
JP L0D8A
;
L0DA5: CALL L0D87
JP L0DAE
;
L0DAB: LD HL,(DOCTBL)
L0DAE: CALL L1ABF
LD E,(HL)
INC HL
LD D,(HL)
INC HL
LD A,D
AND E
INC A
JP Z,NXCMD
EX DE,HL
CALL PRWORD
EX DE,HL
LD A,';'
CALL TYPE
LD B,(HL)
L0DC6: INC HL
LD A,(HL)
CALL TYPE
DEC B
JP NZ,L0DC6
CALL CRLF
INC HL
JP L0DAE
;
L0DD6: LD A,(HL)
INC HL
AND (HL)
INC A
RET Z
DEC HL
PUSH DE
LD D,H
LD E,L
INC HL
INC HL
LD A,(HL)
CALL ADDF
INC HL
LD B,0
L0DE8: LD A,(HL)
LD (DE),A
INC HL
INC DE
LD C,A
AND B
INC A
LD B,C
JP NZ,L0DE8
EX DE,HL
DEC HL
DEC HL
LD (DOCEND),HL
POP DE
RET
;
L0DFB: LD HL,(DOCTBL)
LD A,H
OR L
RET NZ
CALL PRTSTR
DEFB '++COMMAND IGNORED++',0DH
DEFB 0AH,'++Issue ''UNNNN'' to tell '
DEFB 'RESOURCE to use address '
DEFB 'NNNN',0DH,0AH,'as the start '
DEFB 'of the comments table',0DH
DEFB 0AH,0
JP NXCMD
;
CMUSEC: LD HL,CMDBUF+3
LD A,(HL)
CP 0DH
JP Z,CMERR
CP '.'
JP Z,CMERR
CALL GTVAL
EX DE,HL
LD A,H
CP 1FH
JP C,L0E9D
LD (DOCTBL),HL
LD (DOCEND),HL
LD (HL),0FFH
INC HL
LD (HL),0FFH
JP NXCMD
;
L0E9D: CALL PRTSTR
DEFB '++NO!! <2300H!',0DH,0AH
DEFB 0
JP NXCMD
;
L0EB4: PUSH DE
PUSH HL
LD A,1
LD (WFIFLG),A
LD HL,(PCNTR)
EX DE,HL
CALL L17EA
JP C,L0EF6
LD C,B
PUSH HL
L0EC7: LD A,(HL)
CP '+'
JP Z,L0EF5
CP '-'
JP Z,L0EF5
INC HL
DEC C
JP NZ,L0EC7
POP HL
CALL PSTRG
LD A,':'
CALL TYPE
LD A,(TRMFLG)
OR A
JP NZ,L0EF6
CALL TABC
CALL TABC
CALL SEMIC
LD HL,(PCNTR)
CALL PRWORD
CALL CRLF
JP L0EF6
;
L0EF5: POP HL
L0EF6: XOR A
LD (WFIFLG),A
CALL PRSPC
CALL PRSPC
LD HL,(PCNTR)
CALL PRWORD
LD A,1
LD (WFIFLG),A
CALL TABC
POP HL
POP DE
RET
;
DLINE: CALL L0EB4
XOR A
LD (INDX),A
LD HL,(PCNTR)
EX DE,HL
LD HL,(OFFSET)
ADD HL,DE
LD (PGPTR),HL
EX DE,HL
INC HL ;COUNT OVER SINGLE BYTE
LD (PCNTR),HL
EX DE,HL
LD B,(HL)
LD HL,OPCT-7
L0F2D: LD DE,7
ULP: ADD HL,DE
LD A,(HL)
OR A
JP Z,PRDB
AND B
LD C,A
INC HL
LD A,(HL)
CP C
JP NZ,ULP
INC HL
LD A,(HL)
LD (INTYP),A
LD B,5
PROLP: INC HL
LD A,(HL)
CP 1 ;INDX VALUE FLAG
JP NZ,PRO2
LD A,(INDX)
OR A
JP PRO1
;
PRO2: CP '.'
PRO1: CALL NZ,TYPE
DEC B
JP NZ,PROLP
LD HL,(PCNTR)
LD A,(INTYP)
AND 3FH
CP 4
JP C,FOUND
CP 9
JP NC,FOUND
INC HL ;2 BYTE AT LEAST
CP 6
JP C,L0F75
INC HL ;3 BYTE INSTR
L0F75: LD (PCNTR),HL
FOUND: LD E,A
LD D,0
LD HL,JMPTBL
;
ADD HL,DE
ADD HL,DE
ADD HL,DE
PUSH HL
LD HL,(PGPTR)
RET
;
INCPC: PUSH HL
LD HL,(PCNTR)
INC HL
LD (PCNTR),HL
POP HL
RET
; LGTH OPRND EXMPL
JMPTBL: JP TYPE0 ;1 NONE DAA
JP TYPE1 ;1 REG ADD
JP TYPE2 ;1 REG INR
JP TYPE3 ;1 XR STAX
JP TYPE4 ;2 R,DATA MVI
JP TYPE5 ;2 DATA OUT
JP TYPE6 ;3 XR,ADDR LXI
JP TYPE7 ;3 ADDR LHLD
JP TYPE8 ;3 ADDR JZ
JP TYPE9 ;1 NONE RZ
JP TYP10 ;1 NR. RST
JP TYP11 ;1 R,R MOV
JP TYP12 ;2 "CB" BIT
JP TYP13 ;2/4 "ED" LDI
JP TYP14 ;2/4 "DD" SRL
JP TYP15 ;2/4 "FD" RL
JP TYP16 ;2 NONE JR
JP TYP17 ;2 FLAG JR C
JP TYP18 ;2 N,R BIT
JP TYP19 ;X/Y INDEX
JP TYP20 ;4 X/Y,ADD LXI
JP TYP21 ;3 D(),R MOV
JP TYP22 ;3 REG ADD
JP TYP23 ;3
JP TYP24 ;4
;
TYPE0: JP CRLF
;
TYP22: CALL INCPC ;FOR DD/FD INSTRS
TYPE1: CALL TABC
T1B: CALL REG
JP CRLF
;
TYP23: CALL INCPC
TYPE2: CALL TABC
CALL REGM
JP CRLF
;
TYPE3: CALL TABC
CALL XR
JP CRLF
;
TYP24: CALL INCPC
CALL INCPC
TYPE4: CALL TABC
CALL REGM
CALL COMMA
JP T52
;
TYPE5: CALL TABC
T52: LD HL,(PGPTR)
INC HL
LD A,(INDX)
OR A
JP Z,T52A
INC HL
T52A: LD (PGPTR),HL
L1017: LD HL,(PGPTR)
LD A,(HL)
CP ' '
JP C,PHEXB
CP 5BH
JP NC,PHEXB
LD A,(INTYP)
CP 4
JP C,PHEXB
CP 6
JP NC,PHEXB
LD A,(HL)
CALL QCHAR
LD A,27H
CALL TYPE
CALL TABC
CALL SEMIC
PHEXB: LD A,(HL)
CP 0AH
JP C,NO2CH
CALL XO0
LD A,'H'
CALL TYPE
JP CRLF
;
NO2CH: ADD '0'
CALL TYPE
JP CRLF
;
TYPE6: CALL TABC
LD HL,(PGPTR)
LD A,(HL)
CALL XR
CALL COMMA
PRT2X: LD HL,(PGPTR)
INC HL
LD E,(HL)
INC HL
LD D,(HL)
L106E: PUSH DE
CALL L17EA
JP NC,L1084
LD A,(SYBFLG)
OR A
JP Z,L108D
POP DE
PUSH DE
CALL L173A
JP L108D
;
L1084: CALL PSTRG
LD A,(TRMFLG)
OR A
JP Z,TRMLB2
POP DE
JP CRLF
TRMLB2: CALL TABC
CALL SEMIC
L108D: POP DE
LD A,D
OR E
LD A,'0'
JP Z,L10A3
LD A,D
OR A
JP Z,L10A9
CALL XO0
LD A,E
CALL XO
L10A1: LD A,'H'
L10A3: CALL TYPE
JP CRLF
;
L10A9: LD A,E
CP 0AH
JP C,L10B5
CALL XO0
JP L10A1
;
L10B5: ADD '0'
JP L10A3
;
TYPE7: CALL TABC
JP PRT2X
;
TYPE8: CALL GETCC
JP TYPE7
;
TYPE9: CALL GETCC
JP CRLF
;
TYP10: CALL TABC
LD HL,(PGPTR)
LD A,(HL)
RRA
RRA
RRA
AND 7
OR '0'
CALL TYPE
JP CRLF
;
TYP21: CALL INCPC ;THEN FALL THRU
;
TYP11: CALL TABC
CALL REGM
CMREG: CALL COMMA
JP T1B
;
PRTRL: LD C,L
LD A,H
JP PRT2X
;
TYP13: INC HL
LD (PGPTR),HL
LD B,(HL)
LD HL,EDTBL-7
CALL INCPC
JP L0F2D
;
TYP14: LD A,'X'
JP IXIYC
;
TYP15: LD A,'Y'
;
IXIYC: LD (INDX),A
CALL INCPC ;ACCNT FOR PREFIX BYTE
INC HL ;SKIP DD/FD
LD A,(HL) ;BYTE 2 MAY BE OPCODE
CP 0CBH
JP NZ,IXIYT
INC HL
LD A,(HL)
LD (DISPL),A ;FROM THIRD BYTE
TYP12: INC HL
LD B,(HL) ;ACTUAL OPCODE HERE
LD (PGPTR),HL
CALL INCPC
LD HL,CBTBL-7
JP L0F2D
;
IXIYT: PUSH AF
LD (PGPTR),HL ;SAVE OPCODE PNTR
INC HL
LD A,(HL)
LD (DISPL),A ;FROM THIRD BYTE
POP AF ;RECOV OPCODE
LD B,A
LD HL,DDTBL-7
JP L0F2D
;
TYP16: CALL TABC
INC HL
LD A,(HL)
CALL INCPC
LD HL,(PCNTR)
LD E,A
LD D,0
CP D
JP P,NTNEG
DEC D
NTNEG: ADD HL,DE
EX DE,HL
JP L106E
;
TYP17: LD A,(HL)
RRA
RRA
AND 6
PUSH HL
CALL PCC
POP HL
JP TYP16
;
TYP18: CALL TABC
LD A,(HL)
RRA
RRA
RRA
AND 7
OR '0'
CALL TYPE
JP CMREG
;
TYP19: CALL TABC
LD A,(INDX)
CALL TYPE
JP CRLF
;
TYP20: LD (PGPTR),HL
CALL TABC
LD A,(INDX)
CALL TYPE
CALL COMMA
CALL INCPC
CALL INCPC
JP PRT2X
;
XADSP: LD A,(INDX)
OR A
LD A,'M'
JP Z,TYPE
INC HL
LD A,(HL)
PUSH HL
LD A,(DISPL)
LD H,A
OR A
JP P,POSIT
LD A,'-'
CALL TYPE
LD A,H
CPL
INC A
POSIT: CP 64H
JP C,LT100
SBC 64H
LD H,A
LD A,'1'
CALL TYPE
LD A,H
LT100: LD L,0
TENLP: SUB 0AH
JP M,TENOK
INC L
JP TENLP
;
TENOK: ADD 0AH
LD H,A
LD A,'0'
ADD L
CALL TYPE
LD A,H
ADD '0'
POP HL
CALL TYPE
LD HL,INDX-1
LD B,3
JP PSTRG
;
COMMA: LD A,','
JP TYPE
;
TABC: LD A,9
JP TYPE
;
SEMIC: LD A,';'
JP TYPE
;
PRDB: CALL L1A7E
DEFB '.BYTE',9,0
LD A,(INDX)
OR A
JP Z,DB1PR
LD HL,(PGPTR)
DEC HL
LD A,(HL)
CALL XO0
LD A,'H'
CALL TYPE
CALL COMMA
DB1PR: LD A,4
LD (INTYP),A
JP L1017
;
GETCC: LD HL,(PGPTR)
LD A,(HL)
RRA
RRA
AND 0EH
PCC: LD HL,CCTAB
CALL ADDF
LD A,(HL)
CALL TYPE
INC HL
LD A,(HL)
CP '.'
CALL NZ,TYPE
RET
;
QCHAR: PUSH AF
LD A,27H
CALL TYPE
POP AF
CP 27H
JP NZ,TYPE
PUSH AF
CALL TYPE
POP AF
JP TYPE
;
XR: LD HL,(PGPTR)
LD A,(HL)
RRA
RRA
RRA
AND 6
CP 6
JP NZ,L127A
LD A,(HL)
AND 0CFH
CP 0C1H
JP Z,L1264
CP 0C5H
JP Z,L1264
LD A,'S'
CALL TYPE
LD A,'P'
JP TYPE
;
L1264: CALL L1A7E
LD D,B
LD D,E
LD D,A
NOP
RET
;
REGM: LD HL,(PGPTR)
LD A,(HL)
RRA
RRA
RRA
JP L127A
;
REG: LD HL,(PGPTR)
LD A,(HL)
L127A: LD HL,REGTBL
AND 7
CALL ADDF
LD A,(HL)
CP 'M'
JP Z,XADSP
JP TYPE
;
ADDF: ADD L
LD L,A
RET NC
INC H
RET
;
XO0: CP 0A0H
JP C,XO
PUSH AF
LD A,'0'
CALL TYPE
POP AF
JP XO
;
PSTRG: LD A,(HL)
CALL TYPE
INC HL
DEC B
JP NZ,PSTRG
RET
;
CCTAB: DEFB 'NZ'
DEFB 'Z.'
DEFB 'NC'
DEFB 'C.'
DEFB 'PO'
DEFB 'PE'
DEFB 'P.'
DEFB 'M.'
;
REGTBL: DEFB 'BCDE'
DEFB 'HLMA'
;
O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B 0FFH,0AEH,22,'XRA..'
DEFB 0FFH,0B6H,22,'ORA..'
DEFB 0FFH,0BEH,22,'CMP..'
DEFB 0FFH,34H,23,'INR..'
DEFB 0FFH,35H,23,'DCR..'
DEFB 0FFH,36H,24,'MVI..'
DEFB 0FFH,21H,20,'LXI..'
DEFB 0FFH,0F9H,0,'SPI',1,'.'
DEFB 0FFH,0E3H,0,'XTI',1,'.'
DEFB 0FFH,0E9H,0,'PCI',1,'.'
DEFB 0
;
L173A: LD HL,CMDBUF
LD (HL),'L'
INC HL
LD A,D
CALL L189F
LD A,E
CALL L189F
LD HL,CMDBUF
LD B,5
L174D: CALL L1798
JP C,L1757
LD (HL),E
INC HL
LD (HL),D
RET
;
L1757: PUSH HL
PUSH DE
PUSH BC
LD HL,(SYMTP)
LD D,H
LD E,L
LD A,B
ADD 3
ADD L
LD L,A
LD A,H
ADC 0
LD H,A
LD (SYMTP),HL
INC HL
INC HL
LD (HL),0
DEC HL
DEC HL
LD B,H
LD C,L
LD HL,(L1B4B)
L1776: LD A,E
CP L
JP NZ,L1780
LD A,D
CP H
JP Z,L1787
L1780: DEC DE
DEC BC
LD A,(DE)
LD (BC),A
JP L1776
;
L1787: POP BC
POP DE
LD (HL),E
INC HL
LD (HL),D
INC HL
LD (HL),B
POP DE
L178F: INC HL
LD A,(DE)
LD (HL),A
INC DE
DEC B
JP NZ,L178F
RET
;
L1798: PUSH DE
PUSH HL
LD HL,SYMTBL
L179D: POP DE
PUSH DE
INC HL
INC HL
PUSH HL
LD A,(HL)
INC HL
OR A
JP Z,L17E0
CP B
JP C,L17CC
JP NZ,L17D6
LD C,A
CALL CMPSTR
JP Z,L17C5
JP C,L17E0
L17B9: POP HL
LD A,(HL)
INC HL
ADD L
LD L,A
JP NC,L179D
INC H
JP L179D
;
L17C5: POP HL
DEC HL
DEC HL
POP DE
POP DE
OR A
RET
;
L17CC: LD C,A
CALL CMPSTR
JP NC,L17B9
JP L17E0
;
L17D6: LD C,B
CALL CMPSTR
JP Z,L17E0
JP NC,L17B9
L17E0: POP HL
DEC HL
DEC HL
LD (L1B4B),HL
POP HL
POP DE
SCF
RET
;
L17EA: LD HL,SYMTBL
L17ED: LD A,(HL)
INC HL
CP E
JP NZ,L17F8
LD A,(HL)
CP D
JP Z,L1807
L17F8: INC HL
LD A,(HL)
OR A
SCF
RET Z
INC HL
ADD L
LD L,A
JP NC,L17ED
INC H
JP L17ED
;
L1807: INC HL
LD A,(HL)
INC HL
LD B,A
OR A
RET NZ
SCF
RET
;
CMENTR: LD HL,CMDBUF+3
CALL GTVAL
LD A,(HL)
CP ' '
JP Z,L1820
CP ','
JP NZ,CMERR
L1820: INC HL
LD A,(HL)
CP '.'
JP NZ,CMERR
PUSH DE
CALL L1872
POP DE
CALL L174D
JP NXCMD
;
RET
;
CMKILL: LD HL,CMDBUF+3
LD A,(HL)
CP '.'
JP NZ,CMERR
CALL L1872
CALL L1798
JP C,CMERR
LD B,H
LD C,L
INC HL
INC HL
LD A,(HL)
ADD L
LD L,A
LD A,H
ADC 0
LD H,A
INC HL
EX DE,HL
LD HL,(SYMTP)
L1855: LD A,E
CP L
JP NZ,L185F
LD A,D
CP H
JP Z,L1866
L185F: LD A,(DE)
LD (BC),A
INC BC
INC DE
JP L1855
;
L1866: LD H,B
LD L,C
LD (SYMTP),HL
INC HL
INC HL
LD (HL),0
JP NXCMD
;
L1872: INC HL
LD B,0
PUSH HL
L1876: LD A,(HL)
INC HL
INC B
CP '+'
JP Z,L1876
CP '-'
JP Z,L1876
CP '0'
JP C,L1897
CP ':'
JP C,L1876
CP 'A'
JP C,L1897
CP 5BH
JP C,L1876
L1897: DEC B
JP Z,CMERR
DEC HL
EX DE,HL
POP HL
RET
;
L189F: PUSH AF
CALL HEXL
LD (HL),A
INC HL
POP AF
CALL HEXR
LD (HL),A
INC HL
RET
;
HEXL: RRA
RRA
RRA
RRA
HEXR: AND 0FH
CP 0AH
JP C,HEXRN
ADD 7
HEXRN: ADD '0'
RET
;
XO: PUSH AF
CALL HEXL
CALL TYPE
POP AF
CALL HEXR
JP TYPE
;
PRWORD: LD A,H
CALL XO
LD A,L
CALL XO
PRSPC: LD A,' '
JP TYPE
;
GTVAL: LD A,(HL)
CP '.'
JP Z,GTSYMB
LD DE,0
HEXBI: LD A,(HL)
CP '0'
RET C
CP ':'
JP C,CVNUM
CP 'A'
RET C
CP 'G'
RET NC
SUB 7
CVNUM: SUB '0'
EX DE,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD L
LD L,A
EX DE,HL
INC HL
JP HEXBI
;
GTSYMB: CALL L1872
PUSH DE
CALL L1798
JP C,CMERR
LD E,(HL)
INC HL
LD D,(HL)
POP HL
LD A,(HL)
RET
;
FOPEN: PUSH HL
LD HL,START
LD (OFIPTR),HL
XOR A
LD (FCB+32),A
LD DE,FCB
LD C,0FH
CALL BDOS
POP HL
INC A
RET NZ
CALL PRTSTR
DEFB '++FILE NOT FOUND',0DH,0AH
DEFB 0
JP NXCMD
;
RDFCHR: PUSH HL
LD HL,(OFIPTR)
LD A,H
CP 1
JP NZ,L195B
PUSH BC
PUSH DE
LD DE,FCB
LD C,14H
CALL BDOS
OR A
POP DE
POP BC
LD HL,TBUF
JP NZ,L1962
L195B: LD A,(HL)
INC HL
LD (OFIPTR),HL
POP HL
RET
;
L1962: CP 3
JP C,L1980
CALL PRTSTR
DEFB '++UNEXPECTED EOF',0DH,0AH
DEFB 0
JP NXCMD
;
L1980: LD A,1AH
LD (HL),A
JP L195B
;
L1986: PUSH HL
LD DE,FCB
LD C,13H
CALL BDOS
LD DE,FCB
LD C,16H
CALL BDOS
INC A
JP Z,CMERR
XOR A
LD (FCB+32),A
LD HL,TBUF
LD (OFIPTR),HL
POP HL
RET
;
L19A7: LD DE,FCB
LD C,15H
CALL BDOS
OR A
JP NZ,L19D3
LD DE,FCB
LD C,10H
CALL BDOS
INC A
RET NZ
CALL PRTSTR
DEFB '++CLOSE ERROR',0DH,0AH
NOP
JP NXCMD
;
L19D3: CALL PRTSTR
DEFB '++WRITE ERROR',0DH,0AH
NOP
L19E6: PUSH HL
LD HL,(OFIPTR)
LD (HL),A
INC L
LD (OFIPTR),HL
POP HL
RET NZ
PUSH BC
PUSH DE
PUSH HL
LD DE,FCB
LD C,15H
CALL BDOS
OR A
JP NZ,L19D3
LD HL,TBUF
LD (OFIPTR),HL
POP HL
POP DE
POP BC
RET
;
CRLF: LD A,0DH
CALL TYPE
LD A,0AH
JP TYPE
;
PSTAR: LD A,'*'
TYPE: PUSH BC
PUSH DE
PUSH HL
LD E,A
PUSH DE
LD C,2
LD A,(QUIFLG)
OR A
CALL Z,BDOS
POP DE
LD A,(WRTFLG)
LD HL,WFIFLG
AND (HL)
LD A,E
CALL NZ,L19E6
LD A,E
CP 0AH
JP NZ,L1A41
LD A,(L1B35)
OR A
JP Z,L1A41
LD HL,LISCNT+1
DEC (HL)
L1A41: POP HL
POP DE
POP BC
RET
;
GTCMD: CALL PSTAR
LD DE,CMDBUF
LD A,'N'
LD (DE),A
LD C,0AH
CALL BDOS
LD HL,CMDBUF+1
LD E,(HL)
LD D,0
ADD HL,DE
INC HL
LD (HL),0DH
LD HL,CMDBUF+1
LTUCNV: INC HL
LD A,(HL)
CP 0DH
JP Z,CRLF
CP 61H
JP C,LTUCNV
CP 7BH
JP NC,LTUCNV
AND 5FH
LD (HL),A
JP LTUCNV
;
PRTSTR: XOR A
LD (WFIFLG),A
LD (QUIFLG),A
L1A7E: EX (SP),HL
L1A7F: LD A,(HL)
CALL TYPE
INC HL
LD A,(HL)
OR A
JP NZ,L1A7F
INC HL
EX (SP),HL
RET
;
INITBL: XOR A
LD (SYMTBL+2),A
LD HL,SYMTBL
LD (SYMTP),HL
LD A,0DH
LD (CMDBUF+3),A
LD HL,0FFFFH
LD (CTLTBL),HL
LD A,'I'
LD (CTLTBL-1),A
LD HL,(DOCTBL)
LD A,H
OR L
RET Z
LD (DOCEND),HL
LD (HL),0FFH
INC HL
LD (HL),0FFH
RET
;
CMPSTR: LD A,(DE)
CP (HL)
RET NZ
INC DE
INC HL
DEC C
JP NZ,CMPSTR
RET
;
L1ABF: PUSH BC
PUSH DE
PUSH HL
LD C,0BH
CALL BDOS
OR A
JP Z,L1AFA
LD C,1
CALL BDOS
CP 3
JP Z,ABORT
CALL CRLF
JP NXCMD
;
ABORT: CALL PRTSTR
DEFB 0DH,0AH,'ABORT Y/N '
NOP
LD C,1
CALL BDOS
AND 5FH
CP 'Y'
JP Z,0
JP NXCMD
;
L1AFA: POP HL
POP DE
POP BC
RET
;
L1AFE: CP 0DH
RET Z
CP 0AH
RET Z
OR A
RET Z
CP ' '
RET C
CP 7FH
CCF
RET
;
DEFB '('
INDX: DEFB 0,')',0
DISPL: DEFB 0
TRMFLG: DEFB 0
L1B1B: DEFW START
L1B1D: DEFW 0180H
OFFSET: DEFW 0
SYMTP: DEFW SYMTBL
PCNTR: DEFW START
L1B25: DEFW START
PGPTR: DEFW START
DOCTBL: DEFW 0
DOCEND: DEFW 0
L1B2D: DEFW 0
L1B2F: DEFW 0
DMPCNT: DEFW 0FFH
LISCNT: DEFW 0A16H
L1B35: DEFB 1
ASMLIT: DEFB 'ASM'
COMLIT: DEFB 'COM'
CTLLIT: DEFB 'CTL'
SYMLIT: DEFB 'SYM'
DOCLIT: DEFB 'DOC'
WFIFLG: DEFB 0
WRTFLG: DEFB 0
QUIFLG: DEFB 0
L1B48: DEFB 0
L1B49: DEFB 0
L1B4A: DEFB 0
L1B4B: DEFW 0
OFIPTR: DEFW 0
L1B4F: DEFB 0
SYBFLG: DEFB 0
INTYP: DEFB 0,0,0
CMDBUF: DEFS 002CH
END