home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
asm_programming
/
RES86B.ASM
< prev
next >
Wrap
Assembly Source File
|
1985-08-02
|
37KB
|
2,302 lines
; Here is the second half of the RESOURCE program source
page 60,132
code segment byte public
assume cs:code,ds:code
extrn start:near,hsym:near,nwln0:near,delim:near,cmerr:near
extrn nxcmd:near
extrn fcb:word,tbuf:word
public stack,wfiflg,quiflg,segflg,trmflg,segsho,opdtyp,segmsk,insloc
public ofsptr,curpar,segsiz,dmpstt,dmpcnt,dmpend,curofs,wrtflg
public ascbld,liscnt,cntenb,lastwd,doctbl,pcntr,rplptr,ecnt,xcptr
public nxtctl,symtp,docend,ctlbas,fndadd,fndpc,nrsegs,mcbsiz
public cofset,sdflg,ctltop,typndx,xcsw,hiload,symtyp,mcbbas,fake_comtbl
public bdos,initbl,typech,gtcmd,cmdbuf,cmentr,flushf,prtstr,pstrg
public cmkill,prword,gtval,pstg,typech,xo0,crlf,gtval,symbas,prntde
public xo,addfn,keychk,cofset,prspc,pstar,lngth,locsym,ifasci
public semic,dline,dcrlf,adb,strcnt,litall,cmpstr,litcmd,litdoc
public litctl,litsym,fopen,cstbl,segnam,fclose,rdfchr,creatf
public wtfchr,lita86,hexl,hexr,symluk,rdfchr,semic,tabc
;
;
;
dline: cmp nlblfg,0
jnz l11b9
cmp segval,0
jz l11b6
cmp pfxcnt,0
jnz l11b6
mov segval,0 ;clr segval
call pstg
db 0ah,0dh,';ILLEGAL SEGMENT OVERRIDE '
db 'ATTEMPTED !',0ah,0dh,0
l11b6: mov al,segmsk
mov opdtyp,al
call hsym
mov bx,rplptr
mov al,bh
or al,bl
jz l11b9
mov ch,byte ptr [bx]
inc bx ;skip the *
dec ch
call nwln0 ;print replacing line with comment
mov al,0ffh
mov replsw,al
l11b9: dec pfxcnt
mov es,curpar
mov nlblfg,0
mov opdtyp, 04h ;ds is most likely
mov pfflg,al
mov dx,pcntr
mov bx,curofs
add bx,dx
mov curadr,bx
inc dx
mov pcntr,dx
mov ch,es:byte ptr [bx] ;opcode byte in ch
mov cinstr,ch
mov bx,offset opct-7
mov dx,7 ;size of table item -1
l11e3: add bx,dx
mov al,cs:byte ptr [bx]
or al,al
jnz l11ee
jmp pdbbyt ;end of table
;
l11ee: and al,ch
mov cl,al ;masked opcode
inc bx
mov al,cs:byte ptr [bx]
cmp al,cl ;test against pattern
jnz l11e3
inc bx
mov al,cs:byte ptr [bx] ;instr type index
mov byte ptr typndx,al
mov ch,5 ;size of literal
lopclp: inc bx
mov al,cs:byte ptr [bx]
cmp al,'.' ;dot to be ignored
jz nodot
call typech ;output literal opcode
nodot: dec ch
jnz lopclp
mov dl,byte ptr typndx
and dl,3fh
mov dh,0
mov bx,offset jmptbl
add bx,dx
add bx,dx
mov dx,cs:[bx]
mov bx,curadr
jmp dx
;
;
jmptbl dw offset kind00
dw offset kind01
dw offset kind02
dw offset kind03
dw offset kind04
dw offset kind05
dw offset kind06
dw offset kind07
dw offset kind08
dw offset kind09
dw offset kind10
dw offset kind11
dw offset kind12
dw offset kind13
dw offset kind14
dw offset kind15
dw offset kind16
dw offset kind17
dw offset kind18
dw offset kind19
dw offset kind20
dw offset kind21
dw offset kind22
dw offset kind23
dw offset kind24
dw offset kind25
dw offset kind26
dw offset kind27
dw offset kind28
dw offset kind29
dw offset kind30
dw offset kind31
dw offset kind32
dw offset kind33
dw offset kind34
dw offset kind35
dw offset kind36
dw offset kind37
dw offset kind38
dw offset kind39
;
;
;
kind00: jmp dcrlf ;opcode only
;
kind01: call tabc ;in/out
mov al,es:[bx]
test al,2
jnz k01out
test al,1
jnz k01iw
call pstg
db 'AL,DX',0
jmp dcrlf
;
k01iw: call pstg
db 'AX,DX',0
jmp dcrlf
;
k01out: test al,1
jnz k01ow
call pstg
db 'DX,AL',0
jmp dcrlf
;
k01ow: call pstg
db 'DX,AX',0
jmp dcrlf
;
kind02: inc pcntr
call tabc
mov al,es:[bx]
test al,2
jnz k02mtr
call pstg
db 'AX,',0
jmp l139b
;
k02mtr: inc curadr
mov bx,curadr
mov al,es:[bx]
call psmnum
call pstg
db ',AX',0
jmp dcrlf
;
kind37: inc pcntr
call tabc
inc bx
mov al,es:[bx]
test al,2
jnz k37mtr
call pstg
db 'AL,',0
jmp l139b
;
k37mtr: inc curadr
mov bx,curadr
mov al,es:[bx]
call psmnum
call pstg
db ',AL',0
jmp dcrlf
;
kind03: call tabc
mov al,es:[bx]
test al,8
jnz k03mtr
inc pcntr
and al,7
call namrg8
call comma
jmp l139b
;
k03mtr: inc pcntr
inc pcntr
and al,7
call namr16
call comma
pwdval: ;print word value
mov bx,curadr
inc bx
mov dx,es:[bx]
push dx
call symluk
jnb hvsym3
test word ptr sybflg,0ffh
jz nosym3
pop dx
push dx
call addsym
nosym3: pop dx
call pcon16
jmp dcrlf
;
hvsym3: call pstg
db 'OFFSET ',0
call pstrg
pop dx
jmp dcrlf
;
kind04: inc pcntr ;8 bit arith
call tabc
call pstg
db 'AL,',0
l139b: inc curadr
call bytopd
jmp dcrlf
;
bytopd: mov bx,curadr
mov al,es:[bx]
cmp al,' '
jb l13c3
cmp al,'Z'+1
jnb l13c3
mov al,es:[bx]
call pqtchr
mov al,'''' ;27h
call typech ;ending quote
call tabc
call semic
l13c3: mov al,es:[bx]
call psmnum
ret
;
kind05: call tabc ;call/jmp relative address
inc pcntr
inc pcntr
inc bx
mov dx,es:[bx]
inc bx
inc bx
sub bx,curofs
add bx,dx
mov dx,bx
mov opdtyp,0ch ;cs, instruction
call prntde
jmp dcrlf
;
kind06: call tabc
inc pcntr
inc pcntr
call pstg
db 'AX,',0
jmp pwdval
;
opdsy1: push dx
call symluk ;check for symbol
jnb havsym
jmp short mkopds
;
havsym: call pstrg ;display operand symbol
pop dx
ret
;
prtdei: mov bx,curadr
inc bx
mov dx,es:[bx]
prntde: push dx
call symluk ;test for symbol
jnb hvsym2
mkopds: test byte ptr sybflg,0ffh ;building symbols?
jz pmaddr
pop dx
push dx
call addsym
jmp pmaddr
;
hvsym2: call pstrg
test byte ptr trmflg,0ffh
jz cmtadr
pop dx
ret
;
cmtadr: call tabc
call semic
pmaddr: pop dx
pcon16: mov al,dh
or al,dl
mov al,'0' ;30h
jz l147d
mov al,dh
or al,al
jz pcon8
call xo0
mov al,dl
call xo
phxsfx: mov al,'H' ;48h
l147d: call typech
ret
;
pcon8: mov al,dl
psmnum: cmp al,0ah
jb padigt
call xo0
jmp phxsfx
;
padigt: add al,'0' ;30h
jmp l147d
;
kind07: call tabc
inc pcntr
jmp l139b
;
kind08: inc pcntr
jmp dcrlf
;
kind09: mov al,' ' ;lock/rep/repnz
call typech ;space after prfx instr
mov nlblfg,0ffh ;no label betw opcodes
jmp l11b9 ;really continue same instr
;
kind10: call pstg ;xlat opcode
db 9,'AL',0
jmp dcrlf
;
kind11: call pcndop ;conditional jumps
kind21: call tabc ;jcxz/jmps
inc pcntr
mov bx,curadr
inc bx
mov al,es:[bx]
test al,80h ;what sign
jnz k21neg
inc bx
call addfn
jmp k21add
;
k21neg: inc bx
not al
inc al
xor ah,ah
sub bx,ax
k21add: sub bx,curofs
mov dx,bx
mov opdtyp,0ch ;cs, instruction
call prntde
jmp dcrlf
;
kind12: call tabc ;movs/cmps
mov al,es:[bx]
and al,1
jnz k12wrd
call pstg
db 'AL,AL',0
jmp dcrlf
;
k12wrd: call pstg
db 'AX,AX',0
jmp dcrlf
;
kind13: call pstg ;xchg ax with ??
db 9,'AX,',0
mov al,es:[bx]
and al,7
call namr16
jmp dcrlf
;
kind14: call pstg ;unimplemented opcodes
db 'DB',9,'0',0
mov al,es:[bx]
call xo
mov al,'H' ;48h
call typech
jmp dcrlf
;
kind15: call tabc ;one 16 bit register
mov al,es:[bx]
and al,7
call namr16
jmp dcrlf
;
l1552: mov bx,curadr
inc bx
mov al,es:[bx]
and al,7
jmp l156d
;
l155e: mov bx,curadr
inc bx
mov al,es:[bx]
and al,38h
shr al,1
shr al,1
shr al,1
l156d: push ax
mov bx,curadr
mov al,es:[bx]
test al,1
jnz l157c
pop ax
jmp namrg8
;
l157c: pop ax
jmp namr16
;
l1580: mov bx,curadr
inc bx
mov al,es:[bx]
and al,0c0h
cmp al,0
jz l15ba
cmp al,0c0h
jz l1594
jmp l15e0
;
l1594: inc pcntr
mov bx,curadr
mov al,es:[bx]
test al,2
jnz l15ae
call l1552
call comma
call l155e
jmp dcrlf
;
l15ae: call l155e
call comma
call l1552
jmp dcrlf
;
l15ba: inc pcntr
mov bx,curadr
mov al,es:[bx]
test al,2
jnz l15d4
call l1606
call comma
call l155e
jmp dcrlf
;
l15d4: call l155e
call comma
call l1606
jmp dcrlf
;
l15e0: inc pcntr
mov bx,curadr
mov al,es:[bx]
test al,2
jnz l15fa
call l164f
call comma
call l155e
jmp dcrlf
;
l15fa: call l155e
call comma
call l164f
jmp dcrlf
;
l1606: call psgprf ;show segment first
mov bx,curadr
mov al,es:[bx]
test al,1
jnz l1623
call pstg
db 'BYTE PTR ',0
or byte ptr opdtyp,01h ;byte size
jmp l1630
;
l1623: call pstg
db 'WORD PTR ',0
or byte ptr opdtyp,02h ;word size
l1630: call pndxop
mov bx,curadr
inc bx
mov al,es:[bx]
and al,7
cmp al,6
jnz l164e
inc pcntr
inc pcntr
inc bx
mov dx,es:[bx]
call opdsy1
l164e: ret
;
l164f: call psgprf
mov bx,curadr
mov al,es:[bx]
test al,1
jnz l166c
call pstg
db 'BYTE PTR ',0
or byte ptr opdtyp,01h ;byte size
jmp l1679
;
l166c: call pstg
db 'WORD PTR ',0
or byte ptr opdtyp,02h ;word size
l1679: inc pcntr
mov bx,curadr
inc bx
mov al,es:[bx]
inc bx
test al,80h
jnz l1692
mov al,es:[bx]
call psmnum
call pndxop
ret
;
l1692: inc pcntr
mov dx,es:[bx]
call pcon16
call pndxop
ret
;
psgprf: mov al,segval
test al,38h
jz l16b7 ;no prefix
and al,18h
call psgpfx
call colon
mov al,segval
shr al,1
and al,0ch
xor al,08h ;invert b3 for better ascii
mov opdtyp,al ;segment info
mov segval,0
call prspc
ret
;
l16b7: ret
;
namr16: mov bx,offset rtb16
add al,al
call addfn
mov al,cs:[bx]
call typech
inc bx
mov al,cs:[bx]
jmp typech
;
rtb16 db 'AX','CX','DX','BX','SP','BP','SI','DI'
;
namrg8: mov bx,offset rtb08
add al,al
call addfn
mov al,cs:[bx]
call typech
inc bx
mov al,cs:[bx]
jmp typech
;
rtb08 db 'AL','CL','DL','BL','AH','CH','DH','BH'
;
kind22: call tabc
mov al,es:[bx]
and al,1
jnz k22wrd
call pstg
db 'AL',0
jmp dcrlf
;
k22wrd: call pstg
db 'AX',0
jmp dcrlf
;
kind23: mov al,es:[bx] ;segment ovrd prfx
and al,38h
mov segval,al
mov nlblfg,0ffh
mov pfxcnt,1
jmp l11b9 ;to continue instr
;
kind24: call tabc ;push/pop seg regs
mov al,es:[bx]
and al,18h
call psgpfx
jmp dcrlf
;
kind25: call tabc ;mov reg <-> mem
inc pcntr
inc pcntr
mov al,es:[bx]
test al,2
jz k25mtr ;reg<-mem
call pmemor
call comma
call paccum
jmp dcrlf
;
k25mtr: call paccum
call comma
call pmemor
jmp dcrlf
;
paccum: mov bx,curadr
mov al,es:[bx]
test al,1
jnz acc16b
call pstg
db 'AL',0
ret
;
acc16b: call pstg
db 'AX',0
ret
;
pmemor: call psgprf
mov bx,curadr
mov al,es:[bx]
test al,1
jnz l17a6
call pstg
db 'BYTE PTR ',0
or byte ptr opdtyp,01h ;byte size
jmp l17b3
;
l17a6: call pstg
db 'WORD PTR ',0
or byte ptr opdtyp,02h ;word size
l17b3: mov bx,curadr
inc bx
mov dx,es:[bx]
call opdsy1
ret
;
kind26: inc bx
mov al,es:[bx]
and al,38h
cmp al,30h ;stack seg?
jnz l17ce
jmp l1c16
;
l17ce: call pshfop
call tabc
call l17f5
call comma
mov bx,curadr
mov al,es:[bx]
and al,2
jz k26sh1
call pstg
db 'CL',0 ;shift count in cl
jmp dcrlf
;
k26sh1: mov al,'1' ;31h
call typech
jmp dcrlf
;
l17f5: inc pcntr
mov bx,curadr
inc bx
mov al,es:[bx]
and al,0c0h
cmp al,0c0h
jz l180d
cmp al,0
jz l1815
jmp l1811
;
l180d: call l1552
ret
;
l1811: call l164f
ret
;
l1815: call l1606
ret
;
kind27: inc bx
mov al,es:[bx]
and al,38h
jz l1827
jmp l1c16
;
l1827: call pstg
db 'POP',0
call tabc
call l17f5
jmp dcrlf
;
kind28: inc bx
mov al,es:[bx]
test al,20h
jz l1845
jmp l1c16
;
l1845: call pstg
db 'MOV',0
call tabc
mov bx,curadr
mov al,es:[bx]
test al,2
jnz l1865
call l187d
call comma
call l1871
jmp dcrlf
;
l1865: call l1871
call comma
call l187d
jmp dcrlf
;
l1871: mov bx,curadr
inc bx
mov al,es:[bx]
and al,18h
jmp psgpfx
;
l187d: inc pcntr
mov bx,curadr
inc bx
mov al,es:[bx]
and al,0c0h
cmp al,0c0h
jz l1895
cmp al,0
jz l18a1
jmp l18a4
;
l1895: mov bx,curadr
inc bx
mov al,es:[bx]
and al,7
jmp namr16
;
l18a1: jmp l18a7
;
l18a4: jmp l18ba
;
l18a7: call psgprf
call pstg
db 'WORD PTR ',0
or byte ptr opdtyp,02h ;word size
jmp l1630
;
l18ba: call psgprf
call pstg
db 'WORD PTR ',0
or byte ptr opdtyp,02h ;word size
jmp l1679
;
kind29: inc bx
mov al,es:[bx]
and al,38h
jz l18db
jmp l1c16
;
l18db: call pstg
db 'MOV',0
call tabc
jmp l1c19
;
kind30: call tabc
inc bx
mov al,es:[bx]
and al,38h
shr al,1
shr al,1
shr al,1
call namr16
call comma
call l1906
jmp dcrlf
;
l1906: inc pcntr
mov bx,curadr
inc bx
mov al,es:[bx]
and al,0c0h
cmp al,0
jz l18a1
jmp l18a4
;
kind38: call tabc
inc bx
and al,38h
shr al,1
shr al,1
shr al,1
call namr16
call comma
jmp l1a19
;
kind31: inc bx
mov al,es:[bx]
and al,38h
cmp al,8
jnz l1943
jmp l1c16
;
l1943: call pmisci
call tabc
mov bx,curadr
inc bx
mov al,es:[bx]
and al,38h
jz l195a
call l17f5
jmp dcrlf
;
l195a: jmp l1c19
;
kind32: inc bx
mov al,es:[bx]
and al,38h
cmp al,0
jz l1971
cmp al,8
jz l1971
jmp l1c16
;
l1971: cmp al,8
jz l197f
call pstg
db 'INC',0
jmp l1986
;
l197f: call pstg
db 'DEC',0
l1986: call tabc
call l17f5
jmp dcrlf
;
kind33: inc bx
mov al,es:[bx] ;2nd instr byte
and al,38h ;sub-opcode
cmp al,38h
jnz l199f
jmp l1c16 ;make db, not instr
;
l199f: cmp al,0 ;inc reg/mem word
jz l19bc
cmp al,8 ;dec reg/mem word
jz l19bc
cmp al,30h ;push reg/mem
jz l19da
cmp al,18h ;indir interseg call
jz l1a02
cmp al,28h ;indir interseg jmp
jz l1a0e
cmp al,10h ;reg/mem indir inseg call
jz l19e5
cmp al,20h ;reg/mem indir inseg jmp
jz l19f4
hlt ;cant get to here
;
l19bc: cmp al,8
jz l19ca
call pstg
db 'INC',0
jmp l19d1
;
l19ca: call pstg
db 'DEC',0
l19d1: call tabc
call l1906
jmp dcrlf
;
l19da: call pstg
db 'PUSH',0
jmp l19d1
;
l19e5: call pstg
db 'CALL',9,0
call l17f5
jmp dcrlf
;
l19f4: call pstg
db 'JMP',9,0
call l17f5
mov cinstr,0e9h ;fake out for semic delimiter
jmp dcrlf
;
l1a02: call pstg
db 'CALLF',0
jmp l1a16
;
l1a0e: call pstg
db 'JMPF',0
mov cinstr,0e9h ;semic delim fakeout
l1a16: call tabc
l1a19: inc pcntr
mov bx,curadr
inc bx
mov al,es:[bx]
and al,0c0h
cmp al,0
jz l1a2d
jmp l1a41
;
l1a2d: call pstg
db 'DWORD PTR ',0
or byte ptr opdtyp,03h ;dword size
call l1630
jmp dcrlf
;
l1a41: call pstg
db 'DWORD PTR ',0
or byte ptr opdtyp,03h ;dword size
call l1679
jmp dcrlf
;
kind34: call pstg
db ';CALLF TO CSEG',9,0
inc bx
inc bx
inc bx
mov dx,es:[bx]
call pcon16
call dcrlf
call tabc
call pstg
db 'CALLF',9,0
inc pcntr
inc pcntr
inc pcntr
inc pcntr
mov bx,curadr
inc bx
mov dx,es:[bx]
call prtdei
jmp dcrlf
;
kind35: call pstg
db '; JMPF TO CSEG',9,0
inc bx
inc bx
inc bx
mov dx,es:[bx]
call pcon16
call dcrlf
call tabc
call pstg
db 'JMPF',9,0
inc pcntr
inc pcntr
inc pcntr
inc pcntr
mov bx,curadr
inc bx
mov dx,es:[bx]
mov bx,curadr
inc bx
inc bx
inc bx
inc bx
inc bx
sub bx,curofs
add bx,dx
mov dx,bx
call prntde
jmp dcrlf
;
kind36: call tabc
inc bx
mov dx,es:[bx]
call pcon16
inc pcntr
inc pcntr
jmp dcrlf
;
kind16: call tabc
mov al,es:[bx]
and al,7
mov ah,al
inc bx
mov al,es:[bx]
and al,38h
add ah,al
mov al,ah
call psmnum
call comma
call l187d
jmp dcrlf
;
kind17: mov al,es:[bx]
and al,3
cmp al,0
jnz l1b4c
call pstg
db 'NE',0
jmp kind21
;
l1b4c: cmp al,1
jnz l1b55
call pstg
db 'E',0
l1b55: jmp kind21
;
kind18: call parit1
call tabc
jmp l1580
;
kind19: call tabc
jmp l1580
;
kind39: inc bx
mov al,es:[bx]
and al,38h
cmp al,8
jz l1bba
cmp al,20h
jz l1bba
cmp al,30h
jz l1bba
call pstg
db 'DB',9,0
mov bx,curadr
mov al,es:[bx]
call psmnum
call comma
inc bx
mov al,es:[bx]
call psmnum
call comma
inc bx
mov al,es:[bx]
call psmnum
mov bx,curadr
inc bx
mov al,es:[bx]
and al,0c0h
cmp al,80h
jz l1bbd
cmp al,40h
jz l1bd6
mov al,es:[bx]
and al,0c7h
cmp al,6
jz l1bbd
jmp l1be3
;
l1bba: jmp l1c16
;
l1bbd: call comma
inc bx
inc bx
mov al,es:[bx]
call psmnum
call comma
inc bx
mov al,es:[bx]
call psmnum
call dcrlf
jmp l1be3
;
l1bd6: call comma
inc bx
inc bx
mov al,es:[bx]
call psmnum
call dcrlf
l1be3: call pstg
db ';',9,0
mov bx,curadr
jmp l1c0c
;
kind20: mov al,es:[bx]
and al,2
jz l1c0c
inc bx
mov al,es:[bx]
and al,38h
cmp al,8
jz l1c16
cmp al,20h
jz l1c16
cmp al,30h
jz l1c16
dec bx
l1c0c: inc bx
call parith
call tabc
jmp l1c19
;
l1c16: jmp pdbbyt
;
l1c19: mov bx,curadr
inc bx
mov al,es:[bx]
and al,0c0h
cmp al,0
jz l1c7a
cmp al,0c0h
jz l1c47
jmp l1c2d
;
l1c2d: inc pcntr
call l164f
call comma
mov bx,curadr
inc bx
mov al,es:[bx]
inc bx
test al,80h
jz l1c44
inc bx
l1c44: jmp l1c93
;
l1c47: inc pcntr
call l1552
call comma
inc pcntr
mov bx,curadr
mov al,es:[bx]
inc bx
inc bx
l1c5d: call l1cbd
jz l1c66
test al,1
jnz l1c6e
l1c66: mov al,es:[bx]
call psmnum
jmp dcrlf
;
l1c6e: inc pcntr
mov dx,es:[bx]
call pcon16
jmp dcrlf
;
l1c7a: inc pcntr
call l1606
call comma
mov bx,curadr
inc bx
mov al,es:[bx]
and al,7
cmp al,6
jnz l1c93
inc bx
inc bx
l1c93: inc bx
inc pcntr
push bx
mov bx,curadr
mov al,es:[bx]
pop bx
jmp l1c5d ;share common code
;
l1cbd: push bx
push ax
mov bx,curadr
mov al,es:[bx]
cmp al,83h
pop ax
pop bx
ret
;
comma: mov al,',' ;2ch
jmp typech
;
tabc: mov al,9
jmp typech
;
semic: mov al,';' ;3bh
jmp typech
;
colon: mov al,':' ;3ah
jmp typech
;
pdbbyt: call pstg
db 'DB',9,0
jmp bytopd
;
psgpfx: shr al,1
shr al,1
mov bx,offset segtbl
mov ch,2
call addfn
jmp popstx
;
pndxop: mov bx,offset indtbl
push bx
l1d05: mov bx,curadr
inc bx
mov al,es:[bx]
and al,7
shl al,1
shl al,1
shl al,1
pop bx
mov ch,8
call addfn
jmp popstx
;
pmisci: mov bx,curadr
inc bx
mov al,es:[bx]
and al,38h
shr al,1
mov bx,offset msctbl
mov ch,4
call addfn
jmp popstx
;
pshfop: mov bx,curadr
inc bx
mov al,es:[bx]
and al,38h
shr al,1
shr al,1
mov ah,al
shr al,1
add al,ah
mov bx,offset shftbl
jmp popst3
;
parit1: mov bx,curadr
parith: mov al,es:[bx]
and al,38h
shr al,1
shr al,1
mov ah,al
shr al,1
add al,ah
mov bx,offset aritbl
jmp popst3
;
pcndop: mov bx,curadr
mov al,es:[bx]
and al,0fh
mov ch,al
add al,al
add al,ch
mov bx,offset cndtbl
popst3: mov ch,3
call addfn
popstx: mov al,cs:byte ptr [bx]
cmp al,'.' ;2eh
jz popskp
call typech
popskp: inc bx
dec ch
jnz popstx
ret
;
pqtchr: push ax
mov al,'''' ;27h
call typech
pop ax
cmp al,'''' ;27h
jz pqtqt
jmp typech
;
pqtqt: push ax
call typech
pop ax
jmp typech
;
addfn: add al,bl
mov bl,al
jb l1da6
ret
;
l1da6: inc bh
ret
;
xo0: cmp al,0a0h
jnb l1db0
jmp xo
;
l1db0: push ax
mov al,'0' ;30h
call typech
pop ax
jmp xo
;
pstrg: mov al,byte ptr [bx]
call typech
inc bx
dec ch
jnz pstrg
ret
;
;
segtbl db 'ES','CS','SS','DS'
;
cndtbl db 'O..','NO.','B..','NB.'
db 'Z..','NZ.','NA.','A..'
db 'S..','NS.','PE.','PO.'
db 'NGE','GE.','NG.','G..'
;
shftbl db 'ROL','ROR','RCL','RCR'
db 'SHL','SHR','...','SAR'
;
msctbl db 'TEST','....','NOT.','NEG.'
db 'MUL.','IMUL','DIV.','IDIV'
;
aritbl db 'ADD','OR.','ADC','SBB'
db 'AND','SUB','XOR','CMP'
;
indtbl db '[BX+SI].','[BX+DI].','[BP+SI].','[BP+DI].'
db '[SI]....','[DI]....','........','[BX]....'
db '[BX+SI].','[BX+DI].','[BP+SI].','[BP+DI].'
db '[SI]....','[DI]....','........','[BX]....'
;
;
; opcode mask, opcode pattern, kind, literal
;
opct db 0ffh,098h,00,'CBW..' ;no operands
db 0ffh,027h,00,'DAA..'
db 0ffh,02fh,00,'DAS..'
db 0ffh,037h,00,'AAA..'
db 0ffh,0d7h,10,'XLAT.'
db 0ffh,0c3h,00,'RET..'
db 0ffh,0cbh,00,'RETF.'
db 0ffh,099h,00,'CWD..'
db 0ffh,09bh,00,'WAIT.'
db 0ffh,09ch,00,'PUSHF'
db 0ffh,09dh,00,'POPF.'
db 0ffh,09eh,00,'SAHF.'
db 0ffh,09fh,00,'LAHF.'
db 0ffh,0ceh,00,'INTO.'
db 0ffh,0cfh,00,'IRET.'
db 0ffh,0f4h,00,'HLT..'
db 0ffh,0f5h,00,'CMC..'
db 0ffh,0f8h,00,'CLC..'
db 0ffh,0f9h,00,'STC..'
db 0ffh,0fah,00,'CLI..'
db 0ffh,0fbh,00,'STI..'
db 0ffh,0fch,00,'CLD..'
db 0ffh,0fdh,00,'STD..'
db 0ffh,090h,00,'NOP..'
db 0ffh,03fh,00,'AAS..'
db 0f8h,040h,15,'INC..' ;one 16 bit reg
db 0f8h,048h,15,'DEC..'
db 0f8h,050h,15,'PUSH.'
db 0f8h,058h,15,'POP..'
db 0ffh,0f3h,09,'REP..' ;prefix
db 0ffh,0f2h,09,'REPNZ'
db 0f8h,090h,13,'XCHG.'
db 0feh,0a4h,12,'MOVS.' ;string functs
db 0feh,0a6h,12,'CMPS.'
db 0feh,0aah,22,'STOS.'
db 0feh,0ach,22,'LODS.'
db 0feh,0aeh,22,'SCAS.'
db 0ffh,0f0h,09,'LOCK.'
db 0fch,0d0h,26,'.....'
db 0ffh,08fh,27,'.....'
db 0ffh,08ch,28,'.....'
db 0ffh,08eh,28,'.....'
db 0feh,0c6h,29,'.....'
db 0ffh,0c4h,38,'LES..'
db 0ffh,0c5h,38,'LDS..'
db 0feh,0f6h,31,'.....'
db 0ffh,0feh,32,'.....'
db 0ffh,0ffh,33,'.....' ;misc call/jmp
db 0ffh,09ah,34,'.....'
db 0ffh,0eah,35,'.....'
db 0f8h,0d8h,16,'ESC..'
db 0ffh,0c2h,36,'RET..'
db 0ffh,0cah,36,'RETF.'
db 0ffh,026h,23,'.....' ;seg ovrd prefix
db 0ffh,02eh,23,'.....'
db 0ffh,036h,23,'.....'
db 0ffh,03eh,23,'.....'
db 0ffh,004h,04,'ADD..' ;arith 8 bit to acc
db 0ffh,00ch,04,'OR...'
db 0ffh,014h,04,'ADC..'
db 0ffh,01ch,04,'SBB..'
db 0ffh,024h,04,'AND..'
db 0ffh,02ch,04,'SUB..'
db 0ffh,034h,04,'XOR..'
db 0ffh,03ch,04,'CMP..'
db 0ffh,0a8h,04,'TEST.'
db 0fch,080h,20,'.....' ;arith immed to reg/mem
db 0ffh,080h,39,'.....'
db 0ffh,005h,06,'ADD..' ;arith 16 bit to acc
db 0ffh,00dh,06,'OR...'
db 0ffh,015h,06,'ADC..'
db 0ffh,01dh,06,'SBB..'
db 0ffh,025h,06,'AND..'
db 0ffh,02dh,06,'SUB..'
db 0ffh,035h,06,'XOR..'
db 0ffh,03dh,06,'CMP..'
db 0ffh,0a9h,06,'TEST.'
db 0f0h,0b0h,03,'MOV..'
db 0fch,0a0h,25,'MOV..'
db 0ffh,0e4h,37,'IN...'
db 0ffh,0e6h,37,'OUT..'
db 0ffh,0e5h,02,'IN...'
db 0ffh,0e7h,02,'OUT..'
db 0feh,0ech,01,'IN...'
db 0feh,0eeh,01,'OUT..'
db 0c4h,000h,18,'.....'
db 0feh,084h,19,'TEST.'
db 0feh,086h,19,'XCHG.'
db 0fch,088h,19,'MOV..'
db 0ffh,08dh,30,'LEA..'
db 0ffh,0cch,00,'INT 3'
db 0ffh,0cdh,07,'INT..'
db 0ffh,0d4h,08,'AAM..'
db 0ffh,0d5h,08,'AAD..'
db 0f0h,070h,11,'J....'
db 0ffh,0e3h,21,'JCXZ.'
db 0ffh,0ebh,21,'JMPS.'
db 0ffh,0e8h,05,'CALL.'
db 0ffh,0e9h,05,'JMP..'
db 0feh,0e0h,17,'LOOP.'
db 0ffh,0e2h,17,'LOOP.'
db 0ffh,006h,24,'PUSH.'
db 0ffh,007h,24,'POP..'
db 0ffh,00eh,24,'PUSH.'
db 0ffh,016h,24,'PUSH.'
db 0ffh,017h,24,'POP..'
db 0ffh,01eh,24,'PUSH.'
db 0ffh,01fh,24,'POP..'
db 0ffh,060h,00,'PUSHA' ;80186
db 0ffh,061h,00,'POPA.' ;80186
db 0ffh,062h,14,'.....' ;80186 bound
db 0fdh,068h,14,'.....' ;80186 push/pop immed
db 0fdh,069h,14,'.....' ;80186 imul immed
db 0feh,06ch,14,'.....' ;80186 ins [dx]
db 0feh,06eh,14,'.....' ;80186 outs [dx]
db 0feh,0c0h,14,'.....' ;80186 shft by cnt
db 0ffh,0c8h,14,'.....' ;80186 enter
db 0ffh,0c9h,00,'LEAVE' ;80186
db 0ffh,0f2h,14,'.....' ;80186 ins/outs (cc-cf)
db 0f0h,060h,14,'.....' ;unimplemented codes
db 0ffh,00fh,14,'.....'
db 0ffh,0d6h,14,'.....'
db 0ffh,0f1h,14,'.....'
db 0
;
;
; symbol table structure, variable lgth records
; 2 bytes address, 1 byte string lgth,
; 1 byte seg/type, n bytes literal string
; table end defined by lgth byte = 0
; first free byte pntd by symtp
; table stored in ascii string sort order
; type b1-0: 0=instr, 1=byte, 2=word, 3=dword
; type b3-2: 0=ss, 1=ds, 2=es, 3=cs
; (b3 inverted from instr. code)
;
addsym: mov bx,offset cmdbuf ;generate symbol literal
mov byte ptr [bx],'L' ;first symbol char
inc bx
mov al,dh
call stohex
mov al,dl
call stohex
mov bx,offset cmdbuf
mov ch,5 ;fixed string lenght
symtch: call locsym
jb entsym ;if sym at addr doesnt exist
mov [bx],dx
inc bx
ret
;
entsym: push bx ;open up space for new entry
push dx
push cx
mov bx,symtp
mov dx,bx
mov al,ch
mov ah,0
add al,4
add bx,ax
mov symtp,bx ;new end
mov byte ptr 3[bx],0 ;zero lgth byte
mov cx,bx
mov bx,insloc
l22a5: cmp dx,bx
jz inssym
dec dx
dec cx
xchg bx,dx
mov al,[bx]
xchg bx,dx
xchg bx,cx
mov [bx],al
xchg bx,cx
jmp l22a5
;
inssym: pop cx ;put new entry in hole just made
pop dx
mov [bx],dx
inc bx
inc bx
mov al,opdtyp
mov [bx],al
inc bx
mov [bx],ch
pop dx
l22cb: inc bx
xchg bx,dx
mov al,[bx]
xchg bx,dx
mov [bx],al
inc dx
dec ch
jnz l22cb
ret
;
locsym: push dx ;find symbol by literal match
push bx ;string start
mov bx,offset symbas
nxstch: pop dx
push dx ;string start
inc bx
inc bx
inc bx ;skip fixed fields
push bx
mov al,[bx] ;string lgth
inc bx
or al,al
jz strstp ;table end
cmp al,ch ;compare lengths
jb shtstr ;table is shorter
jnz lngstr
mov cl,al ;compare count
call cmpstr
jz symfnd ;found right string
jb strstp ;gone too far
l22fa: pop bx ;table pntr
mov al,[bx]
inc bx ;string start
sub ah,ah ;zero hi byte
add bx,ax
jmp nxstch
;
symfnd: pop bx ;strg size ptr
dec bx
dec bx
dec bx ;back to entry start
pop dx ;adj stack
pop dx ;restore dx
or al,al ;adjust flags
ret
;
shtstr: mov cl,al ;shorter size
call cmpstr
jnb l22fa
jmp strstp
;
lngstr: mov cl,ch ;shorter size
call cmpstr
jz strstp
jnb l22fa
strstp: pop bx ;not found exit, set best approx ptr
dec bx
dec bx
dec bx ;record start
mov insloc,bx ;closest match ptr for insert
pop bx
pop dx
stc ;not found flag
ret
;
symluk: mov bx,offset symbas ;lookup symbol for usage
symlk2: mov ax,[bx] ;by address in dx
inc bx
cmp ax,dx
jz symlk6 ;right address
inc bx
inc bx
symlk3: mov al,[bx] ;possible end flag
or al,al
stc
jnz l2348 ;not end
ret
;
l2348: inc bx ;count size byte
mov ah,0
add bx,ax ;adj for string size
jmp short symlk2
;
symlk6: inc bx
mov al,[bx] ;flag byte
mov symtyp,al ;flags for this symbol
inc bx
test byte ptr nrsegs,0feh ;more than one?
jz mdl80 ;only one segment
xor al,opdtyp ;= current?
and al,00ch ;isolate seg bits
jnz symlk3 ;if not rite segment
mdl80: mov al,[bx] ;string size
inc bx
mov ch,al
or al,al
jnz l235fn
stc
l235fn: ret
;
;
;
cmentr: mov bx,offset cmdbuf+3h
call gtval ;symbol value
mov al,[bx]
call delim ;must exist
l2374: inc bx
mov al,[bx]
cmp al,'.'
jz l237e ;must prefix string
call cmerr
;
l237e: push dx ;value
push bx ;buffer pointer
; ensure label doesnt exist
call lngth ;parse string
call locsym
jb nohit
call prtstr
db 'Duplicate label - not entered',0dh,0ah,7,0
call cmerr
;
nohit: pop bx
pop dx
push dx ;restore regs to
push bx ;value & buff ptr
call symluk
jb symnf
push bx
call ucrlf
call pstrg
call prtstr
db ' was killed.',7,0dh,0ah,0
pop bx
dec bx
dec bx
mov al,[bx] ;old flags
mov opdtyp,al ;for new symbol
dec bx
dec bx
call lkill
symnf: pop bx ;orig cmd ptr
call lngth
pop dx ;symbol value
call symtch
jmp nxcmd
;
;
;
cmkill: mov bx,offset cmdbuf+3
mov al,[bx]
cmp al,'.' ;2eh
jz l2396
call cmerr
;
l2396: call lngth
call locsym
jnb l23a1 ;found it
call cmerr
;
l23a1: call lkill
jmp nxcmd
;
lkill: mov cx,bx
inc bx
inc bx
inc bx
mov al,[bx]
sub ah,ah
add bx,ax
inc bx
xchg bx,dx ;hold in dx
mov bx,symtp
l23b8: cmp dx,bx ;at top yet?
jz l23d5
xchg bx,dx
mov al,[bx] ;from [dx]
xchg bx,dx
xchg bx,cx
mov [bx],al ;to [cx]
xchg bx,cx
inc cx
inc dx
jmp l23b8
;
l23d5: mov bx,cx
mov symtp,bx ;new top
mov byte ptr 3[bx],0
ret
;
lngth: inc bx ;skip dot symbol flag
mov ch,0 ;clear counter
push bx ;save string start pntr
nxtcnt: mov al,[bx] ;char to test
inc bx
inc ch ;count it
cmp al,','
jz gettyp
cmp al,'+' ;2bh
jz nxtcnt
cmp al,'-' ;2dh
jz nxtcnt
cmp al,'0' ;30h
jb endcnt
cmp al,'9'+1 ;3ah
jb nxtcnt
cmp al,'A' ;41h
jb endcnt
cmp al,'Z'+1
jb nxtcnt
endcnt: dec ch ;dont count terminator
jnz gudcnt
ervec1: call cmerr
;
gudcnt: dec bx
xchg bx,dx ;delimiter pntr in dx
pop bx ;string start pntr in bx
ret
;
gettyp: mov al,[bx] ;next char is type
cmp al,'.' ;may be a string coming
jz endcnt ;yes, leave alone now
cmp al,'@'
jb ervec1
cmp al,'P'
jnb ervec1
mov opdtyp,al ;put where inssym wants it
jmp endcnt ;done now
;
stohex: push ax
call hexl
mov [bx],al
inc bx
pop ax
call hexr
mov [bx],al
inc bx
ret
;
hexl: rcr al,1
rcr al,1
rcr al,1
rcr al,1
hexr: and al,0fh
cmp al,0ah
jb hexrn
add al,7
hexrn: add al,'0' ;30h
ret
;
xo: push ax
call hexl
call typech
pop ax
call hexr
jmp typech
;
prword: mov al,bh
call xo
mov al,bl
call xo
prspc: mov al,' ' ;20h
jmp typech
;
gtval: mov al,[bx]
cmp al,'.' ;2eh
jz gtsymb
mov dx,0
hexbi: mov al,[bx]
cmp al,'0' ;30h
jnb l245f
ret
;
l245f: cmp al,'9'+1 ;3ah
jb cvnum
cmp al,'A' ;41h
jnb l2468
ret
;
l2468: cmp al,'G' ;47h
jb l246d
ret
;
l246d: sub al,7
cvnum: sub al,'0' ;30h
xchg bx,dx
add bx,bx
add bx,bx
add bx,bx
add bx,bx
add al,bl
mov bl,al
xchg bx,dx
inc bx
jmp hexbi
;
gtsymb: call lngth
push dx
call locsym
jnb l2491 ;it exists
call cmerr
;
l2491: mov dx,[bx] ;symbol value
pop bx
mov al,[bx] ;string terminator
ret
;
;
fopen: push bx
mov bx,offset tbuf+128
mov ofiptr,bx
xor al,al
mov byte ptr fcb+32,al
mov dx,offset fcb
mov ah,0fh
call bdos
pop bx
inc al
jz l24b3
ret
;
l24b3: call prtstr
db '++FILE NOT FOUND',0dh,0ah,0
stc
ret
;
fclose: mov dx,offset fcb
mov ah,16
call bdos
ret
;
rdfchr: push bx
mov bx,ofiptr
test bh,1
jz l24ea
push cx
push dx
mov dx,offset fcb
mov ah,14h
call bdos
or al,al
pop dx
pop cx
mov bx,offset tbuf
jnz l24f3
l24ea: mov al,[bx]
inc bx
mov ofiptr,bx
pop bx
ret
;
l24f3: cmp al,3
jb mrkeof
call prtstr
db '++UNEXPECTED EOF',0dh,0ah,0
jmp nxcmd
;
mrkeof: mov al,1ah
mov [bx],al
jmp l24ea
;
creatf: push bx
mov dx,offset fcb
mov ah,13h
call bdos
mov dx,offset fcb
mov ah,16h
call bdos
inc al
jnz l252f
call cmerr
;
l252f: xor al,al
mov byte ptr fcb+32,al
mov bx,offset tbuf
mov ofiptr,bx
pop bx
ret
;
flushf: mov dx,offset fcb
mov ah,15h
call bdos
or al,al
jnz l256c
mov dx,offset fcb
mov ah,10h
call bdos
inc al
jz l2556
ret
;
l2556: call prtstr
db '++CLOSE ERROR',0dh,0ah,0
jmp nxcmd
;
l256c: call prtstr
db '++WRITE ERROR',0dh,0ah,0
wtfchr: push bx
mov bx,ofiptr
mov [bx],al
inc bl
mov ofiptr,bx
pop bx
jz l2590
ret
;
l2590: push cx
push dx
push bx
mov dx,offset fcb
mov ah,15h
call bdos
or al,al
jnz l256c
mov bx,offset tbuf
mov ofiptr,bx
pop bx
pop dx
pop cx
ret
;
;
dcrlf: mov bx,xcptr
mov al,bh
or al,bl
jz dcrlf3
call tabc
mov ch,[bx]
xor al,al
or al,ch
jz dcrlf2
dcrlf1: inc bx
mov al,[bx]
call typech
dec ch
jnz dcrlf1
dcrlf2: mov bx,0
mov xcptr,bx
dcrlf3: mov rplptr,bx
xor al,al
mov replsw,al
;
crlf: mov al,cinstr
cmp al,0c3h ;return
jz separ
cmp al,0e9h ;jmp
jz separ
cmp al,0ebh ;jmps
jz separ
cmp al,0c2h ;reti
jz separ
cmp al,0cah ;reti
jz separ
cmp al,0cbh ;reti
jz separ
cmp al,0cfh ;tret
jz separ
cmp al,0eah ;jmpf
jz separ
; more can go here .....
ucrlf: mov al,0dh
call typech
mov al,0ah
jmp typech
;
separ: call ucrlf
mov al,';'
mov cinstr,al
call typech
jmp ucrlf
;
pstar: mov al,'*' ;2ah
;
typech: push cx
push dx
push bx
mov dl,al
mov al,replsw
or al,al
jnz notlf
push dx
mov ah,2
mov al,quiflg
or al,al
jnz l25c8
push es
call bdos
pop es
l25c8: pop dx
mov al,wrtflg
mov bx,offset wfiflg
and al,[bx]
mov al,dl
jz l25d8
call wtfchr
l25d8: mov al,dl
cmp al,0ah
jnz notlf
mov al,cntenb
or al,al
jz notlf
mov bx,offset liscnt+1
dec byte ptr [bx]
notlf: pop bx
pop dx
pop cx
ret
;
;
gtcmd: mov bx,offset segsho ;prompt string
mov ch,3
call pstrg
mov dx,offset cmdbuf
mov al,78 ;4eh
xchg bx,dx
mov [bx],al
xchg bx,dx
mov ah,10 ;line input funct
call bdos
mov bx,offset cmdbuf+1
mov dl,[bx]
mov dh,0
add bx,dx
inc bx
mov byte ptr [bx],0dh
mov bx,offset cmdbuf+1
ltucnv: inc bx
mov al,[bx]
cmp al,0dh
jnz l261b
jmp crlf
;
l261b: cmp al,'a'
jb ltucnv
cmp al,'z'+1
jnb ltucnv
and al,5fh
mov [bx],al
jmp ltucnv
;
prtstr: xor al,al
mov wfiflg,al
mov quiflg,al
pstg: pop si
xchg bx,si
push si
ostrlp: mov al,cs:[bx]
call typech
inc bx
mov al,cs:[bx]
or al,al
jnz ostrlp
inc bx
pop si
xchg bx,si
push si
ret
;
;
initbl: xor al,al
mov byte ptr symbas+3,al ;zero size byte
mov bx,offset symbas
mov symtp,bx ;top = bottom
mov al,0dh
mov byte ptr cmdbuf+3,al ;null command
mov byte ptr ctlbas,' '
mov word ptr ctlbas+1,-1 ;end flag in addr
mov cfence,'I' ;initial mode set
mov bx,offset ctlbas+0c00h
mov ctltop,bx ;expansion limit
mov bx,doctbl
mov al,bh
or al,bl ;test if defined
jnz l2670
ret
;
l2670: mov docend,bx ;end = start
mov word ptr [bx],0ffffh ;end flag in place
ret
;
cmpstr: xchg bx,dx
mov al,[bx]
xchg bx,dx
cmp al,[bx]
jz l2685
ret
;
l2685: inc dx
inc bx
dec cl
jnz cmpstr
ret
;
keychk: push cx
push dx
push bx
mov ah,0bh
call bdos
or al,al
jz l26cc
mov ah,1
call bdos
cmp al,3
jz abort
call crlf
jmp nxcmd
;
abort: call prtstr
db 0dh,0ah,'ABORT Y/N ',0
mov ah,1
call bdos
and al,5fh
cmp al,'Y' ;59h
jnz l26c9
mov ah,0
mov dl,0
jmp bdos
;
l26c9: jmp nxcmd
;
l26cc: pop bx
pop dx
pop cx
ret
;
ifasci: cmp al,0dh
jnz l26d5
ret
;
l26d5: cmp al,0ah
jnz l26da
ret
;
l26da: or al,al
jnz l26df
ret
;
l26df: cmp al,' ' ;20h
jnb l26e4
ret
;
l26e4: cmp al,7fh
cmc
ret
;
bdos: int 21h
ret
;
;
;
curofs dw 0 ;active offset value
curpar dw 0
ofsptr dw offset cofset ;default code offset
deltof dw 0 ;curofs-cofset for ctl tbl use
segsiz dw 0 ;bytes in current segment
dmpstt dw 00h ;dump start addr initial
dmpend dw 0100h ;dump end addr initial
symtbl dw symbas ;addr of symbol table start
symtp dw symbas ;addr of sym tbl end+1
pcntr dw 0h ;prog counter for list etc.
hiload dw 0 ;hi addr of loaded file
lastwd dw 0100h
curadr dw 0h
doctbl dw 0d000h ;comment table start addr
docend dw 0d000h ;comment table end addr
ctltbl dw ctlbas ;mode table start addr
ctltop dw 0 ;mode table end addr
fndpc dw 0
fndadd dw 0
dmpcnt dw 0ffh
mcbbas dw 0 ;memory control block
mcbsiz dw 0 ;nr of paras
mcbext db 0,0 ;mcbext and spare
;
cstbl db ' '
dw 0,0,0,0
cofset dw 0h ;default
;
dstbl db ' '
dw 0,0,0,0
dofset dw 0h ;default
;
estbl db ' '
dw 0,0,0,0
eofset dw 0h ;default
;
sstbl db ' '
dw 0,0,0,0
sofset dw 0h ;default
;
db ' '
dw 0,0,0,0
dw 0
;
db ' '
dw 0,0,0,0
dw 0
;
db ' '
dw 0,0,0,0
dw 0
;
db ' '
dw 0,0,0,0
dw 0
db 0 ;table end flag
;
segnam dw 'SC'
dw 'SD'
dw 'SE'
dw 'SS'
dw 'X1'
dw 'X2'
dw 'X3'
dw 'X4'
;
fake_comtbl:
db 1
dw 0,10h,0,0
db 2
dw 0,10h,0,0
db 3
dw 0,10h,0,0
db 4
dw 0,0fffh,0,0
dw 0,0,0,0
;
lita86 db 'ASM' ;literals for file types
litcmd db 'COM'
litctl db 'CTL'
litsym db 'SMB'
litdoc db 'DOC'
litall db 'ALL'
;
rplptr dw 0 ;addr of replacement comment string
xcptr dw 0
nxtctl dw 0
insloc dw 0
ofiptr dw 0
segsho db 'C->' ;command prompt string
nrsegs db 0 ;number of segments loaded
pfxcnt db 0 ;prefix byte count
nlblfg db 0 ;flag no label on instr
trmflg db -1 ;trim flag, label on instr line, dflt on
segval db 0 ;segment prefix value
segmsk db 0ch ;curr segment test bits (code def.)
segflg db 0 ;segment rqst in curr cmd
opdtyp db 0 ;operand type (size & segment)
symtyp db 0 ;symbol type (size & segment)
liscnt db 22
db 10
cntenb db 1
replsw db 0 ;flag for comment repl. instr
wfiflg db 0
wrtflg db 0
quiflg db 0
sdflg db 0
cinstr db 0
strcnt db 0
ecnt db 0
adb db 0
xcsw db 0
pfflg db 0
ascbld db 0 ;next 2 items must stay together
sybflg db 0 ;are accessed as a word
typndx db 0,0,0
cmdbuf db 80 dup (?)
dw 128 dup (?)
stack dw ?
cfence db ?
ctlbas dw 0600h dup(?) ;enough for 300 items
symbas db ?
code ends
end start