1
0
mirror of https://github.com/pfusik/xasm.git synced 2024-12-22 00:29:15 +00:00
xasm/xasm.asm

2788 lines
44 KiB
NASM
Raw Normal View History

1998-05-10 19:14:44 +00:00
; X-Assembler
IDEAL
P386
MODEL TINY
CODESEG
1999-08-20 17:15:06 +00:00
compak = 1c00h
1998-09-23 14:48:58 +00:00
l_icl = 1024
l_org = 4096
1999-03-04 13:04:42 +00:00
l_lab = 48000
1998-05-22 16:27:22 +00:00
STRUC com
1999-03-04 13:04:42 +00:00
c_code db ?
1999-08-20 17:15:06 +00:00
c_flag db ?
1999-03-04 13:04:42 +00:00
c_name db ?,?,?
c_vec dw ?
1998-05-22 16:27:22 +00:00
ENDS
STRUC icl
prev dw ?
handle dw ?
line dd ?
1999-03-04 13:04:42 +00:00
flags db ?
m_eofl = 1
1998-05-22 16:27:22 +00:00
nam db ?
ENDS
STRUC lab
1999-03-04 13:04:42 +00:00
l_val dw ?
1998-09-14 09:48:16 +00:00
flags db ?
b_sign = 7
m_sign = 80h
m_lnus = 40h
m_ukp1 = 20h
1998-09-16 18:44:16 +00:00
len db ?
1998-05-22 16:27:22 +00:00
nam db ?
ENDS
1998-05-10 19:14:44 +00:00
1998-09-06 16:05:14 +00:00
STRUC movt
1999-03-04 13:04:42 +00:00
m_code db ?
m_vec dw ?
1998-09-06 16:05:14 +00:00
ENDS
1998-09-23 14:48:58 +00:00
;[flags]
m_pass = 1
m_skip = 4
m_norg = 8
m_rorg = 10h
m_rqff = 20h
b_hdr = 6
m_hdr = 40h
1999-08-20 17:15:06 +00:00
m_pair = 80h
m_repa = 100h
b_skit = 9
m_skit = 200h
b_enve = 10
m_enve = 400h
1998-09-23 14:48:58 +00:00
;[swits]
m_swc = 1
1999-08-20 17:15:06 +00:00
m_swe = 2
m_swi = 4
m_swl = 8
b_swn = 4
m_swn = 10h
m_swo = 20h
m_sws = 40h
m_swt = 80h
1998-09-23 14:48:58 +00:00
;[flist]
m_lstc = 1
1999-08-20 17:15:06 +00:00
m_lsti = 4
m_lstl = 8
m_lsto = 10h
1998-09-23 14:48:58 +00:00
m_lsts = m_lsto+m_lstl+m_lsti
nhand = -1 ;null handle
1998-05-10 19:14:44 +00:00
eol equ 13,10
eot equ 13,10,'$'
1998-09-14 09:48:16 +00:00
MACRO lda _rg ;shorter than 'mov (e)ax, _rg'
_rge SUBSTR <_rg>, 1, 1
IFIDNI _rge, <e>
xchg eax, _rg
ELSE
xchg ax, _rg
ENDIF
1998-09-06 16:05:14 +00:00
ENDM
1998-09-14 09:48:16 +00:00
MACRO sta _rg ;shorter than 'mov _rg, (e)ax'
_rge SUBSTR <_rg>, 1, 1
IFIDNI _rge, <e>
xchg _rg, eax
ELSE
xchg _rg, ax
ENDIF
1998-05-10 19:14:44 +00:00
ENDM
MACRO dos _func
1998-09-06 16:05:14 +00:00
IFNB <_func>
IF _func and 0ff00h
1998-05-10 19:14:44 +00:00
mov ax, _func
1998-09-06 16:05:14 +00:00
ELSE
1998-05-10 19:14:44 +00:00
mov ah, _func
1998-09-06 16:05:14 +00:00
ENDIF
ENDIF
1998-05-10 19:14:44 +00:00
int 21h
ENDM
MACRO file _func, _errtx
1998-09-23 14:48:58 +00:00
IFNB <_errtx>
1999-03-04 13:04:42 +00:00
mov [errmsg], offset _errtx
1998-09-23 14:48:58 +00:00
ENDIF
1998-09-06 16:05:14 +00:00
IF _func and 0ff00h
1998-05-10 19:14:44 +00:00
mov ax, _func
1998-09-06 16:05:14 +00:00
ELSE
1998-05-10 19:14:44 +00:00
mov ah, _func
1998-09-06 16:05:14 +00:00
ENDIF
1998-05-10 19:14:44 +00:00
call xdisk
ENDM
MACRO print _text
1998-09-06 16:05:14 +00:00
IFNB <_text>
1998-05-10 19:14:44 +00:00
mov dx, offset _text
1998-09-06 16:05:14 +00:00
ENDIF
1998-05-10 19:14:44 +00:00
dos 9
ENDM
1998-09-06 16:05:14 +00:00
MACRO error _err
push offset _err
jmp errln
ENDM
1999-08-20 17:15:06 +00:00
MACRO testfl _mask
testflag [flags], _mask
ENDM
MACRO resfl _mask
maskflag [flags], not (_mask)
ENDM
MACRO setfl _mask
setflag [flags], _mask
ENDM
MACRO xorfl _mask
flipflag [flags], _mask
ENDM
1998-09-06 16:05:14 +00:00
MACRO jpass1 _dest
1999-08-20 17:15:06 +00:00
testflag [flags], m_pass
1998-09-06 16:05:14 +00:00
jz _dest
ENDM
MACRO jpass2 _dest
1999-08-20 17:15:06 +00:00
testflag [flags], m_pass
1998-09-06 16:05:14 +00:00
jnz _dest
ENDM
1999-04-17 10:36:00 +00:00
MACRO jopcod _dest
1999-03-04 13:04:42 +00:00
cmp bp, offset var
jne _dest
ENDM
1999-04-17 10:36:00 +00:00
MACRO jnopcod _dest
1999-03-04 13:04:42 +00:00
cmp bp, offset var
je _dest
ENDM
1998-05-10 19:14:44 +00:00
MACRO cmd _oper
1999-08-20 17:15:06 +00:00
_tp SUBSTR <_oper>, 4, 4
1998-05-10 19:14:44 +00:00
_tp CATSTR <0>, &_tp, <h>
1999-08-20 17:15:06 +00:00
dw _tp
1998-08-31 11:00:16 +00:00
IRP _ct,<3,2,1>
_tp SUBSTR <_oper>, _ct, 1
% db '&_tp'
ENDM
1999-08-20 17:15:06 +00:00
_tp SUBSTR <_oper>, 8
1998-05-10 19:14:44 +00:00
dw _tp
ENDM
1998-09-14 09:48:16 +00:00
MACRO opr _oper
_tp SUBSTR <_oper>, 1, 1
db _tp
_tp SUBSTR <_oper>, 2
_tp CATSTR <v_>, _tp
dw _tp
ENDM
1998-09-23 14:48:58 +00:00
MACRO undata
db 6 dup(?)
lstnum db 5 dup(?)
lstspa db ?
lstorg db 26 dup(?)
line db 258 dup(?)
tlabel db 256 dup(?)
1999-08-20 17:15:06 +00:00
obuf db 128 dup(?)
obufen:
1998-09-23 14:48:58 +00:00
objnam db 128 dup(?)
lstnam db 128 dup(?)
tabnam db 128 dup(?)
t_icl db l_icl dup(?)
t_org db l_org dup(?)
ENDM
1998-08-31 11:00:16 +00:00
;*****************************
1998-05-10 19:14:44 +00:00
1998-09-23 14:48:58 +00:00
zero db 100h dup(?)
start:
IFDEF compak
undata
db compak+start-$ dup(?)
ENDIF
1998-05-10 19:14:44 +00:00
print hello
mov di, 81h
movzx cx, [di-1]
1999-03-04 13:04:42 +00:00
jcxz usg ; brak parametrow - usage
1998-05-10 19:14:44 +00:00
mov al, ' '
repe scasb
1999-03-04 13:04:42 +00:00
je usg ; same spacje - usage
1998-05-10 19:14:44 +00:00
dec di
inc cx
1998-09-23 14:48:58 +00:00
mov si, di
1998-05-10 19:14:44 +00:00
mov al, '?'
repne scasb
1999-03-04 13:04:42 +00:00
jne begin ; '?' - usage
1998-05-10 19:14:44 +00:00
1999-03-04 13:04:42 +00:00
usg: print usgtxt ; usage - instrukcja
dos 4c03h
1998-05-10 19:14:44 +00:00
1999-03-04 13:04:42 +00:00
begin: lodsb ; pobierz nazwe
1998-09-23 14:48:58 +00:00
cmp al, '/'
1999-03-04 13:04:42 +00:00
je usg ; najpierw musi byc nazwa
1998-09-23 14:48:58 +00:00
mov di, offset (icl t_icl).nam+1
lea dx, [di-1]
xor ah, ah
1999-03-04 13:04:42 +00:00
mov [tabnam], ah ; nie ma nazwy tabeli symboli
1998-09-23 14:48:58 +00:00
dinam equ di-t_icl-offset (icl).nam
1999-03-04 13:04:42 +00:00
mnam1: dec di ; zapisz do t_icl.nam, ...
mov [objnam+dinam], ax ; ... objnam, ...
mov [lstnam+dinam], ax ; ... lstnam
1998-09-23 14:48:58 +00:00
stosw
lodsb
cmp al, ' '
je mnam2
cmp al, '/'
je mnam2
cmp al, 0dh
jne mnam1
1999-03-04 13:04:42 +00:00
mnam2: call adasx ; doczep .ASX
1998-09-23 14:48:58 +00:00
mov [fslen], di
chex1: dec di
cmp [byte di], '.'
jne chex1
1999-03-04 13:04:42 +00:00
mov [byte objnam+dinam], '.' ; doczep .OBX
1998-09-23 14:48:58 +00:00
mov [dword objnam+dinam+1], 'XBO'
1999-03-04 13:04:42 +00:00
mov [byte lstnam+dinam], '.' ; doczep .LST
1998-09-23 14:48:58 +00:00
mov [dword lstnam+dinam+1], 'TSL'
1999-03-04 13:04:42 +00:00
gsw0: dec si
gsw1: lodsb ; pobierz switche
1998-09-23 14:48:58 +00:00
cmp al, ' '
1999-03-04 13:04:42 +00:00
je gsw1 ; pomin spacje
1998-09-23 14:48:58 +00:00
cmp al, 0dh
je gswx
cmp al, '/'
1999-03-04 13:04:42 +00:00
jne usg ; musi byc '/'
1998-09-23 14:48:58 +00:00
lodsb
1999-03-04 13:04:42 +00:00
and al,0dfh ; mala litera -> duza
1998-09-23 14:48:58 +00:00
mov di, offset swilet
1999-08-20 17:15:06 +00:00
mov cx, 8
1998-09-23 14:48:58 +00:00
repne scasb
1999-03-04 13:04:42 +00:00
jne usg ; nie ma takiego switcha
bts [word swits], cx ; sprawdz bit i ustaw
jc usg ; juz byl taki
1998-09-23 14:48:58 +00:00
mov di, offset lstnam
mov ecx, 'TSL'
cmp al, 'L'
1999-03-04 13:04:42 +00:00
je gsw2 ; /L
1998-09-23 14:48:58 +00:00
mov di, offset tabnam
mov ecx, 'BAL'
cmp al, 'T'
1999-03-04 13:04:42 +00:00
je gsw2 ; /T
1998-09-23 14:48:58 +00:00
cmp al, 'O'
1999-03-04 13:04:42 +00:00
jne gsw1 ; switch bez parametru
1998-09-23 14:48:58 +00:00
cmp [byte si], ':'
1999-03-04 13:04:42 +00:00
jne usg ; /O wymaga ':'
1998-09-23 14:48:58 +00:00
mov di, offset objnam
mov ecx, 'XBO'
1999-03-04 13:04:42 +00:00
gsw2: lodsb
cmp al, ':'
jne gsw0
mov dx, di ; jesli ':', to ...
gsw3: lodsb ; ... pobierz nazwe
1998-09-23 14:48:58 +00:00
stosb
cmp al, ' '
je gsw4
cmp al, '/'
je gsw4
cmp al, 0dh
jne gsw3
gsw4: mov [byte di-1], 0
1999-03-04 13:04:42 +00:00
lda ecx ; doczep ecx
1998-09-23 14:48:58 +00:00
call adext
1999-03-04 13:04:42 +00:00
jmp gsw0
1998-09-23 14:48:58 +00:00
gswx: mov al, [swits]
not al
and al, m_lstl+m_lstc
or al, m_lsto
mov [flist], al
1999-08-20 17:15:06 +00:00
test [swits], m_swe
jz noswe
prpsp: mov ax, [16h]
mov ds, ax
cmp ax, [16h]
jne prpsp
mov ax, [2ch]
test ax, ax
jz enver
dec ax
mov [cs:envseg], ax
mov ds, ax
mov es, ax
mov si, 10h
mov di, si
xor al, al
renv1: cmp al, [si]
jz renvx
cmp [word si], 'RE'
jne renv2
cmp [byte si+2], 'R'
jne renv2
cmp [byte si+7], '='
jne renv2
cmp [dword si+3], 'ELIF'
je renv3
cmp [dword si+3], 'ENIL'
je renv3
renv2: movsb
cmp al, [si-1]
jnz renv2
jmp renv1
renv3: lodsb
test al, al
jnz renv3
jmp renv1
enver: push cs
pop ds
print envtxt
dos 4c02h
renvx: push cs
pop ds
mov [envofs], di
stosb
push ds
pop es
noswe: btr [word swits], b_swn
jnc noswn
mov dx, offset objnam ; sprawdz czas modyfikacji object'a
dos 3d00h
jc noswn ; pewnie nie istnieje
sta bx ; handle -> bx
dos 5700h
mov [word objmod], cx ; zapisz czas
mov [word high objmod], dx ; zapisz date
dos 3eh
or [swits], m_swn ; sprawdzimy czas modyfikacji source'a
noswn: mov bp, offset var
1998-09-23 14:48:58 +00:00
npass: mov [orgvec], offset t_org-2
mov di, [fslen]
1998-05-22 16:27:22 +00:00
1998-09-23 14:48:58 +00:00
opfile: call fopen
1999-08-20 17:15:06 +00:00
btr [word swits], b_swn
jnc main
sta bx
dos 5700h ; sprawdz czas modyfikacji
push dx
push cx
pop eax
cmp eax, [objmod]
ja main
print oldtxt
dos 4c00h
1998-05-10 19:14:44 +00:00
1999-03-04 13:04:42 +00:00
main: mov bx, [iclen]
mov bx, [(icl bx).prev]
test [(icl bx).flags], m_eofl
jnz filend ; czy byl juz koniec pliku ?
mov di, offset line ; ... nie - omin ewentualny LF
call fread1
jz filend
cmp [line], 0ah
je skiplf
inc di
skiplf:
1998-05-22 16:27:22 +00:00
mov bx, [iclen]
mov bx, [(icl bx).prev]
1999-03-04 13:04:42 +00:00
inc [(icl bx).line] ; zwieksz nr linii w pliku
inc [lines] ; ilosc wszystkich linii
1998-09-23 14:48:58 +00:00
test [swits], m_swi
1999-03-04 13:04:42 +00:00
jz gline1 ; czy /I
and [flist], not m_lsti ; ... tak
1998-09-23 14:48:58 +00:00
cmp bx, offset t_icl
1999-03-04 13:04:42 +00:00
jbe gline1 ; czy includowany plik ?
or [flist], m_lsti ; ... tak, nie listuj
1998-05-10 19:14:44 +00:00
1998-09-23 14:48:58 +00:00
gline1: cmp di, offset line+256
1998-05-10 19:14:44 +00:00
jnb linlon
1999-03-04 13:04:42 +00:00
call fread1
1998-05-10 19:14:44 +00:00
jz eof
1999-04-17 10:36:00 +00:00
mov al, [di]
cmp al, 0dh ; pc cr
je syntax
cmp al, 0ah ; unix lf
je syntax
cmp al, 9bh ; atari eol
je syntax
inc di
jmp gline1
1998-05-10 19:14:44 +00:00
1999-03-04 13:04:42 +00:00
eof: mov bx, [iclen] ; koniec pliku
or [(icl bx).flags], m_eofl
1998-05-10 19:14:44 +00:00
1999-03-04 13:04:42 +00:00
syntax: call lspeol ; zapisz CR/LF i zapamietaj dlugosc linii
1998-09-23 14:48:58 +00:00
mov si, offset line
1998-05-10 19:14:44 +00:00
mov al, [si]
cmp al, '*'
1998-09-23 14:48:58 +00:00
je lstrem
1998-05-10 19:14:44 +00:00
cmp al, ';'
1998-09-23 14:48:58 +00:00
je lstrem
1998-05-10 19:14:44 +00:00
cmp al, '|'
1998-09-23 14:48:58 +00:00
je lstrem
1999-08-20 17:15:06 +00:00
cmp al, 0dh
je lsteol
testfl m_skip
1999-03-04 13:04:42 +00:00
jz nskip ; czy byl falszywy warunek ?
skip1: call get ; ... tak - omin etykiete ...
1998-09-16 08:39:58 +00:00
cmp al, ' '
je skip2
cmp al, 9
jne skip1
1999-03-04 13:04:42 +00:00
skip2: call space1 ; omin spacje
lodsd ; sprawdz komende
1998-09-16 08:39:58 +00:00
and eax, 0dfdfdfh
1998-10-03 13:17:18 +00:00
cmp eax, 'DNE'
je filend
push offset lstrem
1999-03-04 13:04:42 +00:00
cmp eax, 'TFI' ; IFT
1998-09-16 08:39:58 +00:00
je skift
1999-03-04 13:04:42 +00:00
cmp eax, 'SLE' ; ELS
1998-09-16 08:39:58 +00:00
je skels
1999-03-04 13:04:42 +00:00
cmp eax, 'FIE' ; EIF
1998-09-16 08:39:58 +00:00
jne skret
call p_eif
dec [sift]
jns skret
1999-08-20 17:15:06 +00:00
resfl m_skip
1998-09-16 08:39:58 +00:00
inc [sift] ;0
skret: ret
skift: call shlelf
inc [sift]
ret
skels: call btself
cmp [sift], 0
jnz skret
jmp fliski
1998-09-23 14:48:58 +00:00
1999-08-20 17:15:06 +00:00
lstrem: call chklst
jnz main
mov di, offset lstspa+1
call putlsp
jmp main
1998-10-03 13:17:18 +00:00
lsteol: call chklst
1998-09-23 14:48:58 +00:00
jnz main
mov di, offset lstspa
call lspeol
1998-10-03 13:17:18 +00:00
call putlnm
jmp main
1998-09-16 08:39:58 +00:00
nskip: mov [labvec], 0
1998-05-10 19:14:44 +00:00
cmp al, ' '
1999-03-04 13:04:42 +00:00
je s_one
1998-05-10 19:14:44 +00:00
cmp al, 9
1999-03-04 13:04:42 +00:00
je s_one
cmp al, ':' ; linia powtarzana
jne labdef
inc si
call getuns
jc unknow
test ax, ax
jz lstrem
jmp s_cmd
labdef: jpass2 deflp2 ; jest etykieta
call flabel ; definicja etykiety w pass 1
1998-09-14 09:48:16 +00:00
jnc ltwice
1998-05-10 19:14:44 +00:00
mov di, [laben]
mov [labvec], di
mov ax, [origin]
1999-03-04 13:04:42 +00:00
stosw ; domyslnie equ *
1998-09-14 09:48:16 +00:00
mov al, m_lnus
1998-09-16 18:44:16 +00:00
mov ah, dl
stosw
1998-05-10 19:14:44 +00:00
mov cx, dx
1998-09-16 18:44:16 +00:00
sub cl, 4
lda si
mov si, offset tlabel
1999-03-04 13:04:42 +00:00
rep movsb ; przepisz nazwe
1998-09-16 18:44:16 +00:00
sta si
mov [laben], di
cmp di, offset t_lab+l_lab-4
1999-03-04 13:04:42 +00:00
jb s_one
1998-09-16 18:44:16 +00:00
error e_tlab
1998-09-14 09:48:16 +00:00
ltwice: error e_twice
1999-03-04 13:04:42 +00:00
deflp2: call rlabel ; definicja etykiety w pass 2
1998-09-14 09:48:16 +00:00
mov ax, [pslab]
mov [labvec], ax
1999-03-04 13:04:42 +00:00
add [pslab], dx ; oznacz jako minieta
1998-05-10 19:14:44 +00:00
1999-03-04 13:04:42 +00:00
s_one: mov ax, 1
s_cmd: mov [times], ax
s_cmd0: lodsb
1998-05-21 13:50:52 +00:00
cmp al, ' '
1999-03-04 13:04:42 +00:00
je s_cmd0
1998-05-21 13:50:52 +00:00
cmp al, 9
1999-03-04 13:04:42 +00:00
je s_cmd0
1998-05-21 13:50:52 +00:00
cmp al, 0dh
jne s_cmd1
cmp [byte high labvec], 0
1999-03-04 13:04:42 +00:00
jne uneol ; niedozwolona linia z sama etykieta
cmp [times], 1
jne uneol ; niedozwolona linia z samym licznikiem
jmp lsteol
1998-05-21 13:50:52 +00:00
s_cmd1: dec si
1998-09-23 14:48:58 +00:00
mov di, offset lstorg
1999-08-20 17:15:06 +00:00
testfl m_norg
1998-09-23 14:48:58 +00:00
jnz nlorg
mov ax, [origin]
1999-03-04 13:04:42 +00:00
call phword ; listuj * hex
1998-09-23 14:48:58 +00:00
mov al, ' '
stosb
nlorg: mov [lstidx], di
1999-03-04 13:04:42 +00:00
mov [cmdvec], si
1999-08-20 17:15:06 +00:00
rdcmd1: resfl m_pair
rdcmd2: mov [scdvec], 0
rdcmd3: lodsw ; wez trzy litery
1998-05-22 16:27:22 +00:00
and ax, 0dfdfh
1998-08-31 11:00:16 +00:00
xchg al, ah
shl eax, 16
mov ah, 0dfh
and ah, [si]
1999-04-17 10:36:00 +00:00
jopcod lbnox ; jezeli nie cytujemy ...
1999-08-20 17:15:06 +00:00
mov [obufpt], offset obuf ; (oprozniamy bufor wyjsciowy)
testfl m_norg
1999-03-04 13:04:42 +00:00
jz lbnox ; ... i nie bylo ORG ...
1998-09-23 14:48:58 +00:00
cmp [byte high labvec], 0
1999-03-04 13:04:42 +00:00
je lbnox ; ... a jest etykieta ...
1998-09-23 14:48:58 +00:00
cmp eax, 'EQU' shl 8
1999-03-04 13:04:42 +00:00
jne noorg ; ... to dozwolony jest tylko EQU
1999-08-20 17:15:06 +00:00
lbnox: inc si
cmp [byte si], ':' ; czy para instrukcji?
jne nopair
jopcod ntopco
inc si
mov [scdvec], si
call get ; w kolejnych trzech literach nie moze byc EOLa
call get
call get
setfl m_pair
nopair: mov di, offset comtab ; przeszukiwanie polowkowe
1998-05-22 16:27:22 +00:00
mov bx, 64*size com
1999-03-04 13:04:42 +00:00
sfcmd1: mov al, [(com di+bx).c_code]
1999-08-20 17:15:06 +00:00
mov [cod], al
mov al, [(com di+bx).c_flag]
cmp eax, [dword (com di+bx).c_flag]
jb sfcmd2
je fncmd
add di, bx
1998-05-10 19:14:44 +00:00
cmp di, offset comend
1999-08-20 17:15:06 +00:00
jb sfcmd2
1998-05-10 19:14:44 +00:00
sub di, bx
1999-08-20 17:15:06 +00:00
sfcmd2: shr bx, 1
1998-05-10 19:14:44 +00:00
cmp bl, 3
ja sfcmd1
mov bl, 0
je sfcmd1
1998-09-06 16:05:14 +00:00
error e_inst
1998-05-10 19:14:44 +00:00
1999-03-04 13:04:42 +00:00
ntrep: error e_crep
1999-04-17 10:36:00 +00:00
ntopco: error e_opcod
1999-03-04 13:04:42 +00:00
1999-08-20 17:15:06 +00:00
ntpair: error e_pair
ntrepa: error e_repa
fncmd: test al, 80h
jz ckcmd1
jopcod ntopco ; nie ma opcoda
ckcmd1: test al, 40h
jz ckcmd2
cmp [times], 1 ; nie mozna powtarzac ...
jne ntrep
testfl m_pair ; ... ani parowac
jnz ntpair
ckcmd2: test al, 20h
jz ckcmd3
test al, 10h ; nie mozna generowac skoku przez dyrektywe
jz rncmd2 ; (dyrektywa neutralna)
resfl m_repa ; skok zabroniony
testfl m_skit
jz rncmd2
eskit: error e_skit
ckcmd3: jopcod ckcmd4
testfl m_skit
jz ckcmd4
inc [origin] ; robimy miejsce na argument skoku
inc [curorg]
inc [obufpt]
ckcmd4: test al, 08h
jz ckcmd5
testfl m_repa ; pseudo instrukcja powtarzania
jz ntrepa
mov ax, [origin]
xchg ax, [reporg]
call bra0
jmp encmd1
ckcmd5: setfl m_repa
test al, 04h
mov ax, [origin]
mov [reporg], ax
jz rncmd2
setfl m_skit ; pseudo instrukcja omijania
mov al, [(com di+bx).c_code]
call savbyt
jmp encmd2
rncmd2: mov al, [cod]
call [(com di+bx).c_vec] ; wywolaj procedure
encmd1: btr [flags], b_skit
jnc encmd2
mov ax, [origin]
sub ax, [reporg]
add ax, 80h
call calcbr
mov [obuf], al
encmd2: call oflush
mov cx, [scdvec]
jcxz encmd3
mov si, cx
jmp rdcmd2
encmd3: call linend
dec [times]
jz main
mov si, [cmdvec]
jmp rdcmd1
; ERROR
errln: call ppline
erron: call prname
print errtxt
pop si
call msgenv
dos 4c02h
; WARNING
warln: call ppline
call prname
print wartxt
pop ax
pop si
push ax
mov [byte exitcod], 1
msgenv: call prline
btr [flags], b_enve
jnc msgenx
print envtxt
msgenx: ret
prname: mov bx, [iclen]
cmp bx, offset t_icl
jna msgenx
mov di, [(icl bx).prev]
push di
lea dx, [(icl di).nam]
mov [byte bx-1], '$'
mov [envnam], dx
sub bx, dx
mov [envlen], bx
print
mov dl, ' '
dos 2
mov dl, '('
dos 2
pop bx
mov eax, [(icl bx).line]
call pridec
mov dl, ')'
dos 2
mov dl, ' '
dos 2
test [swits], m_swe
jz msgenx
les di, [dword envofs]
mov ax, [es:3]
shl ax, 4
sub ax, di
sub ax, offset dectxt+10+19-1
sub ax, [envlen]
add ax, [envnum]
mov [envlen], ax
js senve
mov eax, 'FRRE'
stosd
mov eax, '=ELI'
stosd
mov si, [envnam]
senv1: movsb
cmp [byte si], '$'
jne senv1
xor al, al
stosb
mov eax, 'LRRE'
stosd
mov eax, '=ENI'
stosd
mov si, [envnum]
senv2: movsb
cmp [byte si], '$'
jne senv2
xor ax, ax
stosw
push ds
pop es
ret
senve: setfl m_enve
ret
ppline: mov si, offset line
prline: mov dl, [si]
dos 2
inc si
cmp [byte si-1], 0ah
jne prline
ret
miseif: push offset e_meif
jmp erron
skiten: push offset e_skit
jmp erron
; End of file
1998-10-03 13:17:18 +00:00
skend: call chklst
jnz filend
mov di, offset lstspa+1
call putlsp
1999-03-04 13:04:42 +00:00
filend: call fclose
1998-05-22 16:27:22 +00:00
cmp bx, offset t_icl
ja main
1998-09-06 16:05:14 +00:00
jpass2 fin
1998-05-22 16:27:22 +00:00
1998-09-16 08:39:58 +00:00
cmp [elflag], 1
jne miseif
1999-08-20 17:15:06 +00:00
testfl m_skit
jnz skiten
setfl m_pass+m_norg+m_rorg+m_rqff+m_hdr
1998-09-23 14:48:58 +00:00
and [flist], not m_lsto
jmp npass
1998-05-10 19:14:44 +00:00
1998-05-22 16:27:22 +00:00
fin: mov bx, [ohand]
1999-03-04 13:04:42 +00:00
mov [errmsg], offset e_wrobj
1998-09-23 14:48:58 +00:00
call hclose
test [swits], m_swt
1999-03-04 13:04:42 +00:00
jz nlata ; czy /T ?
cmp [laben], offset t_lab ; ... tak
jbe nlata ; czy tablica pusta ?
cmp [byte tabnam], 0 ; ... nie
jnz oplata ; czy dana nazwa ?
cmp [lhand], nhand ; ... nie
jne latt1 ; czy otwarty listing ?
call opnlst ; ... nie - otworz
1998-09-23 14:48:58 +00:00
jmp latt2
latt1: call plseol
jmp latt2
1999-03-04 13:04:42 +00:00
oplata: call lclose ; zamknij listing
1998-09-23 14:48:58 +00:00
mov dx, offset tabnam
1999-03-04 13:04:42 +00:00
call opntab ; otworz tablica
1998-09-23 14:48:58 +00:00
latt2: mov dx, offset tabtxt
mov cx, tabtxl
call putlad
mov si, offset t_lab
lata1: mov di, offset lstnum
mov eax, ' '
test [(lab si).flags], m_lnus
jz lata2
mov al, 'n'
lata2: test [(lab si).flags], m_ukp1
jz lata3
mov ah, '2'
lata3: stosd
1999-03-04 13:04:42 +00:00
mov ax, [(lab si).l_val]
1998-09-23 14:48:58 +00:00
test [(lab si).flags], m_sign
jz lata4
mov [byte di-1], '-'
neg ax
lata4: call phword
mov al, ' '
stosb
mov cx, (offset (lab)-offset (lab).nam) and 0ffh
add cl, [(lab si).len]
add si, offset (lab).nam
rep movsb
call lspeol
call putlst
cmp si, [laben]
jb lata1
nlata: call lclose
1998-05-10 19:14:44 +00:00
mov eax, [lines]
shr eax, 1
call pridec
print lintxt
mov eax, [bytes]
1998-10-03 13:17:18 +00:00
test eax, eax
jz zrbyt
1998-05-10 19:14:44 +00:00
call pridec
print byttxt
1998-10-03 13:17:18 +00:00
zrbyt: mov ax, [exitcod]
1999-08-20 17:15:06 +00:00
; dos ;!!!!!!
1998-05-10 19:14:44 +00:00
1998-05-22 16:27:22 +00:00
; I/O
1999-03-04 13:04:42 +00:00
xdisk: dos
jnc cloret
push [errmsg]
jmp erron
1998-05-10 19:14:44 +00:00
1998-09-06 16:05:14 +00:00
icler: push offset e_icl
jmp erron
1999-03-04 13:04:42 +00:00
lclose: mov bx, nhand ; mov bx, [lhand]
xchg bx, [lhand] ; mov [lhand], nhand
mov [errmsg], offset e_wrlst
1998-09-23 14:48:58 +00:00
hclose: cmp bx, nhand
je cloret
file 3eh
cloret: ret
1998-09-06 16:05:14 +00:00
fopen: cmp di, offset t_icl+l_icl-2
jnb icler
1998-05-22 16:27:22 +00:00
mov bx, [iclen]
mov [(icl bx).line], 0
1999-03-04 13:04:42 +00:00
mov [(icl bx).flags], 0
1998-05-22 16:27:22 +00:00
lea dx, [(icl bx).nam]
mov [(icl di).prev], bx
mov [iclen], di
file 3d00h, e_open
mov bx, [iclen]
mov bx, [(icl bx).prev]
mov [(icl bx).handle], ax
ret
1999-03-04 13:04:42 +00:00
fread1: mov dx, di
mov cx, 1
1998-05-22 16:27:22 +00:00
fread: mov ah, 3fh
1999-03-04 13:04:42 +00:00
fsrce: mov bx, [iclen]
1998-05-22 16:27:22 +00:00
mov bx, [(icl bx).prev]
mov bx, [(icl bx).handle]
1999-03-04 13:04:42 +00:00
mov [errmsg], offset e_read
1998-05-22 16:27:22 +00:00
call xdisk
test ax, ax
ret
fclose: mov ah, 3eh
1999-03-04 13:04:42 +00:00
call fsrce
1998-05-22 16:27:22 +00:00
mov bx, [iclen]
1998-09-23 14:48:58 +00:00
cmp bx, [srcen]
jne fclos1
mov [srcen], 0
fclos1: mov bx, [(icl bx).prev]
1998-05-22 16:27:22 +00:00
mov [iclen], bx
ret
1999-08-20 17:15:06 +00:00
putwor: mov cx, 2 ; zapisz slowo do pliku
jmp putowo
putbyt: mov cx, 1 ; zapisz bajt
putowo: mov dx, offset oword
mov [oword], ax
putblk: jpass1 putx ; zapisz blok
1998-09-23 14:48:58 +00:00
cmp [ohand], nhand
1999-03-04 13:04:42 +00:00
jne putb1 ; otwarty object ?
1999-08-20 17:15:06 +00:00
push cx dx
1999-03-04 13:04:42 +00:00
mov dx, offset objnam ; ... nie - otworz
1998-09-23 14:48:58 +00:00
xor cx, cx
file 3ch, e_crobj
mov [ohand], ax
print objtxt
1999-08-20 17:15:06 +00:00
pop dx cx
1998-09-23 14:48:58 +00:00
putb1: mov bx, [ohand]
file 40h, e_wrobj
1999-08-20 17:15:06 +00:00
movzx ecx, cx
add [bytes], ecx
1998-05-10 19:14:44 +00:00
putx: ret
1998-09-23 14:48:58 +00:00
orgwor: push ax
call phword
pop ax
1998-05-10 19:14:44 +00:00
jmp putwor
1999-08-20 17:15:06 +00:00
chorg: testfl m_norg
1998-09-23 14:48:58 +00:00
jz putx
noorg: error e_norg
tmorgs: error e_orgs
savwor: push ax
call savbyt
pop ax
mov al, ah
1998-05-10 19:14:44 +00:00
1999-04-17 10:36:00 +00:00
savbyt: jopcod xopco
1999-08-20 17:15:06 +00:00
mov di, [obufpt]
stosb
mov [obufpt], di
testfl m_hdr
1998-09-23 14:48:58 +00:00
jz savb1
1999-08-20 17:15:06 +00:00
call chorg
1998-09-23 14:48:58 +00:00
mov ax, [origin]
1999-08-20 17:15:06 +00:00
testfl m_rorg
1998-09-23 14:48:58 +00:00
jnz borg1
cmp ax, [curorg]
je borg3
borg1: add [orgvec], 2
jpass1 borg2
mov di, offset lstorg
1999-08-20 17:15:06 +00:00
testfl m_rqff
1998-09-23 14:48:58 +00:00
jz noff
mov ax, 0ffffh
call orgwor
mov ax, ' >'
stosw
mov ax, [origin]
noff: call orgwor
mov al, '-'
1998-05-22 16:27:22 +00:00
stosb
1998-09-23 14:48:58 +00:00
mov bx, [orgvec]
mov ax, [bx]
call orgwor
mov ax, ' >'
stosw
mov ax, [origin]
1999-08-20 17:15:06 +00:00
mov [lstidx], di
borg2: resfl m_rorg+m_rqff
1998-09-23 14:48:58 +00:00
borg3: jpass2 borg4
mov di, [orgvec]
stosw
borg4: inc ax
mov [curorg], ax
savb1: inc [origin]
1999-08-20 17:15:06 +00:00
cmp [obufpt], offset obufen
jb oflur
testfl m_skit
jnz eskit
oflush: mov dx, offset obuf
mov cx, [obufpt]
sub cx, dx
jz oflur
mov [obufpt], dx
call putblk
1998-09-23 14:48:58 +00:00
test [flist], m_lsts
1999-08-20 17:15:06 +00:00
jnz oflur
mov bx, offset obuf
1998-09-23 14:48:58 +00:00
mov di, [lstidx]
1999-08-20 17:15:06 +00:00
olst1: cmp di, offset line-3
1998-09-23 14:48:58 +00:00
jae lstxtr
1999-08-20 17:15:06 +00:00
mov al, [bx]
inc bx
1998-09-23 14:48:58 +00:00
call phbyte
mov al, ' '
1999-08-20 17:15:06 +00:00
stosb
loop olst1
olstx: mov [lstidx], di
oflur: ret
lstxtr: cmp di, offset line-1
jae olstx
mov ax, ' +'
stosw
1998-09-23 14:48:58 +00:00
mov [lstidx], di
1999-08-20 17:15:06 +00:00
ret
1998-09-23 14:48:58 +00:00
1998-10-03 13:17:18 +00:00
chklst: mov al, m_lsts
1999-08-20 17:15:06 +00:00
testfl m_skip
1998-10-03 13:17:18 +00:00
jz chkls1
mov al, m_lsts+m_lstc
chkls1: test al, [flist]
1999-08-20 17:15:06 +00:00
linret: ret
1998-10-03 13:17:18 +00:00
1998-09-23 14:48:58 +00:00
; Stwierdza blad, jesli nie spacja, tab lub eol
linend: lodsb
1998-05-22 16:27:22 +00:00
cmp al, 0dh
1998-09-23 14:48:58 +00:00
je linen1
cmp al, ' '
je linen1
cmp al, 9
je linen1
error e_xtra
linen1: test [flist], m_lsts
jnz linret
1999-03-04 13:04:42 +00:00
cmp [times], 1
jne linret
1998-09-23 14:48:58 +00:00
mov di, [lstidx]
1998-10-03 13:17:18 +00:00
putlsp: call putspa
1998-09-23 14:48:58 +00:00
; Listuje linie z numerem
putlnm: mov di, offset lstspa
mov bx, [iclen]
mov bx, [(icl bx).prev]
mov eax, [(icl bx).line]
call numdec
lstlsp: dec di
mov [byte di], ' '
cmp di, offset lstnum
ja lstlsp
mov bx, [iclen]
cmp bx, [srcen]
1999-03-04 13:04:42 +00:00
je nlsrc ; czy zmienil sie asemblowany plik ?
mov [srcen], bx ; ... tak
1998-09-23 14:48:58 +00:00
cmp [lhand], nhand
1999-03-04 13:04:42 +00:00
jne lsrc1 ; otwarty listing ?
call opnlst ; ... nie - otworz
1998-09-23 14:48:58 +00:00
lsrc1: mov dx, offset srctxt
mov cx, offset srctxl
1999-03-04 13:04:42 +00:00
call putlad ; komunikat o nowym source'u
1998-09-23 14:48:58 +00:00
mov bx, [iclen]
mov cx, bx
mov bx, [(icl bx).prev]
lea dx, [(icl bx).nam]
stc
sbb cx, dx
1999-03-04 13:04:42 +00:00
call putlad ; nazwa
1998-09-23 14:48:58 +00:00
call plseol
nlsrc:
test [swits], m_sws
1999-03-04 13:04:42 +00:00
jnz putlst ; jezeli nie ma /S ...
1998-09-23 14:48:58 +00:00
mov si, offset lstnum
1999-03-04 13:04:42 +00:00
mov di, si ; ... zamien spacje na taby
1998-09-23 14:48:58 +00:00
spata1: xor dl, dl
spata2: lodsb
stosb
cmp al, 0ah
je spatax
cmp al, 9
je spata1
dec dx
cmp al, ' '
jne spata2
and dx, 7
jz spata2
mov cx, dx
mov bx, si
spata3: cmp al, [bx]
jne spata2
inc bx
loop spata3
mov [byte di-1], 9
mov si, bx
jmp spata1
spatax: call lsplen
; Zapis linii lstnum o dlug. linlen
putlst: mov dx, offset lstnum
mov cx, [linlen]
putlad: mov bx, [lhand]
file 40h, e_wrlst
1999-08-20 17:15:06 +00:00
ret
1998-09-23 14:48:58 +00:00
opnlst: mov dx, offset lstnam
opntab: xor cx, cx
file 3ch, e_crlst
mov [lhand], ax
print lsttxt
mov dx, offset hello
mov cx, hellen
jmp putlad
plseol: mov dx, offset eoltxt
mov cx, 2
jmp putlad
lspeol: mov ax, 0a0dh
stosw
lsplen: lea ax, [di+zero-lstnum]
mov [linlen], ax
1998-05-22 16:27:22 +00:00
ret
1998-09-23 14:48:58 +00:00
adasx: mov eax, 'XSA'
1999-03-04 13:04:42 +00:00
; Dodaj rozszerzenie nazwy, gdy go nie ma
; we: dx,di-poczatek,koniec nazwy; eax-rozszerzenie
1998-09-23 14:48:58 +00:00
adext: mov bx, di
adex1: dec bx
cmp [byte bx], '\'
je adex2
cmp [byte bx], '.'
je adexr
cmp bx, dx
ja adex1
adex2: mov [byte di-1], '.'
stosd
adexr: ret
1999-03-04 13:04:42 +00:00
; Zapisz dziesietnie eax; di-koniec liczby
1998-09-23 14:48:58 +00:00
numdec: mov ebx, 10
numde1: cdq
1998-05-10 19:14:44 +00:00
div ebx
add dl, '0'
dec di
mov [di], dl
test eax, eax
1998-09-23 14:48:58 +00:00
jnz numde1
ret
1999-03-04 13:04:42 +00:00
; Wyswietl dziesietnie eax
1998-09-23 14:48:58 +00:00
pridec: mov di, offset dectxt+10
call numdec
1998-05-10 19:14:44 +00:00
mov dx, di
1999-08-20 17:15:06 +00:00
mov [envnum], di
1998-05-10 19:14:44 +00:00
print
ret
1999-03-04 13:04:42 +00:00
; Zapisz hex ax od [di]
1998-09-06 16:05:14 +00:00
phword: push ax
mov al, ah
call phbyte
pop ax
1999-08-20 17:15:06 +00:00
phbyte: aam 10h
cmp al, 10
1998-09-06 16:05:14 +00:00
sbb al, 69h
das
1999-08-20 17:15:06 +00:00
xchg al, ah
cmp al, 10
sbb al, 69h
das
stosw
1998-09-06 16:05:14 +00:00
ret
1999-03-04 13:04:42 +00:00
; Pobierz znak (eol=error)
1998-05-21 13:50:52 +00:00
get: lodsb
cmp al, 0dh
je uneol
ret
1998-09-06 16:05:14 +00:00
uneol: error e_uneol
1998-05-21 13:50:52 +00:00
1998-09-06 16:05:14 +00:00
ilchar: error e_char
1998-05-21 13:50:52 +00:00
1999-03-04 13:04:42 +00:00
; Omin spacje i tabulatory
1998-05-21 13:50:52 +00:00
spaces: call get
1998-05-10 19:14:44 +00:00
cmp al, ' '
1998-05-21 13:50:52 +00:00
je space1
1998-05-10 19:14:44 +00:00
cmp al, 9
1998-05-21 13:50:52 +00:00
je space1
1998-09-06 16:05:14 +00:00
error e_spac
1998-05-21 13:50:52 +00:00
space1: call get
cmp al, ' '
je space1
cmp al, 9
je space1
1998-05-10 19:14:44 +00:00
dec si
rstret: ret
1999-03-04 13:04:42 +00:00
; Zapisz spacje od di do line
1998-09-23 14:48:58 +00:00
putspa: mov cx, offset line
sub cx, di
mov al, ' '
rep stosb
1999-03-04 13:04:42 +00:00
mov [lstspa], al
1998-09-23 14:48:58 +00:00
ret
1998-05-21 13:50:52 +00:00
1999-03-04 13:04:42 +00:00
; Pobierz nazwe pliku
1998-05-22 16:27:22 +00:00
rfname: call spaces
mov di, offset (icl).nam
add di, [iclen]
1999-03-04 13:04:42 +00:00
; Pobierz lancuch do [di]
1998-05-21 13:50:52 +00:00
rstr: call get
1998-05-10 19:14:44 +00:00
cmp al, "'"
1998-09-16 08:39:58 +00:00
je rstr0
cmp al, '"'
1998-05-10 19:14:44 +00:00
jne strer
1998-09-16 08:39:58 +00:00
rstr0: mov dx, di
mov ah, al
1998-05-21 13:50:52 +00:00
rstr1: call get
1998-05-10 19:14:44 +00:00
stosb
1998-09-16 08:39:58 +00:00
cmp al, ah
1998-05-10 19:14:44 +00:00
jne rstr1
lodsb
1998-09-16 08:39:58 +00:00
cmp al, ah
1998-05-10 19:14:44 +00:00
je rstr1
dec si
1998-05-22 16:27:22 +00:00
mov [byte di-1], 0
lea cx, [di-1]
sub cx, dx
1998-05-10 19:14:44 +00:00
jnz rstret
1998-09-06 16:05:14 +00:00
strer: error e_str
1998-05-10 19:14:44 +00:00
1999-03-04 13:04:42 +00:00
; Przepisz etykiete do tlabel (wyj: dx-dl.etykiety+4)
1998-05-10 19:14:44 +00:00
rlabel: mov di, offset tlabel
mov [byte di], 0
1998-09-14 09:48:16 +00:00
rlab1: lodsb
1998-05-10 19:14:44 +00:00
cmp al, '0'
1998-09-14 09:48:16 +00:00
jb rlabx
1998-05-10 19:14:44 +00:00
cmp al, '9'
1998-09-14 09:48:16 +00:00
jbe rlab2
1998-05-10 19:14:44 +00:00
cmp al, '_'
1998-09-14 09:48:16 +00:00
je rlab2
1999-08-20 17:15:06 +00:00
and al, 0dfh
cmp al, 'A'
1998-09-14 09:48:16 +00:00
jb rlabx
1999-08-20 17:15:06 +00:00
cmp al, 'Z'
1998-09-14 09:48:16 +00:00
ja rlabx
rlab2: stosb
1998-09-16 18:44:16 +00:00
cmp di, offset tlabel+252
jb rlab1
1999-08-20 17:15:06 +00:00
linlon: push offset e_long
jmp erron
1998-09-16 18:44:16 +00:00
rlabx: cmp [byte tlabel], 'A'
1998-05-10 19:14:44 +00:00
jb ilchar
1998-09-16 18:44:16 +00:00
lea dx, [di+zero-tlabel+lab.nam]
1998-05-10 19:14:44 +00:00
dec si
1998-09-14 09:48:16 +00:00
ret
1999-03-04 13:04:42 +00:00
; Czytaj etykiete i szukaj w t_lab
1998-09-16 18:44:16 +00:00
; wyj: dx-dlugosc etykiety+4
1998-09-14 09:48:16 +00:00
; C=0: znaleziona, bx=adres wpisu
; C=1: nie ma jej
flabel: call rlabel
1998-05-10 19:14:44 +00:00
push si
1998-09-16 18:44:16 +00:00
xor cx, cx
mov si, offset t_lab
mov ax, [laben]
dec ax
flab1: add si, cx
cmp ax, si
1998-09-14 09:48:16 +00:00
jb flabx
1998-09-16 18:44:16 +00:00
mov cl, [(lab si).len]
cmp cl, dl
1998-09-14 09:48:16 +00:00
jne flab1
1998-09-16 18:44:16 +00:00
add si, offset (lab).nam
sub cl, offset (lab).nam
1998-05-10 19:14:44 +00:00
mov di, offset tlabel
repe cmpsb
1998-09-14 09:48:16 +00:00
jne flab1
1998-09-16 18:44:16 +00:00
lea bx, [si+tlabel-offset (lab).nam]
1999-03-04 13:04:42 +00:00
sub bx, di ; c=0
1998-09-14 09:48:16 +00:00
flabx: pop si
1998-05-10 19:14:44 +00:00
ret
1998-09-14 09:48:16 +00:00
wropar: error e_wpar
spaval: call spaces
1999-03-04 13:04:42 +00:00
; Czytaj wyrazenie i zwroc jego wartosc w [val]
1998-08-25 14:47:04 +00:00
; (C=1 wartosc nieokreslona w pass 1)
1998-09-14 09:48:16 +00:00
getval: xor bx, bx
mov [ukp1], bh
push bx
v_lop:
v_par1: inc bh
call get
cmp al, '['
je v_par1
cmp al, '('
je wropar
1998-05-10 19:14:44 +00:00
cmp al, '-'
je valuem
dec si
mov al, '+'
1998-09-14 09:48:16 +00:00
valuem: mov bl, al
xor eax, eax
1998-05-21 13:50:52 +00:00
call get
1998-05-10 19:14:44 +00:00
cmp al, '*'
je valorg
cmp al, "'"
je valchr
1998-09-16 08:39:58 +00:00
cmp al, '"'
je valchr
1998-05-21 13:50:52 +00:00
cmp al, '^'
je valreg
1999-03-04 13:04:42 +00:00
cmp al, '{'
je valquo
mov di, -1
1998-09-14 09:48:16 +00:00
xor edx, edx
mov ecx, 16
1998-05-10 19:14:44 +00:00
cmp al, '$'
je rdnum3
1998-09-14 09:48:16 +00:00
mov cl, 2
1998-05-10 19:14:44 +00:00
cmp al, '%'
je rdnum3
1998-09-14 09:48:16 +00:00
mov cl, 10
1998-05-10 19:14:44 +00:00
cmp al, '9'
ja vlabel
1998-09-06 16:05:14 +00:00
rdnum1: cmp al, '9'
jbe rdnum2
1998-05-10 19:14:44 +00:00
and al, 0dfh
cmp al, 'A'
jb value0
add al, '0'+10-'A'
rdnum2: sub al, '0'
1998-09-14 09:48:16 +00:00
cmp al, cl
1998-05-10 19:14:44 +00:00
jnb value0
1999-03-04 13:04:42 +00:00
movzx edi, al
1998-09-14 09:48:16 +00:00
lda edx
mul ecx
1999-03-04 13:04:42 +00:00
add eax, edi
1998-09-14 09:48:16 +00:00
js toobig
adc edx, edx
1998-05-10 19:14:44 +00:00
jnz toobig
1998-09-14 09:48:16 +00:00
sta edx
1998-05-10 19:14:44 +00:00
rdnum3: lodsb
jmp rdnum1
1998-09-14 09:48:16 +00:00
vlabel: push bx
dec si
call flabel
jnc vlabfn
jpass1 vlukp1
error e_undec
1998-09-30 17:23:10 +00:00
vlabfn: jpass1 vlchuk
1998-10-25 18:44:40 +00:00
and [(lab bx).flags], not m_lnus
1998-09-14 09:48:16 +00:00
cmp bx, [pslab]
1998-09-30 17:23:10 +00:00
jb vlchuk
test [(lab bx).flags], m_ukp1
jz vlukp1
1998-09-14 09:48:16 +00:00
error e_fref
1998-09-30 17:23:10 +00:00
vlchuk: test [(lab bx).flags], m_ukp1
jz vlabkn
1998-09-14 09:48:16 +00:00
vlukp1: mov [ukp1], 0ffh
vlabkn: bt [word (lab bx).flags], b_sign
sbb eax, eax
1999-03-04 13:04:42 +00:00
mov ax, [(lab bx).l_val]
1998-09-14 09:48:16 +00:00
pop bx
jmp value1
1998-09-23 14:48:58 +00:00
valorg: call chorg
mov ax, [origin]
1998-05-10 19:14:44 +00:00
jmp value1
1998-09-16 08:39:58 +00:00
valchr: mov dl, al
call get
cmp al, dl
1998-05-10 19:14:44 +00:00
jne valch1
lodsb
1998-09-16 08:39:58 +00:00
cmp al, dl
1998-05-10 19:14:44 +00:00
jne strer
1998-09-16 08:39:58 +00:00
valch1: cmp dl, [si]
1998-05-10 19:14:44 +00:00
jne strer
1998-09-14 09:48:16 +00:00
inc si
1998-05-10 19:14:44 +00:00
cmp [byte si], '*'
jne value1
inc si
1998-09-14 09:48:16 +00:00
xor al, 80h
1998-05-10 19:14:44 +00:00
jmp value1
1998-05-21 13:50:52 +00:00
valreg: call get
sub al, '0'
1999-08-20 17:15:06 +00:00
cmp al, 4
ja ilchar
1998-05-21 13:50:52 +00:00
add al, 0d0h
mov ah, al
call get
1998-09-06 16:05:14 +00:00
cmp al, '9'
jbe valre1
1998-05-21 13:50:52 +00:00
and al, 0dfh
cmp al, 'A'
1998-09-06 16:05:14 +00:00
jb ilchar
1998-05-21 13:50:52 +00:00
add al, '0'+10-'A'
valre1: sub al, '0'
cmp al, 0fh
ja ilchar
cmp ah, 0d1h
1998-09-14 09:48:16 +00:00
jne value1
1998-05-21 13:50:52 +00:00
sub ax, 0f0h
1999-03-04 13:04:42 +00:00
jmp value1
1999-04-17 10:36:00 +00:00
valquo: jopcod rcopco
1999-03-04 13:04:42 +00:00
push bx
1999-04-17 10:36:00 +00:00
mov [opcosp], sp
1999-03-04 13:04:42 +00:00
mov bp, offset var2
1999-08-20 17:15:06 +00:00
jmp rdcmd3
1999-04-17 10:36:00 +00:00
xopco: mov bp, offset var
mov sp, [opcosp]
1999-08-20 17:15:06 +00:00
mov ah, al
1999-03-04 13:04:42 +00:00
call get
cmp al, '}'
1999-04-17 10:36:00 +00:00
jne msopco
1999-08-20 17:15:06 +00:00
movzx eax, ah
1999-03-04 13:04:42 +00:00
pop bx
jmp value1
1999-04-17 10:36:00 +00:00
rcopco: error e_ropco
1999-03-04 13:04:42 +00:00
1999-04-17 10:36:00 +00:00
msopco: error e_mopco
1998-05-10 19:14:44 +00:00
value0: dec si
1999-03-04 13:04:42 +00:00
test di, di
1998-09-14 09:48:16 +00:00
js ilchar
lda edx
value1: cmp bl, '-'
1998-05-10 19:14:44 +00:00
jne value2
1998-09-14 09:48:16 +00:00
neg eax
value2: push eax
v_par2: dec bh
js mbrack
1998-05-10 19:14:44 +00:00
lodsb
1998-09-14 09:48:16 +00:00
cmp al, ']'
je v_par2
mov ah, [si]
mov di, offset opert2
mov cx, noper2
repne scasw
1999-03-04 13:04:42 +00:00
je foper2 ; operator 2-znakowy
1998-09-14 09:48:16 +00:00
mov cx, noper1
repne scasb
1999-03-04 13:04:42 +00:00
je foper1 ; operator 1-znakowy
test bh, bh ; koniec wyrazenia
jnz mbrack ; musza byc zamkniete nawiasy
1998-05-10 19:14:44 +00:00
dec si
1998-09-14 09:48:16 +00:00
mov di, offset opert1
foper1: sub di, offset opert1
jmp goper
foper2: inc si
sub di, offset opert2
shr di, 1
add di, noper1
goper: lea ax, [di+operpa]
add di, di
add di, ax
mov bl, [di]
1999-03-04 13:04:42 +00:00
mov di, [di+1]
1998-09-14 09:48:16 +00:00
pop eax
v_com: pop cx
cmp cx, bx
jb v_xcm
pop ecx
xchg eax, ecx
pop dx
push offset v_com
push dx
ret
v_xcm: cmp bl, 1
jbe v_xit
1999-03-04 13:04:42 +00:00
push cx di eax bx
1998-09-14 09:48:16 +00:00
jmp v_lop
v_xit: mov [dword val], eax
cmp [ukp1], 1
cmc
1999-08-20 17:15:06 +00:00
jc unsret
1998-10-25 18:44:40 +00:00
wrange: cmp eax, 10000h
1998-09-14 09:48:16 +00:00
cmc
1999-08-20 17:15:06 +00:00
jnb unsret
1998-09-14 09:48:16 +00:00
cmp eax, -0ffffh
jb orange
ret
brange: cmp eax, 100h
1999-08-20 17:15:06 +00:00
jb unsret
1998-09-14 09:48:16 +00:00
cmp eax, -0ffh
jb orange
1998-05-10 19:14:44 +00:00
ret
1998-09-14 09:48:16 +00:00
spauns: call spaces
getuns: call getval
1998-09-30 17:23:10 +00:00
pushf
jnc getun1
jpass1 getun2
getun1: test eax, eax
js orange
getun2: popf
unsret: ret
getpos: call getval
jc unknow
1998-09-14 09:48:16 +00:00
test eax, eax
1998-09-30 17:23:10 +00:00
jg unsret
1998-09-14 09:48:16 +00:00
orange: error e_range
mbrack: error e_brack
1998-09-06 16:05:14 +00:00
toobig: error e_nbig
1998-05-10 19:14:44 +00:00
1999-03-04 13:04:42 +00:00
; Procedury operatorow nie moga zmieniac bx ani di
v_sub: neg ecx ; -
v_add: add eax, ecx ; +
1998-10-03 13:17:18 +00:00
jno v_ret
1998-09-14 09:48:16 +00:00
oflow: error e_over
div0: error e_div0
1999-03-04 13:04:42 +00:00
v_mul: mov edx, ecx ; *
1998-09-14 09:48:16 +00:00
xor ecx, eax
imul edx
test ecx, ecx
js v_mu1
test edx, edx
jnz oflow
test eax, eax
js oflow
ret
v_mu1: inc edx
jnz oflow
test eax, eax
jns oflow
ret
1999-03-04 13:04:42 +00:00
v_div: jecxz div0 ; /
1998-09-14 09:48:16 +00:00
cdq
idiv ecx
ret
1999-03-04 13:04:42 +00:00
v_mod: jecxz div0 ; %
1998-09-14 09:48:16 +00:00
cdq
idiv ecx
sta edx
1999-08-20 17:15:06 +00:00
ret
1998-09-14 09:48:16 +00:00
v_sln: neg ecx
1999-03-04 13:04:42 +00:00
v_sal: test ecx, ecx ; <<
1998-09-14 09:48:16 +00:00
js v_srn
jz v_ret
cmp ecx, 20h
jb v_sl1
test eax, eax
jnz oflow
ret
v_sl1: add eax, eax
jo oflow
loop v_sl1
1999-08-20 17:15:06 +00:00
p_rep:
p_skp:
v_ret: ret
1998-09-14 09:48:16 +00:00
v_srn: neg ecx
1999-03-04 13:04:42 +00:00
v_sar: test ecx, ecx ; >>
1998-09-14 09:48:16 +00:00
js v_sln
cmp ecx, 20h
jb v_sr1
mov cl, 1fh
v_sr1: sar eax, cl
ret
1999-03-04 13:04:42 +00:00
v_and: and eax, ecx ; &
1998-09-14 09:48:16 +00:00
ret
1999-03-04 13:04:42 +00:00
v_or: or eax, ecx ; |
1998-09-14 09:48:16 +00:00
ret
1999-03-04 13:04:42 +00:00
v_xor: xor eax, ecx ; ^
1998-09-14 09:48:16 +00:00
ret
1999-03-04 13:04:42 +00:00
v_equ: cmp eax, ecx ; =
1998-09-14 09:48:16 +00:00
je v_one
v_zer: xor eax, eax
ret
1999-03-04 13:04:42 +00:00
v_one: mov eax, 1
1998-09-14 09:48:16 +00:00
ret
1999-03-04 13:04:42 +00:00
v_neq: cmp eax, ecx ; <> !=
1998-09-14 09:48:16 +00:00
jne v_one
jmp v_zer
1999-03-04 13:04:42 +00:00
v_les: cmp eax, ecx ; <
1998-09-14 09:48:16 +00:00
jl v_one
jmp v_zer
1999-03-04 13:04:42 +00:00
v_grt: cmp eax, ecx ; >
1998-09-14 09:48:16 +00:00
jg v_one
jmp v_zer
1999-03-04 13:04:42 +00:00
v_leq: cmp eax, ecx ; <=
1998-09-14 09:48:16 +00:00
jle v_one
jmp v_zer
1999-03-04 13:04:42 +00:00
v_geq: cmp eax, ecx ; >=
1998-09-14 09:48:16 +00:00
jge v_one
jmp v_zer
1999-03-04 13:04:42 +00:00
v_anl: jecxz v_zer ; &&
1998-09-14 09:48:16 +00:00
test eax, eax
jz v_ret
jmp v_one
1999-03-04 13:04:42 +00:00
v_orl: or eax, ecx ; ||
1998-09-14 09:48:16 +00:00
jz v_ret
jmp v_one
1999-03-04 13:04:42 +00:00
; Pobierz operand rozkazu i rozpoznaj tryb adresowania
1998-05-10 19:14:44 +00:00
getadr: call spaces
lodsb
1998-09-06 16:05:14 +00:00
xor dx, dx
1998-05-10 19:14:44 +00:00
cmp al, '@'
je getadx
cmp al, '#'
1998-09-14 09:48:16 +00:00
je getaim
1998-05-10 19:14:44 +00:00
cmp al, '<'
1998-09-14 09:48:16 +00:00
je getaim
1998-05-10 19:14:44 +00:00
cmp al, '>'
1998-09-14 09:48:16 +00:00
je getaim
1998-05-10 19:14:44 +00:00
mov dl, 8
cmp al, '('
je getad1
dec si
1998-05-22 16:27:22 +00:00
lodsw
and al, 0dfh
1998-09-06 16:05:14 +00:00
mov dl, 2
1998-05-22 16:27:22 +00:00
cmp ax, ':A'
1998-09-06 16:05:14 +00:00
je getad1
inc dx
cmp ax, ':Z'
je getad1
1998-05-22 16:27:22 +00:00
dec si
dec si
1998-09-06 16:05:14 +00:00
xor dx, dx
1998-05-22 16:27:22 +00:00
1998-09-06 16:05:14 +00:00
getad1: push dx
1998-09-14 09:48:16 +00:00
call getuns
1998-05-10 19:14:44 +00:00
sbb al, al
1998-09-06 16:05:14 +00:00
jnz getad2
mov al, [byte high val]
1998-05-22 16:27:22 +00:00
getad2: pop dx
1998-05-10 19:14:44 +00:00
cmp dl, 8
1998-09-06 16:05:14 +00:00
jae getaid
1998-09-14 09:48:16 +00:00
cmp dl, 2
jae getad3
1998-05-10 19:14:44 +00:00
cmp al, 1
1998-09-06 16:05:14 +00:00
adc dl, 2
getad3: lodsw
1998-05-10 19:14:44 +00:00
and ah, 0dfh
1998-09-06 16:05:14 +00:00
mov bl, 2
1998-05-10 19:14:44 +00:00
cmp ax, 'X,'
1998-09-06 16:05:14 +00:00
je getabi
mov bl, 4
1998-05-10 19:14:44 +00:00
cmp ax, 'Y,'
1998-09-06 16:05:14 +00:00
je getabi
1998-05-10 19:14:44 +00:00
dec si
dec si
jmp getadx
1998-09-06 16:05:14 +00:00
getabi: add dl, bl
getaxt: lodsb
cmp al, '+'
je getabx
inc bx
cmp al, '-'
je getabx
dec si
jmp getadx
getabx: mov dh, bl
getadx: lda dx
mov [word amod], ax
ret
1998-09-14 09:48:16 +00:00
getaim: cmp al, '<'
pushf
call getval
popf
jb getai2
je getai1
mov al, ah
getai1: movzx eax, al
mov [dword val], eax
getai2: mov dx, 1
1998-05-10 19:14:44 +00:00
jmp getadx
1998-09-06 16:05:14 +00:00
1998-05-10 19:14:44 +00:00
getaid: lodsb
cmp al, ','
je getaix
cmp al, ')'
1998-09-14 09:48:16 +00:00
jne mparen
1998-05-10 19:14:44 +00:00
lodsw
1999-08-20 17:15:06 +00:00
mov dx, 1009h
mov bl, 14h
1998-09-06 16:05:14 +00:00
cmp ax, '0,'
1999-08-20 17:15:06 +00:00
je getaxt
1998-09-06 16:05:14 +00:00
xor dh, dh
mov bl, 4
1998-05-10 19:14:44 +00:00
and ah, 0dfh
cmp ax, 'Y,'
1998-09-06 16:05:14 +00:00
je getaxt
inc dx
1998-05-10 19:14:44 +00:00
dec si
dec si
jmp getadx
getaix: lodsw
1999-08-20 17:15:06 +00:00
mov dh, 8
1998-09-06 16:05:14 +00:00
cmp ax, ')0'
je getadx
xor dh, dh
1998-05-10 19:14:44 +00:00
and al, 0dfh
cmp ax, ')X'
1998-09-06 16:05:14 +00:00
je getadx
1998-05-10 19:14:44 +00:00
jmp ilchar
p_imp = savbyt
1998-05-21 13:50:52 +00:00
p_ads: call getadr
mov al, [cod]
call savbyt
mov al, 60h
cmp [cod], 18h
je p_as1
mov al, 0e0h
p_as1: mov [cod], al
jmp p_ac1
1998-05-10 19:14:44 +00:00
p_acc: call getadr
1998-09-06 16:05:14 +00:00
p_ac1: mov ax, [word amod]
cmp al, 7
1998-05-10 19:14:44 +00:00
jne acc1
1998-09-06 16:05:14 +00:00
dec [amod]
1999-08-20 17:15:06 +00:00
acc1: cmp ah, 8
1998-09-06 16:05:14 +00:00
jb acc3
mov ax, 0a2h
je acc2
mov al, 0a0h
acc2: call savwor
acc3: mov al, [amod]
mov bx, offset acctab
1998-05-10 19:14:44 +00:00
xlat
test al, al
jz ilamod
or al, [cod]
cmp al, 89h
1998-09-06 16:05:14 +00:00
jne putsfx
ilamod: error e_amod
1998-05-10 19:14:44 +00:00
p_srt: call getadr
cmp al, 6
jnb ilamod
cmp al, 1
je ilamod
mov bx, offset srttab
xlat
or al, [cod]
cmp al, 0c0h
je ilamod
cmp al, 0e0h
je ilamod
1998-09-06 16:05:14 +00:00
putsfx: call putcmd
mov al, [amod+1]
1999-08-20 17:15:06 +00:00
and al, 7
1998-09-06 16:05:14 +00:00
mov bx, offset sfxtab
xlat
test al, al
jnz savbyt
putret: ret
1998-05-10 19:14:44 +00:00
1998-05-22 16:27:22 +00:00
p_inw: call getadr
cmp al, 6
jnb ilamod
sub al, 2
jb ilamod
mov bx, offset inwtab
xlat
push ax
call putcmd
inc [val]
mov ax, 03d0h
test [amod], 1
jz p_iw1
dec ah
p_iw1: call savwor
pop ax
1998-09-06 16:05:14 +00:00
jmp putsfx
1998-05-22 16:27:22 +00:00
1998-05-10 19:14:44 +00:00
p_ldi: call getadr
1998-09-06 16:05:14 +00:00
p_ld1: mov al, [amod]
1998-05-10 19:14:44 +00:00
cmp al, 1
jb ilamod
cmp al, 4
jb ldi1
and al, 0feh
xor al, [cod]
cmp al, 0a4h
jne ilamod
mov al, [amod]
ldi1: mov bx, offset lditab
xlat
putcod: or al, [cod]
1998-09-06 16:05:14 +00:00
jmp putsfx
1998-05-10 19:14:44 +00:00
putcmd: call savbyt
mov al, [amod]
mov bx, offset lentab
xlat
cmp al, 2
jb putret
1998-09-14 09:48:16 +00:00
mov eax, [dword val]
1998-05-10 19:14:44 +00:00
jne savwor
1998-09-06 16:05:14 +00:00
jpass1 putcm1
1998-09-14 09:48:16 +00:00
call brange
1998-05-10 19:14:44 +00:00
putcm1: jmp savbyt
p_sti: call getadr
1998-09-06 16:05:14 +00:00
p_st1: mov al, [amod]
1998-05-10 19:14:44 +00:00
cmp al, 2
jb ilamod
1998-09-06 16:05:14 +00:00
je cod8
1998-05-10 19:14:44 +00:00
cmp al, 3
je cod0
and al, 0feh
xor al, [cod]
cmp al, 80h
jne ilamod
or [amod], 1
mov al, 10h
jmp putcod
cod8: mov al, 8
jmp putcod
cod0: xor al, al
jmp putcod
p_cpi: call getadr
cmp al, 1
jb ilamod
cmp al, 4
jnb ilamod
cmp al, 2
jb cod0
1999-08-20 17:15:06 +00:00
mov al, 0ch
je putcod
1998-05-10 19:14:44 +00:00
mov al, 4
jmp putcod
p_bra: call getadr
1999-08-20 17:15:06 +00:00
and al, 0feh
cmp al, 2
jne ilamod
1998-05-10 19:14:44 +00:00
mov ax, [val]
1999-08-20 17:15:06 +00:00
bra0: jpass1 bra1
call chorg
1998-05-10 19:14:44 +00:00
sub ax, [origin]
add ax, 7eh
1999-08-20 17:15:06 +00:00
call calcbr
1998-05-10 19:14:44 +00:00
mov [byte val], al
1999-03-04 13:04:42 +00:00
bra1: mov al, [cod]
call savbyt
1998-05-10 19:14:44 +00:00
mov al, [byte val]
jmp savbyt
1999-08-20 17:15:06 +00:00
calcbr: test ah, ah
jnz toofar
add al, 80h
ret
1998-09-06 16:05:14 +00:00
toofar: cmp ax, 8080h
jae toofa1
sub ax, 0ffh
neg ax
toofa1: neg ax
1998-09-14 09:48:16 +00:00
mov di, offset brout
1998-09-06 16:05:14 +00:00
call phword
error e_bra
1998-05-10 19:14:44 +00:00
p_jsr: call getadr
mov al, 20h
1998-05-21 13:50:52 +00:00
jmp p_abs
1998-05-10 19:14:44 +00:00
p_bit: call getadr
cmp al, 2
mov al, 2ch
je putcmd
cmp [amod], 3
jne ilamod
mov al, 24h
jmp putcmd
1998-05-21 13:50:52 +00:00
p_juc: call getadr
mov al, [cod]
mov ah, 3
call savwor
jmp p_jp1
1998-05-10 19:14:44 +00:00
p_jmp: call getadr
1998-09-06 16:05:14 +00:00
p_jp1: cmp [amod], 10
je chkbug
jpass1 p_jpu
cmp [cod], 4ch
je p_jpu
1999-08-20 17:15:06 +00:00
testfl m_norg ; nieznany * (przy OPT H-)
jnz p_jpu
mov ax, [val] ; moze branch wystarczy?
1998-09-06 16:05:14 +00:00
sub ax, [origin]
add ax, 80h
test ah, ah
jnz p_jpu
push si
push offset w_bras
call warln
pop si
p_jpu: mov al, 4ch
1998-05-21 13:50:52 +00:00
p_abs: and [amod], 0feh
1998-05-10 19:14:44 +00:00
cmp [amod], 2
1998-09-06 16:05:14 +00:00
je p_jpp
jmp ilamod
chkbug: jpass1 p_jid
cmp [byte val], 0ffh
jne p_jid
push si
push offset w_bugjp
call warln
pop si
p_jid: mov al, 6ch
p_jpp: jmp putcmd
getops: call getadr
1999-03-04 13:04:42 +00:00
lea di, [op1]
1998-09-06 16:05:14 +00:00
call stop
push [word ukp1]
call getadr
pop [word ukp1]
mov [tempsi], si
1999-03-04 13:04:42 +00:00
lea di, [op2]
1998-09-06 16:05:14 +00:00
call stop
movzx bx, [cod]
add bx, offset movtab
1999-03-04 13:04:42 +00:00
ldop1: lea si, [op1]
1998-09-14 09:48:16 +00:00
ldop: lodsd
mov [dword val], eax
1998-09-06 16:05:14 +00:00
lodsw
mov [word amod], ax
ret
1998-09-14 09:48:16 +00:00
stop: mov eax, [dword val]
stosd
1998-09-06 16:05:14 +00:00
mov ax, [word amod]
stosw
ret
1999-03-04 13:04:42 +00:00
mcall1: mov al, [(movt bx).m_code]
1998-09-06 16:05:14 +00:00
mov [cod], al
push bx
1999-03-04 13:04:42 +00:00
call [(movt bx).m_vec]
1998-09-06 16:05:14 +00:00
pop bx
ret
1999-03-04 13:04:42 +00:00
mcall2: mov al, [(movt bx+3).m_code]
1998-09-06 16:05:14 +00:00
mov [cod], al
push bx
1999-03-04 13:04:42 +00:00
call [(movt bx+3).m_vec]
1998-09-06 16:05:14 +00:00
pop bx
ret
1998-05-10 19:14:44 +00:00
1998-09-06 16:05:14 +00:00
p_mvs: call getops
call mcall1
1999-03-04 13:04:42 +00:00
lea si, [op2]
1998-09-06 16:05:14 +00:00
call ldop
p_mvx: call mcall2
mov si, [tempsi]
ret
p_mws: call getops
mov ax, [word amod]
cmp ax, 8
jae ilamod
cmp al, 1
jne p_mw1
mov [byte high val], 0
1998-09-14 09:48:16 +00:00
mov [word val+2], 0
1998-09-06 16:05:14 +00:00
p_mw1: call mcall1
1999-03-04 13:04:42 +00:00
lea si, [op2]
1998-09-06 16:05:14 +00:00
call ldop
cmp [word amod], 8
jae ilamod
call mcall2
call ldop1
cmp [amod], 1
je p_mwi
inc [val]
jmp p_mw2
1998-09-14 09:48:16 +00:00
p_mwi: movzx eax, [byte high val]
1998-09-06 16:05:14 +00:00
cmp [ukp1], ah ;0
jnz p_mwh
cmp al, [byte val]
je p_mw3
1998-09-14 09:48:16 +00:00
p_mwh: mov [dword val], eax
1998-09-06 16:05:14 +00:00
p_mw2: call mcall1
1999-03-04 13:04:42 +00:00
p_mw3: lea si, [op2]
1998-09-06 16:05:14 +00:00
call ldop
inc [val]
jmp p_mvx
1998-09-23 14:48:58 +00:00
p_opt: call spaces
xor cx, cx
1999-08-20 17:15:06 +00:00
opt0: lodsw
1998-09-23 14:48:58 +00:00
and al, 0dfh
cmp al, 'L'
je optlst
cmp al, 'H'
je opthdr
jcxz opter
dec si
dec si
ret
optlst: inc cx
cmp ah, '+'
je optl1
cmp ah, '-'
jne opter
or [flist], m_lsto
1999-08-20 17:15:06 +00:00
opt1: xor al, [si]
and al, 0dfh
jne opt0
opter: error e_opt
1998-09-23 14:48:58 +00:00
optl1: jpass1 opt1
and [flist], not m_lsto
jmp opt1
opthdr: inc cx
cmp ah, '+'
je opth1
cmp ah, '-'
jne opter
1999-08-20 17:15:06 +00:00
resfl m_hdr+m_rqff
1998-09-23 14:48:58 +00:00
jmp opt1
1999-08-20 17:15:06 +00:00
opth1: bts [flags], b_hdr
1998-09-23 14:48:58 +00:00
jc opt1
1999-08-20 17:15:06 +00:00
setfl m_rorg
1998-09-23 14:48:58 +00:00
jmp opt1
1998-05-10 19:14:44 +00:00
1998-09-14 09:48:16 +00:00
p_ert: call spaval
jpass1 equret
test eax, eax
jz equret
error e_user
1998-05-10 19:14:44 +00:00
p_equ: mov di, [labvec]
1998-09-14 09:48:16 +00:00
test di, di
jz nolabl
1999-03-04 13:04:42 +00:00
mov [(lab di).l_val], 0
1998-09-14 09:48:16 +00:00
and [(lab di).flags], not m_sign
call spaval
1998-05-10 19:14:44 +00:00
mov di, [labvec]
1998-08-31 11:00:16 +00:00
jnc equ1
1998-09-14 09:48:16 +00:00
or [(lab di).flags], m_ukp1
1999-03-04 13:04:42 +00:00
equ1: mov [(lab di).l_val], ax
1998-09-14 09:48:16 +00:00
test eax, eax
1998-09-23 14:48:58 +00:00
jns equ2
1998-09-14 09:48:16 +00:00
or [(lab di).flags], m_sign
1998-09-23 14:48:58 +00:00
equ2: test [flist], m_lsts
jnz equret
sta dx
mov di, offset lstorg
mov ax, ' ='
test eax, eax
jns equ3
mov ah, '-'
neg dx
equ3: stosw
lda dx
call phword
mov [lstidx], di
1998-05-10 19:14:44 +00:00
equret: ret
1998-09-06 16:05:14 +00:00
nolabl: error e_label
1998-05-10 19:14:44 +00:00
1999-08-20 17:15:06 +00:00
chkhon: testfl m_hdr
1998-10-04 17:27:10 +00:00
jnz equret
error e_hoff
1998-09-23 14:48:58 +00:00
p_org: call spaces
lodsw
and al, 0dfh
cmp ax, ':F'
je orgff
cmp ax, ':A'
je orgaf
dec si
dec si
jmp orget
1999-08-20 17:15:06 +00:00
orgff: setfl m_rqff
orgaf: setfl m_rorg
1998-10-04 17:27:10 +00:00
call chkhon
1998-09-23 14:48:58 +00:00
orget: call getuns
1998-05-10 19:14:44 +00:00
jc unknow
1999-08-20 17:15:06 +00:00
setorg: resfl m_norg
1998-05-10 19:14:44 +00:00
mov [origin], ax
ret
1998-10-04 17:27:10 +00:00
p_rui: call chkhon
mov ah, 2
1999-08-20 17:15:06 +00:00
call setorg
1998-09-14 09:48:16 +00:00
call spauns
1998-05-22 16:27:22 +00:00
jmp savwor
1998-09-14 09:48:16 +00:00
valuco: call getval
1998-05-21 13:50:52 +00:00
jc unknow
call get
cmp al, ','
jne badsin
mov ax, [val]
ret
1998-09-06 16:05:14 +00:00
badsin: error e_sin
1998-05-21 13:50:52 +00:00
1998-05-10 19:14:44 +00:00
p_dta: call spaces
1998-05-21 13:50:52 +00:00
dta1: call get
1998-05-10 19:14:44 +00:00
and al, 0dfh
mov [cod], al
cmp al, 'A'
je dtan1
cmp al, 'B'
je dtan1
cmp al, 'L'
je dtan1
cmp al, 'H'
je dtan1
cmp al, 'C'
je dtat1
cmp al, 'D'
je dtat1
1998-09-16 08:39:58 +00:00
cmp al, 'R'
je dtar1
1998-05-10 19:14:44 +00:00
jmp ilchar
dtan1: lodsb
cmp al, '('
1998-09-14 09:48:16 +00:00
jne mparen
1998-05-10 19:14:44 +00:00
1998-05-21 13:50:52 +00:00
dtan2: lodsd
and eax, 0ffdfdfdfh
cmp eax, '(NIS'
jne dtansi
call valuco
1998-10-25 18:44:40 +00:00
mov [sinadd], eax
1998-05-21 13:50:52 +00:00
call valuco
1998-10-25 18:44:40 +00:00
mov [sinamp], eax
1998-09-30 17:23:10 +00:00
call getpos
1998-05-21 13:50:52 +00:00
mov [sinsiz], ax
mov [sinmin], 0
dec ax
mov [sinmax], ax
call get
cmp al, ')'
je presin
cmp al, ','
jne badsin
call valuco
1998-09-14 09:48:16 +00:00
test eax, eax
1998-05-21 13:50:52 +00:00
js badsin
mov [sinmin], ax
1998-09-14 09:48:16 +00:00
call getuns
1998-05-21 13:50:52 +00:00
jc unknow
cmp ax, [sinmin]
jb badsin
mov [sinmax], ax
lodsb
cmp al, ')'
1998-09-14 09:48:16 +00:00
jne mparen
1998-05-21 13:50:52 +00:00
presin: finit
fldpi
fld st
faddp st(1), st
1998-08-25 14:47:04 +00:00
fidiv [sinsiz]
1998-05-21 13:50:52 +00:00
gensin: fild [sinmin]
fmul st, st(1)
fsin
1998-08-25 14:47:04 +00:00
fimul [sinamp]
1998-10-25 18:44:40 +00:00
fiadd [sinadd]
fistp [dword val]
1998-09-06 16:05:14 +00:00
inc [sinmin]
1998-10-25 18:44:40 +00:00
mov eax, [dword val]
call wrange
1998-05-21 13:50:52 +00:00
jmp dtasto
dtansi: sub si, 4
1998-09-14 09:48:16 +00:00
call getval
1998-09-23 14:48:58 +00:00
dtasto: mov al, [cod]
cmp al, 'A'
je dtana
jpass1 dtans
1998-05-10 19:14:44 +00:00
cmp al, 'L'
je dtanl
cmp al, 'H'
je dtanh
1998-09-23 14:48:58 +00:00
mov eax, [dword val]
1998-09-14 09:48:16 +00:00
call brange
jmp dtans
1998-05-10 19:14:44 +00:00
1998-09-23 14:48:58 +00:00
dtana: mov ax, [val]
call savwor
jmp dtanx
1998-05-10 19:14:44 +00:00
dtanl: mov al, [byte low val]
jmp dtans
dtanh: mov al, [byte high val]
dtans: call savbyt
1998-05-21 13:50:52 +00:00
dtanx: mov ax, [sinmin]
cmp ax, [sinmax]
jbe gensin
lodsb
1998-05-10 19:14:44 +00:00
cmp al, ','
je dtan2
cmp al, ')'
je dtanxt
1998-09-14 09:48:16 +00:00
mparen: error e_paren
1998-05-10 19:14:44 +00:00
1998-09-06 16:05:14 +00:00
unknow: error e_uknow
1998-05-10 19:14:44 +00:00
dtat1: mov di, offset tlabel
call rstr
lodsb
mov ah, 80h
cmp al, '*'
je dtat2
dec si
xor ah, ah
dtat2: push si
1998-05-22 16:27:22 +00:00
mov si, dx
1998-05-10 19:14:44 +00:00
dtatm: lodsb
xor al, ah
cmp [cod], 'D'
jne ascinx
mov dl, 60h
and dl, al
jz ascin1
cmp dl, 60h
je ascinx
sub al, 60h
ascin1: add al, 40h
1998-09-23 14:48:58 +00:00
ascinx: push ax cx
1998-05-10 19:14:44 +00:00
call savbyt
1998-09-23 14:48:58 +00:00
pop cx ax
1998-05-10 19:14:44 +00:00
loop dtatm
pop si
dtanxt: lodsb
cmp al, ','
je dta1
dec si
ret
1999-03-04 13:04:42 +00:00
; Zapisz liczbe rzeczywista
1998-09-16 08:39:58 +00:00
dtar1: lodsb
cmp al, '('
jne mparen
dtar2: xor bx, bx
xor edx, edx
xor cx, cx
call getsgn
dreal1: call getdig
jnc dreal2
cmp al, '.'
je drealp
test bh, bh
jnz drealz
jmp ilchar
dreal2: mov bh, 1
test al, al
jz dreal1
dec cx
dreal3: inc cx
call putdig
call getdig
jnc dreal3
cmp al, '.'
je drealp
and al, 0dfh
cmp al, 'E'
jne drealf
dreale: call getsgn
call getdig
jc ilchar
mov ah, al
call getdig
jnc dreal4
shr ax, 8
dreal4: aad
add di, di
jnc drealn
neg ax
drealn: add cx, ax
jmp drealf
dreal5: test edx, edx
jnz dreal9
test bl, bl
jnz dreal9
dec cx
dreal9: call putdig
drealp: call getdig
jnc dreal5
and al, 0dfh
cmp al, 'E'
je dreale
drealf: test edx, edx
jnz drealx
test bl, bl
jnz drealx
drealz: xor ax, ax
xor edx, edx
jmp dreals
drealx: add cx, 80h
cmp cx, 20h
js drealz
cmp cx, 0e2h
jnb toobig
add di, di
rcr cl, 1
mov al, 10h
jc dreal7
cmp bl, al
mov al, 1
jb dreal7
shrd edx, ebx, 4
shr bl, 4
jmp dreal8
dreal6: shld ebx, edx, 4
shl edx, 4
dreal7: cmp bl, al
jb dreal6
dreal8: lda cx
mov ah, bl
dreals: rol edx, 16
push edx
call savwor
pop ax
xchg ah, al
call savwor
pop ax
xchg ah, al
call savwor
dec si
lodsb
cmp al, ','
je dtar2
cmp al, ')'
jne mparen
jmp dtanxt
putdig: cmp bl, 10h
jnb rlret
shld ebx, edx, 4
shl edx, 4
add dl, al
ret
getsgn: call get
cmp al, '-'
stc
je sgnret
cmp al, '+'
1999-08-20 17:15:06 +00:00
je sgnret ; C=0
1998-09-16 08:39:58 +00:00
dec si
sgnret: rcr di, 1
rlret: ret
getdig: call get
cmp al, '0'
jb rlret
cmp al, '9'+1
cmc
jb rlret
sub al, '0'
ret
1998-05-22 16:27:22 +00:00
p_icl: call rfname
1998-05-21 13:50:52 +00:00
pop ax
1998-09-23 14:48:58 +00:00
push di
1998-05-21 13:50:52 +00:00
call linend
1998-09-23 14:48:58 +00:00
mov dx, offset (icl).nam
add dx, [iclen]
pop di
call adasx
1998-05-10 19:14:44 +00:00
jmp opfile
1998-05-22 16:27:22 +00:00
p_ins: call rfname
1998-09-30 17:23:10 +00:00
xor eax, eax
mov [insofs], eax
mov [inslen], ax
lodsb
cmp al, ','
jne p_ii2
push di
call getval
jc unknow
mov [insofs], eax
lodsb
cmp al, ','
jne p_ii1
call getpos
mov [inslen], ax
inc si
p_ii1: pop di
p_ii2: dec si
1998-05-22 16:27:22 +00:00
push si
1998-09-30 17:23:10 +00:00
call fopen
mov dx, [word insofs]
mov cx, [word high insofs]
mov ax, 4200h
jcxz p_ip1
mov al, 2
1999-03-04 13:04:42 +00:00
p_ip1: call fsrce
1998-09-30 17:23:10 +00:00
p_in1: mov cx, [inslen]
jcxz p_in2
test ch, ch
jz p_in3
p_in2: mov cx, 256
p_in3: mov dx, offset tlabel
1998-05-22 16:27:22 +00:00
call fread
1998-09-23 14:48:58 +00:00
jz p_inx
1998-05-22 16:27:22 +00:00
cwde
mov bx, [iclen]
mov bx, [(icl bx).prev]
add [(icl bx).line], eax
1998-09-23 14:48:58 +00:00
mov si, offset tlabel
1998-09-30 17:23:10 +00:00
push ax
1998-05-22 16:27:22 +00:00
sta cx
1998-09-30 17:23:10 +00:00
p_inp: lodsb
1998-09-23 14:48:58 +00:00
push cx
call savbyt
pop cx
1998-09-30 17:23:10 +00:00
loop p_inp
pop ax
cmp [inslen], 0
jz p_in1
sub [inslen], ax
jnz p_in1
1998-09-23 14:48:58 +00:00
p_inx: call fclose
1998-05-22 16:27:22 +00:00
pop si
1998-09-30 17:23:10 +00:00
cmp [inslen], 0
jz rlret
error e_fshor
1998-05-22 16:27:22 +00:00
1998-05-10 19:14:44 +00:00
p_end: pop ax
1998-05-21 13:50:52 +00:00
call linend
1998-05-10 19:14:44 +00:00
jmp filend
1998-09-16 08:39:58 +00:00
shlelf: shl [elflag], 1
jnc cndret
error e_tmift
btself: bts [elflag], 0
jnc cndret
error e_eifex
p_ift: call spaval
jc unknow
call shlelf
test eax, eax
jz fliski
cndret: ret
p_els: cmp [elflag], 1
je misift
call btself
1999-08-20 17:15:06 +00:00
fliski: xorfl m_skip
1998-09-16 08:39:58 +00:00
ret
p_eif: shr [elflag], 1
jnz cndret
misift: error e_mift
1998-05-22 16:27:22 +00:00
; addressing modes:
; 0-@ 1-# 2-A 3-Z 4-A,X 5-Z,X 6-A,Y 7-Z,Y 8-(Z,X) 9-(Z),Y 10-(A)
1998-05-10 19:14:44 +00:00
lentab db 1,2,3,2,3,2,3,2,2,2,3
acctab db 0,9,0dh,5,1dh,15h,19h,19h,1,11h,0
srttab db 0ah,0,0eh,6,1eh,16h
lditab db 0,0,0ch,4,1ch,14h,1ch,14h
1998-05-22 16:27:22 +00:00
inwtab db 0eeh,0e6h,0feh,0f6h
1999-08-20 17:15:06 +00:00
; pseudo-adr modes: 2-X+ 3-X- 4-Y+ 5-Y-
; +8-,0) +16-),0
sfxtab db 0,0,0e8h,0cah,0c8h,088h
1998-09-06 16:05:14 +00:00
movtab movt <0a0h,p_ac1>,<080h,p_ac1>
movt <0a2h,p_ld1>,<086h,p_st1>
movt <0a0h,p_ld1>,<084h,p_st1>
1998-05-10 19:14:44 +00:00
1999-08-20 17:15:06 +00:00
comtab: cmd ADC0060p_acc
cmd ADD8018p_ads
cmd AND0020p_acc
cmd ASL0000p_srt
cmd BCC0090p_bra
cmd BCS00b0p_bra
cmd BEQ00f0p_bra
cmd BIT002cp_bit
cmd BMI0030p_bra
cmd BNE00d0p_bra
cmd BPL0010p_bra
cmd BRK0000p_imp
cmd BVC0050p_bra
cmd BVS0070p_bra
cmd CLC0018p_imp
cmd CLD00d8p_imp
cmd CLI0058p_imp
cmd CLV00b8p_imp
cmd CMP00c0p_acc
cmd CPX00e0p_cpi
cmd CPY00c0p_cpi
cmd DEC00c0p_srt
cmd DEX00cap_imp
cmd DEY0088p_imp
cmd DTA8000p_dta
cmd EIFe000p_eif
cmd ELSe000p_els
cmd ENDe000p_end
cmd EOR0040p_acc
cmd EQUe000p_equ
cmd ERTe000p_ert
cmd ICLe000p_icl
cmd IFTe000p_ift
cmd INC00e0p_srt
cmd INIf0e2p_rui
cmd INSf000p_ins
cmd INW8000p_inw
cmd INX00e8p_imp
cmd INY00c8p_imp
cmd JCC80b0p_juc
cmd JCS8090p_juc
cmd JEQ80d0p_juc
cmd JMI8010p_juc
cmd JMP004cp_jmp
cmd JNE80f0p_juc
cmd JPL8030p_juc
cmd JSR0020p_jsr
cmd JVC8070p_juc
cmd JVS8050p_juc
cmd LDA00a0p_acc
cmd LDX00a2p_ldi
cmd LDY00a0p_ldi
cmd LSR0040p_srt
cmd MVA8000p_mvs
cmd MVX8006p_mvs
cmd MVY800cp_mvs
cmd MWA8000p_mws
cmd MWX8006p_mws
cmd MWY800cp_mws
cmd NOP00eap_imp
cmd OPTe000p_opt
cmd ORA0000p_acc
cmd ORGf000p_org
cmd PHA0048p_imp
cmd PHP0008p_imp
cmd PLA0068p_imp
cmd PLP0028p_imp
cmd RCC8890p_rep
cmd RCS88b0p_rep
cmd REQ88f0p_rep
cmd RMI8830p_rep
cmd RNE88d0p_rep
cmd ROL0020p_srt
cmd ROR0060p_srt
cmd RPL8810p_rep
cmd RTI0040p_imp
cmd RTS0060p_imp
cmd RUNf0e0p_rui
cmd RVC8850p_rep
cmd RVS8870p_rep
cmd SBC00e0p_acc
cmd SCC8490p_skp
cmd SCS84b0p_skp
cmd SEC0038p_imp
cmd SED00f8p_imp
cmd SEI0078p_imp
cmd SEQ84f0p_skp
cmd SMI8430p_skp
cmd SNE84d0p_skp
cmd SPL8410p_skp
cmd STA0080p_acc
cmd STX0086p_sti
cmd STY0084p_sti
cmd SUB8038p_ads
cmd SVC8450p_skp
cmd SVS8470p_skp
cmd TAX00aap_imp
cmd TAY00a8p_imp
cmd TSX00bap_imp
cmd TXA008ap_imp
cmd TXS009ap_imp
cmd TYA0098p_imp
1998-05-10 19:14:44 +00:00
comend:
1998-09-14 09:48:16 +00:00
operpa: opr 1ret
opr 5add
opr 5sub
opr 6mul
opr 6div
opr 6mod
opr 6and
opr 5or
opr 5xor
opr 4equ
opr 4les
opr 4grt
opr 6sal
opr 6sar
opr 4leq
opr 4geq
opr 4neq
opr 4neq
opr 3anl
opr 2orl
opert2 db '<<>><=>=<>!=&&||'
noper2 = ($-opert2)/2
opert1 db '+-*/%&|^=<>'
noper1 = $-opert1
1999-08-20 17:15:06 +00:00
swilet db 'TSONLIEC'
1998-09-23 14:48:58 +00:00
1999-08-20 17:15:06 +00:00
hello db 'X-Assembler 2.2 by Fox/Taquart',eot
1998-09-23 14:48:58 +00:00
hellen = $-hello-1
usgtxt db "Syntax: XASM source [options]",eol
db "/c List false conditionals",eol
1999-08-20 17:15:06 +00:00
db "/e Set environment variables on error",eol
1998-09-23 14:48:58 +00:00
db "/i Don't list included source",eol
db "/l[:fname] Generate listing",eol
1999-08-20 17:15:06 +00:00
db "/n Assemble only if source newer than object",eol
1998-09-23 14:48:58 +00:00
db "/o:fname Write object as 'fname'",eol
db "/s Don't convert spaces to tabs in listing",eol
db "/t[:fname] List label table",eot
1999-08-20 17:15:06 +00:00
oldtxt db 'Source is older than object - not assembling',eot
envtxt db 'Can''t change environment',eot
1998-09-23 14:48:58 +00:00
objtxt db 'Writing object...',eot
lsttxt db 'Writing listing...'
eoltxt db eot
srctxt db 'Source: '
srctxl = $-srctxt
tabtxt db 'Label table:',eol
tabtxl = $-tabtxt
lintxt db ' lines of source assembled',eot
byttxt db ' bytes written to object',eot
1998-05-10 19:14:44 +00:00
dectxt db 10 dup(' '),'$'
1998-09-06 16:05:14 +00:00
wartxt db 'WARNING: $'
w_bugjp db 'Buggy indirect jump',eol
w_bras db 'Branch would be sufficient',eol
errtxt db 'ERROR: $'
e_open db 'Can''t open file',eol
e_read db 'Disk read error',eol
1998-09-23 14:48:58 +00:00
e_crobj db 'Can''t write object',eol
e_wrobj db 'Error writing object',eol
e_crlst db 'Can''t write listing',eol
e_wrlst db 'Error writing listing',eol
1998-09-06 16:05:14 +00:00
e_icl db 'Too many files nested',eol
e_long db 'Line too long',eol
e_uneol db 'Unexpected eol',eol
e_char db 'Illegal character',eol
e_twice db 'Label declared twice',eol
e_inst db 'Illegal instruction',eol
e_nbig db 'Number too big',eol
e_xtra db 'Extra characters on line',eol
e_label db 'Label name required',eol
e_str db 'String error',eol
e_orgs db 'Too many ORGs',eol
1998-09-14 09:48:16 +00:00
e_paren db 'Need parenthesis',eol
1998-09-06 16:05:14 +00:00
e_tlab db 'Too many labels',eol
1998-09-14 09:48:16 +00:00
e_amod db 'Illegal addressing mode',eol
1998-09-06 16:05:14 +00:00
e_bra db 'Branch out of range by $'
1998-09-14 09:48:16 +00:00
brout db ' bytes',eol
1998-09-06 16:05:14 +00:00
e_sin db 'Bad or missing sinus parameter',eol
e_spac db 'Space expected',eol
1998-09-23 14:48:58 +00:00
e_opt db 'Invalid options',eol
1998-09-14 09:48:16 +00:00
e_over db 'Arithmetic overflow',eol
e_div0 db 'Divide by zero',eol
e_range db 'Value out of range',eol
e_uknow db 'Label not defined before',eol
e_undec db 'Undeclared label',eol
e_fref db 'Illegal forward reference',eol
e_wpar db 'Use square brackets instead',eol
1999-03-04 13:04:42 +00:00
e_brack db 'No matching bracket',eol
1998-09-14 09:48:16 +00:00
e_user db 'User error',eol
1998-09-16 08:39:58 +00:00
e_tmift db 'Too many IFTs nested',eol
e_eifex db 'EIF expected',eol
e_mift db 'Missing IFT',eol
e_meif db 'Missing EIF',eol
1998-09-23 14:48:58 +00:00
e_norg db 'No ORG specified',eol
1998-09-30 17:23:10 +00:00
e_fshor db 'File is too short',eol
1998-10-04 17:27:10 +00:00
e_hoff db 'Illegal when headers off',eol
1999-03-04 13:04:42 +00:00
e_crep db 'Can''t repeat this directive',eol
1999-04-17 10:36:00 +00:00
e_opcod db 'Can''t get op-code of this',eol
e_ropco db 'Nested op-codes not supported',eol
e_mopco db 'Missing ''}''',eol
1999-08-20 17:15:06 +00:00
e_pair db 'Can''t pair this directive',eol
e_skit db 'Can''t skip over it',eol
e_repa db 'No instruction to repeat',eol
1998-09-06 16:05:14 +00:00
exitcod dw 4c00h
1998-09-23 14:48:58 +00:00
ohand dw nhand
lhand dw nhand
1999-08-20 17:15:06 +00:00
flags dw m_norg+m_rorg+m_rqff+m_hdr
1998-09-23 14:48:58 +00:00
swits db 0
sift db 0
1998-05-10 19:14:44 +00:00
lines dd 0
bytes dd 0
1998-09-23 14:48:58 +00:00
srcen dw 0
1998-05-22 16:27:22 +00:00
iclen dw t_icl
1998-09-16 18:44:16 +00:00
laben dw t_lab
pslab dw t_lab
1998-09-16 08:39:58 +00:00
elflag dd 1
1998-05-21 13:50:52 +00:00
sinmin dw 1
sinmax dw 0
1998-10-25 18:44:40 +00:00
sinadd dd ?
sinamp dd ?
1998-05-21 13:50:52 +00:00
sinsiz dw ?
1998-09-23 14:48:58 +00:00
flist db ?
1999-03-04 13:04:42 +00:00
fslen dw ?
times dw ?
cmdvec dw ?
1999-08-20 17:15:06 +00:00
scdvec dw ?
1999-04-17 10:36:00 +00:00
opcosp dw ?
1999-03-04 13:04:42 +00:00
insofs dd ?
inslen dw ?
1998-05-10 19:14:44 +00:00
origin dw ?
1998-09-23 14:48:58 +00:00
curorg dw ?
orgvec dw ?
1999-08-20 17:15:06 +00:00
reporg dw ?
1998-09-23 14:48:58 +00:00
linlen dw ?
lstidx dw ?
1999-03-04 13:04:42 +00:00
labvec dw ?
1999-08-20 17:15:06 +00:00
obufpt dw ?
oword dw ?
objmod dd ?
1998-09-14 09:48:16 +00:00
op1 dd ?
dw ?
op2 dd ?
dw ?
1999-03-04 13:04:42 +00:00
tempsi dw ?
errmsg dw ?
1999-08-20 17:15:06 +00:00
envofs dw ?
envseg dw ?
envnam dw ?
envnum dw ?
envlen dw ?
1999-03-04 13:04:42 +00:00
var:
MACRO bb _name
_name&o = $-var
_name equ byte bp+_name&o
db ?
ENDM
MACRO bw _name
_name&o = $-var
_name equ word bp+_name&o
dw ?
ENDM
bw val
dw ?
bb amod
db ?
bb ukp1
db ?
bb cod
var2 db ($-var) dup(?)
1998-05-10 19:14:44 +00:00
1998-09-23 14:48:58 +00:00
IFNDEF compak
undata
ENDIF
1998-09-14 09:48:16 +00:00
t_lab db l_lab dup(?)
1998-05-10 19:14:44 +00:00
ENDS
END start