many fixes, found by actually running the code

This commit is contained in:
ceriel 1989-10-10 11:38:18 +00:00
parent 2364f3f6b0
commit 010bade227
12 changed files with 27 additions and 48 deletions

View file

@ -9,9 +9,7 @@
! eax is source ! eax is source
cmp edx,1 cmp edx,1
jne 2f jne 2f
o16 cbw ! needs operand size toggle to convert movsxb eax,al
! from one to two bytes.
cwde
mov edx,4 mov edx,4
jmp 1f jmp 1f
2: 2:

View file

@ -5,7 +5,7 @@
.sect .text .sect .text
.exg: .exg:
push edi push edi
mov esp,edi mov edi,esp
add edi,8 add edi,8
mov ebx,edi mov ebx,edi
add ebx,ecx add ebx,ecx
@ -14,6 +14,8 @@
mov eax,(ebx) mov eax,(ebx)
xchg eax,(edi) xchg eax,(edi)
mov (ebx),eax mov (ebx),eax
add edi,4
add ebx,4
loop 1b loop 1b
2: 2:
pop edi pop edi

View file

@ -8,12 +8,11 @@
cmp edx,4 cmp edx,4
.extern .unknown .extern .unknown
jne .unknown jne .unknown
pop ebx ! descriptor address pop ebx ! descriptor address
pop eax ! index pop eax ! index
pop edx ! array base
sub eax,(ebx) sub eax,(ebx)
mul 8(ebx) mul 8(ebx)
mov ebx,edx pop ebx ! array base
add ebx,eax add ebx,eax
push ecx push ecx
ret ret

View file

@ -8,7 +8,7 @@
mov edx,edi mov edx,edi
mov edi,esp mov edi,esp
add edi,ecx add edi,ecx
sar ecx,1 sar ecx,2
1: 1:
pop eax pop eax
or eax,(edi) or eax,(edi)

View file

@ -5,18 +5,16 @@
.lar4: .lar4:
! ebx, descriptor address ! ebx, descriptor address
! eax, index ! eax, index
pop ecx
pop edx ! base address
push ecx
sub eax,(ebx) sub eax,(ebx)
mov ecx,8(ebx) mov ecx,8(ebx)
imul ecx imul ecx
pop ebx
pop edx ! base address
add edx,eax add edx,eax
sar ecx,1 sar ecx,1
jnb 1f jnb 1f
xor eax,eax xor eax,eax
movb al,(edx) movb al,(edx)
pop ebx
push eax push eax
jmp ebx jmp ebx
1: 1:
@ -24,13 +22,12 @@
jnb 1f jnb 1f
xor eax,eax xor eax,eax
o16 mov ax,(edx) o16 mov ax,(edx)
pop ebx
push eax push eax
jmp ebx jmp ebx
1: 1:
mov edx,esi ! saved esi xchg edx,esi ! saved esi
mov eax,8(ebx) mov eax,ecx
pop ebx ! return address sal eax,2
sub esp,eax sub esp,eax
mov eax,edi ! save edi mov eax,edi ! save edi
mov edi,esp mov edi,esp

View file

@ -11,20 +11,20 @@
mov eax,ecx mov eax,ecx
sar ecx,1 sar ecx,1
jnb 1f jnb 1f
xor eax,eax movsxb eax,(ebx)
movb al,(edx)
push eax push eax
jmp edx jmp edx
1: 1:
sar ecx,1 sar ecx,1
jnb 1f jnb 1f
xor eax,eax movsx eax,(ebx)
o16 mov ax,(edx)
push eax push eax
jmp edx jmp edx
1: 1:
mov ebx,edx push edx
mov edx,esi mov edx,esi
mov esi,ebx
pop ebx
sub esp,eax sub esp,eax
jmp 1f jmp 1f

View file

@ -3,22 +3,8 @@
.define .nop .define .nop
.extern printd, printc, hol0 .extern printd, printc, hol0
SIO_S = 0xDA
SIO_D = 0xD8
RXRDY = 0x02
.nop: .nop:
mov eax,(hol0) mov eax,(hol0)
call printd call printd
! movb al,' '
! call printc
! mov eax,esp
! call printd
!1:
! inb SIO_S
! andb al,RXRDY
! jz 1b
! inb SIO_D
! call printc
movb al,'\n' movb al,'\n'
jmp printc jmp printc

View file

@ -5,30 +5,24 @@
.sar4: .sar4:
! ebx, descriptor address ! ebx, descriptor address
! eax, index ! eax, index
pop ecx
pop edx ! base address
push ecx
sub eax,(ebx) sub eax,(ebx)
mov ecx,8(ebx) mov ecx,8(ebx)
push edx
imul ecx imul ecx
pop edx pop ebx
pop edx ! base address
add edx,eax add edx,eax
sar ecx,1 sar ecx,1
jnb 1f jnb 1f
pop ebx
pop eax pop eax
movb (edx),al movb (edx),al
jmp ebx jmp ebx
1: 1:
sar ecx,1 sar ecx,1
jnb 1f jnb 1f
pop ebx
pop eax pop eax
o16 mov (edx),ax o16 mov (edx),ax
jmp ebx jmp ebx
1: 1:
pop ebx
xchg edi,edx ! edi = base address, edx is saved edi xchg edi,edx ! edi = base address, edx is saved edi
mov eax,esi mov eax,esi
mov esi,esp mov esi,esp

View file

@ -13,9 +13,9 @@
push edi push edi
mov ebx,esp mov ebx,esp
xor edi,edi xor edi,edi
sar ecx,1 sar ecx,2
1: 1:
mov 4(ebx)(edi),edx mov 8(ebx)(edi),edx
add edi,4 add edi,4
loop 1b loop 1b
!endif !endif

View file

@ -20,8 +20,10 @@
o16 mov (ebx),ax o16 mov (ebx),ax
jmp edx jmp edx
1: 1:
mov ebx,edx push edx
mov edx,edi mov edx,edi
mov edi,ebx
pop ebx
jmp 1f jmp 1f
.sti: .sti:
! only called with count >> 4 ! only called with count >> 4

View file

@ -2,4 +2,4 @@
.sect .text .sect .text
.define .stop .define .stop
.stop: .stop:
int 3 jmp _exit

View file

@ -14,4 +14,5 @@
pop eax pop eax
ret ret
2: 2:
push eax
call .stop call .stop