many changes because of introduction of register variables si/di

This commit is contained in:
ceriel 1987-06-09 10:22:50 +00:00
parent 798261d992
commit f751192942
32 changed files with 271 additions and 171 deletions

View file

@ -2,9 +2,12 @@
.define .and .define .and
! #bytes in cx ! #bytes in cx
! save di; it might be a register variable
.sect .text .sect .text
.and: .and:
pop bx ! return address pop bx ! return address
mov dx,di
mov di,sp mov di,sp
add di,cx add di,cx
sar cx,1 sar cx,1
@ -13,4 +16,5 @@
and ax,(di) and ax,(di)
stos stos
loop 1b loop 1b
mov di,dx
jmp bx jmp bx

View file

@ -3,32 +3,32 @@
.sect .text .sect .text
.cii: .cii:
pop di ! return address pop bx ! return address
! pop cx, dest. size ! pop cx, dest. size
! pop bx, src. size ! pop dx, src. size
! ax is first word of source ! ax is first word of source
cmp bx,1 cmp dx,1
jne 2f jne 2f
cbw cbw
mov bx,2 mov dx,2
2: 2:
cmp bx,cx cmp dx,cx
je 8f je 8f
cmp bx,2 cmp dx,2
je 1f je 1f
cmp bx,4 cmp dx,4
jne 9f jne 9f
cmp cx,2 cmp cx,2
jne 9f jne 9f
pop dx pop dx
8: 8:
jmp di jmp bx
1: 1:
cmp cx,4 cmp cx,4
jne 9f jne 9f
cwd cwd
push dx push dx
jmp di jmp bx
9: 9:
push ax ! push low source push ax ! push low source
.extern EILLINS .extern EILLINS

View file

@ -6,6 +6,8 @@
.cms: .cms:
pop bx ! return address pop bx ! return address
mov dx,sp mov dx,sp
push si
push di
mov si,dx mov si,dx
add dx,cx add dx,cx
mov di,dx mov di,dx
@ -15,5 +17,7 @@
je 1f je 1f
inc cx inc cx
1: 1:
pop di
pop si
mov sp,dx mov sp,dx
jmp bx jmp bx

View file

@ -4,23 +4,25 @@
.sect .text .sect .text
.cmu4: .cmu4:
pop bx ! return address pop bx ! return address
xor ax,ax
pop cx pop cx
pop dx pop dx
pop si pop ax
pop di push si
cmp di,dx mov si,sp
xchg bx,2(si)
pop si
cmp bx,dx
ja 1f ja 1f
jb 2f jb 2f
cmp si,cx cmp ax,cx
ja 1f ja 1f
je 3f je 3f
2: 2:
dec ax mov ax,-1
3: ret
jmp bx 3:
1: xor ax,ax
inc ax ret
jmp bx 1:
mov ax,1
ret ret

View file

@ -4,12 +4,12 @@
! #bytes in cx ! #bytes in cx
.sect .text .sect .text
.com: .com:
pop bx ! return address mov bx,sp
mov di,sp add bx,2
sar cx,1 sar cx,1
1: 1:
not (di) not (bx)
inc di inc bx
inc di inc bx
loop 1b loop 1b
jmp bx ret

View file

@ -3,14 +3,15 @@
.sect .text .sect .text
.csa2: .csa2:
! si, descriptor address ! bx, descriptor address
! bx, index ! ax, index
mov dx,(si) ! default mov dx,(bx) ! default
sub bx,2(si) sub ax,2(bx)
cmp bx,4(si) cmp ax,4(bx)
ja 1f ja 1f
sal bx,1 sal ax,1
mov bx,6(bx)(si) add bx,ax
mov bx,6(bx)
test bx,bx test bx,bx
jnz 2f jnz 2f
1: 1:

View file

