Initial revision
authorceriel <none@none>
Thu, 19 Jan 1989 16:43:32 +0000 (16:43 +0000)
committerceriel <none@none>
Thu, 19 Jan 1989 16:43:32 +0000 (16:43 +0000)
51 files changed:
mach/i386/libem/.distr [new file with mode: 0644]
mach/i386/libem/LIST [new file with mode: 0644]
mach/i386/libem/Makefile [new file with mode: 0644]
mach/i386/libem/adi.s [new file with mode: 0644]
mach/i386/libem/and.s [new file with mode: 0644]
mach/i386/libem/blm.s [new file with mode: 0644]
mach/i386/libem/cii.s [new file with mode: 0644]
mach/i386/libem/cms.s [new file with mode: 0644]
mach/i386/libem/com.s [new file with mode: 0644]
mach/i386/libem/compmodule [new file with mode: 0755]
mach/i386/libem/csa4.s [new file with mode: 0644]
mach/i386/libem/csb4.s [new file with mode: 0644]
mach/i386/libem/cuu.s [new file with mode: 0644]
mach/i386/libem/dup.s [new file with mode: 0644]
mach/i386/libem/dvi.s [new file with mode: 0644]
mach/i386/libem/dvu.s [new file with mode: 0644]
mach/i386/libem/end.s [new file with mode: 0644]
mach/i386/libem/error.s [new file with mode: 0644]
mach/i386/libem/exg.s [new file with mode: 0644]
mach/i386/libem/fakfp.s [new file with mode: 0644]
mach/i386/libem/fat.s [new file with mode: 0644]
mach/i386/libem/gto.s [new file with mode: 0644]
mach/i386/libem/iaar.s [new file with mode: 0644]
mach/i386/libem/ilar.s [new file with mode: 0644]
mach/i386/libem/inn.s [new file with mode: 0644]
mach/i386/libem/ior.s [new file with mode: 0644]
mach/i386/libem/isar.s [new file with mode: 0644]
mach/i386/libem/lar4.s [new file with mode: 0644]
mach/i386/libem/loi.s [new file with mode: 0644]
mach/i386/libem/mli.s [new file with mode: 0644]
mach/i386/libem/mon.s [new file with mode: 0644]
mach/i386/libem/ngi.s [new file with mode: 0644]
mach/i386/libem/nop.s [new file with mode: 0644]
mach/i386/libem/print.s [new file with mode: 0644]
mach/i386/libem/rck.s [new file with mode: 0644]
mach/i386/libem/return.s [new file with mode: 0644]
mach/i386/libem/rmi.s [new file with mode: 0644]
mach/i386/libem/rmu.s [new file with mode: 0644]
mach/i386/libem/rol.s [new file with mode: 0644]
mach/i386/libem/ror.s [new file with mode: 0644]
mach/i386/libem/sar4.s [new file with mode: 0644]
mach/i386/libem/sbi.s [new file with mode: 0644]
mach/i386/libem/set.s [new file with mode: 0644]
mach/i386/libem/sli.s [new file with mode: 0644]
mach/i386/libem/sri.s [new file with mode: 0644]
mach/i386/libem/sti.s [new file with mode: 0644]
mach/i386/libem/stop.s [new file with mode: 0644]
mach/i386/libem/strhp.s [new file with mode: 0644]
mach/i386/libem/trp.s [new file with mode: 0644]
mach/i386/libem/unknown.s [new file with mode: 0644]
mach/i386/libem/xor.s [new file with mode: 0644]

