--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.define .fat
+
+.fat:
+ ! $Header$
+ call .trp
+ call .stop
+ ! no return
--- /dev/null
+.define .gto
+
+.gto:
+ ! $Header$
+ mov bp,4(bx)
+ mov sp,2(bx)
+ jmp (bx)
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.define .mon
+
+.mon:
+ ! $Header$
+ call .stop
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.define .stop
+.stop:
+ ! $Header$
+ int 3
--- /dev/null
+.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
--- /dev/null
+.define endtext,enddata,endbss
+.define _end,_etext,_edata
+
+ ! $Header$
+ .text
+endtext:
+_etext:
+ .align 2
+ .data
+enddata:
+_edata:
+ .align 2
+ .bss
+_end:
+endbss:
+ .align 2
--- /dev/null
+.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
--- /dev/null
+.define .unknown
+
+.unknown:
+ ! $Header$
+ mov ax,EILLINS
+ push ax
+ jmp .fat
--- /dev/null
+.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