@ -3,20 +3,17 @@
.sect .text .sect .text
.csb2: .csb2:
!si, descriptor address !bx, descriptor address
!dx, index !ax, index
lods mov dx,(bx)
xchg ax,bx ! default mov cx,2(bx)
lods
xchg ax,cx ! number of cases
1: 1:
add bx,4
dec cx dec cx
jl 2f jl 2f
lods cmp ax,(bx)
cmp ax,dx
lods
jne 1b jne 1b
xchg ax,bx mov bx,2(bx)
2: 2:
test bx,bx test bx,bx
jnz 3f jnz 3f

View file

@ -7,27 +7,27 @@
.ciu: .ciu:
.cui: .cui:
.cuu: .cuu:
pop di ! return address pop bx ! return address
! pop cx, dest. size ! pop cx, dest. size
! pop bx, source size ! pop dx, source size
! ax is low word of source ! ax is low word of source
cmp bx,cx cmp dx,cx
je 8f je 8f
cmp bx,2 cmp dx,2
je 1f je 1f
cmp bx,4 cmp dx,4
jne 9f jne 9f
cmp cx,2 cmp cx,2
jne 9f jne 9f
pop dx pop dx
8: 8:
jmp di jmp bx
1: 1:
cmp cx,4 cmp cx,4
jne 9f jne 9f
xor dx,dx xor dx,dx
push dx push dx
jmp di jmp bx
9: 9:
push ax ! to help debugging ? push ax ! to help debugging ?
.extern EILLINS .extern EILLINS

View file

@ -5,9 +5,13 @@
.sect .text .sect .text
.dup: .dup:
pop bx ! return address pop bx ! return address
mov ax,si
mov dx,di
mov si,sp mov si,sp
sub sp,cx sub sp,cx
mov di,sp mov di,sp
sar cx,1 sar cx,1
rep movs rep movs
mov si,ax
mov di,dx
jmp bx jmp bx

View file

@ -28,7 +28,7 @@
.extern .dvi4 .extern .dvi4
call .dvi4 call .dvi4
pop bx pop bx
push cx push dx
push ax push ax
jmp bx jmp bx
9: 9:

View file

@ -1,13 +1,15 @@
.sect .text; .sect .rom; .sect .data; .sect .bss .sect .text; .sect .rom; .sect .data; .sect .bss
.define .dvi4 .define .dvi4
yl=2 yl=6
yh=4 yh=8
xl=6 xl=10
xh=8 xh=12
.sect .text .sect .text
.dvi4: .dvi4:
push si
push di
mov si,sp ! copy of sp mov si,sp ! copy of sp
mov bx,yl(si) mov bx,yl(si)
mov ax,yh(si) mov ax,yh(si)
@ -42,7 +44,10 @@ xh=8
1: 1:
! cx is high order result ! cx is high order result
! ax is low order result ! ax is low order result
ret 8 mov dx,cx
pop di
pop si
ret 8 ! result in ax/dx
7: 7:
push dx ! sign of y push dx ! sign of y

View file

@ -28,7 +28,7 @@
.extern .dvu4 .extern .dvu4
call .dvu4 call .dvu4
pop bx pop bx
push cx push dx
push ax push ax
jmp bx jmp bx
9: 9:

View file

@ -1,13 +1,15 @@
.sect .text; .sect .rom; .sect .data; .sect .bss .sect .text; .sect .rom; .sect .data; .sect .bss
.define .dvu4 .define .dvu4
yl=2 yl=6
yh=4 yh=8
xl=6 xl=10
xh=8 xh=12
.sect .text .sect .text
.dvu4: .dvu4:
push si
push di
mov si,sp ! copy of sp mov si,sp ! copy of sp
mov bx,yl(si) mov bx,yl(si)
mov ax,yh(si) mov ax,yh(si)
@ -22,7 +24,10 @@ xh=8
9: 9:
! cx is high order result ! cx is high order result
! ax is low order result ! ax is low order result
ret 8 mov dx,cx
pop di
pop si
ret 8 ! result in ax/dx
7: 7:
mov di,ax mov di,ax

View file

