From 9c93cbdfaaa40c1bee1692e5dfc20425fd63cf69 Mon Sep 17 00:00:00 2001 From: keie Date: Thu, 7 Feb 1985 15:33:13 +0000 Subject: [PATCH] *** empty log message *** --- mach/i86/libem/adi.s | 25 ++++++++++++ mach/i86/libem/and.s | 15 +++++++ mach/i86/libem/cii.s | 37 +++++++++++++++++ mach/i86/libem/cms.s | 18 +++++++++ mach/i86/libem/cmu4.s | 25 ++++++++++++ mach/i86/libem/com.s | 14 +++++++ mach/i86/libem/csa2.s | 23 +++++++++++ mach/i86/libem/csb2.s | 26 ++++++++++++ mach/i86/libem/cuu.s | 35 +++++++++++++++++ mach/i86/libem/dup.s | 12 ++++++ mach/i86/libem/dvi.s | 35 +++++++++++++++++ mach/i86/libem/dvi4.s | 85 ++++++++++++++++++++++++++++++++++++++++ mach/i86/libem/dvu.s | 35 +++++++++++++++++ mach/i86/libem/dvu4.s | 49 +++++++++++++++++++++++ mach/i86/libem/error.s | 30 ++++++++++++++ mach/i86/libem/exg.s | 20 ++++++++++ mach/i86/libem/fakfp.s | 42 ++++++++++++++++++++ mach/i86/libem/fat.s | 7 ++++ mach/i86/libem/gto.s | 7 ++++ mach/i86/libem/iaar.s | 15 +++++++ mach/i86/libem/ilar.s | 13 ++++++ mach/i86/libem/inn.s | 29 ++++++++++++++ mach/i86/libem/ior.s | 15 +++++++ mach/i86/libem/isar.s | 13 ++++++ mach/i86/libem/lar2.s | 23 +++++++++++ mach/i86/libem/loi.s | 19 +++++++++ mach/i86/libem/mli.s | 27 +++++++++++++ mach/i86/libem/mli4.s | 17 ++++++++ mach/i86/libem/mon.s | 5 +++ mach/i86/libem/ngi.s | 27 +++++++++++++ mach/i86/libem/nop.s | 22 +++++++++++ mach/i86/libem/print.s | 47 ++++++++++++++++++++++ mach/i86/libem/printf.s | 38 ++++++++++++++++++ mach/i86/libem/rck.s | 17 ++++++++ mach/i86/libem/rmi.s | 35 +++++++++++++++++ mach/i86/libem/rmi4.s | 83 +++++++++++++++++++++++++++++++++++++++ mach/i86/libem/rmu.s | 35 +++++++++++++++++ mach/i86/libem/rmu4.s | 55 ++++++++++++++++++++++++++ mach/i86/libem/rol.s | 33 ++++++++++++++++ mach/i86/libem/ror.s | 34 ++++++++++++++++ mach/i86/libem/sar2.s | 22 +++++++++++ mach/i86/libem/sbi.s | 27 +++++++++++++ mach/i86/libem/set.s | 35 +++++++++++++++++ mach/i86/libem/sli.s | 32 +++++++++++++++ mach/i86/libem/sri.s | 32 +++++++++++++++ mach/i86/libem/sti.s | 17 ++++++++ mach/i86/libem/stop.s | 4 ++ mach/i86/libem/strhp.s | 19 +++++++++ mach/i86/libem/tail.s | 16 ++++++++ mach/i86/libem/trp.s | 15 +++++++ mach/i86/libem/unknown.s | 7 ++++ mach/i86/libem/xor.s | 15 +++++++ 52 files changed, 1383 insertions(+) create mode 100644 mach/i86/libem/adi.s create mode 100644 mach/i86/libem/and.s create mode 100644 mach/i86/libem/cii.s create mode 100644 mach/i86/libem/cms.s create mode 100644 mach/i86/libem/cmu4.s create mode 100644 mach/i86/libem/com.s create mode 100644 mach/i86/libem/csa2.s create mode 100644 mach/i86/libem/csb2.s create mode 100644 mach/i86/libem/cuu.s create mode 100644 mach/i86/libem/dup.s create mode 100644 mach/i86/libem/dvi.s create mode 100644 mach/i86/libem/dvi4.s create mode 100644 mach/i86/libem/dvu.s create mode 100644 mach/i86/libem/dvu4.s create mode 100644 mach/i86/libem/error.s create mode 100644 mach/i86/libem/exg.s create mode 100644 mach/i86/libem/fakfp.s create mode 100644 mach/i86/libem/fat.s create mode 100644 mach/i86/libem/gto.s create mode 100644 mach/i86/libem/iaar.s create mode 100644 mach/i86/libem/ilar.s create mode 100644 mach/i86/libem/inn.s create mode 100644 mach/i86/libem/ior.s create mode 100644 mach/i86/libem/isar.s create mode 100644 mach/i86/libem/lar2.s create mode 100644 mach/i86/libem/loi.s create mode 100644 mach/i86/libem/mli.s create mode 100644 mach/i86/libem/mli4.s create mode 100644 mach/i86/libem/mon.s create mode 100644 mach/i86/libem/ngi.s create mode 100644 mach/i86/libem/nop.s create mode 100644 mach/i86/libem/print.s create mode 100644 mach/i86/libem/printf.s create mode 100644 mach/i86/libem/rck.s create mode 100644 mach/i86/libem/rmi.s create mode 100644 mach/i86/libem/rmi4.s create mode 100644 mach/i86/libem/rmu.s create mode 100644 mach/i86/libem/rmu4.s create mode 100644 mach/i86/libem/rol.s create mode 100644 mach/i86/libem/ror.s create mode 100644 mach/i86/libem/sar2.s create mode 100644 mach/i86/libem/sbi.s create mode 100644 mach/i86/libem/set.s create mode 100644 mach/i86/libem/sli.s create mode 100644 mach/i86/libem/sri.s create mode 100644 mach/i86/libem/sti.s create mode 100644 mach/i86/libem/stop.s create mode 100644 mach/i86/libem/strhp.s create mode 100644 mach/i86/libem/tail.s create mode 100644 mach/i86/libem/trp.s create mode 100644 mach/i86/libem/unknown.s create mode 100644 mach/i86/libem/xor.s diff --git a/mach/i86/libem/adi.s b/mach/i86/libem/adi.s new file mode 100644 index 000000000..f1f060900 --- /dev/null +++ b/mach/i86/libem/adi.s @@ -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 index 000000000..e77b09d51 --- /dev/null +++ b/mach/i86/libem/and.s @@ -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 index 000000000..4304a0ee8 --- /dev/null +++ b/mach/i86/libem/cii.s @@ -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 index 000000000..cec20db01 --- /dev/null +++ b/mach/i86/libem/cms.s @@ -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 index 000000000..2e4bf9460 --- /dev/null +++ b/mach/i86/libem/cmu4.s @@ -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 index 000000000..23aee51da --- /dev/null +++ b/mach/i86/libem/com.s @@ -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 index 000000000..60ef8ed16 --- /dev/null +++ b/mach/i86/libem/csa2.s @@ -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 index 000000000..f49fe8a54 --- /dev/null +++ b/mach/i86/libem/csb2.s @@ -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 index 000000000..7719f39d1 --- /dev/null +++ b/mach/i86/libem/cuu.s @@ -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 index 000000000..9634463c5 --- /dev/null +++ b/mach/i86/libem/dup.s @@ -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 index 000000000..fd3daac87 --- /dev/null +++ b/mach/i86/libem/dvi.s @@ -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 index 000000000..e4c66ff13 --- /dev/null +++ b/mach/i86/libem/dvi4.s @@ -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 index 000000000..b2bcdd678 --- /dev/null +++ b/mach/i86/libem/dvu.s @@ -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 index 000000000..fff547b6a --- /dev/null +++ b/mach/i86/libem/dvu4.s @@ -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 index 000000000..64354e67f --- /dev/null +++ b/mach/i86/libem/error.s @@ -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 index 000000000..8b5bf4b93 --- /dev/null +++ b/mach/i86/libem/exg.s @@ -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 index 000000000..df97bc26d --- /dev/null +++ b/mach/i86/libem/fakfp.s @@ -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 index 000000000..5a0dd072f --- /dev/null +++ b/mach/i86/libem/fat.s @@ -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 index 000000000..8fdb23bab --- /dev/null +++ b/mach/i86/libem/gto.s @@ -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 index 000000000..4a2a92ebc --- /dev/null +++ b/mach/i86/libem/iaar.s @@ -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 index 000000000..11fbed54f --- /dev/null +++ b/mach/i86/libem/ilar.s @@ -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 index 000000000..ced6bbc28 --- /dev/null +++ b/mach/i86/libem/inn.s @@ -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 index 000000000..0fc130a44 --- /dev/null +++ b/mach/i86/libem/ior.s @@ -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 index 000000000..569bb7797 --- /dev/null +++ b/mach/i86/libem/isar.s @@ -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 index 000000000..58a7c3aa7 --- /dev/null +++ b/mach/i86/libem/lar2.s @@ -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 index 000000000..c958d5e72 --- /dev/null +++ b/mach/i86/libem/loi.s @@ -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 index 000000000..f143488db --- /dev/null +++ b/mach/i86/libem/mli.s @@ -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 index 000000000..36395fd7d --- /dev/null +++ b/mach/i86/libem/mli4.s @@ -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 index 000000000..30dd48ef0 --- /dev/null +++ b/mach/i86/libem/mon.s @@ -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 index 000000000..6a479f7f2 --- /dev/null +++ b/mach/i86/libem/ngi.s @@ -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 index 000000000..26aa071d0 --- /dev/null +++ b/mach/i86/libem/nop.s @@ -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 index 000000000..bb8ea8ae9 --- /dev/null +++ b/mach/i86/libem/print.s @@ -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 index 000000000..31ea794be --- /dev/null +++ b/mach/i86/libem/printf.s @@ -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 index 000000000..5a012147e --- /dev/null +++ b/mach/i86/libem/rck.s @@ -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 index 000000000..81fdc89ec --- /dev/null +++ b/mach/i86/libem/rmi.s @@ -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 index 000000000..6abaea1b8 --- /dev/null +++ b/mach/i86/libem/rmi4.s @@ -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 index 000000000..3e74de7ea --- /dev/null +++ b/mach/i86/libem/rmu.s @@ -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 index 000000000..4a79fcf05 --- /dev/null +++ b/mach/i86/libem/rmu4.s @@ -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 index 000000000..6de420f41 --- /dev/null +++ b/mach/i86/libem/rol.s @@ -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 index 000000000..5b98ec8f8 --- /dev/null +++ b/mach/i86/libem/ror.s @@ -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 index 000000000..8a317de4b --- /dev/null +++ b/mach/i86/libem/sar2.s @@ -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 index 000000000..018f399fc --- /dev/null +++ b/mach/i86/libem/sbi.s @@ -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 index 000000000..0c5dabd8b --- /dev/null +++ b/mach/i86/libem/set.s @@ -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 index 000000000..3d57008bd --- /dev/null +++ b/mach/i86/libem/sli.s @@ -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 index 000000000..9cd97357c --- /dev/null +++ b/mach/i86/libem/sri.s @@ -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 index 000000000..9e2fcc670 --- /dev/null +++ b/mach/i86/libem/sti.s @@ -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 index 000000000..5aeaf51fd --- /dev/null +++ b/mach/i86/libem/stop.s @@ -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 index 000000000..e5e11bf86 --- /dev/null +++ b/mach/i86/libem/strhp.s @@ -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 index 000000000..059b23769 --- /dev/null +++ b/mach/i86/libem/tail.s @@ -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 index 000000000..7f95dc289 --- /dev/null +++ b/mach/i86/libem/trp.s @@ -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 index 000000000..2da916e26 --- /dev/null +++ b/mach/i86/libem/unknown.s @@ -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 index 000000000..913d3429c --- /dev/null +++ b/mach/i86/libem/xor.s @@ -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 -- 2.34.1