*** empty log message ***
authorkeie <none@none>
Thu, 7 Feb 1985 15:33:13 +0000 (15:33 +0000)
committerkeie <none@none>
Thu, 7 Feb 1985 15:33:13 +0000 (15:33 +0000)
52 files changed:
mach/i86/libem/adi.s [new file with mode: 0644]
mach/i86/libem/and.s [new file with mode: 0644]
mach/i86/libem/cii.s [new file with mode: 0644]
mach/i86/libem/cms.s [new file with mode: 0644]
mach/i86/libem/cmu4.s [new file with mode: 0644]
mach/i86/libem/com.s [new file with mode: 0644]
mach/i86/libem/csa2.s [new file with mode: 0644]
mach/i86/libem/csb2.s [new file with mode: 0644]
mach/i86/libem/cuu.s [new file with mode: 0644]
mach/i86/libem/dup.s [new file with mode: 0644]
mach/i86/libem/dvi.s [new file with mode: 0644]
mach/i86/libem/dvi4.s [new file with mode: 0644]
mach/i86/libem/dvu.s [new file with mode: 0644]
mach/i86/libem/dvu4.s [new file with mode: 0644]
mach/i86/libem/error.s [new file with mode: 0644]
mach/i86/libem/exg.s [new file with mode: 0644]
mach/i86/libem/fakfp.s [new file with mode: 0644]
mach/i86/libem/fat.s [new file with mode: 0644]
mach/i86/libem/gto.s [new file with mode: 0644]
mach/i86/libem/iaar.s [new file with mode: 0644]
mach/i86/libem/ilar.s [new file with mode: 0644]
mach/i86/libem/inn.s [new file with mode: 0644]
mach/i86/libem/ior.s [new file with mode: 0644]
mach/i86/libem/isar.s [new file with mode: 0644]
mach/i86/libem/lar2.s [new file with mode: 0644]
mach/i86/libem/loi.s [new file with mode: 0644]
mach/i86/libem/mli.s [new file with mode: 0644]
mach/i86/libem/mli4.s [new file with mode: 0644]
mach/i86/libem/mon.s [new file with mode: 0644]
mach/i86/libem/ngi.s [new file with mode: 0644]
mach/i86/libem/nop.s [new file with mode: 0644]
mach/i86/libem/print.s [new file with mode: 0644]
mach/i86/libem/printf.s [new file with mode: 0644]
mach/i86/libem/rck.s [new file with mode: 0644]
mach/i86/libem/rmi.s [new file with mode: 0644]
mach/i86/libem/rmi4.s [new file with mode: 0644]
mach/i86/libem/rmu.s [new file with mode: 0644]
mach/i86/libem/rmu4.s [new file with mode: 0644]
mach/i86/libem/rol.s [new file with mode: 0644]
mach/i86/libem/ror.s [new file with mode: 0644]
mach/i86/libem/sar2.s [new file with mode: 0644]
mach/i86/libem/sbi.s [new file with mode: 0644]
mach/i86/libem/set.s [new file with mode: 0644]
mach/i86/libem/sli.s [new file with mode: 0644]
mach/i86/libem/sri.s [new file with mode: 0644]
mach/i86/libem/sti.s [new file with mode: 0644]
mach/i86/libem/stop.s [new file with mode: 0644]
mach/i86/libem/strhp.s [new file with mode: 0644]
mach/i86/libem/tail.s [new file with mode: 0644]
mach/i86/libem/trp.s [new file with mode: 0644]
mach/i86/libem/unknown.s [new file with mode: 0644]
mach/i86/libem/xor.s [new file with mode: 0644]