@ -4,18 +4,17 @@
! #bytes in cx ! #bytes in cx
.sect .text .sect .text
.exg: .exg:
pop bx ! return address push di
mov dx,cx mov sp,di
mov si,sp add di,4
sub sp,cx mov bx,di
mov di,sp add bx,cx
rep movs
mov si,sp
mov di,sp
add di,dx
add di,dx
mov cx,dx
sar cx,1 sar cx,1
rep movs 1:
mov sp,si mov ax,(bx)
jmp bx xchg ax,(di)
mov (bx),ax
loop 1b
2:
pop di
ret

View file

@ -3,15 +3,17 @@
.define .iaar .define .iaar
.iaar: .iaar:
pop bx pop cx
pop dx pop dx
cmp dx,2 cmp dx,2
.extern .unknown .extern .unknown
jne .unknown jne .unknown
pop si ! descriptor address pop bx ! descriptor address
pop ax ! index pop ax ! index
pop di ! array base pop dx ! array base
sub ax,(si) sub ax,(bx)
mul 4(si) mul 4(bx)
add di,ax mov bx,dx
jmp bx add bx,ax
push cx
ret

View file

@ -3,14 +3,13 @@
.define .ilar .define .ilar
.ilar: .ilar:
pop bx pop cx
pop dx pop dx
.extern .unknown .extern .unknown
cmp dx,2 cmp dx,2
jne .unknown jne .unknown
pop di ! descriptor address pop bx ! descriptor address
pop ax ! index pop ax ! index
pop si ! array base push cx
push bx
.extern .lar2 .extern .lar2
jmp .lar2 jmp .lar2

View file

@ -5,22 +5,24 @@
! #bytes in cx ! #bytes in cx
! bit # in ax ! bit # in ax
.inn: .inn:
pop bx ! return address
xor dx,dx xor dx,dx
xor si,si mov bx,8
mov di,8 div bx
div di mov bx,sp
mov di,sp add bx,2
add di,ax add bx,ax
cmp ax,cx cmp ax,cx
xchg ax,dx
xchg ax,si ! ax:=si,si:=dx,does not change carry
jae 1f jae 1f
movb dl,bits(si) movb al,(bx)
testb (di),dl mov bx,dx
testb al,bits(bx)
jz 1f jz 1f
inc ax mov ax,1
jmp 2f
1: 1:
xor ax,ax
2:
pop bx
add sp,cx add sp,cx
! ax is result ! ax is result
jmp bx jmp bx

View file

@ -5,6 +5,7 @@
! #bytes in cx ! #bytes in cx
.ior: .ior:
pop bx ! return address pop bx ! return address
mov dx,di
mov di,sp mov di,sp
add di,cx add di,cx
sar cx,1 sar cx,1
@ -13,4 +14,5 @@
or ax,(di) or ax,(di)
stos stos
loop 1b loop 1b
mov di,dx
jmp bx jmp bx

View file

@ -3,14 +3,13 @@
.define .isar .define .isar
.isar: .isar:
pop bx pop cx
pop dx pop ax
cmp dx,2 cmp ax,2
.extern .unknown .extern .unknown
jne .unknown jne .unknown
pop si ! descriptor address pop bx ! descriptor address
pop ax ! index pop ax ! index
pop di ! array base push cx
push bx
.extern .sar2 .extern .sar2
jmp .sar2 jmp .sar2

View file

@ -3,22 +3,33 @@
.define .lar2 .define .lar2
.lar2: .lar2:
pop bx ! return address ! bx, descriptor address
! di, descriptor address
! ax, index ! ax, index
! si, base address pop cx
sub ax,(di) pop dx ! base address
mov cx,4(di) push cx
push si
mov si,dx
sub ax,(bx)
mov cx,4(bx)
imul cx imul cx
add si,ax add si,ax
sar cx,1 sar cx,1
jnb 1f jnb 1f
xorb ah,ah xorb ah,ah
lodsb lodsb
pop si
pop bx
push ax push ax
jmp bx jmp bx
1: 1:
sub sp,4(di) pop dx ! saved si
mov ax,4(bx)
pop bx ! return address
sub sp,ax
mov ax,di ! save di
mov di,sp mov di,sp
rep movs rep movs
mov di,ax
mov si,dx
jmp bx jmp bx

