home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ZSYS
/
ZNODE-12
/
I
/
ITOZ14.LBR
/
ITOZ14.ZZ0
/
ITOZ14.Z80
Wrap
Text File
|
1992-04-05
|
39KB
|
1,805 lines
; ITOZ.Z80
;
Vers equ 14 ; release version
SubVers equ ' ' ; revision level
;
; For documentation and version history, see accompanying IOTZ.HLP file.
;
; Gene Pizzetta
; 481 Revere St.
; Revere, MA 02151
;
; Voice: (617) 284-0891
; Newton Centre Z-Node: (617) 965-7259
; Ladera Z-Node Central: (310) 670-9465
;
; System addresses . . .
;
CpmFcb equ 5Ch ; default FCB (input)
AltFcb equ 6Ch ; alternate FCB (output)
CpmDma equ 80h ; default DMA buffer (write buffer)
;
; ASCII . . .
;
CtrlC equ 03h ; ^C
LF equ 0Ah ; line feed
CR equ 0Dh ; carriage return
CpmEof equ 1Ah ; CP/M end-of-file (^Z)
;
; Externals . . .
;
.request zslib,z3lib,syslib
;
ext zcheck,eatspc,eatnspc,paudc,getstp,setstp ; ZSLIB
ext gcomnam,comnam,hvtinit,hvdinit,hvon,hvoff
ext z3init,envptr,gzmtop,getquiet,puter2,inverror ; Z3LIB
ext pfn2,eprint,epstr,cout,phlfdc,retud,logud ; SYSLIB
ext condin,getmtop,initfcb,setdma,f$open,f$make
ext f$close,f$read,f$write,f$delete,f$rename,codend
;
jp Start
;
db 'Z3ENV',1 ; ZCPR3 header
Z3EAdr: dw 0
;
; Configuration area . . .
;
dw 0 ; filler
db 'ITOZ' ; for ZCNFG and ADNAME
db Vers/10+'0',Vers mod 10+'0',' '
dw MTABLE ; MTABLE address for ADNAME
db 0 ; storage for ADNAME character count
AstFlg: db 0FFh ; FFh=replace "*" with semi-colon, 0=don't
ClnFlg: db 0FFh ; FFh=colons after labels, 0=as is
DbFlag: db 0FFh ; FFh=use DB/DW/DS, 0=use DEFB/DEFW/DEFS
QtFlag: db 0 ; FFh=quiet, 0=verbose
AbtFlg: db 0 ; FFh=error on user abort, 0 = no error
;
; Start of program . . .
;
Start: ld hl,(Z3EAdr) ; initialize environment
call zcheck
call z3init
ld (Stack),sp ; save old stack
ld sp,Stack ; ..and set up new one
call Init ; initialize data area
ld ix,CpmFcb ; point to the input FCB
ld a,(ix+1)
cp ' ' ; anything there?
jp z,Usage ; (no)
cp '/' ; help request?
jr nz,Start1 ; (no)
ld a,(ix+2)
cp '/'
jp z,Usage ; (yes)
Start1: call GetDU ; get source directory
ld (InDir),bc ; ..and save it
ld ix,AltFcb ; check for output directory (if any)
call GetDU ; ..get it (or the default if none)
ld (OutDir),bc
ld hl,CpmFcb+1 ; prepare to use default output filename
ld bc,DftTyp ; ..and default filetype
ld a,(ix+1) ; check for output filename
cp ' ' ; anything there?
jr z,Start2 ; (no, none given)
cp '/' ; options?
jr z,Start2 ; (must be)
ld hl,AltFcb+1 ; we've got a filename, so move it
ld bc,AltFcb+9 ; ..and filetype
Start2: push bc ; save filetype pointer
push hl ; save filename pointer
ld de,OutFcb+1 ; move filename
ld bc,8
push bc ; save count
ldir
pop bc ; recover count
pop hl ; recover filename pointer
ld de,OutFn+1 ; point to final filename storage
ldir ; ..and put it there also
pop hl ; recover filetype pointer in HL
ld c,3 ; DE points to final filetype storage
ldir ; ..and move it also
ld hl,'$$' ; put temporary filetype ($$$)
ld a,h ; into FCB
ld (OutFcb+9),hl
ld (OutFcb+11),a
call GetOpt ; check for command line options
ld a,(OpQFlg)
or a
jr nz,QSkip1
call eprint
db 'Translating ',0
call hvon
ld bc,(InDir)
call PrtDU
ld de,CpmFcb+1 ; point to filename
call pfn2 ; ..and print it
call hvoff
QSkip1: ld hl,CpmFcb+1
call ChkAmb ; check for ambiguous filename
call InDU
ld de,CpmFcb ; point to FCB
call initfcb ; initialize it
call f$open ; ..and open file
jr z,OpenOK ; (opened okay)
ld a,10 ; error code
call eprint
db ' File not found.',0
jp ErExit
;
OpenOK: ld a,(OpQFlg)
or a
jr nz,QSkip2
call eprint
db ' to ZILOG mnemonics as ',0
call hvon
ld bc,(OutDir)
call PrtDU
ld de,OutFn+1 ; point to output filename
call pfn2 ; ..and print it
call hvoff
call eprint
db ' .. ',0
QSkip2: ld hl,OutFn+1
call ChkAmb ; check for ambiguous filename
call OutDU
ld de,OutFcb ; point to FCB
call initfcb
call f$make ; create an output file
inc a ; A = FFh on error
jr nz,RdLoop ; (created okay)
call ClsIn
ld a,11 ; error code
call eprint
db 'No directory space.',0
jp ErExit
;
RdLoop: call ReadF ; read file to MemTop
ScLoop: ld de,(InPtr)
ld a,(de) ; get 1st character in next line
cp CpmEof ; end of file?
jr z,Done ; (yes)
ld (IBoL),de ; save start of program line
ld hl,(OutPtr)
ld (OBoL),hl ; save start of result line
xor a
ld (CmtFlg),a ; zero comment flag (and carry)
ld hl,(LstByt) ; get end of read buffer
sbc hl,de ; get difference to beginning of next line
jr z,RdLoop ; if next line starts at LstByt
ld b,h ; put length in BC
ld c,l
ex de,hl ; get InPtr in HL (beginning of line)
push bc
push hl
ld a,LF
cpir ; is there a full line left?
pop hl
pop bc
jp z,ST1 ; (yes, go process line)
ld de,(InBuf) ; no
ld (InPtr),de
ldir ; move last to start of read buffer
call ReadF1 ; read more
jr ScLoop
;
ReadF: ld hl,(InBuf) ; re-initialize InPtr
ld (InPtr),hl
ReadF1: call InDU
ReadF2: call setdma ; set DMA for next sector
ld de,CpmFcb ; read a sector
call f$read
jr nz,ReadF3 ; (end of file)
ld de,128 ; set new DMA
add hl,de
ex de,hl ; new DMA in DE
ld hl,(MemTop) ; top of memory
or a ; clear carry
sbc hl,de ; subtract new DMA from MemTop
ex de,hl ; restore new DMA to HL
jr nc,ReadF2 ; keep going if not out of memory
ReadF3: ld (LstByt),hl ; save in LstByt one byte after last read
ld hl,CpmDma ; reset DMA to default buffer
call setdma
ret
;
Done: ld hl,(OutPtr)
ld b,128
ld a,CpmEof
DoneLp: ld (hl),a
inc hl
djnz DoneLp
ld hl,OutBuf ; move last record to output buffer
ld de,CpmDma
ld bc,128
ldir
call OutDU
ld de,OutFcb ; write final sector
call f$write
jp nz,WERR
call ClsIn ; close input file
call ClsOut ; close output file
call DatStp ; move the create date stamp
ld hl,'AB' ; move BAK to filetype
ld a,'K'
ld (OutFcb+9),hl
ld (OutFcb+11),a
call OutDU
ld de,OutFcb
call f$delete ; blind erase any BAK-type file
ex de,hl ; HL -> BAK filename
ld de,OutFn
call f$rename ; blind rename any existing file to BAK
ld hl,'$$' ; move $$$ type back to FCB
ld a,h
ld (OutFcb+9),hl
ld (OutFcb+11),a
ex de,hl ; HL -> final filename
ld de,OutFcb ; DE -> temporary ($$$) name
call f$rename
;
Finish: ld a,(OpQFlg)
or a
ld a,(ErCode) ; get possible syntax errors
jr z,ErExit ; (not quiet, so ignore this)
or a
jr z,ErExit ; (no syntax errors)
call eprint
db 'Syntax errors found in source file.',0
ErExit: ld b,a ; put error code in B
call Z3Chk
jr z,Exit
ld a,b ; recover error code
call puter2 ; set program error flag
or a
jr z,Exit ; (no error)
cp 80h ; syntax error?
call nz,inverror ; call error handler, except for syntax errors
Exit: call hvdinit
ld sp,(Stack)
ret
;
; Support routines . . .
;
BLL: ld a,e ; put char before CR in A
ld hl,(InPtr)
ld de,(OutPtr)
ldir ; copy blank lines and labels
ld (InPtr),hl
ld (OutPtr),de
cp ':' ; does label already have colon?
jr z,BL1 ; (yes)
dec a ; was it blank line?
jr z,BL1 ; (yes)
ld a,(OpCFlg) ; do we add a colon?
or a
jr z,BL1 ; (no)
ld hl,(OutPtr)
inc hl
ld (OutPtr),hl ; increment pointer
ex de,hl
dec de ; point DE at byte after LF
ld h,d
ld l,e
dec hl ; point HL at LF
ld c,2
lddr ; move CRLF one byte ahead
ld a,':' ; insert colon
ld (de),a
BL1: jp ScLoop ; get next line
;
ST1: ld hl,(LCnt) ; increment line count
inc hl
ld (LCnt),hl
ld bc,1 ; initialize BC
ld e,c ; initialize E to non-colon
ld hl,(InPtr)
ST2: inc c
ld a,(hl)
ld d,a ; save char in D
cp CpmEof ; end of file?
jp z,Done ; (yes)
cp CR ; end of line?
jr z,BLL ; (yes)
cp ';' ; comment line?
jr z,CONT1 ; (yes)
cp '*' ; comment line?
jr z,CONT1 ; (yes)
;
cp ':' ; fix for double colon
jr z,ST4
;
ld a,e
cp ':' ; was the last character a ":"?
jr z,CONT1 ; (yes, instruction follows immediately)
ST4: ld a,d ; restore current byte in A
ld e,a ; ..and also in E
cp ' '+1 ; is it greater than space?
inc hl
jr nc,ST2 ; (yes, loop)
CKMORE: ld a,(hl)
cp CR
jr nz,SKIP
call COMM
jp CONT4
;
SKIP: cp ' '+1
inc hl
jr c,CKMORE
CONT1: call LINE ; translate line
CONT4: ld de,(OutPtr)
ld a,(CmtFlg) ; check comment flag
or a
jr z,CONT2 ; (no comment)
ld hl,(LCAdr) ; get end of instruction
ld a,(LChar)
ld (hl),a ; restore byte
dec de
dec de
CONT3: call TPFIN ; finish line
CONT2: ld hl,OutBuf+128
ex de,hl
sbc hl,de ; more than 128 bytes at OutPtr
jp c,ScLoop ; (no, get next line)
WRI: call CkAbrt
ld hl,OutBuf ; move 128 bytes from OutBuf to CpmDma
ld de,CpmDma
ld bc,128
ldir
call OutDU
ld de,OutFcb ; write a sector
call f$write
jr z,NOERR
WERR: ld a,11 ; error code
call eprint
db 'Disk full.',0
jp Abort
;
NOERR: ld hl,OutBuf+CpmDma ; move remaining to start of OutBuf
ld de,OutBuf
ld bc,CpmDma
ldir
ld hl,(OutPtr) ; adjust OutPtr
ld de,80h
or a
sbc hl,de
ld (OutPtr),hl
jp ScLoop ; continue processing
;
LINE: ld hl,LinBuf ; clear line buffer
ld de,LinBuf+1
ld bc,255 ; clear plenty
ld (hl),0
ldir
ld hl,(InPtr)
dec hl
ld a,' '
L1: inc hl ; scan to 1st non-blank
cp (hl)
jr nc,L1 ; (if not greater than space)
ld a,(hl) ; get 1st character greater than space
cp ';' ; was character ";"?
jr z,COMM ; (yes, a comment line)
cp '*' ; was character "*"?
jr nz,L2 ; (no, not a comment line)
ld a,(OpAFlg) ; do we change it to a semi-colon?
or a
jr z,COMM ; (no, just copy line)
ld (hl),';' ; insert semi-colon
COMM: ld hl,(InPtr)
call TP12 ; put line at OutPtr without further ado
inc hl
COMM1: inc hl
ld (InPtr),hl
ret
;
L2: call SCN+3 ; test for EQU
push hl
exx
pop hl
ld bc,3
ld de,EQM
call CHK1
ld hl,SetFlg
set 6,(hl) ; assume not
jr nz,LIN3 ; (not EQU)
cp ' '+1 ; is character after EQU a space or less?
jr nc,LIN3 ; (no)
res 6,(hl) ; it's EQU
ld hl,(InPtr)
jp LIN4
;
CMSCN: ld hl,LinBuf ; enter with char in A
CMS1: ld c,a ; save in C
CMS2: ld a,(hl) ; get char from M
cp CR ; end of line?
ld a,c ; restore A
jr z,CMS3 ; (end of line)
cp (hl) ; match?
ret z ; (yes)
inc hl ; bump pointer
jr CMS2 ; and loop
;
CMS3: or a ; clear carry
ret ; return
;
F3: dec hl ; scan back to 1st character greater than space
ld a,(hl)
cp ' '+1
ret
;
LIN3: exx
push hl
exx
pop hl
ld bc,3
ld de,SEM
call CHK1 ; check for SET
ld hl,SetFlg
set 7,(hl) ; assume not SET
jr nz,NEWLIN
cp ' '+1 ; is there a space or less after SET?
jr nc,NEWLIN ; (no)
res 7,(hl) ; it's SET, so zero 8th bit of SetFlg
exx
ld (hl),'~'
ld hl,(InPtr)
jr LIN4
;
NEWLIN: ld hl,(InPtr)
ld c,50 ; copy label, if any, to OutPtr
ld de,(OutPtr)
ld a,' '
cp (hl)
jr nc,LIN2 ; (no label)
LIN1: ldi ; copy label to OutPtr
jp po,ERROR
ld a,(hl)
cp ':' ; are we at colon?
jr nz,LIN84 ; (new code for double colon fix)
inc hl
cp (hl)
dec hl
jr nz,LIN21 ; (insert colon and scan to > space)
jr LIN1
;
LIN84: cp ' '+1 ; are we still looking at label?
jr nc,LIN1 ; (yes,keep going)
ld a,(OpCFlg) ; check colon flag
or a
jr z,LIN21 ; (no colon)
ld a,(SetFlg) ; check for SET or EQU
and 0C0h
cp 0C0h
jr nz,LIN21 ; (SET or EQU pseudo-op)
push hl
push de
LINM: ld a,(hl)
cp ' '+1
inc hl
jr c,LINM
dec hl
ld bc,5
ld de,MACRM+1
call CHK1
pop de
pop hl
jr z,LIN21
ld a,':'
ld (de),a ; insert colon
inc de
LIN21: ld a,' '
LIN2: ldi ; copy to mnemonic field
jp po,ERROR
cp (hl) ; there yet?
jr nc,LIN2 ; (no,loop)
ld (OutPtr),de
LIN4: ld de,LinBuf ; move line into buffer starting with
ld c,127 ; ..mnemonic and ending with CR
ld a,LF
S2: ldi
jp po,ERROR
cp (hl)
jr nz,S2
inc hl
ld (InPtr),hl ; save location in 8080 program
dec de
ld (LCAdr),de ; save end of instruction location in LinBuf
ld hl,LinBuf ; check if comment in mnemonic field
ld a,(hl)
cp ';'
jp z,TP12 ; (comment in field, so just copy line)
cp '*'
jr z,NFIX ; (* in mnemonic field, must be pseudo-op)
ld a,';'
call CMSCN ; is there a semicolon in line?
jr nz,CHKA ; (no semi-colon, check for asterisk)
ld hl,LinBuf ; get ready to scan line for semi-colon
S6: ld a,(hl) ; get character
cp CR
jr z,CHKA
cp ';' ; is it a semi-colon?
jr z,F2 ; (yes, it's a comment line)
cp '''' ; is it a single quote?
inc hl
jr nz,S6 ; (no, keep looping)
call CMS1 ; yes, scan for closing quote
jp nz,ERROR ; (error if none)
inc hl
jr S6
;
CHKA: ld a,'*' ; no semi-colon, check for asterisk as comment
call CMSCN
jr nz,NFIX ; (none, so it's no comment)
ld hl,LinBuf ; set up to scan for asterisk
A1: ld a,(hl)
cp CR
jr z,NFIX
cp '*'
jr nz,A2
call ATEST
jr c,FIX1 ; (yes)
A2: cp '''' ; is it a quote?
inc hl
jr nz,A1 ; (no, loop)
call CMS1 ; check for closing quote
jp nz,ERROR ; (error if none)
inc hl
jr A1
;
FIX1: ld a,(OpAFlg) ; do we change "*" to ";"?
or a
jr z,F2 ; (no)
ld (hl),';' ; insert semicolon
F2: call F3 ; scan back to end of operand
jr c,F2
inc hl
ld a,(hl)
ld (LChar),a ; save 1st char after operand
ld (LCAdr),hl ; save location
ld a,CR
ld (hl),a ; store CR after operand
ld (CmtFlg),a ; set comment flag
NFIX: ld hl,SetFlg
bit 6,(hl)
jp z,TP1 ; (it was EQU, so just copy line)
bit 7,(hl)
jr nz,NFIX1 ; not SET
ld hl,LinBuf ; get beginning of line
ld de,(OutPtr) ; load place in output buffer
ld a,'~'
call CPY ; copy to ~ mark
push hl ; save start of SET
ld a,(DbFlag) ; ASET or DEFL?
or a
ld hl,ASETM ; assume move in ASET and tab
jr nz,UASET ; (we're right)
ld hl,DEFLM ; no, move in DEFL and tab
UASET: ld bc,4
ldir
pop hl
inc hl
inc hl
inc hl ; point to byte after SET
jp TPFIN ; finish copy to CR
;
ATEST: dec hl
ld c,a
ld a,(hl)
cp ' '+1
inc hl
ld a,c
ret
;
NFIX1: ld de,LinBuf ; calculate line length
ld hl,(LCAdr)
or a
sbc hl,de
inc hl
ld (LLen),hl ; store it here
ld hl,MTABLE ; point at main opcode table
ld a,(hl)
ld b,0
TOP: ld c,a ; find mnemonic from table
push bc
push hl
or a ; make sure carry is clear
call CHK
jr nz,CHK3 ; (no match)
ld c,a ; maybe a match, save A)
ld a,(de) ; get next character in LinBuf
cp ' '+1 ; is it a space or less?
ld a,c ; restore A
CHK3: pop hl
pop bc
jr c,MTCH ; (yes, found match, type in A)
ld a,(hl) ; no match, so index to next
add a,2
ld e,a
ld d,0
add hl,de
ld a,(hl)
or a
jr nz,TOP ; (loop)
jp ERROR ; end of table
;
CHK: inc hl ; search for mnemonic
ld de,LinBuf
CHK1: ld a,(de)
cpi
ld a,(hl)
inc de
ret nz
ret po
jr CHK1
;
MTCH: dec a ; found
ld e,a
ld d,0
ld hl,JTABLE ; index to jump table
add hl,de
add hl,de
ld e,(hl)
inc hl
ld d,(hl)
ld hl,(OutPtr)
ex de,hl
jp (HL) ; go to routine with OutPtr in DE
;
NCPY: ld a,(hl) ; new routine to take care of trailing
cp ' '+1 ; ..blanks or tabs before CRLF
ret c
ld (de),a
inc hl
inc de
jr NCPY
;
;=======================
; TYPE 1 -- same as Zilog
;
TP1: ld hl,LinBuf
TP12: ld de,(OutPtr)
TPFIN: call G2 ; copy rest of line and put CR
TP11: inc de ; add LF and exit
ld a,LF
ld (de),a
inc de
ld (OutPtr),de
ret
;
;=======================
; Type 2 -- one for one substitution
;
TP2: ld hl,STABLE
call TP21
jp TPFIN
;
TP21: ld c,(hl) ; search for match in STABLE
call CHK
jr z,TP22 ; (found)
add hl,bc ; go to 2nd length byte
ld c,(hl)
add hl,bc ; skip 2nd (8080) mnemonic
inc hl ; now pointing at next line in STABLE
jr TP21
;
TP22: ld c,(hl) ; get length of 8080 mnemonic
inc hl
push de ; save address of byte after mnemonic
ld de,(OutPtr)
ldir
pop hl ; restore for copy (TPFIN)
ret
;
TP26: ld a,CR ; utility routine called many times elsewhere
ld (de),a
jp TP11
;
SCN: ld hl,LinBuf-1 ; scans to field after mnemonic
ld a,' '+1
TP31: inc hl
cp (hl)
jr c,TP31
dec a
TP32: cp (hl)
inc hl
jr nc,TP32
dec hl
ret ; HL pointing to 1st character in opcode field
;
;=======================
; TYPE 3 -- MOV mnemonics
;
TP3: call LDM
call SCN
ld a,(hl)
cp 'M'
jr nz,TP33
TP35: call PAR ; put "(HL)" if M
inc hl
jp TPFIN
TP33: ld bc,2
ldir ; put register and comma
TP331: ld a,(hl)
cp 'M' ; is it MOV from M
jp nz,TPFIN ; (no)
TP36: call PAR ; yes, put "(HL)"
jp TP26 ; finish line
;
LDM: ld hl,LDM1 ; put "LD" and tab
ld bc,3
ldir
ret
;
PAR: push hl
ld hl,PAR1
ld bc,4
ldir
pop hl
ret
;
G2: ld a,CR ; copy to end of line and put on CR
call CPY
ld (de),a
ret
;
CPY: ld bc,127 ; copies to character in A
CPY1: cp (hl)
ret z
ldi
jp po,ERROR
jr CPY1
;
;=======================
; TYPE 4 -- MVI mnemonics
;
TP4: call LDM
call SCN
ld a,(hl)
cp 'M'
jp nz,TPFIN ; copy rest of line if not M
jp TP35 ; finish like MOV
;
;=======================
; TYPE 5 -- LDX and LDY mnemonics
;
TP5: call LDM
ld hl,LinBuf+2
ex af,af'
ld a,(hl) ; put X or Y in alternate registers
ex af,af'
call SCN
TP54: ld bc,2
ldir ; copy register and comma
TP53: call IDX ; put "(IX+" or "(IY+"
jp c,TP52
TP51: call NCPY ; copy displacement
TP52: ld a,')' ; put right parens
ld (de),a
inc de
jp TP26 ; finish line
;
IDX: push hl ; see TP53 comment
ld hl,IDX1
ld bc,2
ldir
ex af,af'
ld (de),a
inc de
pop hl
ld a,(hl)
cp '0'
jp z,IMPL
cp '-'
ret z
ld a,'+'
ld (de),a
inc de
or a
ret
;
IMPL: scf
ret
;
;=======================
; TYPE 6 -- STX, STY, MVIX, and MVIY mnemonics
;
TP6: call LDM
ld hl,LinBuf+2
ld a,(hl)
cp 'I' ; is it MVIX or MVIY?
jr nz,TP61 ; (no)
inc hl
TP61: ex af,af'
ld a,(hl) ; put X or Y in alternate registers
ex af,af'
call CSCN ; scan to comma
call IDX ; see TYPE 5
jp c,TP69
call NCPY ; copy displacement
TP69: call RPC ; put right parens
call SCN ; Scan to register
ld a,','
call CPY ; copy register or immediate byte or label
jp TP26 ; finish line
;
RPC: push hl ; put right parens and comma
ld hl,RPC1
ld bc,2
ldir
pop hl
ret
;
CSCN: ld bc,(LLen) ; scan to comma
ld a,','
cpir
ret
;
;=======================
; TYPE 7 -- LDAX and LDA mnemonics
;
TP7: call LDM
TP75: call TP71 ; put "A,("
ld hl,LinBuf+3
ld a,(hl) ; look at 4th character in mnemonic
cp 'X' ; is it LDAX?
ex af,af' ; save flags
call SCN ; scan to operand field
ex af,af' ; restore flags
jp nz,TP51 ; (no, it's LDA)
TP751: ld a,(hl) ; LDAX routine
ld (de),a
inc de
cp 'B' ; is it LDAX B?
jr z,TP74 ; (yes)
cp 'D' ; is it LDAX D?
TP73: jp nz,ERROR ; (no, must be bad code)
TP74: inc a ; put in C or E
ld (de),a
inc de
jp TP52
;
TP71: push hl
ld hl,TP72
ld bc,3
ldir
pop hl
ret
;
;=======================
; TYPE 8 -- STAX and STA mnemonics
;
TP8: call LDM
TP85: ld a,'(' ; put left parens
ld (de),a
inc de
ld hl,LinBuf+3 ; look at 4th character
ld a,(hl)
cp 'X' ; is it X?
ex af,af' ; save flags
call SCN ; scan to operand field
ex af,af' ; restore flags
jr nz,TP82 ; (no, must be LDA)
ld a,(hl) ; STAX routine
ld (de),a
inc de
cp 'B' ; is it STAX B?
jr z,TP81 ; (yes)
cp 'D' ; is it STAX D?
jp nz,ERROR ; (no, bad code)
TP81: inc a ; put in C or E
ld (de),a
inc de
TP83: call RPC ; put right parens and comma
TP84: ld a,'A' ; put "A" and finish line
ld (de),a
inc de
jp TP26
;
TP82: call NCPY ; copy to end of line
jr TP83 ; finish like above
;
;=======================
; TYPE 9 -- LDAI, LDAR, STAI, and STAR mnemonics
;
TP9: call LDM
ld hl,LinBuf+1
ld a,(hl)
cp 'T' ; is it STAI or STAR?
jr z,TP91 ; (yes)
call TP71 ; put "A,("
dec de ; back up over left parens
inc hl
inc hl
ld a,(hl) ; get last character
TP92: ld (de),a ; put last character
inc de
jp TP26 ; finish line
;
TP91: inc hl
inc hl
ld a,(hl) ; get last character
ld (de),a ; put last character
inc de
ld a,','
ld (de),a ; put comma
inc de
jp TP84 ; put "A" and finish line
;
;=======================
; TYPE 10 -- LXI, LXIX, and LXIY mnemonics
;
TPA: call LDM
ld hl,LinBuf+3
ld a,(hl) ; get X, Y, or delimiter
cp ' '+1
jr c,TPA1 ; it's LXI
dec hl
ld bc,2
ldir ; copy IX or IY
ld a,','
ld (de),a ; put comma
inc de
call SCN
TPA3: jp TPFIN ; copy rest of line
;
TPA1: call SCN
ld a,(hl)
cp 'S' ; is it SP?
jr z,TPA3 ; (yes)
cp '6' ; is it SP?
jr nz,TPA4 ; (no)
ld a,'S' ; (yes)
TPA4: call DO2 ; copy right parens or SP
inc hl
jr TPA3 ; finish line
;
DO2: push hl ; copy right parens if 1st character in A
ld hl,RPTAB
ld bc,12
cpir
dec hl
ld c,2
ldir
pop hl
ret
;
;=======================
; TYPE 11 -- LHLD, LddD, LIXD, and LIYD mnemonics
;
TPB: call LDM
ld hl,LinBuf+1
ld bc,2
ldir ; copy register pair
call TPB1 ; copy comma and left parens
call SCN
jp TP51 ; finish like TYPE 5
;
TPB1: push hl
ld hl,TPB2
ld bc,2
ldir
pop hl
ret
;
;=======================
; TYPE 12 -- SHLD, SddD, SIXD, and SIYD mnemonics
;
TPC: call LDM
ld a,'('
ld (de),a ; put left parens
inc de
call SCN
call NCPY ; copy rest of line if greater than space
call RPC ; put right parens and comma
ld hl,LinBuf+1
TPC1: ld bc,2
ldir ; copy register pair
jp TP26 ; finish line
;
;=======================
; TYPE 13 -- SPHL, SPIX, and SPIY mnemonics
;
TPD: call LDM
ld hl,LinBuf
ld bc,2
ldir ; copy "SP"
ld a,','
ld (de),a ; put comma
inc de
jr TPC1 ; put last 2 characters
;
;=======================
; TYPE 14 -- PUSH, POP, PUSHIX, and POPIX
;
TPE: ld hl,LinBuf+1
ld a,(hl)
cp 'O' ; is it POP?
ld hl,TPE2
ld bc,5
jr nz,TPE1 ; (no)
ld hl,TPE5
dec bc ; adjust for POP
TPE1: ldir ; copy PUSH or POP and tab
ld hl,LinBuf+3
ld a,'I'
cp (hl) ; is it POPIX?
jp z,TPFIN ; (yes, copy rest of line)
inc hl
cp (hl) ; is it PUSHIX?
jp z,TPFIN ; (yes, copy rest of line)
call SCN
ld a,(hl)
cp 'P' ; is it PSW?
jr z,TPE4 ; (yes)
cp '6' ; is it PSW?
jr z,TPE4 ; (yes)
call DO2 ; copy register pair
TPE3: jp TP26 ; finish line
;
TPE4: ld hl,AFM
ld bc,2
ldir ; copy "AF"
jr TPE3 ; finish line
;
;=======================
; TYPE 15 -- exchange mnemonics (except EXX)
;
TPF: ld hl,EXM
ld bc,3
ldir ; copy "EX" and tab
ld hl,LinBuf+1
ld a,(hl)
cp 'T' ; is it XTIX or XTIY?
jr z,TPF2 ; (yes)
ld hl,CHG
ld c,5
cp 'C' ; is it XCHG?
jr z,TPF1 ; (yes)
ld hl,XAF ; else EXAF
inc bc ; adjust for 6 characters
TPF1: ldir
jp TP26 ; finish line
;
TPF2: inc hl
push hl ; save start of IX or IY
ld hl,SPM
ld c,5
ldir ; copy "(SP),"
pop hl
ld c,2
jr TPF1 ; copy "IX" or "IY" and finish
;
;=======================
; TYPE 16 -- 8-bit arithmetic and logic (except immediate)
;
TYP1: ld hl,LinBuf+1
ld bc,3
ld a,(hl)
dec hl
cp 'D'
jr z,TYP11 ; copy mnemonic without change
cp 'U'
jr z,TYP11 ; likewise
ld a,(hl) ; get 1st character
ld hl,ARTAB
TYP12: ld c,(hl)
inc hl
cpir ; find match
jr nz,TYP12
dec hl ; back up
inc bc ; restore BC
TYP11: ldir ; copy match
call TYP17
TYP18: inc hl
inc hl
ld a,(hl)
cp ' '+1 ; is it an index register
jr nc,TYP14 ; (yes)
call SCN
ld a,(hl)
cp 'M' ; is it M
jr nz,TYP15 ; (no)
call PAR ; put "(HL)"
TYP16: jp TP26 ; finish line
;
TYP15: ld (de),a ; put register
inc de
jr TYP16 ; finish
;
TYP13: call TP71 ; put "A,("
dec de ; back over left parens
ret
;
TYP14: ld c,a
ex af,af'
ld a,c ; put X or Y in alternate
ex af,af'
call SCN
jp TP53 ; finish like TYPE 5
;
TYP17: ld a,9
ld (de),a ; put tab
inc de
ld hl,LinBuf+1
ld a,(hl)
cp 'E'
call c,TYP13 ; if ADD, ADC, or SBB
ret
;
;=======================
; TYPE 17 -- 8-bit arithmetic and logic immediate
;
TYP2: ld hl,AITAB
call TP21 ; find and put match
call TYP17 ; put tab and "A," if needed
call SCN
jp TPFIN ; copy rest of line
;
;=======================
; TYPE 18 -- INR and DCR mnemonics
;
TYP3: call TYP32
jp TYP18 ; finish like TYPE 16
;
TYP32: ld hl,LinBuf+1
ld bc,4
push hl
ld a,(hl)
cp 'N' ; is it INR?
ld hl,IRM
jr z,TYP31 ; (yes)
add hl,bc ; index to DEC
TYP31: ldir ; copy INC or DEC and tab
pop hl
ret
;
;=======================
; TYPE 19 -- DAD, DSBC, DADC, and DADX mnemonics
;
TYP4: ld hl,LinBuf+3
ld bc,3
ld a,(hl)
push af
cp 'C' ; is it DSBC or DADC?
dec hl
dec hl ; back up to "S" or "A"
jr z,TYP41 ; (yes)
ld hl,ADM
TYP41: ldir ; copy ADD, SBC, or ADC
ld a,9
ld (de),a ; put tab
inc de
pop af
cp 'X' ; is it "X"?
ld hl,HLM
ld c,2
call nc,TYP42 ; if X or Y
ldir ; copy HL, IX, or IY
ld a,','
ld (de),a ; put comma
inc de
TYP43: call SCN
ld a,(hl)
cp 'I' ; is it "I"?
jp nc,TPFIN ; copy IX, IY, or SP
cp '6' ; is it SP?
jr nz,TYP44 ; (no)
ld a,'S' ; yes
TYP44: call DO2 ; copy BC, DE, HL, or SP
jp TP26 ; finish line
;
TYP42: ld hl,RPTAB+9
cp (hl)
dec hl ; point at IX
ret z
inc hl
inc hl ; point at IY
ret
;
;=======================
; TYPE 20 -- INX, DCX, and INXIX mnemonics
;
TYP5: call TYP32
inc hl
inc hl
ld a,(hl)
cp ' '+1
jp nc,TPFIN
jr TYP43
;
;=======================
; TYPE 21 -- shift and rotate group
;
TYP6: ld hl,LinBuf+3
ld a,(hl) ; get X or Y, if any
push af ; save on stack
ld hl,LinBuf
push hl
ld bc,3
ldir ; copy mnemonic
pop hl
inc hl
ld a,(hl)
cp 'A' ; is it RL or RR (Zilog)?
jp nz,TYP61 ; (no)
dec de
ld a,(de) ; get R or L
dec de
ld (de),a ; put in 2nd position
inc de ; adjust pointer
TYP61: ld a,9
ld (de),a ; put tab
inc de
call SCN
ex af,af'
pop af
cp 'X' ; was it X or Y?
jr nc,TYP62 ; (yes)
ld a,(hl)
cp 'M' ; is it memory?
jp nz,TPFIN ; (no, finish line)
jp TP36 ; put "(HL)" and finish
;
TYP62: ex af,af'
jp TP53 ; do index register stuff
;
;=======================
; TYPE 22 -- BIT, SET, RES, and RST mnemonics
;
TYP7: ld hl,LinBuf
ld bc,3
ldir ; put 1st three characters
ld a,(hl)
push af ; save fourth if any
ld a,9
ld (de),a ; put tab
inc de
ld hl,LinBuf+1 ; point to 2nd character
ld a,(hl)
cp 'S' ; is it RST?
push af
call SCN
pop af
jr z,RSTT ; (yes)
ld a,',' ; copy bit or label if used
call CPY
ld a,(hl) ; put comma
ld (de),a
inc hl ; bump pointers
inc de
ex af,af'
pop af
cp 'X' ; was fourth X or Y?
jp c,TP331 ; (no)
ex af,af'
jp TP53 ; do index stuff
;
RSTT: pop af ; balance stack
ld a,(hl) ; get RST operand (0-7)
sub 30h ; subtract bias
add a,a ; double it
ld c,a ; put in BC
ld b,0
ld hl,RSTABL
add hl,bc ; index to table
ld c,2
ldir ; copy 2 to output file
jp TP26 ; finish up
;
;=======================
; TYPE 23 -- all jump and JR mnemonics
;
TYP8: ld hl,LinBuf+1
ld bc,3
ld a,(hl)
cp 'R' ; is it relative jump?
ld hl,JPM
jr nz,TYP84 ; (no)
ld hl,JRM
TYP84: ldir ; put "JR" or "JP"
ld hl,LinBuf
ld a,'P'
cp (hl) ; is it PCHL or PCIX?
inc hl
inc hl
jr z,TYP81 ; (yes)
cp (hl) ; is it JMP?
jr z,TYP82 ; (yes)
dec hl
ld a,(hl)
cp 'R' ; is it relative jump?
ld a,' '
jr nz,TYP83 ; (no)
inc hl
cp (hl) ; is it conditional?
jr nc,TYP82 ; (no)
ld c,3
TYP83: ldi ; put condition code
cp (hl)
jr c,TYP83
ld a,','
ld (de),a ; put comma
inc de
TYP82: call SCN ; scan to address
jp TPFIN ; put rest of line
;
TYP81: ld a,'('
ld (de),a ; put left parens for PCHL, etc.
inc de
jp TP51 ; finish
;
;=======================
; TYPE 24 -- CALL mnemonics
;
TYP9: ld hl,CLM
ld bc,5
ldir ; put "CALL" and tab
ld hl,LinBuf+1
ld a,(hl)
cp 'A' ; is it CALL?
jr z,TYP82 ; (yes)
ld a,' '
jr TYP83 ; finish like conditional jumps
;
;=======================
; TYPE 25 -- all RET mnemonics
;
TYPA: ld hl,LinBuf+1
ld a,(hl)
cp 'E' ; is it RET?
dec hl
jp z,TPFIN ; (yes, just copy whole line)
inc hl
push hl
ld hl,RTM
ld bc,4
ldir ; put "RET"
pop hl
ld a,' '
TYPA1: ldi ; put condition code
cp (hl)
jr c,TYPA1
jp TP26 ; finish line
;
;=======================
; TYPE 26 -- IN mnemonics
;
TYPB: ld hl,INM
ld bc,3
ldir ; put "IN"
ld hl,LinBuf+2
ld a,(hl)
cp 'P' ; is it INP?
jp nz,TP75 ; (no, finish like LDA)
call SCN
ld a,(hl)
ld (de),a ; put register
inc de
ld hl,RCM
ld bc,4
ldir ; put comma and "(C)"
jp TP26 ; finish line
;
;=======================
; TYPE 27 -- OUT mnemonics
;
TYPC: ld hl,OTM
ld bc,4
ldir ; put "OUT" and tab
ld hl,LinBuf+3
ld a,(hl)
cp 'P' ; is it OUTP?
jp nz,TP85 ; (no, finish like STA)
ld hl,RCM+1
ld bc,4
ldir ; put "(C)" and comma
call SCN
ld a,(hl)
ld (de),a ; put register
inc de
jp TP26 ; finish line
;
;=======================
; TYPE 28 -- IM mnemonics
;
TYPD: ld hl,IMM
ld bc,3
ldir ; put "IM" and tab
ld hl,LinBuf+2
ld a,(hl)
ld (de),a ; put number
inc de
jp TP26 ; finish line
;
; ERROR -- Unrecognized opcodes lead here
;
ERROR: ld sp,Stack ; reset the stack
ld a,(OpQFlg)
or a
jr nz,QSkip3
call eprint
db CR,LF,'Syntax Error in Line ',0
ld hl,(LCnt)
call phlfdc
call eprint
db CR,LF,0
ld bc,127
ld hl,(IBoL) ; get beginning of bad line
push hl
ld a,LF
cpir ; find beginning of next line
ld (InPtr),hl
ld a,(hl) ; save first byte
ex af,af'
ld (hl),0 ; terminate string with this
pop de ; restore beginning of bad line
ERR2: ld a,(de) ; get byte
cp CR ; are we at the end?
jr z,ERR1 ; (yes)
call cout
inc de ; increment pointer
jr ERR2 ; ..and loop
ERR1: ld hl,(InPtr)
ex af,af'
ld (hl),a ; restore byte
QSkip3: ld a,80h ; set error code
ld (ErCode),a
ld de,(OBoL) ; put message in output file
ld hl,BadMsg
ld bc,44
ldir
ld hl,(IBoL) ; restore beginning of bad line
jp CONT3 ; copy bad line and go process next
;
; Init -- initializes data areas
;
Init: call hvtinit ; initialize terminal
ld hl,DftNam ; point to default name
call gcomnam ; get disk name, if available
call Z3Chk ; make a Z check
push af ; save flags
call z,getmtop ; get top of memory if not ZCPR3
pop af ; recover flags
call nz,gzmtop ; get top of memory if ZCPR3
ld l,0 ; zero low byte
dec h ; come down one page
ld (MemTop),hl ; ..and store top of memory
call codend ; get end of code
ld (InBuf),hl ; ..and make it the input buffer
call getquiet ; is ZCPR quiet flag set?
rra ; make it 0 or FF
sbc a,a
jr nz,Init1 ; (yes)
ld a,(QtFlag) ; no, get quiet configuration byte
Init1: ld (OpQFlg),a ; ..and store in Q option flag
ld hl,OutBuf
ld (OutPtr),hl ; initialize output buffer pointer
ld hl,(AstFlg) ; move defaults (QtFlag done above)
ld (OpAFlg),hl
xor a ; zero some data
ld b,4
ld hl,SetFlg
InitLp: ld (hl),a
inc hl
djnz InitLp
ld a,(DbFlag) ; are we substituting pseudo-ops?
or a
ret z ; (no)
ld hl,SUBTAB ; yes, move them
ld de,STAB1
ld bc,50
ldir
ret
;
; GetOpt -- parses command line options, if any.
;
GetOpt: ld hl,CpmDma+1 ; point to command tail
call eatspc ; move past first token
call eatnspc
call eatspc
ret z ; (no options)
cp '/' ; slash?
inc hl ; move past it
jr z,GotOpt ; (we've got options)
call eatnspc ; move past second token
call eatspc
ret z ; (no options)
cp '/'
jr nz,GotOpt ; (we've got options)
inc hl ; move past slash
GotOpt: ld a,(hl) ; get option
inc hl ; point to next
or a
ret z ; (end of options)
cp 'Q'
jr z,OptQ
cp 'A'
jr z,OptA
cp 'C'
jr z,OptC
cp ' ' ; skip intervening and trailing spaces
jr z,GotOpt
ld a,19 ; error code
call eprint
db ' Invalid option.',0
jp ErExit
;
OptQ: ld de,OpQFlg
jr DoOpt
;
OptA: ld de,OpAFlg
jr DoOpt
;
OptC: ld de,OpCFlg
;
DoOpt: ld a,(de)
cpl
ld (de),a
jr GotOpt
;
; Z3Chk -- Checks for ZCPR3 using high byte of ENVPTR. Returns NZ
; if Z-System.
;
Z3Chk: ld a,(envptr+1)
or a
ret
;
; GetDU -- Returns drive in B and user in C. If no drive is found,
; returns current drive. Under CP/M, returns current user only.
; Expects address of FCB in IX. Uses AF and BC.
;
GetDU: call retud ; B=current drive, C=current user
ld a,(ix+0) ; get drive byte
or a
jr z,GetDU1 ; (none)
dec a ; make A=0, etc.
ld b,a ; ..and put drive in B
GetDU1: ld a,(envptr+1) ; Z-System?
or a
ret z ; (no)
ld c,(ix+13) ; put user in C
ld a,(ix+15) ; get error byte
or a
ret z
ld a,2 ; error code
call eprint
db ' Invalid directory.',0
jp ErExit
;
; InDU and OutDU -- logs into correct directory for source file (InDU)
; and destination file (OutDU). Preserves all registers.
;
InDU: push bc
ld bc,(InDir)
jr SetDU
;
OutDU: push bc
ld bc,(OutDir)
SetDU: call logud
pop bc
ret
;
; PrtDU -- Prints DU in BC. Uses AF.
;
PrtDU: ld a,b ; get drive
add 'A' ; make it printable
call cout
ld a,c ; get user
call paudc
ld a,':' ; add a colon
call cout
ret
;
; DatStp -- Get create stamp from original file, if available, and
; transfer it to new file. Uses temporary storage at StpTmp (5 bytes).
;
DatStp: call InDU ; setup for input file
ld de,CpmFcb
call initfcb ; re-initialize FCB
ld hl,CpmDma ; point to DMA buffer
call getstp ; get ZSDOS file stamp
ret nz ; (error, give up)
ld a,(CpmDma+1) ; check for create date
or a
jr nz,DatSt1 ; (we've got a create date)
ld a,(CpmDma+11) ; none, so check for modify date
or a
ret z ; (no date stamp)
ld hl,CpmDma+10 ; point to modify date
jr DatSt2
DatSt1: ld hl,CpmDma ; point to create date
DatSt2: ld de,StpTmp ; move date to storage
ld bc,5
ldir
call OutDU ; setup for output file
ld de,OutFcb
call initfcb
ld hl,CpmDma ; point to DMA buffer
call getstp ; get file stamp
ret nz ; (error, give up)
ld hl,StpTmp
ld de,CpmDma ; move old create stamp to date string
ld bc,5
ldir
ld de,OutFcb ; setup for file stamping
ld hl,CpmDma
call setstp ; set file stamp
ret
;
; ClsIn -- close input file.
;
ClsIn: call InDU
ld de,CpmFcb
call f$close
ret
;
; ClsOut -- close output file.
;
ClsOut: call OutDU
ld de,OutFcb
call f$close
ret
;
; ChkAmb -- check for ambiguous filename at address in HL.
;
ChkAmb: ld bc,11
ld a,'?'
cpir
ret nz ; (okay)
call ClsIn ; in case...
ld a,8 ; error code
call eprint
db ' Ambiguous filename.',0
jp ErExit
;
; CkAbrt -- checks for user abort
;
CkAbrt: call condin ; check keyboard
ret z ; (nothing)
cp CtrlC
ret nz ; (not ^C)
call eprint
db CR,LF,'Aborted.',0
ld a,(AbtFlg) ; get error code, if any
Abort: push af ; save error code
call ClsIn ; close files
call ClsOut
ld de,OutFcb ; delete partial output
call f$delete
pop af ; recover error code
jp ErExit
;
; Usage -- Intelligent help screen.
;
Usage: call eprint
DftNam: db 'ITOZ Version '
db Vers/10+'0','.',Vers mod 10+'0',SubVers,CR,LF
db 'Translates extended Intel opcodes to Zilog.',CR,LF
db 'Usage:',CR,LF
db ' ',0
ld hl,comnam ; print program name
call epstr
call eprint
db ' {dir:}infile {dir:}{outfile} {{/}options}',CR,LF
db 'Default outfile is "infile.Z80".',CR,LF
db 'Options:',CR,LF
db ' A ',0
ld a,(OpAFlg)
or a
call nz,PrDont
call eprint
db 'replace "*" with ";" before comments',CR,LF
db ' C ',0
ld a,(OpCFlg)
or a
call nz,PrDont
call eprint
db 'add missing colons after labels',CR,LF
db ' Q quiet mode',0
ld a,(OpQFlg)
or a
call nz,PrOff
call eprint
db CR,LF
db 'Opcodes in source file must be in upper-case.',0
jp Finish
;
PrOff: call eprint
db ' off',0
ret
;
PrDont: call eprint
db 'don''t ',0
ret
;
; Initialized data . . .
;
; Message for flagging unknown opcodes in output file
BadMsg: db '; *** FOLLOWING INSTRUCTION NOT RECOGNIZED',CR,LF
;
DftTyp: db 'Z80' ; default output filetype
;
; Small tables and strings used by various routines
;
EQM: db 'EQU' ; used by L2
SEM: db 'SET' ; used by LIN3
DEFLM: db 'DEFL' ; used by NFIX
ASETM: db 'ASET' ; used by NFIX
LDM1: db 'LD',9 ; used by LDM
PAR1: db '(HL)' ; used by PAR
IDX1: db '(I' ; used by IDX
RPC1: db '),' ; used by RPC
RPTAB: db 'BCDEHLSPIXIY' ; used by DO2 and TYP42
TP72: db 'A,(' ; used by TP71
TPB2: db ',(' ; used by TPB1
TPE2: db 'PUSH',9 ; used by TPE
TPE5: db 'POP',9 ; used by TPE
AFM: db 'AF' ; used by TPE4
EXM: db 'EX',9 ; used by TPF
CHG: db 'DE,HL' ; used by TPF
XAF: db 'AF,AF''' ; used by TPF
SPM: db '(SP),' ; used by TPF2
;
ARTAB: db 2,'CP',3,'SBC',3,'AND' ; used by TYP1
db 2,'OR',3,'XOR'
;
AITAB: db 3,'ADI',3,'ADD' ; used by TYP2
db 3,'ACI',3,'ADC'
db 3,'SUI',3,'SUB'
db 3,'SBI',3,'SBC'
db 3,'ANI',3,'AND'
db 3,'ORI',2,'OR'
db 3,'XRI',3,'XOR'
db 3,'CPI',2,'CP'
;
IRM: db 'INC',9 ; used by TYP32
db 'DEC',9
;
ADM: db 'ADD' ; used by TYP4
HLM: db 'HL' ; used by TYP41
RSTABL: db '0008162432404856' ; used by RSTT
JPM: db 'JP',9 ; used by TYP8
JRM: db 'JR',9 ; used by TYP8
CLM: db 'CALL',9 ; used by TYP9
RTM: db 'RET',9 ; used by TYPA
INM: db 'IN',9 ; used by TYPB
RCM: db ',(C),' ; used by TYPB and TYPC
OTM: db 'OUT',9 ; used by TYPC
IMM: db 'IM',9 ; used by TYPD
;
MACLIB IZTABLES ; insert large tables here
;
; Uninitialized data . . .
;
DSEG
;
SetFlg: ds 1 ; SET/EQU flag
LCnt: ds 2 ; line counter
ErCode: ds 1 ; error code storage (80h if syntax error)
OutFn: ds 12 ; final output filename
InDir: ds 2 ; source directory
OutDir: ds 2 ; destination directory
OpQFlg: ds 1 ; quiet flag
OpAFlg: ds 1 ; replace asterisks with semi-colons flag
OpCFlg: ds 1 ; colons on labels flag
CmtFlg: ds 1 ; comment/no comment flag
LChar: ds 1 ; storage for character at end of instruction
LCAdr: ds 2 ; storage for address of above
LLen: ds 2 ; storage for line length
InPtr: ds 2 ; current pointer to 8080 program buffer
IBoL: ds 2 ; beginning of current input line
OBoL: ds 2 ; beginning of current output line
MemTop: ds 2 ; top of memory
OutPtr: ds 2 ; current pointer to output buffer
LstByt: ds 2 ; pointer to 1st byte after last read
InBuf: ds 2 ; input buffer address
StpTmp: ds 5 ; temporary date stamp storage
OutFcb: ds 36 ; output FCB
ds 100 ; stack
Stack: ds 2 ; storage for original stack pointer
LinBuf: ds 256 ; line buffer
OutBuf: ds 256 ; output buffer
;
end