diff --git a/mach/i386/libem/.distr b/mach/i386/libem/.distr
new file mode 100644 (file)
index 0000000..e862ca9
--- /dev/null
@@ -0,0 +1,5 @@
+LIST
+Makefile
+compmodule
+end.s
+libem_s.a
diff --git a/mach/i386/libem/LIST b/mach/i386/libem/LIST
new file mode 100644 (file)
index 0000000..955e075
--- /dev/null
@@ -0,0 +1,47 @@
+libem_s.a
+adi.s
+and.s
+blm.s
+cii.s
+cms.s
+com.s
+csa4.s
+csb4.s
+cuu.s
+dup.s
+dvi.s
+dvu.s
+error.s
+exg.s
+fakfp.s
+fat.s
+gto.s
+iaar.s
+ilar.s
+inn.s
+ior.s
+isar.s
+lar4.s
+loi.s
+mli.s
+mon.s
+ngi.s
+nop.s
+print.s
+rck.s
+return.s
+rmi.s
+rmu.s
+rol.s
+ror.s
+sar4.s
+sbi.s
+set.s
+sli.s
+sri.s
+sti.s
+stop.s
+strhp.s
+trp.s
+unknown.s
+xor.s
diff --git a/mach/i386/libem/Makefile b/mach/i386/libem/Makefile
new file mode 100644 (file)
index 0000000..b6a883d
--- /dev/null
@@ -0,0 +1,30 @@
+# $Header$
+MACH=i386
+
+all:            libem_o.a end.o
+
+install:       all
+               ../../install libem_o.a tail_em
+               ../../install end.o end_em
+
+cmp:           all
+               -../../compare libem_o.a tail_em
+               -../../compare end.o end_em
+
+
+end.o:         end.s
+               $(MACH) -I../../../h -O -c end.s
+
+libem_o.a:     libem_s.a
+               ASAR=aal ; export ASAR ;\
+               march . libem_o.a
+
+clean:
+               rm -f *.o libem_o.a
+
+opr :
+               make pr | opr
+
+pr:
+               @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+               @pr `pwd`/end.s
diff --git a/mach/i386/libem/adi.s b/mach/i386/libem/adi.s
new file mode 100644 (file)
index 0000000..396c197
--- /dev/null
@@ -0,0 +1,18 @@
+.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
diff --git a/mach/i386/libem/and.s b/mach/i386/libem/and.s
new file mode 100644 (file)
index 0000000..eddfa79
--- /dev/null
@@ -0,0 +1,20 @@
+.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
diff --git a/mach/i386/libem/blm.s b/mach/i386/libem/blm.s
new file mode 100644 (file)
index 0000000..4e1a8ce
--- /dev/null
@@ -0,0 +1,15 @@
+.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
+
diff --git a/mach/i386/libem/cii.s b/mach/i386/libem/cii.s
new file mode 100644 (file)
index 0000000..60a3c5b
--- /dev/null
@@ -0,0 +1,33 @@
+.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
+       o16 cbw                 ! needs operand size toggle to convert
+                               ! from one to two bytes.
+       cwde
+       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
diff --git a/mach/i386/libem/cms.s b/mach/i386/libem/cms.s
new file mode 100644 (file)
index 0000000..d8d2639
--- /dev/null
@@ -0,0 +1,23 @@
+.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
diff --git a/mach/i386/libem/com.s b/mach/i386/libem/com.s
new file mode 100644 (file)
index 0000000..dfc5f70
--- /dev/null
@@ -0,0 +1,14 @@
+.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
diff --git a/mach/i386/libem/compmodule b/mach/i386/libem/compmodule
new file mode 100755 (executable)
index 0000000..575cf59
--- /dev/null
@@ -0,0 +1,4 @@
+if i386 -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
diff --git a/mach/i386/libem/csa4.s b/mach/i386/libem/csa4.s
new file mode 100644 (file)
index 0000000..f902450
--- /dev/null
@@ -0,0 +1,27 @@
+.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
diff --git a/mach/i386/libem/csb4.s b/mach/i386/libem/csb4.s
new file mode 100644 (file)
index 0000000..4a82141
--- /dev/null
@@ -0,0 +1,29 @@
+.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
diff --git a/mach/i386/libem/cuu.s b/mach/i386/libem/cuu.s
new file mode 100644 (file)
index 0000000..16177b6
--- /dev/null
@@ -0,0 +1,22 @@
+.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
diff --git a/mach/i386/libem/dup.s b/mach/i386/libem/dup.s
new file mode 100644 (file)
index 0000000..071a46c
--- /dev/null
@@ -0,0 +1,17 @@
+.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
diff --git a/mach/i386/libem/dvi.s b/mach/i386/libem/dvi.s
new file mode 100644 (file)
index 0000000..f7a8730
--- /dev/null
@@ -0,0 +1,21 @@
+.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
diff --git a/mach/i386/libem/dvu.s b/mach/i386/libem/dvu.s
new file mode 100644 (file)
index 0000000..5f5a717
--- /dev/null
@@ -0,0 +1,21 @@
+.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
diff --git a/mach/i386/libem/end.s b/mach/i386/libem/end.s
new file mode 100644 (file)
index 0000000..b986b7a
--- /dev/null
@@ -0,0 +1,17 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define        endtext,enddata,endbss
+.define _end,_etext,_edata
+
+        ! $Header$
+       .sect .text
+endtext:
+_etext:
+       .align 4
+       .sect .data
+enddata:
+_edata:
+       .align 4
+.sect .endsect
+_end:
+endbss:
+       .align 4
diff --git a/mach/i386/libem/error.s b/mach/i386/libem/error.s
new file mode 100644 (file)
index 0000000..36684ef
--- /dev/null
@@ -0,0 +1,42 @@
+.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:
+       push ebp
+       push esi
+       push edi
+       push edx
+       push ecx
+       push ebx
+       push eax
+       mov  ecx,eax
+       mov  ebx,1
+       sal  ebx,cl
+.extern .ignmask
+.extern .trp
+       test ebx,(.ignmask)
+       jne  2f
+       call    .trp
+2:
+       pop  eax
+       pop  ebx
+       pop  ecx
+       pop  edx
+       pop  edi
+       pop  esi
+       pop  ebp
+       ret
+
+.Xtrp:
+       cmp     eax,16
+       jge     1f
+       call    .error
+       ret
+1:
+       jmp     .trp
diff --git a/mach/i386/libem/exg.s b/mach/i386/libem/exg.s
new file mode 100644 (file)
index 0000000..d491dff
--- /dev/null
@@ -0,0 +1,20 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define .exg
+
+       ! #bytes in ecx
+.sect .text
+.exg:
+       push    edi
+       mov     esp,edi
+       add     edi,8
+       mov     ebx,edi
+       add     ebx,ecx
+       sar     ecx,2
+1:
+       mov     eax,(ebx)
+       xchg    eax,(edi)
+       mov     (ebx),eax
+       loop    1b
+2:
+       pop     edi
+       ret
diff --git a/mach/i386/libem/fakfp.s b/mach/i386/libem/fakfp.s
new file mode 100644 (file)
index 0000000..0baadb9
--- /dev/null
@@ -0,0 +1,38 @@
+.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
+.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
+.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
+.define .cmf4, .cmf8
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+!      $Header$
+
+       .sect .text
+.adf4:
+.adf8:
+.sbf4:
+.sbf8:
+.mlf4:
+.mlf8:
+.dvf4:
+.dvf8:
+.ngf4:
+.ngf8:
+.fif4:
+.fif8:
+.fef4:
+.fef8:
+.cif4:
+.cif8:
+.cuf4:
+.cuf8:
+.cfi:
+.cfu:
+.cff4:
+.cff8:
+.cmf4:
+.cmf8:
+       mov     eax,18  ! illegal instruction EILLINS
+       jmp     .trp
diff --git a/mach/i386/libem/fat.s b/mach/i386/libem/fat.s
new file mode 100644 (file)
index 0000000..0302552
--- /dev/null
@@ -0,0 +1,10 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define .fat
+
+.fat:
+.extern .trp
+.extern .stop
+       call    .trp
+       call    .stop
+       ! no return
diff --git a/mach/i386/libem/gto.s b/mach/i386/libem/gto.s
new file mode 100644 (file)
index 0000000..0149f27
--- /dev/null
@@ -0,0 +1,8 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define .gto
+
+.gto:
+       mov     ebp,8(ebx)
+       mov     esp,4(ebx)
+       jmp     (ebx)
diff --git a/mach/i386/libem/iaar.s b/mach/i386/libem/iaar.s
new file mode 100644 (file)
index 0000000..af9fd28
--- /dev/null
@@ -0,0 +1,19 @@
+.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
+       pop     edx      ! array base
+       sub     eax,(ebx)
+       mul     8(ebx)
+       mov     ebx,edx
+       add     ebx,eax
+       push    ecx
+       ret
diff --git a/mach/i386/libem/ilar.s b/mach/i386/libem/ilar.s
new file mode 100644 (file)
index 0000000..1551486
--- /dev/null
@@ -0,0 +1,15 @@
+.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
diff --git a/mach/i386/libem/inn.s b/mach/i386/libem/inn.s
new file mode 100644 (file)
index 0000000..95d8ac0
--- /dev/null
@@ -0,0 +1,32 @@
+.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
diff --git a/mach/i386/libem/ior.s b/mach/i386/libem/ior.s
new file mode 100644 (file)
index 0000000..ac40fb4
--- /dev/null
@@ -0,0 +1,18 @@
+.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,1
+1:
+       pop     eax
+       or      eax,(edi)
+       stos
+       loop    1b
+       mov     edi,edx
+       jmp     ebx
diff --git a/mach/i386/libem/isar.s b/mach/i386/libem/isar.s
new file mode 100644 (file)
index 0000000..75b46b7
--- /dev/null
@@ -0,0 +1,15 @@
+.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
diff --git a/mach/i386/libem/lar4.s b/mach/i386/libem/lar4.s
new file mode 100644 (file)
index 0000000..4eaa070
--- /dev/null
@@ -0,0 +1,40 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define .lar4
+
+.lar4:
+                               ! ebx, descriptor address
+                               ! eax, index
+       pop     ecx
+       pop     edx             ! base address
+       push    ecx
+       sub     eax,(ebx)
+       mov     ecx,8(ebx)
+       imul    ecx
+       add     edx,eax
+       sar     ecx,1
+       jnb     1f
+       xor     eax,eax
+       movb    al,(edx)
+       pop     ebx
+       push    eax
+       jmp     ebx
+1:
+       sar     ecx,1
+       jnb     1f
+       xor     eax,eax
+       o16 mov ax,(edx)
+       pop     ebx
+       push    eax
+       jmp     ebx
+1:
+       mov     edx,esi         ! saved esi
+       mov     eax,8(ebx)
+       pop     ebx             ! return address
+       sub     esp,eax
+       mov     eax,edi         ! save edi
+       mov     edi,esp
+       rep movs
+       mov     edi,eax
+       mov     esi,edx
+       jmp     ebx
diff --git a/mach/i386/libem/loi.s b/mach/i386/libem/loi.s
new file mode 100644 (file)
index 0000000..b1919ee
--- /dev/null
@@ -0,0 +1,44 @@
+.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
+       xor     eax,eax
+       movb    al,(edx)
+       push    eax
+       jmp     edx
+1:
+       sar     ecx,1
+       jnb     1f
+       xor     eax,eax
+       o16 mov ax,(edx)
+       push    eax
+       jmp     edx
+1:
+       mov     ebx,edx
+       mov     edx,esi
+       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
diff --git a/mach/i386/libem/mli.s b/mach/i386/libem/mli.s
new file mode 100644 (file)
index 0000000..84185fb
--- /dev/null
@@ -0,0 +1,20 @@
+.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
diff --git a/mach/i386/libem/mon.s b/mach/i386/libem/mon.s
new file mode 100644 (file)
index 0000000..42cac7c
--- /dev/null
@@ -0,0 +1,7 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define .mon
+
+.mon:
+.extern .stop
+       call    .stop
diff --git a/mach/i386/libem/ngi.s b/mach/i386/libem/ngi.s
new file mode 100644 (file)
index 0000000..b15a1fa
--- /dev/null
@@ -0,0 +1,19 @@
+.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
diff --git a/mach/i386/libem/nop.s b/mach/i386/libem/nop.s
new file mode 100644 (file)
index 0000000..c0f59f2
--- /dev/null
@@ -0,0 +1,24 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define .nop
+.extern printd, printc, hol0
+
+SIO_S           = 0xDA
+SIO_D           = 0xD8
+RXRDY           = 0x02
+
+.nop:
+       mov     eax,(hol0)
+       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'
+       jmp     printc
diff --git a/mach/i386/libem/print.s b/mach/i386/libem/print.s
new file mode 100644 (file)
index 0000000..a18cd92
--- /dev/null
@@ -0,0 +1,47 @@
+.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
diff --git a/mach/i386/libem/rck.s b/mach/i386/libem/rck.s
new file mode 100644 (file)
index 0000000..e1a6669
--- /dev/null
@@ -0,0 +1,20 @@
+.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
diff --git a/mach/i386/libem/return.s b/mach/i386/libem/return.s
new file mode 100644 (file)
index 0000000..f12a881
--- /dev/null
@@ -0,0 +1,17 @@
+.define .sdret, .dsret, .sret, .dret, .cret 
+.sect .text
+
+.dsret:
+       pop     edi
+.sret:
+       pop     esi
+.cret:
+       mov     esp,ebp
+       pop     ebp
+       ret
+
+.sdret:
+       pop     esi
+.dret:
+       pop     edi
+       jmp     .cret
diff --git a/mach/i386/libem/rmi.s b/mach/i386/libem/rmi.s
new file mode 100644 (file)
index 0000000..775abbd
--- /dev/null
@@ -0,0 +1,21 @@
+.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
diff --git a/mach/i386/libem/rmu.s b/mach/i386/libem/rmu.s
new file mode 100644 (file)
index 0000000..d51029d
--- /dev/null
@@ -0,0 +1,21 @@
+.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
diff --git a/mach/i386/libem/rol.s b/mach/i386/libem/rol.s
new file mode 100644 (file)
index 0000000..68365d7
--- /dev/null
@@ -0,0 +1,20 @@
+.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
diff --git a/mach/i386/libem/ror.s b/mach/i386/libem/ror.s
new file mode 100644 (file)
index 0000000..ef34a96
--- /dev/null
@@ -0,0 +1,20 @@
+.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
diff --git a/mach/i386/libem/sar4.s b/mach/i386/libem/sar4.s
new file mode 100644 (file)
index 0000000..2cbeef6
--- /dev/null
@@ -0,0 +1,39 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define .sar4
+
+.sar4:
+                               ! ebx, descriptor address
+                               ! eax, index
+       pop     ecx
+       pop     edx             ! base address
+       push    ecx
+       sub     eax,(ebx)
+       mov     ecx,8(ebx)
+       push    edx
+       imul    ecx
+       pop     edx
+       add     edx,eax
+       sar     ecx,1
+       jnb     1f
+       pop     ebx
+       pop     eax
+       movb    (edx),al
+       jmp     ebx
+1:
+       sar     ecx,1
+       jnb     1f
+       pop     ebx
+       pop     eax
+       o16 mov (edx),ax
+       jmp     ebx
+1:
+       pop     ebx
+       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
diff --git a/mach/i386/libem/sbi.s b/mach/i386/libem/sbi.s
new file mode 100644 (file)
index 0000000..2897d31
--- /dev/null
@@ -0,0 +1,19 @@
+.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
diff --git a/mach/i386/libem/set.s b/mach/i386/libem/set.s
new file mode 100644 (file)
index 0000000..0f334bc
--- /dev/null
@@ -0,0 +1,42 @@
+.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,1
+1:
+       mov     4(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
diff --git a/mach/i386/libem/sli.s b/mach/i386/libem/sli.s
new file mode 100644 (file)
index 0000000..dd5b616
--- /dev/null
@@ -0,0 +1,20 @@
+.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
diff --git a/mach/i386/libem/sri.s b/mach/i386/libem/sri.s
new file mode 100644 (file)
index 0000000..2fb7871
--- /dev/null
@@ -0,0 +1,20 @@
+.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
diff --git a/mach/i386/libem/sti.s b/mach/i386/libem/sti.s
new file mode 100644 (file)
index 0000000..4bd0e1a
--- /dev/null
@@ -0,0 +1,39 @@
+.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:
+       mov     ebx,edx
+       mov     edx,edi
+       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
diff --git a/mach/i386/libem/stop.s b/mach/i386/libem/stop.s
new file mode 100644 (file)
index 0000000..fbf0e69
--- /dev/null
@@ -0,0 +1,5 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define .stop
+.stop:
+       int     3
diff --git a/mach/i386/libem/strhp.s b/mach/i386/libem/strhp.s
new file mode 100644 (file)
index 0000000..ff2c217
--- /dev/null
@@ -0,0 +1,27 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define        .strhp
+.extern .reghp, .limhp, EHEAP, .trp
+
+.strhp:
+       pop     ebx
+       pop     eax
+       mov     (.reghp),eax
+       cmp     eax,(.limhp)
+       jb      1f
+       add     eax,02000
+       and     eax,~0777
+       mov     (.limhp),eax
+       push    ebx
+       push    eax
+       call    _brk
+       pop     ecx
+       pop     ebx
+       cmp     eax,-1
+       je      2f
+1:
+       jmp     ebx
+2:
+       mov     eax,EHEAP
+       push    ebx
+       jmp     .trp
diff --git a/mach/i386/libem/trp.s b/mach/i386/libem/trp.s
new file mode 100644 (file)
index 0000000..4292fe3
--- /dev/null
@@ -0,0 +1,17 @@
+.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:
+       call    .stop
diff --git a/mach/i386/libem/unknown.s b/mach/i386/libem/unknown.s
new file mode 100644 (file)
index 0000000..59425f2
--- /dev/null
@@ -0,0 +1,9 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
+.define .unknown
+.extern EILLINS, .fat
+
+.unknown:
+       mov  eax,EILLINS
+       push eax
+       jmp  .fat
diff --git a/mach/i386/libem/xor.s b/mach/i386/libem/xor.s
new file mode 100644 (file)
index 0000000..2dfb30d
--- /dev/null
@@ -0,0 +1,18 @@
+.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