View file

@ -3,18 +3,26 @@
.define .loi .define .loi
! #bytes in cx ! #bytes in cx
! source address in si ! address in bx
! save si/di. they might be register variables
.loi: .loi:
pop bx pop ax
mov dx,cx mov dx,si
mov si,bx
mov bx,ax
mov ax,cx
sar cx,1 sar cx,1
jnb 1f jnb 1f
xorb ah,ah xorb ah,ah
lodsb lodsb
mov si,dx
push ax push ax
jmp bx jmp bx
1: 1:
sub sp,dx sub sp,ax
mov ax,di
mov di,sp mov di,sp
rep movs rep movs
mov si,dx
mov di,ax
jmp bx jmp bx

View file

@ -13,15 +13,27 @@
push ax push ax
jmp bx jmp bx
1: 1:
mov dx,bx
cmp ax,4 cmp ax,4
jne 9f jne 9f
pop si push bx
pop di mov cx,bx
pop bx mov bx,sp
pop ax mov ax,2(bx)
push dx mov (bx),ax
jmp .mli4 mov ax,4(bx)
mov 2(bx),ax
mov ax,6(bx)
mov 4(bx),ax
mov ax,8(bx)
mov 6(bx),ax
mov 8(bx),cx
pop ax
pop dx
jsr .mli4
pop bx
push dx
push ax
jmp bx
9: 9:
.extern EODDZ .extern EODDZ
.extern .trp .extern .trp

View file

@ -2,17 +2,24 @@
.sect .text .sect .text
.define .mli4 .define .mli4
! x * y with yl=2
! x.low = si x.high = di yh=4
! y.low = bx y.high = ax ! x * y
! xl in ax
! xh in dx
.mli4: .mli4:
mul si ! xl*yh mov bx,sp
mov cx,ax push dx
mov ax,di mov cx,ax
mul bx ! xh*yl mul yh(bx) ! xl*yh
add cx,ax ! xh*yl+xl*yh pop dx
mov ax,si push ax
mul bx ! xl*yl mov ax,dx
mul yl(bx) ! xh * yl
pop dx
add dx,ax ! xh*yl+xl*yh
mov ax,cx
mul yl(bx) ! xl*yl
add dx,cx add dx,cx
ret ret 4

View file

@ -2,12 +2,12 @@
.sect .text .sect .text
.define .rck .define .rck
! descriptor address in si ! descriptor address in bx
! value in ax, must be left there ! value in ax, must be left there
.rck: .rck:
cmp ax,(si) cmp ax,(bx)
jl 2f jl 2f
cmp ax,2(si) cmp ax,2(bx)
jg 2f jg 2f
ret ret
2: 2:

View file

@ -27,10 +27,10 @@
push ax push ax
.extern .rmi4 .extern .rmi4
call .rmi4 call .rmi4
pop ax pop bx
push bx
push dx push dx
jmp ax push ax
jmp bx
9: 9:
.extern EODDZ .extern EODDZ
.extern .trp .extern .trp

View file

@ -2,12 +2,14 @@
.sect .text .sect .text
.define .rmi4 .define .rmi4
yl=2 yl=6
yh=4 yh=8
xl=6 xl=10
xh=8 xh=12
.rmi4: .rmi4:
push si
push di
mov si,sp ! copy of sp mov si,sp ! copy of sp
mov bx,yl(si) mov bx,yl(si)
mov ax,yh(si) mov ax,yh(si)
@ -41,6 +43,10 @@ xh=8
1: 1:
! bx is high order result ! bx is high order result
! dx is low order result ! dx is low order result
mov ax,dx
mov dx,bx ! result in ax/dx
pop di
pop si
ret 8 ret 8
7: 7:

