mirror of
https://github.com/pfusik/xasm.git
synced 2024-12-22 15:31:23 +00:00
X-Assembler 1.8.
This commit is contained in:
parent
5213b3a799
commit
94cbe9523c
72
xasm.asm
72
xasm.asm
@ -4,7 +4,7 @@
|
|||||||
P386
|
P386
|
||||||
MODEL TINY
|
MODEL TINY
|
||||||
CODESEG
|
CODESEG
|
||||||
ORG 100h
|
zero db 100h dup(?)
|
||||||
start:
|
start:
|
||||||
db 5*1024 dup(0) ;for packing
|
db 5*1024 dup(0) ;for packing
|
||||||
|
|
||||||
@ -26,13 +26,13 @@ nam db ?
|
|||||||
ENDS
|
ENDS
|
||||||
|
|
||||||
STRUC lab
|
STRUC lab
|
||||||
prev dw ?
|
|
||||||
val dw ?
|
val dw ?
|
||||||
flags db ?
|
flags db ?
|
||||||
b_sign = 7
|
b_sign = 7
|
||||||
m_sign = 80h
|
m_sign = 80h
|
||||||
m_lnus = 40h
|
m_lnus = 40h
|
||||||
m_ukp1 = 20h
|
m_ukp1 = 20h
|
||||||
|
len db ?
|
||||||
nam db ?
|
nam db ?
|
||||||
ENDS
|
ENDS
|
||||||
|
|
||||||
@ -240,34 +240,30 @@ nskip: mov [labvec], 0
|
|||||||
jpass2 deflp2
|
jpass2 deflp2
|
||||||
call flabel
|
call flabel
|
||||||
jnc ltwice
|
jnc ltwice
|
||||||
push si
|
|
||||||
mov si, offset tlabel
|
|
||||||
mov di, [laben]
|
mov di, [laben]
|
||||||
mov [labvec], di
|
mov [labvec], di
|
||||||
scasw ;add di, 2
|
|
||||||
mov ax, [origin]
|
mov ax, [origin]
|
||||||
stosw
|
stosw
|
||||||
mov al, m_lnus
|
mov al, m_lnus
|
||||||
stosb
|
mov ah, dl
|
||||||
mov cx, dx
|
|
||||||
rep movsb
|
|
||||||
mov ax, di
|
|
||||||
cmp ax, offset t_lab+l_lab-5
|
|
||||||
jnb tmlab
|
|
||||||
xchg ax, [laben]
|
|
||||||
stosw
|
stosw
|
||||||
pop si
|
mov cx, dx
|
||||||
jmp s_cmd
|
sub cl, 4
|
||||||
|
lda si
|
||||||
|
mov si, offset tlabel
|
||||||
|
rep movsb
|
||||||
|
sta si
|
||||||
|
mov [laben], di
|
||||||
|
cmp di, offset t_lab+l_lab-4
|
||||||
|
jb s_cmd
|
||||||
|
error e_tlab
|
||||||
|
|
||||||
ltwice: error e_twice
|
ltwice: error e_twice
|
||||||
tmlab: error e_tlab
|
|
||||||
|
|
||||||
deflp2: call rlabel
|
deflp2: call rlabel
|
||||||
mov ax, [pslab]
|
mov ax, [pslab]
|
||||||
mov [labvec], ax
|
mov [labvec], ax
|
||||||
add ax, offset (lab).nam
|
add [pslab], dx
|
||||||
add ax, dx
|
|
||||||
mov [pslab], ax
|
|
||||||
|
|
||||||
s_cmd: lodsb
|
s_cmd: lodsb
|
||||||
cmp al, ' '
|
cmp al, ' '
|
||||||
@ -569,7 +565,7 @@ rstr1: call get
|
|||||||
|
|
||||||
strer: error e_str
|
strer: error e_str
|
||||||
|
|
||||||
; Przepisuje etykiete do tlabel (wyj: dx-dl.etykiety)
|
; Przepisuje etykiete do tlabel (wyj: dx-dl.etykiety+4)
|
||||||
rlabel: mov di, offset tlabel
|
rlabel: mov di, offset tlabel
|
||||||
mov [byte di], 0
|
mov [byte di], 0
|
||||||
rlab1: lodsb
|
rlab1: lodsb
|
||||||
@ -589,34 +585,38 @@ rlab1: lodsb
|
|||||||
ja rlabx
|
ja rlabx
|
||||||
add al, 'A'-'a'
|
add al, 'A'-'a'
|
||||||
rlab2: stosb
|
rlab2: stosb
|
||||||
jmp rlab1
|
cmp di, offset tlabel+252
|
||||||
rlabx: mov dx, di
|
jb rlab1
|
||||||
mov di, offset tlabel
|
jmp linlon
|
||||||
cmp [byte di], 'A'
|
rlabx: cmp [byte tlabel], 'A'
|
||||||
jb ilchar
|
jb ilchar
|
||||||
sub dx, di
|
lea dx, [di+zero-tlabel+lab.nam]
|
||||||
dec si
|
dec si
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Czyta etykiete i szuka w t_lab
|
; Czyta etykiete i szuka w t_lab
|
||||||
; wyj: dx-dlugosc etykiety
|
; wyj: dx-dlugosc etykiety+4
|
||||||
; C=0: znaleziona, bx=adres wpisu
|
; C=0: znaleziona, bx=adres wpisu
|
||||||
; C=1: nie ma jej
|
; C=1: nie ma jej
|
||||||
flabel: call rlabel
|
flabel: call rlabel
|
||||||
push si
|
push si
|
||||||
mov bx, [laben]
|
xor cx, cx
|
||||||
flab1: cmp bx, offset t_lab
|
mov si, offset t_lab
|
||||||
|
mov ax, [laben]
|
||||||
|
dec ax
|
||||||
|
flab1: add si, cx
|
||||||
|
cmp ax, si
|
||||||
jb flabx
|
jb flabx
|
||||||
lea cx, [bx-5]
|
mov cl, [(lab si).len]
|
||||||
mov bx, [(lab bx).prev]
|
cmp cl, dl
|
||||||
sub cx, bx
|
|
||||||
cmp cx, dx
|
|
||||||
jne flab1
|
jne flab1
|
||||||
lea si, [(lab bx).nam]
|
add si, offset (lab).nam
|
||||||
|
sub cl, offset (lab).nam
|
||||||
mov di, offset tlabel
|
mov di, offset tlabel
|
||||||
repe cmpsb
|
repe cmpsb
|
||||||
jne flab1
|
jne flab1
|
||||||
clc
|
lea bx, [si+tlabel-offset (lab).nam]
|
||||||
|
sub bx, di ;c=0
|
||||||
flabx: pop si
|
flabx: pop si
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -1835,7 +1835,7 @@ noper2 = ($-opert2)/2
|
|||||||
opert1 db '+-*/%&|^=<>'
|
opert1 db '+-*/%&|^=<>'
|
||||||
noper1 = $-opert1
|
noper1 = $-opert1
|
||||||
|
|
||||||
hello db 'X-Assembler 1.7 by Fox/Taquart',eot
|
hello db 'X-Assembler 1.8 by Fox/Taquart',eot
|
||||||
usgtxt db 'Give a source filename. Default extension is .ASX.',eol
|
usgtxt db 'Give a source filename. Default extension is .ASX.',eol
|
||||||
db 'Object file will be written with .COM extension.',eot
|
db 'Object file will be written with .COM extension.',eot
|
||||||
lintxt db ' lines assembled',eot
|
lintxt db ' lines assembled',eot
|
||||||
@ -1887,8 +1887,8 @@ flags db 0
|
|||||||
lines dd 0
|
lines dd 0
|
||||||
bytes dd 0
|
bytes dd 0
|
||||||
iclen dw t_icl
|
iclen dw t_icl
|
||||||
laben dw t_lab-2
|
laben dw t_lab
|
||||||
pslab dw t_lab-2
|
pslab dw t_lab
|
||||||
orgvec dw t_org
|
orgvec dw t_org
|
||||||
sift dw 0
|
sift dw 0
|
||||||
elflag dd 1
|
elflag dd 1
|
||||||
|
Loading…
Reference in New Issue
Block a user