+++ /dev/null
-#define CHAR_UNSIGNED 0
-#define MSB_AT_LOW_ADDRESS 0
-#define MSW_AT_LOW_ADDRESS 0
-#define FL_MSB_AT_LOW_ADDRESS 0
-#define FL_MSW_AT_LOW_ADDRESS 0
-#define FL_MSL_AT_LOW_ADDRESS 0
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .adf4
-
- .sect .text
-.adf4:
- mov bx,sp
- flds 4(bx)
- fadds 8(bx)
- fstps 8(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .adf8
-
- .sect .text
-.adf8:
- mov bx,sp
- fldd 4(bx)
- faddd 12(bx)
- fstpd 12(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .adi
-
- ! #bytes in ecx , top of stack in eax
- .sect .text
-.adi:
- pop ebx ! return address
- cmp ecx,4
- jne 9f
- pop ecx
- add eax,ecx
- jmp ebx
-9:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push ebx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .and
-
- ! #bytes in ecx
- ! save edi; it might be a register variable
-
- .sect .text
-.and:
- pop ebx ! return address
- mov edx,edi
- mov edi,esp
- add edi,ecx
- sar ecx,2
-1:
- pop eax
- and eax,(edi)
- stos
- loop 1b
- mov edi,edx
- jmp ebx
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .blm
-
- ! ecx: count in words
-.blm:
- mov ebx,esp
- mov eax,esi
- mov edx,edi
- mov edi,4(ebx)
- mov esi,8(ebx)
- rep movs
- mov esi,eax
- mov edi,edx
- ret 8
-
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cff4
-
- .sect .text
-.cff4:
- mov bx,sp
- fldd 4(bx)
- fstcw 4(bx)
- wait
- mov dx,4(bx)
- and 4(bx),0xf3ff ! set to rounding mode
- wait
- fldcw 4(bx)
- fstps 8(bx)
- mov 4(bx),dx
- wait
- fldcw 4(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cff8
-
- .sect .text
-.cff8:
- mov bx,sp
- flds 4(bx)
- fstpd 4(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cfi
-
- .sect .text
-.cfi:
- mov bx,sp
- fstcw 4(bx)
- wait
- mov dx,4(bx)
- or 4(bx),0xc00 ! truncating mode
- wait
- fldcw 4(bx)
- cmp 8(bx),4
- jne 2f
- ! loc 4 loc ? cfi
- flds 12(bx)
- fistpl 12(bx)
-1:
- mov 4(bx),dx
- wait
- fldcw 4(bx)
- ret
-2:
- ! loc 8 loc ? cfi
- fldd 12(bx)
- fistpl 16(bx)
- jmp 1b
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cfu
-
- .sect .text
-.cfu:
- mov bx,sp
- fstcw 4(bx)
- wait
- mov dx,4(bx)
- or 4(bx),0xc00 ! truncating mode
- wait
- fldcw 4(bx)
- cmp 8(bx),4
- jne 2f
- ! loc 4 loc ? cfu
- flds 12(bx)
- fabs ! ???
- fiaddl (bigmin)
- fistpl 12(bx)
- wait
- mov ax,12(bx)
- sub ax,(bigmin)
- mov 12(bx),ax
-1:
- mov 4(bx),dx
- wait
- fldcw 4(bx)
- ret
-2:
- ! loc 8 loc ? cfu
- fldd 12(bx)
- fabs ! ???
- fiaddl (bigmin)
- fistpl 16(bx)
- mov ax,16(bx)
- sub ax,(bigmin)
- mov 16(bx),ax
- jmp 1b
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cif4
-
- .sect .text
-.cif4:
- mov bx,sp
- fildl 8(bx)
- fstps 8(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cif8
-
- .sect .text
-.cif8:
- mov bx,sp
- fildl 8(bx)
- fstpd 4(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cii
-
-.sect .text
-.cii:
- pop ebx ! return address
- ! pop ecx, dest. size
- ! pop edx, src. size
- ! eax is source
- cmp edx,1
- jne 2f
- movsxb eax,al
- mov edx,4
- jmp 1f
-2:
- cmp edx,2
- jne 1f
- cwde ! convert from 2 to 4 bytes
- mov edx,4
-1:
- cmp edx,ecx
- jne 9f
- cmp edx,4
- jne 9f
- jmp ebx
-9:
-.extern EILLINS
-.extern .fat
- mov eax,EILLINS
- push eax
- jmp .fat
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cmf4
-
- .sect .text
-.cmf4:
- mov bx,sp
- xor cx,cx
- flds 8(bx)
- flds 4(bx)
- fcompp ! compare and pop operands
- fstsw ax
- wait
- sahf
- je 1f
- jb 2f
- dec cx
- jmp 1f
-2:
- inc cx
-1:
- mov ax,cx
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cmf8
-
- .sect .text
-.cmf8:
- mov bx,sp
- xor cx,cx
- fldd 12(bx)
- fldd 4(bx)
- fcompp ! compare and pop operands
- fstsw ax
- wait
- sahf
- je 1f
- jb 2f
- dec cx
- jmp 1f
-2:
- inc cx
-1:
- mov ax,cx
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cms
-
- ! #bytes in ecx
- .sect .text
-.cms:
- pop ebx ! return address
- mov edx,esp
- push esi
- push edi
- mov esi,edx
- add edx,ecx
- mov edi,edx
- add edx,ecx
- sar ecx,2
- repe cmps
- je 1f
- inc ecx
-1:
- pop edi
- pop esi
- mov esp,edx
- jmp ebx
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .com
-
- ! #bytes in ecx
- .sect .text
-.com:
- mov ebx,esp
- add ebx,4
- sar ecx,2
-1:
- not (ebx)
- add ebx,4
- loop 1b
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .csa4
-
-.sect .text
-.csa4:
- ! ebx, descriptor address
- ! eax, index
- mov edx,(ebx) ! default
- sub eax,4(ebx)
- cmp eax,8(ebx)
- ja 1f
- sal eax,2
- add ebx,eax
- mov ebx,12(ebx)
- test ebx,ebx
- jnz 2f
-1:
- mov ebx,edx
- test ebx,ebx
- jnz 2f
-.extern ECASE
-.extern .fat
- mov eax,ECASE
- push eax
- jmp .fat
-2:
- jmp ebx
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .csb4
-
-.sect .text
-.csb4:
- !ebx, descriptor address
- !eax, index
- mov edx,(ebx)
- mov ecx,4(ebx)
-1:
- add ebx,8
- dec ecx
- jl 4f
- cmp eax,(ebx)
- jne 1b
- mov ebx,4(ebx)
-2:
- test ebx,ebx
- jnz 3f
-.extern ECASE
-.extern .fat
- mov eax,ECASE
- push eax
- jmp .fat
-3:
- jmp ebx
-4:
- mov ebx,edx
- jmp 2b
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cuf4
-
- .sect .text
-.cuf4:
- mov bx,sp
- fildl 8(bx)
- cmp 8(bx),0
- jge 1f
- fisubl (bigmin)
- fisubl (bigmin)
-1:
- fstps 8(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cuf8
-
- .sect .text
-.cuf8:
- mov bx,sp
- fildl 8(bx)
- cmp 8(bx),0
- jge 1f
- fisubl (bigmin)
- fisubl (bigmin)
-1:
- fstpd 4(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .ciu
-.define .cui
-.define .cuu
-
-.sect .text
-.ciu:
-.cui:
-.cuu:
- pop ebx ! return address
- ! pop ecx, dest. size
- ! pop edx, source size
- ! eax is source
- cmp edx,ecx
- jne 8f
- jmp ebx
-8:
-.extern EILLINS
-.extern .fat
- mov eax,EILLINS
- push eax
- jmp .fat
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .dup
-
- ! #bytes in ecx
- .sect .text
-.dup:
- pop ebx ! return address
- mov eax,esi
- mov edx,edi
- mov esi,esp
- sub esp,ecx
- mov edi,esp
- sar ecx,2
- rep movs
- mov esi,eax
- mov edi,edx
- jmp ebx
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .dvf4
-
- .sect .text
-.dvf4:
- mov bx,sp
- flds 8(bx)
- fdivs 4(bx)
- fstps 8(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .dvf8
-
- .sect .text
-.dvf8:
- mov bx,sp
- fldd 12(bx)
- fdivd 4(bx)
- fstpd 12(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .dvi
-
- ! #bytes in eax
- .sect .text
-.dvi:
- pop ebx ! return address
- cmp eax,4
- jne 1f
- pop eax
- cwd
- pop ecx
- idiv ecx
- push eax
- jmp ebx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push ebx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .dvu
-
- ! #bytes in eax
- .sect .text
-.dvu:
- pop ebx ! return address
- cmp eax,4
- jne 1f
- pop eax
- xor edx,edx
- pop ecx
- div ecx
- push eax
- jmp ebx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push ebx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .error
-.define .Xtrp
-
- ! eax is trap number
- ! all registers must be saved
- ! because return is possible
- ! May only be called with error no's <16
-.sect .text
-.error:
- mov ecx,eax
- mov ebx,1
- sal ebx,cl
-.extern .ignmask
-.extern .trp
- test ebx,(.ignmask)
- jne 2f
- call .trp
-2:
- ret
-
-.Xtrp:
- pusha
- cmp eax,16
- jge 1f
- call .error
- popa
- ret
-1:
- call .trp
- popa
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .exg
-
- ! #bytes in ecx
-.sect .text
-.exg:
- push edi
- mov edi,esp
- add edi,8
- mov ebx,edi
- add ebx,ecx
- sar ecx,2
-1:
- mov eax,(ebx)
- xchg eax,(edi)
- mov (ebx),eax
- add edi,4
- add ebx,4
- loop 1b
-2:
- pop edi
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .fat
-
-.fat:
-.extern .trp
-.extern .stop
- call .trp
- call .stop
- ! no return
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .fef4
-
- .sect .text
-.fef4:
- ! this could be simpler, if only the
- ! fxtract instruction was emulated properly
- mov bx,sp
- mov ax,8(bx)
- and ax,0x7f800000
- je 1f ! zero exponent
- shr ax,23
- sub ax,126
- mov cx,ax ! exponent in cx
- mov ax,8(bx)
- and ax,0x807fffff
- or ax,0x3f000000 ! load -1 exponent
- mov bx,4(bx)
- mov 4(bx),ax
- mov (bx),cx
- ret
-1: ! we get here on zero exp
- mov ax,8(bx)
- and ax,0x007fffff
- jne 1f ! zero result
- mov bx,4(bx)
- mov (bx),ax
- mov 4(bx),ax
- ret
-1: ! otherwise unnormalized number
- mov cx,8(bx)
- and cx,0x807fffff
- mov dx,cx
- and cx,0x80000000
- mov ax,-125
-2:
- test dx,0x800000
- jne 1f
- dec ax
- shl dx,1
- or dx,cx
- jmp 2b
-1:
- mov bx,4(bx)
- mov (bx),ax
- and dx,0x807fffff
- or dx,0x3f000000 ! load -1 exponent
- mov 4(bx),dx
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .fef8
-
- .sect .text
-.fef8:
- ! this could be simpler, if only the
- ! fxtract instruction was emulated properly
- mov bx,sp
- mov ax,12(bx)
- and ax,0x7ff00000
- je 1f ! zero exponent
- shr ax,20
- sub ax,1022
- mov cx,ax ! exponent in cx
- mov ax,12(bx)
- and ax,0x800fffff
- or ax,0x3fe00000 ! load -1 exponent
- mov dx,8(bx)
- mov bx,4(bx)
- mov 4(bx),dx
- mov 8(bx),ax
- mov (bx),cx
- ret
-1: ! we get here on zero exp
- mov ax,12(bx)
- and ax,0xfffff
- or ax,8(bx)
- jne 1f ! zero result
- mov bx,4(bx)
- mov (bx),ax
- mov 4(bx),ax
- mov 8(bx),ax
- ret
-1: ! otherwise unnormalized number
- mov cx,12(bx)
- and cx,0x800fffff
- mov dx,cx
- and cx,0x80000000
- mov ax,-1021
-2:
- test dx,0x100000
- jne 1f
- dec ax
- shl 8(bx),1
- rcl dx,1
- or dx,cx
- jmp 2b
-1:
- and dx,0x800fffff
- or dx,0x3fe00000 ! load -1 exponent
- mov cx,8(bx)
- mov bx,4(bx)
- mov (bx),ax
- mov 8(bx),dx
- mov 4(bx),cx
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .fif4
-
- .sect .text
-.fif4:
- mov bx,sp
- flds 8(bx)
- fmuls 12(bx) ! multiply
- fld st ! copy result
- ftst ! test sign; handle negative separately
- fstsw ax
- wait
- sahf ! result of test in condition codes
- jb 1f
- frndint ! this one rounds (?)
- fcom st(1) ! compare with original; if <=, then OK
- fstsw ax
- wait
- sahf
- jbe 2f
- fisubs (one) ! else subtract 1
- jmp 2f
-1: ! here, negative case
- frndint ! this one rounds (?)
- fcom st(1) ! compare with original; if >=, then OK
- fstsw ax
- wait
- sahf
- jae 2f
- fiadds (one) ! else add 1
-2:
- fsub st(1),st ! subtract integer part
- mov bx,4(bx)
- fstps (bx)
- fstps 4(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .fif8
-
- .sect .text
-.fif8:
- mov bx,sp
- fldd 8(bx)
- fmuld 16(bx) ! multiply
- fld st ! and copy result
- ftst ! test sign; handle negative separately
- fstsw ax
- wait
- sahf ! result of test in condition codes
- jb 1f
- frndint ! this one rounds (?)
- fcom st(1) ! compare with original; if <=, then OK
- fstsw ax
- wait
- sahf
- jbe 2f
- fisubs (one) ! else subtract 1
- jmp 2f
-1: ! here, negative case
- frndint ! this one rounds (?)
- fcom st(1) ! compare with original; if >=, then OK
- fstsw ax
- wait
- sahf
- jae 2f
- fiadds (one) ! else add 1
-2:
- fsub st(1),st ! subtract integer part
- mov bx,4(bx)
- fstpd (bx)
- fstpd 8(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define one, bigmin
-
- .sect .rom
-one:
- .data2 1
-two:
- .data2 2
-bigmin:
- .data4 -2147483648
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .gto
-
-.gto:
- mov ebp,8(ebx)
- mov esp,4(ebx)
- jmp (ebx)
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-.define hol0
-.sect .data
-hol0:
- .data4 0, 0
- .data4 0, 0
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .iaar
-
-.iaar:
- pop ecx
- pop edx
- cmp edx,4
-.extern .unknown
- jne .unknown
- pop ebx ! descriptor address
- pop eax ! index
- sub eax,(ebx)
- mul 8(ebx)
- pop ebx ! array base
- add ebx,eax
- push ecx
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .ilar
-
-.ilar:
- pop ecx
- pop edx
-.extern .unknown
- cmp edx,4
- jne .unknown
- pop ebx ! descriptor address
- pop eax ! index
- push ecx
-.extern .lar4
- jmp .lar4
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .inn
-
- ! #bytes in ecx
- ! bit # in eax
-.inn:
- xor edx,edx
- mov ebx,8
- div ebx
- mov ebx,esp
- add ebx,4
- add ebx,eax
- cmp eax,ecx
- jae 1f
- movb al,(ebx)
- mov ebx,edx
- testb al,bits(ebx)
- jz 1f
- mov eax,1
- jmp 2f
-1:
- xor eax,eax
-2:
- pop ebx
- add esp,ecx
- ! eax is result
- jmp ebx
-
- .sect .rom
-bits:
- .data1 1,2,4,8,16,32,64,128
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .ior
-
- ! #bytes in ecx
-.ior:
- pop ebx ! return address
- mov edx,edi
- mov edi,esp
- add edi,ecx
- sar ecx,2
-1:
- pop eax
- or eax,(edi)
- stos
- loop 1b
- mov edi,edx
- jmp ebx
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .isar
-
-.isar:
- pop ecx
- pop eax
- cmp eax,4
-.extern .unknown
- jne .unknown
- pop ebx ! descriptor address
- pop eax ! index
- push ecx
-.extern .sar4
- jmp .sar4
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .lar4
-
-.lar4:
- ! ebx, descriptor address
- ! eax, index
- sub eax,(ebx)
- mov ecx,8(ebx)
- imul ecx
- pop ebx
- pop edx ! base address
- add edx,eax
- sar ecx,1
- jnb 1f
- xor eax,eax
- movb al,(edx)
- push eax
- jmp ebx
-1:
- sar ecx,1
- jnb 1f
- xor eax,eax
- o16 mov ax,(edx)
- push eax
- jmp ebx
-1:
- xchg edx,esi ! saved esi
- mov eax,ecx
- sal eax,2
- sub esp,eax
- mov eax,edi ! save edi
- mov edi,esp
- rep movs
- mov edi,eax
- mov esi,edx
- jmp ebx
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .loi
-.define .los
-
- ! #bytes in ecx
- ! address in ebx
- ! save esi/edi. they might be register variables
-.los:
- pop edx
- mov eax,ecx
- sar ecx,1
- jnb 1f
- movsxb eax,(ebx)
- push eax
- jmp edx
-1:
- sar ecx,1
- jnb 1f
- movsx eax,(ebx)
- push eax
- jmp edx
-1:
- push edx
- mov edx,esi
- mov esi,ebx
- pop ebx
- sub esp,eax
- jmp 1f
-
-.loi:
- ! only called with size >= 4
- mov edx,esi
- mov esi,ebx
- pop ebx
- sub esp,ecx
- sar ecx,2
-1:
- mov eax,edi
- mov edi,esp
- rep movs
- mov esi,edx
- mov edi,eax
- jmp ebx
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .mlf4
-
- .sect .text
-.mlf4:
- mov bx,sp
- flds 4(bx)
- fmuls 8(bx)
- fstps 8(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .mlf8
-
- .sect .text
-.mlf8:
- mov bx,sp
- fldd 4(bx)
- fmuld 12(bx)
- fstpd 12(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .mli
-
- ! #bytes in eax
-.mli:
- pop ebx ! return address
- cmp eax,4
- jne 1f
- pop eax
- pop ecx
- mul ecx
- push eax
- jmp ebx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push ebx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .mon
-
-.mon:
-.extern .stop
- call .stop
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .ngf4
-
- .sect .text
-.ngf4:
- mov bx,sp
- flds 4(bx)
- fchs
- fstps 4(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .ngf8
-
- .sect .text
-.ngf8:
- mov bx,sp
- fldd 4(bx)
- fchs
- fstpd 4(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .ngi
-
- ! #bytes in eax
-.ngi:
- pop ebx ! return address
- cmp eax,4
- jne 1f
- pop ecx
- neg ecx
- push ecx
- jmp ebx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push ebx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .nop
-.extern printd, printc, hol0
-
-.nop:
- mov eax,(hol0)
- call printd
- movb al,'\n'
- jmp printc
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define printc,printd,prints
-
- ! argument in eax
- ! uses ebx
-prints:
- xchg eax,ebx
-1:
- movb al,(ebx)
- inc ebx
- testb al,al
- jz 2f
- call printc
- jmp 1b
-2:
- ret
-
- ! argument in eax
- ! uses ecx and edx
-printd:
- xor edx,edx
- mov ecx,10
- div ecx
- test eax,eax
- jz 1f
- push edx
- call printd
- pop edx
-1:
- xchg eax,edx
- addb al,'0'
-
- ! argument in eax
-printc:
- push eax
- mov ebx,esp
- mov eax,1
- push eax
- push ebx
- push eax
- call __write
- pop ebx
- pop ebx
- pop ebx
- pop ebx
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .rck
-
- ! descriptor address in ebx
- ! value in eax, must be left there
-.rck:
- cmp eax,(ebx)
- jl 2f
- cmp eax,4(ebx)
- jg 2f
- ret
-2:
- push eax
-.extern ERANGE
-.extern .error
- mov eax,ERANGE
- call .error
- pop eax
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .rmi
-
- ! #bytes in eax
-.rmi:
- pop ebx ! return address
- cmp eax,4
- jne 1f
- pop eax
- cwd
- pop ecx
- idiv ecx
- push edx
- jmp ebx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push ebx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .rmu
-
- ! #bytes in eax
-.rmu:
- pop ebx ! return address
- cmp eax,4
- jne 1f
- pop eax
- xor edx,edx
- pop ecx
- idiv ecx
- push edx
- jmp ebx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push ebx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .rol
-
- ! #bytes in eax
-.rol:
- pop edx ! return address
- cmp eax,4
- jne 1f
- pop eax
- pop ecx
- rol eax,cl
- push eax
- jmp edx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push edx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .ror
-
- ! #bytes in eax
-.ror:
- pop edx ! return address
- cmp eax,4
- jne 1f
- pop eax
- pop ecx
- ror eax,cl
- push eax
- jmp edx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push edx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .sar4
-
-.sar4:
- ! ebx, descriptor address
- ! eax, index
- sub eax,(ebx)
- mov ecx,8(ebx)
- imul ecx
- pop ebx
- pop edx ! base address
- add edx,eax
- sar ecx,1
- jnb 1f
- pop eax
- movb (edx),al
- jmp ebx
-1:
- sar ecx,1
- jnb 1f
- pop eax
- o16 mov (edx),ax
- jmp ebx
-1:
- xchg edi,edx ! edi = base address, edx is saved edi
- mov eax,esi
- mov esi,esp
- rep movs
- mov esp,esi
- mov esi,eax
- mov edi,edx
- jmp ebx
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .sbf4
-
- .sect .text
-.sbf4:
- mov bx,sp
- flds 8(bx)
- fsubs 4(bx)
- fstps 8(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .sbf8
-
- .sect .text
-.sbf8:
- mov bx,sp
- fldd 12(bx)
- fsubd 4(bx)
- fstpd 12(bx)
- wait
- ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .sbi
-
- ! #bytes in ecx , top of stack in eax
-.sbi:
- pop ebx ! return subress
- cmp ecx,4
- jne 1f
- pop ecx
- sub eax,ecx
- neg eax
- jmp ebx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push ebx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .set
-
- ! #bytes in ecx
- ! bit # in eax
-.set:
- pop ebx ! return address
- xor edx,edx
-!ifdef create set
- sub esp,ecx
- push ebx
- push edi
- mov ebx,esp
- xor edi,edi
- sar ecx,2
-1:
- mov 8(ebx)(edi),edx
- add edi,4
- loop 1b
-!endif
- mov ebx,8
- div ebx
- cmp eax,edi
- jae 2f
- mov edi,edx
- movb dl,bits(edi)
- mov edi,esp
- add edi,eax
- orb 8(edi),dl
- pop edi
- ret
-2:
-.extern ESET
-.extern .trp
- pop edi
- mov eax,ESET
- jmp .trp
-
- .sect .rom
-bits:
- .data1 1,2,4,8,16,32,64,128
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .sli
-
- ! #bytes in eax
-.sli:
- pop edx ! return address
- cmp eax,4
- jne 1f
- pop eax
- pop ecx
- sal eax,cl
- push eax
- jmp edx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push edx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .sri
-
- ! #bytes in eax
-.sri:
- pop edx ! return address
- cmp eax,4
- jne 1f
- pop eax
- pop ecx
- sar eax,cl
- push eax
- jmp edx
-1:
-.extern EODDZ
-.extern .trp
- mov eax,EODDZ
- push edx
- jmp .trp
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .sti
-.define .sts
-
- ! #bytes in ecx
- ! address in ebx
- ! save edi/esi. they might be register variables
-.sts:
- pop edx
- sar ecx,1
- jnb 1f
- pop eax
- movb (ebx),al
- jmp edx
-1:
- sar ecx,1
- jnb 1f
- pop eax
- o16 mov (ebx),ax
- jmp edx
-1:
- push edx
- mov edx,edi
- mov edi,ebx
- pop ebx
- jmp 1f
-.sti:
- ! only called with count >> 4
- mov edx,edi
- mov edi,ebx
- pop ebx
- sar ecx,2
-1:
- mov eax,esi
- mov esi,esp
- rep movs
- mov esp,esi
- mov edi,edx
- mov esi,eax
- jmp ebx
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .stop
-.stop:
- jmp ___exit
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .trp
-.extern .trppc, .stop
-
- ! eax is trap number
-.trp:
- xor ebx,ebx
- xchg ebx,(.trppc)
- test ebx,ebx
- jz 2f
- push eax
- call ebx
- pop eax
- ret
-2:
- push eax
- call .stop
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .unknown
-.extern EILLINS, .fat
-
-.unknown:
- mov eax,EILLINS
- push eax
- jmp .fat
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .xor
-
- ! #bytes in ecx
-.xor:
- pop ebx ! return address
- mov edx,edi
- mov edi,esp
- add edi,ecx
- sar ecx,2
-1:
- pop eax
- xor eax,(edi)
- stos
- loop 1b
- mov edi,edx
- jmp ebx
+++ /dev/null
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#define LINO_AD 0
-#define FILN_AD 4
-
-#define LINO (*(int *)(_hol0()+LINO_AD))
-#define FILN (*(char **)(_hol0()+FILN_AD))
-
-#define EARRAY 0
-#define ERANGE 1
-#define ESET 2
-#define EIOVFL 3
-#define EFOVFL 4
-#define EFUNFL 5
-#define EIDIVZ 6
-#define EFDIVZ 7
-#define EIUND 8
-#define EFUND 9
-#define ECONV 10
-
-#define ESTACK 16
-#define EHEAP 17
-#define EILLINS 18
-#define EODDZ 19
-#define ECASE 20
-#define EMEMFLT 21
-#define EBADPTR 22
-#define EBADPC 23
-#define EBADLAE 24
-#define EBADMON 25
-#define EBADLIN 26
-#define EBADGTO 27
+++ /dev/null
-#
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ
-.define .trppc, .ignmask
-
-ERANGE = 1
-ESET = 2
-EIDIVZ = 6
-EHEAP = 17
-EILLINS = 18
-EODDZ = 19
-ECASE = 20
-
-#include <em_abs.h>
-
-.sect .data
-.trppc:
- .data4 0
-.ignmask:
- .data4 EIOVFL | EIUND | ECONV | EFOVFL | EFUNFL