View file

@ -27,10 +27,10 @@
push ax push ax
.extern .rmu4 .extern .rmu4
call .rmu4 call .rmu4
pop ax pop bx
push bx
push dx push dx
jmp ax push ax
jmp bx
9: 9:
.extern EODDZ .extern EODDZ
.extern .trp .extern .trp

View file

@ -2,12 +2,14 @@
.sect .text .sect .text
.define .rmu4 .define .rmu4
yl=2 yl=6
yh=4 yh=8
xl=6 xl=10
xh=8 xh=12
.rmu4: .rmu4:
push si
push di
mov si,sp ! copy of sp mov si,sp ! copy of sp
mov bx,yl(si) mov bx,yl(si)
mov ax,yh(si) mov ax,yh(si)
@ -25,7 +27,11 @@ xh=8
9: 9:
! bx is high order result ! bx is high order result
! dx is low order result ! dx is low order result
ret 8 mov ax,dx
mov dx,bx
pop di
pop si
ret 8 ! result in ax/dx
7: 7:
mov di,ax mov di,ax

View file

@ -3,21 +3,31 @@
.define .sar2 .define .sar2
.sar2: .sar2:
pop bx ! return address ! bx, descriptor address
! si, descriptor address
! ax, index ! ax, index
! di, base address pop cx
sub ax,(si) pop dx ! base address
mov cx,4(si) push cx
xchg di,dx ! di = base address, dx is saved di
sub ax,(bx)
mov cx,4(bx)
push dx
imul cx imul cx
pop dx
add di,ax add di,ax
sar cx,1 sar cx,1
jnb 1f jnb 1f
pop bx
pop ax pop ax
stosb stosb
mov di,dx
jmp bx jmp bx
1: 1:
pop bx
mov ax,si
mov si,sp mov si,sp
rep movs rep movs
mov sp,si mov sp,si
mov si,ax
mov di,dx
jmp bx jmp bx

View file

@ -8,27 +8,32 @@
pop bx ! return address pop bx ! return address
xor dx,dx xor dx,dx
!ifdef create set !ifdef create set
mov di,sp sub sp,cx
sub di,cx push bx
push di
mov bx,sp
xor di,di
sar cx,1
1: 1:
push dx mov dx,4(di)(bx)
cmp sp,di add di,2
ja 1b loop 1b
!endif !endif
mov di,8 mov bx,8
div di div bx
cmp ax,cx cmp ax,di
jae 2f jae 2f
mov di,dx
movb dl,bits(di)
mov di,sp mov di,sp
add di,ax add di,ax
mov si,dx orb 4(di),dl
movb dl,bits(si) pop di
orb (di),dl ret
jmp bx
2: 2:
.extern ESET .extern ESET
.extern .trp .extern .trp
push bx pop di
mov ax,ESET mov ax,ESET
push ax push ax
jmp .trp jmp .trp

View file

@ -3,16 +3,24 @@
.define .sti .define .sti
! #bytes in cx ! #bytes in cx
! destination address in di ! address in bx
! save di/si. they might be register variables
.sti: .sti:
pop bx ! return address mov dx,di ! save di
pop ax ! return address
mov di,bx
mov bx,ax
sar cx,1 sar cx,1
jnb 1f jnb 1f
pop ax pop ax
stosb stosb
mov di,dx
jmp bx jmp bx
1: 1:
mov bx,si
mov si,sp mov si,sp
rep movs rep movs
mov sp,si mov sp,si
mov di,dx
mov si,bx
jmp bx jmp bx

View file

@ -5,6 +5,7 @@
! #bytes in cx ! #bytes in cx
.xor: .xor:
pop bx ! return address pop bx ! return address
mov dx,di
mov di,sp mov di,sp
add di,cx add di,cx
sar cx,1 sar cx,1
@ -13,4 +14,5 @@
xor ax,(di) xor ax,(di)
stos stos
loop 1b loop 1b
mov di,dx
jmp bx jmp bx