diff --git a/mach/i86/libem/adi.s b/mach/i86/libem/adi.s
new file mode 100644 (file)
index 0000000..f1f0609
--- /dev/null
@@ -0,0 +1,25 @@
+.define .adi
+
+        ! $Header$
+       ! #bytes in cx , top of stack in ax
+.adi:
+       pop     bx              ! return address
+       cmp     cx,2
+       jne     1f
+       pop     cx
+       add     ax,cx
+       jmp     bx
+1:
+       cmp     cx,4
+       jne     9f
+       pop     dx
+       pop     cx
+       add     ax,cx
+       pop     cx
+       adc     dx,cx
+       push    dx
+       jmp     bx
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/and.s b/mach/i86/libem/and.s
new file mode 100644 (file)
index 0000000..e77b09d
--- /dev/null
@@ -0,0 +1,15 @@
+.define        .and
+
+        ! $Header$
+       ! #bytes in cx
+.and:
+       pop     bx              ! return address
+       mov     di,sp
+       add     di,cx
+       sar     cx,1
+1:
+       pop     ax
+       and     ax,(di)
+       stos
+       loop    1b
+       jmp     bx
diff --git a/mach/i86/libem/cii.s b/mach/i86/libem/cii.s
new file mode 100644 (file)
index 0000000..4304a0e
--- /dev/null
@@ -0,0 +1,37 @@
+.define .cii
+
+.cii:
+        ! $Header$
+       pop     di              ! return address
+                               ! pop     cx, dest. size
+                               ! pop     bx, src. size
+                               ! ax is first word of source
+       cmp     bx,cx
+       je      8f
+       cmp     bx,2
+       je      1f
+       cmp     bx,4
+       jne     7f
+       cmp     cx,2
+       jne     9f
+       pop     dx
+8:
+       jmp     di
+7:      cmp     bx,1
+       jne     9f
+       cmp     cx,2
+       jne     9f
+       cbw
+       jmp     8b
+1:
+       cmp     cx,4
+       jne     9f
+       cwd
+       push    dx
+       jmp     di
+9:
+       push    ax              ! push low source
+       mov     ax,EILLINS
+       push    ax
+       jmp     .fat
+       jmp     bx
diff --git a/mach/i86/libem/cms.s b/mach/i86/libem/cms.s
new file mode 100644 (file)
index 0000000..cec20db
--- /dev/null
@@ -0,0 +1,18 @@
+.define .cms
+
+        ! $Header$
+       ! #bytes in cx
+.cms:
+       pop     bx              ! return address
+       mov     dx,sp
+       mov     si,dx
+       add     dx,cx
+       mov     di,dx
+       add     dx,cx
+       sar     cx,1
+       repe cmps
+       je      1f
+       inc     cx
+1:
+       mov     sp,dx
+       jmp     bx
diff --git a/mach/i86/libem/cmu4.s b/mach/i86/libem/cmu4.s
new file mode 100644 (file)
index 0000000..2e4bf94
--- /dev/null
@@ -0,0 +1,25 @@
+.define .cmu4
+
+.cmu4:
+        ! $Header$
+       pop     bx              ! return address
+       xor     ax,ax
+       pop     cx
+       pop     dx
+       pop     si
+       pop     di
+       cmp     di,dx
+       ja      1f
+       jb      2f
+       cmp     si,cx
+       ja      1f
+       je      3f
+2:
+       dec     ax
+3:
+       jmp     bx
+1:
+       inc     ax
+       jmp     bx
+
+       ret
diff --git a/mach/i86/libem/com.s b/mach/i86/libem/com.s
new file mode 100644 (file)
index 0000000..23aee51
--- /dev/null
@@ -0,0 +1,14 @@
+.define        .com
+
+        ! $Header$
+       ! #bytes in cx
+.com:
+       pop     bx              ! return address
+       mov     di,sp
+       sar     cx,1
+1:
+       not     (di)
+       inc     di
+       inc     di
+       loop    1b
+       jmp     bx
diff --git a/mach/i86/libem/csa2.s b/mach/i86/libem/csa2.s
new file mode 100644 (file)
index 0000000..60ef8ed
--- /dev/null
@@ -0,0 +1,23 @@
+.define .csa2
+
+.csa2:
+        ! $Header$
+                               ! si, descriptor address
+                               ! bx, index
+       mov     dx,(si)         ! default
+       sub     bx,2(si)
+       cmp     bx,4(si)
+       ja      1f
+       sal     bx,1
+       mov     bx,6(bx)(si)
+       test    bx,bx
+       jnz     2f
+1:
+       mov     bx,dx
+       test    bx,bx
+       jnz     2f
+       mov     ax,ECASE
+       push    ax
+       jmp     .fat
+2:
+       jmp     bx
diff --git a/mach/i86/libem/csb2.s b/mach/i86/libem/csb2.s
new file mode 100644 (file)
index 0000000..f49fe8a
--- /dev/null
@@ -0,0 +1,26 @@
+.define .csb2
+
+.csb2:
+        ! $Header$
+                               !si, descriptor address
+                               !dx,  index
+       lods
+       xchg    ax,bx           ! default
+       lods
+       xchg    ax,cx           ! number of cases
+1:
+       dec     cx
+       jl      2f
+       lods
+       cmp     ax,dx
+       lods
+       jne     1b
+       xchg    ax,bx
+2:
+       test    bx,bx
+       jnz     3f
+       mov     ax,ECASE
+       push    ax
+       jmp     .fat
+3:
+       jmp     bx
diff --git a/mach/i86/libem/cuu.s b/mach/i86/libem/cuu.s
new file mode 100644 (file)
index 0000000..7719f39
--- /dev/null
@@ -0,0 +1,35 @@
+.define .ciu
+.define .cui
+.define .cuu
+
+.ciu:
+.cui:
+.cuu:
+        ! $Header$
+       pop     di              ! return address
+                               ! pop     cx, dest. size
+                               ! pop     bx, source size
+                               ! ax is low word of source
+       cmp     bx,cx
+       je      8f
+       cmp     bx,2
+       je      1f
+       cmp     bx,4
+       jne     9f
+       cmp     cx,2
+       jne     9f
+       pop     dx
+8:
+       jmp     di
+1:
+       cmp     cx,4
+       jne     9f
+       xor     dx,dx
+       push    dx
+       jmp     di
+9:
+       push    ax              ! to help debugging ?
+       mov     ax,EILLINS
+       push    ax
+       jmp     .fat
+       jmp     bx
diff --git a/mach/i86/libem/dup.s b/mach/i86/libem/dup.s
new file mode 100644 (file)
index 0000000..9634463
--- /dev/null
@@ -0,0 +1,12 @@
+.define        .dup
+
+        ! $Header$
+       ! #bytes in cx
+.dup:
+       pop     bx              ! return address
+       mov     si,sp
+       sub     sp,cx
+       mov     di,sp
+       sar     cx,1
+       rep movs
+       jmp     bx
diff --git a/mach/i86/libem/dvi.s b/mach/i86/libem/dvi.s
new file mode 100644 (file)
index 0000000..fd3daac
--- /dev/null
@@ -0,0 +1,35 @@
+.define .dvi
+
+        ! $Header$
+        ! #bytes in ax
+.dvi:
+        pop     bx              ! return address
+        cmp     ax,2
+        jne     1f
+        pop     ax
+        cwd
+        pop     cx
+        idiv    cx
+        push    ax
+        jmp     bx
+1:
+        cmp     ax,4
+        jne     9f
+        pop     ax
+        pop     dx
+        pop     si
+        pop     di
+        push    bx
+        push    di
+        push    si
+        push    dx
+        push    ax
+        call   .dvi4
+        pop     bx
+        push    cx
+        push    ax
+        jmp     bx
+9:
+        mov     ax,EODDZ
+        push    ax
+        jmp     .trp
diff --git a/mach/i86/libem/dvi4.s b/mach/i86/libem/dvi4.s
new file mode 100644 (file)
index 0000000..e4c66ff
--- /dev/null
@@ -0,0 +1,85 @@
+.define .dvi4
+
+yl=2
+yh=4
+xl=6
+xh=8
+
+.dvi4:
+        ! $Header$
+       mov     si,sp           ! copy of sp
+       mov     bx,yl(si)
+       mov     ax,yh(si)
+       cwd
+       mov     di,dx
+       cmp     dx,ax
+       jne     7f
+       and     dx,dx
+       jge     1f
+       neg     bx
+       je      7f
+1:
+       xor     dx,dx
+       mov     cx,xl(si)
+       mov     ax,xh(si)
+       and     ax,ax
+       jge     2f
+       neg     ax
+       neg     cx
+       sbb     ax,dx
+       not     di
+2:
+       div     bx
+       xchg    ax,cx
+       div     bx              ! cx = high abs(result), ax=low abs(result)
+9:
+       and     di,di
+       jge     1f
+       neg     cx
+       neg     ax
+       sbb     cx,0
+1:
+                       ! cx is high order result
+                       ! ax is low order result
+       ret     8
+
+7:
+       push    dx              ! sign of y
+       mov     di,ax
+       xor     bx,bx
+       and     di,di
+       jge     1f
+       neg     di
+       neg     yl(si)
+       sbb     di,bx
+1:
+       mov     ax,xl(si)
+       mov     dx,xh(si)
+       and     dx,dx
+       jge     1f
+       neg     dx
+       neg     ax
+       sbb     dx,bx
+       not     -2(si)
+1:
+       mov     cx,16
+1:
+       shl     ax,1
+       rcl     dx,1
+       rcl     bx,1
+       cmp     di,bx
+       ja      3f
+       jb      2f
+       cmp     yl(si),dx
+       jbe     2f
+3:
+       loop    1b
+       jmp     1f
+2:
+       sub     dx,yl(si)
+       sbb     bx,di
+       inc     ax
+       loop    1b
+1:
+       pop     di              ! di=sign of result,ax= result
+       jmp     9b
diff --git a/mach/i86/libem/dvu.s b/mach/i86/libem/dvu.s
new file mode 100644 (file)
index 0000000..b2bcdd6
--- /dev/null
@@ -0,0 +1,35 @@
+.define .dvu
+
+        ! $Header$
+       ! #bytes in ax
+.dvu:
+       pop     bx              ! return address
+       cmp     ax,2
+       jne     1f
+       pop     ax
+       xor     dx,dx
+       pop     cx
+       div     cx
+       push    ax
+       jmp     bx
+1:
+       cmp     ax,4
+       jne     9f
+       pop     ax
+       pop     dx
+       pop     si
+       pop     di
+       push    bx
+       push    di
+       push    si
+       push    dx
+       push    ax
+       call   .dvu4
+       pop     bx
+       push    cx
+       push    ax
+       jmp     bx
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/dvu4.s b/mach/i86/libem/dvu4.s
new file mode 100644 (file)
index 0000000..fff547b
--- /dev/null
@@ -0,0 +1,49 @@
+.define .dvu4
+
+yl=2
+yh=4
+xl=6
+xh=8
+
+.dvu4:
+        ! $Header$
+       mov     si,sp           ! copy of sp
+       mov     bx,yl(si)
+       mov     ax,yh(si)
+       or      ax,ax
+       jne     7f
+       xor     dx,dx
+       mov     cx,xl(si)
+       mov     ax,xh(si)
+       div     bx
+       xchg    ax,cx
+       div     bx
+9:
+                       ! cx is high order result
+                       ! ax is low order result
+       ret     8
+
+7:
+       mov     di,ax
+       xor     bx,bx
+       mov     ax,xl(si)
+       mov     dx,xh(si)
+       mov     cx,16
+1:
+       shl     ax,1
+       rcl     dx,1
+       rcl     bx,1
+       cmp     di,bx
+       ja      3f
+       jb      2f
+       cmp     yl(si),dx
+       jbe     2f
+3:
+       loop    1b
+       jmp     9b
+2:
+       sub     dx,yl(si)
+       sbb     bx,di
+       inc     ax
+       loop    1b
+       jmp     9b
diff --git a/mach/i86/libem/error.s b/mach/i86/libem/error.s
new file mode 100644 (file)
index 0000000..64354e6
--- /dev/null
@@ -0,0 +1,30 @@
+.define .error
+
+        ! $Header$
+       ! ax is trap number
+       ! all registers must be saved
+       ! because return is possible
+       ! May only be called with error no's <16
+.error:
+       push bp
+       push si
+       push di
+       push dx
+       push cx
+       push bx
+       push ax
+       mov  cx,ax
+       mov  bx,1
+       sal  bx,cl
+       test bx,(.ignmask)
+       jne  2f
+       call    .trp
+2:
+       pop  ax
+       pop  bx
+       pop  cx
+       pop  dx
+       pop  di
+       pop  si
+       pop  bp
+       ret
diff --git a/mach/i86/libem/exg.s b/mach/i86/libem/exg.s
new file mode 100644 (file)
index 0000000..8b5bf4b
--- /dev/null
@@ -0,0 +1,20 @@
+.define .exg
+
+        ! $Header$
+       ! #bytes in cx
+.exg:
+       pop     bx              ! return address
+       mov     dx,cx
+       mov     si,sp
+       sub     sp,cx
+       mov     di,sp
+       rep movs
+       mov     si,sp
+       mov     di,sp
+       add     di,dx
+       add     di,dx
+       mov     cx,dx
+       sar     cx,1
+       rep movs
+       mov     sp,si
+       jmp     bx
diff --git a/mach/i86/libem/fakfp.s b/mach/i86/libem/fakfp.s
new file mode 100644 (file)
index 0000000..df97bc2
--- /dev/null
@@ -0,0 +1,42 @@
+.define .mlf,.dvf,.ngf,.adf,.sbf,.cmf,.zrf,.fif,.fef
+.define .mlf8,.dvf8,.ngf8,.adf8,.sbf8,.cmf8,.zrf8,.fif8,.fef8
+.define .mlf4,.dvf4,.ngf4,.adf4,.sbf4,.cmf4,.zrf4,.fif4,.fef4
+.define .cif,.cfi,.cuf,.cfu,.cff
+
+.mlf:
+.dvf:
+.ngf:
+.adf:
+.sbf:
+.cmf:
+.zrf:
+.fif:
+.fef:
+.mlf4:
+.dvf4:
+.ngf4:
+.adf4:
+.sbf4:
+.cmf4:
+.zrf4:
+.fif4:
+.fef4:
+.mlf8:
+.dvf8:
+.ngf8:
+.adf8:
+.sbf8:
+.cmf8:
+.zrf8:
+.fif8:
+.fef8:
+.cif:
+.cfi:
+.cuf:
+.cfu:
+.cff:
+        ! $Header$
+       pop     bx              ! return address
+       mov     ax,EILLINS
+       push    ax
+       jmp     .fat
diff --git a/mach/i86/libem/fat.s b/mach/i86/libem/fat.s
new file mode 100644 (file)
index 0000000..5a0dd07
--- /dev/null
@@ -0,0 +1,7 @@
+.define .fat
+
+.fat:
+        ! $Header$
+       call    .trp
+       call    .stop
+       ! no return
diff --git a/mach/i86/libem/gto.s b/mach/i86/libem/gto.s
new file mode 100644 (file)
index 0000000..8fdb23b
--- /dev/null
@@ -0,0 +1,7 @@
+.define .gto
+
+.gto:
+        ! $Header$
+       mov     bp,4(bx)
+       mov     sp,2(bx)
+       jmp     (bx)
diff --git a/mach/i86/libem/iaar.s b/mach/i86/libem/iaar.s
new file mode 100644 (file)
index 0000000..4a2a92e
--- /dev/null
@@ -0,0 +1,15 @@
+.define .iaar
+
+.iaar:
+        ! $Header$
+       pop     bx
+       pop     dx
+       cmp     dx,2
+       jne     .unknown
+       pop     si      ! descriptor address
+       pop     ax      ! index
+       pop     di      ! array base
+       sub     ax,(si)
+       mul     4(si)
+       add     di,ax
+       jmp     bx
diff --git a/mach/i86/libem/ilar.s b/mach/i86/libem/ilar.s
new file mode 100644 (file)
index 0000000..11fbed5
--- /dev/null
@@ -0,0 +1,13 @@
+.define .ilar
+
+.ilar:
+        ! $Header$
+       pop     bx
+       pop     dx
+       cmp     dx,2
+       jne     .unknown
+       pop     di      ! descriptor address
+       pop     ax      ! index
+       pop     si      ! array base
+       push    bx
+       jmp    .lar2
diff --git a/mach/i86/libem/inn.s b/mach/i86/libem/inn.s
new file mode 100644 (file)
index 0000000..ced6bbc
--- /dev/null
@@ -0,0 +1,29 @@
+.define .inn
+
+        ! $Header$
+       ! #bytes in cx
+       ! bit # in ax
+.inn:
+       pop     bx              ! return address
+       xor     dx,dx
+       xor     si,si
+       mov     di,8
+       div     di
+       mov     di,sp
+       add     di,ax
+       cmp     ax,cx
+       xchg    ax,dx
+       xchg    ax,si           ! ax:=si,si:=dx,does not change carry
+       jae     1f
+       movb    dl,bits(si)
+       testb   (di),dl
+       jz      1f
+       inc     ax
+1:
+       add     sp,cx
+       ! ax is result
+       jmp     bx
+
+       .data
+bits:
+       .byte 1,2,4,8,16,32,64,128
diff --git a/mach/i86/libem/ior.s b/mach/i86/libem/ior.s
new file mode 100644 (file)
index 0000000..0fc130a
--- /dev/null
@@ -0,0 +1,15 @@
+.define        .ior
+
+        ! $Header$
+       ! #bytes in cx
+.ior:
+       pop     bx              ! return address
+       mov     di,sp
+       add     di,cx
+       sar     cx,1
+1:
+       pop     ax
+       or      ax,(di)
+       stos
+       loop    1b
+       jmp     bx
diff --git a/mach/i86/libem/isar.s b/mach/i86/libem/isar.s
new file mode 100644 (file)
index 0000000..569bb77
--- /dev/null
@@ -0,0 +1,13 @@
+.define .isar
+
+.isar:
+        ! $Header$
+       pop     bx
+       pop     dx
+       cmp     dx,2
+       jne     .unknown
+       pop     si      ! descriptor address
+       pop     ax      ! index
+       pop     di      ! array base
+       push    bx
+       jmp    .sar2
diff --git a/mach/i86/libem/lar2.s b/mach/i86/libem/lar2.s
new file mode 100644 (file)
index 0000000..58a7c3a
--- /dev/null
@@ -0,0 +1,23 @@
+.define .lar2
+
+.lar2:
+        ! $Header$
+       pop     bx              ! return address
+                               ! di, descriptor address
+                               ! ax, index
+                               ! si, base address
+       sub     ax,(di)
+       mov     cx,4(di)
+       imul    cx
+       add     si,ax
+       sar     cx,1
+       jnb     1f
+       xorb    ah,ah
+       lodsb
+       push    ax
+       jmp     bx
+1:
+       sub     sp,4(di)
+       mov     di,sp
+       rep movs
+       jmp     bx
diff --git a/mach/i86/libem/loi.s b/mach/i86/libem/loi.s
new file mode 100644 (file)
index 0000000..c958d5e
--- /dev/null
@@ -0,0 +1,19 @@
+.define .loi
+
+        ! $Header$
+       ! #bytes in cx
+       ! source address in si
+.loi:
+       pop     bx
+       mov     dx,cx
+       sar     cx,1
+       jnb     1f
+       xorb    ah,ah
+       lodsb
+       push    ax
+       jmp     bx
+1:
+       sub     sp,dx
+       mov     di,sp
+       rep movs
+       jmp     bx
diff --git a/mach/i86/libem/mli.s b/mach/i86/libem/mli.s
new file mode 100644 (file)
index 0000000..f143488
--- /dev/null
@@ -0,0 +1,27 @@
+.define .mli
+
+        ! $Header$
+       ! #bytes in ax
+.mli:
+       pop     bx              ! return address
+       cmp     ax,2
+       jne     1f
+       pop     ax
+       pop     cx
+       mul     cx
+       push    ax
+       jmp     bx
+1:
+       mov     dx,bx
+       cmp     ax,4
+       jne     9f
+       pop     si
+       pop     di
+       pop     bx
+       pop     ax
+       push    dx
+       jmp    .mli4
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/mli4.s b/mach/i86/libem/mli4.s
new file mode 100644 (file)
index 0000000..36395fd
--- /dev/null
@@ -0,0 +1,17 @@
+.define .mli4
+
+        ! $Header$
+       ! x * y with
+       ! x.low = si x.high = di
+       ! y.low = bx y.high = ax
+
+.mli4:
+       mul     si              ! xl*yh
+       mov     cx,ax
+       mov     ax,di
+       mul     bx              ! xh*yl
+       add     cx,ax           ! xh*yl+xl*yh
+       mov     ax,si
+       mul     bx              ! xl*yl
+       add     dx,cx
+       ret
diff --git a/mach/i86/libem/mon.s b/mach/i86/libem/mon.s
new file mode 100644 (file)
index 0000000..30dd48e
--- /dev/null
@@ -0,0 +1,5 @@
+.define .mon
+
+.mon:
+        ! $Header$
+       call    .stop
diff --git a/mach/i86/libem/ngi.s b/mach/i86/libem/ngi.s
new file mode 100644 (file)
index 0000000..6a479f7
--- /dev/null
@@ -0,0 +1,27 @@
+.define .ngi
+
+        ! $Header$
+       ! #bytes in ax
+.ngi:
+       pop     bx              ! return address
+       cmp     ax,2
+       jne     1f
+       pop     cx
+       neg     cx
+       push    cx
+       jmp     bx
+1:
+       cmp     ax,4
+       jne     9f
+       pop     dx
+       pop     ax
+       neg     ax
+       neg     dx
+       sbb     ax,0
+       push    dx
+       push    ax
+       jmp     bx
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/nop.s b/mach/i86/libem/nop.s
new file mode 100644 (file)
index 0000000..26aa071
--- /dev/null
@@ -0,0 +1,22 @@
+.define .nop
+
+SIO_S           = 0xDA
+SIO_D           = 0xD8
+RXRDY           = 0x02
+
+.nop:
+        ! $Header$
+       mov     ax,(hol0)
+       call    printd
+!       movb    al,' '
+!       call    printc
+!       mov     ax,sp
+!       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/i86/libem/print.s b/mach/i86/libem/print.s
new file mode 100644 (file)
index 0000000..bb8ea8a
--- /dev/null
@@ -0,0 +1,47 @@
+.define        printc,printd,prints
+
+SIO_D          = 0xD8
+SIO_S          = 0xDA
+TXRDY          = 0x01
+
+        ! $Header$
+       ! argument in ax
+       ! uses bx
+prints:
+       xchg    ax,bx
+1:
+       movb    al,(bx)
+       inc     bx
+       testb   al,al
+       jz      2f
+       call    printc
+       jmp     1b
+2:
+       ret
+
+       ! argument in ax
+       ! uses cx and dx
+printd:
+       xor     dx,dx
+       mov     cx,10
+       div     cx
+       test    ax,ax
+       jz      1f
+       push    dx
+       call    printd
+       pop     dx
+1:
+       xchg    ax,dx
+       addb    al,'0'
+       .errnz  printc - .
+
+       ! argument in ax
+printc:
+       push    ax
+1:
+       inb     SIO_S
+       andb    al,TXRDY
+       jz      1b
+       pop     ax
+       outb    SIO_D
+       ret
diff --git a/mach/i86/libem/printf.s b/mach/i86/libem/printf.s
new file mode 100644 (file)
index 0000000..31ea794
--- /dev/null
@@ -0,0 +1,38 @@
+.define        printf
+
+printf:
+        ! $Header$
+       pop     bx              ! return address
+       xchg    ax,di
+       mov     si,sp
+1:
+       movb    al,(di)
+       inc     di
+       testb   al,al
+       jz      6f
+       cmpb    al,'%'
+       je      3f
+2:
+       call    printc
+       jmp     1b
+3:
+       movb    al,(di)
+       inc     di
+       cmpb    al,'c'
+       jne     4f
+       lods
+       jmp     2b
+4:
+       cmpb    al,'d'
+       jne     5f
+       lods
+       call    printd
+       jmp     1b
+5:
+       cmpb    al,'s'
+       jne     2b
+       lods
+       call    prints
+       jmp     1b
+6:
+       jmp     bx
diff --git a/mach/i86/libem/rck.s b/mach/i86/libem/rck.s
new file mode 100644 (file)
index 0000000..5a01214
--- /dev/null
@@ -0,0 +1,17 @@
+.define .rck
+
+        ! $Header$
+       ! descriptor address in si
+       ! value in ax, must be left there
+.rck:
+       cmp     ax,(si)
+       jl      2f
+       cmp     ax,2(si)
+       jg      2f
+       ret
+2:
+       push    ax
+       mov     ax,ERANGE
+       call    .error
+       pop     ax
+       ret
diff --git a/mach/i86/libem/rmi.s b/mach/i86/libem/rmi.s
new file mode 100644 (file)
index 0000000..81fdc89
--- /dev/null
@@ -0,0 +1,35 @@
+.define .rmi
+
+        ! $Header$
+       ! #bytes in ax
+.rmi:
+       pop     bx              ! return address
+       cmp     ax,2
+       jne     1f
+       pop     ax
+       cwd
+       pop     cx
+       idiv    cx
+       push    dx
+       jmp     bx
+1:
+       cmp     ax,4
+       jne     9f
+       pop     ax
+       pop     dx
+       pop     si
+       pop     di
+       push    bx
+       push    di
+       push    si
+       push    dx
+       push    ax
+       call   .rmi4
+       pop     ax
+       push    bx
+       push    dx
+       jmp     ax
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/rmi4.s b/mach/i86/libem/rmi4.s
new file mode 100644 (file)
index 0000000..6abaea1
--- /dev/null
@@ -0,0 +1,83 @@
+.define .rmi4
+
+yl=2
+yh=4
+xl=6
+xh=8
+
+.rmi4:
+        ! $Header$
+       mov     si,sp           ! copy of sp
+       mov     bx,yl(si)
+       mov     ax,yh(si)
+       cwd
+       cmp     dx,ax
+       jne     7f
+       and     dx,dx
+       jge     1f
+       neg     bx
+       je      7f
+1:
+       xor     dx,dx
+       mov     cx,xl(si)
+       mov     ax,xh(si)
+       and     ax,ax
+       jge     2f
+       neg     ax
+       neg     cx
+       sbb     ax,dx
+2:
+       div     bx
+       xchg    ax,cx
+       div     bx              ! dx= result(low), 0=result(high)
+       xor     bx,bx
+9:
+       cmp     xh(si),0
+       jge     1f
+       neg     bx
+       neg     dx
+       sbb     bx,0
+1:
+                       ! bx is high order result
+                       ! dx is low order result
+       ret     8
+
+7:
+       mov     di,ax
+       xor     bx,bx
+       and     di,di
+       jge     1f
+       neg     di
+       neg     yl(si)
+       sbb     di,bx
+1:
+       mov     ax,xl(si)
+       mov     dx,xh(si)
+       and     dx,dx
+       jge     1f
+       neg     dx
+       neg     ax
+       sbb     dx,bx
+1:
+       mov     cx,16
+1:
+       shl     ax,1
+       rcl     dx,1
+       rcl     bx,1
+       cmp     di,bx
+       ja      3f
+       jb      2f
+       cmp     yl(si),dx
+       jbe     2f
+3:
+       loop    1b
+               ! dx=result(low), bx=result(high)
+       jmp     9b
+2:
+       sub     dx,yl(si)
+       sbb     bx,di
+       inc     ax
+       loop    1b
+1:
+               ! dx=result(low), bx=result(high)
+       jmp     9b
diff --git a/mach/i86/libem/rmu.s b/mach/i86/libem/rmu.s
new file mode 100644 (file)
index 0000000..3e74de7
--- /dev/null
@@ -0,0 +1,35 @@
+.define .rmu
+
+        ! $Header$
+       ! #bytes in ax
+.rmu:
+       pop     bx              ! return address
+       cmp     ax,2
+       jne     1f
+       pop     ax
+       xor     dx,dx
+       pop     cx
+       idiv    cx
+       push    dx
+       jmp     bx
+1:
+       cmp     ax,4
+       jne     9f
+       pop     ax
+       pop     dx
+       pop     si
+       pop     di
+       push    bx
+       push    di
+       push    si
+       push    dx
+       push    ax
+       call   .rmu4
+       pop     ax
+       push    bx
+       push    dx
+       jmp     ax
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/rmu4.s b/mach/i86/libem/rmu4.s
new file mode 100644 (file)
index 0000000..4a79fcf
--- /dev/null
@@ -0,0 +1,55 @@
+.define .rmu4
+
+yl=2
+yh=4
+xl=6
+xh=8
+
+.rmu4:
+        ! $Header$
+       mov     si,sp           ! copy of sp
+       mov     bx,yl(si)
+       mov     ax,yh(si)
+       or      ax,ax
+       jne     7f
+1:
+       xor     dx,dx
+       mov     cx,xl(si)
+       mov     ax,xh(si)
+2:
+       div     bx
+       xchg    ax,cx
+       div     bx
+       xor     bx,bx
+9:
+                       ! bx is high order result
+                       ! dx is low order result
+       ret     8
+
+7:
+       mov     di,ax
+       xor     bx,bx
+       mov     ax,xl(si)
+       mov     dx,xh(si)
+       mov     cx,16
+1:
+       shl     ax,1
+       rcl     dx,1
+       rcl     bx,1
+       cmp     di,bx
+       ja      3f
+       jb      2f
+       cmp     yl(si),dx
+       jbe     2f
+3:
+       loop    1b
+               ! dx=result(low), bx=result(high)
+       jmp     9b
+2:
+       sub     dx,yl(si)
+       sbb     bx,di
+       inc     ax
+       loop    1b
+1:
+               ! dx=result(low), bx=result(high)
+       jmp     9b
diff --git a/mach/i86/libem/rol.s b/mach/i86/libem/rol.s
new file mode 100644 (file)
index 0000000..6de420f
--- /dev/null
@@ -0,0 +1,33 @@
+.define .rol
+
+        ! $Header$
+       ! #bytes in ax
+.rol:
+       pop     dx              ! return address
+       cmp     ax,2
+       jne     1f
+       pop     ax
+       pop     cx
+       rol     ax,cl
+       push    ax
+       jmp     dx
+1:
+       cmp     ax,4
+       jne     9f
+       pop     cx
+       jcxz    2f
+       pop     ax
+       pop     bx
+3:
+       sal     ax,1
+       rcl     bx,1
+       adc     ax,0
+       loop    3b
+       push    bx
+       push    ax
+2:
+       jmp     dx
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/ror.s b/mach/i86/libem/ror.s
new file mode 100644 (file)
index 0000000..5b98ec8
--- /dev/null
@@ -0,0 +1,34 @@
+.define .ror
+
+        ! $Header$
+       ! #bytes in ax
+.ror:
+       pop     dx              ! return address
+       cmp     ax,2
+       jne     1f
+       pop     ax
+       pop     cx
+       ror     ax,cl
+       push    ax
+       jmp     dx
+1:
+       cmp     ax,4
+       jne     9f
+       pop     cx
+       jcxz    2f
+       neg     cx
+       add     cx,32
+       pop     ax
+       pop     bx
+3:
+       sar     bx,1
+       rcr     ax,1
+       loop    3b
+       push    bx
+       push    ax
+2:
+       jmp     dx
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/sar2.s b/mach/i86/libem/sar2.s
new file mode 100644 (file)
index 0000000..8a317de
--- /dev/null
@@ -0,0 +1,22 @@
+.define .sar2
+
+.sar2:
+        ! $Header$
+       pop     bx              ! return address
+                               ! si, descriptor address
+                               ! ax, index
+                               ! di, base address
+       sub     ax,(si)
+       mov     cx,4(si)
+       imul    cx
+       add     di,ax
+       sar     cx,1
+       jnb     1f
+       pop     ax
+       stosb
+       jmp     bx
+1:
+       mov     si,sp
+       rep movs
+       mov     sp,si
+       jmp     bx
diff --git a/mach/i86/libem/sbi.s b/mach/i86/libem/sbi.s
new file mode 100644 (file)
index 0000000..018f399
--- /dev/null
@@ -0,0 +1,27 @@
+.define .sbi
+
+        ! $Header$
+       ! #bytes in cx , top of stack in ax
+.sbi:
+       pop     bx              ! return subress
+       cmp     cx,2
+       jne     1f
+       pop     cx
+       sub     ax,cx
+       neg     ax
+       jmp     bx
+1:
+       cmp     cx,4
+       jne     9f
+       pop     dx
+       pop     cx
+       sub     cx,ax
+       mov     ax,cx
+       pop     cx
+       sbc     cx,dx
+       push    cx
+       jmp     bx
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/set.s b/mach/i86/libem/set.s
new file mode 100644 (file)
index 0000000..0c5dabd
--- /dev/null
@@ -0,0 +1,35 @@
+.define .set
+
+        ! $Header$
+       ! #bytes in cx
+       ! bit # in ax
+.set:
+       pop     bx              ! return address
+       xor     dx,dx
+!ifdef create set
+       mov     di,sp
+       sub     di,cx
+1:
+       push    dx
+       cmp     sp,di
+       ja      1b
+!endif
+       mov     di,8
+       div     di
+       cmp     ax,cx
+       jae     2f
+       mov     di,sp
+       add     di,ax
+       mov     si,dx
+       movb    dl,bits(si)
+       orb     (di),dl
+       jmp     bx
+2:
+       push    bx
+       mov     ax,ESET
+       push    ax
+       jmp     .trp
+
+       .data
+bits:
+       .byte   1,2,4,8,16,32,64,128
diff --git a/mach/i86/libem/sli.s b/mach/i86/libem/sli.s
new file mode 100644 (file)
index 0000000..3d57008
--- /dev/null
@@ -0,0 +1,32 @@
+.define .sli
+
+        ! $Header$
+       ! #bytes in ax
+.sli:
+       pop     dx              ! return address
+       cmp     ax,2
+       jne     1f
+       pop     ax
+       pop     cx
+       sal     ax,cl
+       push    ax
+       jmp     dx
+1:
+       cmp     ax,4
+       jne     9f
+       pop     cx
+       jcxz    2f
+       pop     ax
+       pop     bx
+3:
+       sal     ax,1
+       rcl     bx,1
+       loop    3b
+       push    bx
+       push    ax
+2:
+       jmp     dx
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/sri.s b/mach/i86/libem/sri.s
new file mode 100644 (file)
index 0000000..9cd9735
--- /dev/null
@@ -0,0 +1,32 @@
+.define .sri
+
+        ! $Header$
+       ! #bytes in ax
+.sri:
+       pop     dx              ! return address
+       cmp     ax,2
+       jne     1f
+       pop     ax
+       pop     cx
+       sar     ax,cl
+       push    ax
+       jmp     dx
+1:
+       cmp     ax,4
+       jne     9f
+       pop     cx
+       jcxz    2f
+       pop     ax
+       pop     bx
+3:
+       sar     bx,1
+       rcr     ax,1
+       loop    3b
+       push    bx
+       push    ax
+2:
+       jmp     dx
+9:
+       mov     ax,EODDZ
+       push    ax
+       jmp     .trp
diff --git a/mach/i86/libem/sti.s b/mach/i86/libem/sti.s
new file mode 100644 (file)
index 0000000..9e2fcc6
--- /dev/null
@@ -0,0 +1,17 @@
+.define .sti
+
+        ! $Header$
+       ! #bytes in cx
+       ! destination address in di
+.sti:
+       pop     bx              ! return address
+       sar     cx,1
+       jnb     1f
+       pop     ax
+       stosb
+       jmp     bx
+1:
+       mov     si,sp
+       rep movs
+       mov     sp,si
+       jmp     bx
diff --git a/mach/i86/libem/stop.s b/mach/i86/libem/stop.s
new file mode 100644 (file)
index 0000000..5aeaf51
--- /dev/null
@@ -0,0 +1,4 @@
+.define .stop
+.stop:
+        ! $Header$
+       int     3
diff --git a/mach/i86/libem/strhp.s b/mach/i86/libem/strhp.s
new file mode 100644 (file)
index 0000000..e5e11bf
--- /dev/null
@@ -0,0 +1,19 @@
+.define        .strhp
+
+.strhp:
+        ! $Header$
+       pop     bx
+       pop     ax
+       mov     (.reghp),ax
+       cmp     ax,(.limhp)
+       jb      1f
+       add     ax,02000
+       and     ax,~0777
+       mov     (.limhp),ax
+       cmp     ax,sp
+       jae     2f
+1:
+       jmp     bx
+2:
+       mov     ax,EHEAP
+       jmp     .fat
diff --git a/mach/i86/libem/tail.s b/mach/i86/libem/tail.s
new file mode 100644 (file)
index 0000000..059b237
--- /dev/null
@@ -0,0 +1,16 @@
+.define        endtext,enddata,endbss
+.define _end,_etext,_edata
+
+        ! $Header$
+       .text
+endtext:
+_etext:
+       .align 2
+       .data
+enddata:
+_edata:
+       .align 2
+       .bss
+_end:
+endbss:
+       .align 2
diff --git a/mach/i86/libem/trp.s b/mach/i86/libem/trp.s
new file mode 100644 (file)
index 0000000..7f95dc2
--- /dev/null
@@ -0,0 +1,15 @@
+.define .trp
+
+        ! $Header$
+               ! ax is trap number
+.trp:
+       xor     bx,bx
+       xchg    bx,(.trppc)
+       test    bx,bx
+       jz      2f
+       push    ax
+       call    bx
+       pop     ax
+       ret
+2:
+       call    .stop
diff --git a/mach/i86/libem/unknown.s b/mach/i86/libem/unknown.s
new file mode 100644 (file)
index 0000000..2da916e
--- /dev/null
@@ -0,0 +1,7 @@
+.define .unknown
+
+.unknown:
+        ! $Header$
+       mov  ax,EILLINS
+       push ax
+       jmp  .fat
diff --git a/mach/i86/libem/xor.s b/mach/i86/libem/xor.s
new file mode 100644 (file)
index 0000000..913d342
--- /dev/null
@@ -0,0 +1,15 @@
+.define        .xor
+
+        ! $Header$
+       ! #bytes in cx
+.xor:
+       pop     bx              ! return address
+       mov     di,sp
+       add     di,cx
+       sar     cx,1
+1:
+       pop     ax
+       xor     ax,(di)
+       stos
+       loop    1b
+       jmp     bx