-tail_em.a
+libem_s.a
adi.s
and.s
cii.s
stop.s
printf.s
print.s
-tail.s
-install:
- ../../install head_em.s head_em
- ../../install tail_em.a tail_em
+# $Header$
+MACH=i86
+install: all
+ ../../install head_em.o head_em
+ ../../install libem_o.a tail_em
+ ../../install end.o end_em
-cmp:
- -../../compare head_em.s head_em
- -../../compare tail_em.a tail_em
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libem_o.a tail_em
+ -../../compare end.o end_em
-clean :
+all: head_em.o libem_o.a end.o
+end.o: end.s
+ $(MACH) -I../../../h -c end.s
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -c head_em.s
+
+libem_o.a: libem_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libem_o.a
+
+clean:
+ rm -f *.o
opr :
- make pr | opr
+ make pr | opr
pr:
- @pr head_em.s
- @arch pv tail_em.a | pr -h `pwd`/tail_em.a
+ @pr `pwd`/head_em.s
+ @arch pv libem_s.a | pr -h `pwd`/libem_s.a
+ @pr `pwd`/end.s
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .adi
- ! $Header$
! #bytes in cx , top of stack in ax
+ .sect .text
.adi:
pop bx ! return address
cmp cx,2
push dx
jmp bx
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .and
- ! $Header$
! #bytes in cx
+ .sect .text
.and:
pop bx ! return address
mov di,sp
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .cii
+.sect .text
.cii:
- ! $Header$
pop di ! return address
! pop cx, dest. size
! pop bx, src. size
jmp di
9:
push ax ! push low source
+.extern EILLINS
+.extern .fat
mov ax,EILLINS
push ax
jmp .fat
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .cms
- ! $Header$
! #bytes in cx
+ .sect .text
.cms:
pop bx ! return address
mov dx,sp
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .cmu4
+.sect .text
.cmu4:
- ! $Header$
pop bx ! return address
xor ax,ax
pop cx
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .com
- ! $Header$
! #bytes in cx
+ .sect .text
.com:
pop bx ! return address
mov di,sp
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .csa2
+.sect .text
.csa2:
- ! $Header$
! si, descriptor address
! bx, index
mov dx,(si) ! default
mov bx,dx
test bx,bx
jnz 2f
+.extern ECASE
+.extern .fat
mov ax,ECASE
push ax
jmp .fat
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .csb2
+.sect .text
.csb2:
- ! $Header$
!si, descriptor address
!dx, index
lods
2:
test bx,bx
jnz 3f
+.extern ECASE
+.extern .fat
mov ax,ECASE
push ax
jmp .fat
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .ciu
.define .cui
.define .cuu
+.sect .text
.ciu:
.cui:
.cuu:
- ! $Header$
pop di ! return address
! pop cx, dest. size
! pop bx, source size
jmp di
9:
push ax ! to help debugging ?
+.extern EILLINS
+.extern .fat
mov ax,EILLINS
push ax
jmp .fat
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .dup
- ! $Header$
! #bytes in cx
+ .sect .text
.dup:
pop bx ! return address
mov si,sp
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .dvi
- ! $Header$
! #bytes in ax
+ .sect .text
.dvi:
pop bx ! return address
cmp ax,2
push si
push dx
push ax
+.extern .dvi4
call .dvi4
pop bx
push cx
push ax
jmp bx
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .dvi4
yl=2
xl=6
xh=8
+.sect .text
.dvi4:
- ! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .dvu
- ! $Header$
! #bytes in ax
+ .sect .text
.dvu:
pop bx ! return address
cmp ax,2
push si
push dx
push ax
+.extern .dvu4
call .dvu4
pop bx
push cx
push ax
jmp bx
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .dvu4
yl=2
xl=6
xh=8
+.sect .text
.dvu4:
- ! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)
+.sect .text; .sect .rom; .sect .data; .sect .bss
.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
+.sect .text
.error:
push bp
push si
mov cx,ax
mov bx,1
sal bx,cl
+.extern .ignmask
+.extern .trp
test bx,(.ignmask)
jne 2f
call .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
.define .exg
- ! $Header$
! #bytes in cx
+.sect .text
.exg:
pop bx ! return address
mov dx,cx
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.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
.cuf:
.cfu:
.cff:
- ! $Header$
pop bx ! return address
+.extern EILLINS
+.extern .fat
mov ax,EILLINS
push ax
jmp .fat
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .fat
.fat:
- ! $Header$
+.extern .trp
+.extern .stop
call .trp
call .stop
! no return
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .gto
.gto:
- ! $Header$
mov bp,4(bx)
mov sp,2(bx)
jmp (bx)
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .iaar
.iaar:
- ! $Header$
pop bx
pop dx
cmp dx,2
+.extern .unknown
jne .unknown
pop si ! descriptor address
pop ax ! index
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .ilar
.ilar:
- ! $Header$
pop bx
pop dx
+.extern .unknown
cmp dx,2
jne .unknown
pop di ! descriptor address
pop ax ! index
pop si ! array base
push bx
+.extern .lar2
jmp .lar2
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .inn
- ! $Header$
! #bytes in cx
! bit # in ax
.inn:
! ax is result
jmp bx
- .data
+ .sect .data
bits:
- .byte 1,2,4,8,16,32,64,128
+ .data1 1,2,4,8,16,32,64,128
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .ior
- ! $Header$
! #bytes in cx
.ior:
pop bx ! return address
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .isar
.isar:
- ! $Header$
pop bx
pop dx
cmp dx,2
+.extern .unknown
jne .unknown
pop si ! descriptor address
pop ax ! index
pop di ! array base
push bx
+.extern .sar2
jmp .sar2
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .lar2
.lar2:
- ! $Header$
pop bx ! return address
! di, descriptor address
! ax, index
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .loi
- ! $Header$
! #bytes in cx
! source address in si
.loi:
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .mli
- ! $Header$
! #bytes in ax
.mli:
pop bx ! return address
push dx
jmp .mli4
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .mli4
- ! $Header$
! x * y with
! x.low = si x.high = di
! y.low = bx y.high = ax
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .mon
.mon:
- ! $Header$
+.extern .stop
call .stop
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .ngi
- ! $Header$
! #bytes in ax
.ngi:
pop bx ! return address
push ax
jmp bx
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.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:
- ! $Header$
mov ax,(hol0)
call printd
! movb al,' '
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define printc,printd,prints
SIO_D = 0xD8
SIO_S = 0xDA
TXRDY = 0x01
- ! $Header$
! argument in ax
! uses bx
prints:
1:
xchg ax,dx
addb al,'0'
- .errnz printc - .
! argument in ax
printc:
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define printf
+.extern printc, printd, prints
printf:
- ! $Header$
pop bx ! return address
xchg ax,di
mov si,sp
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .rck
- ! $Header$
! descriptor address in si
! value in ax, must be left there
.rck:
ret
2:
push ax
+.extern ERANGE
+.extern .error
mov ax,ERANGE
call .error
pop ax
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .rmi
- ! $Header$
! #bytes in ax
.rmi:
pop bx ! return address
push si
push dx
push ax
+.extern .rmi4
call .rmi4
pop ax
push bx
push dx
jmp ax
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .rmi4
yl=2
xh=8
.rmi4:
- ! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .rmu
- ! $Header$
! #bytes in ax
.rmu:
pop bx ! return address
push si
push dx
push ax
+.extern .rmu4
call .rmu4
pop ax
push bx
push dx
jmp ax
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .rmu4
yl=2
xh=8
.rmu4:
- ! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .rol
- ! $Header$
! #bytes in ax
.rol:
pop dx ! return address
2:
jmp dx
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .ror
- ! $Header$
! #bytes in ax
.ror:
pop dx ! return address
2:
jmp dx
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .sar2
.sar2:
- ! $Header$
pop bx ! return address
! si, descriptor address
! ax, index
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .sbi
- ! $Header$
! #bytes in cx , top of stack in ax
.sbi:
pop bx ! return subress
sub cx,ax
mov ax,cx
pop cx
- sbc cx,dx
+ sbb cx,dx
push cx
jmp bx
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .set
- ! $Header$
! #bytes in cx
! bit # in ax
.set:
orb (di),dl
jmp bx
2:
+.extern ESET
+.extern .trp
push bx
mov ax,ESET
push ax
jmp .trp
- .data
+ .sect .data
bits:
- .byte 1,2,4,8,16,32,64,128
+ .data1 1,2,4,8,16,32,64,128
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .sli
- ! $Header$
! #bytes in ax
.sli:
pop dx ! return address
2:
jmp dx
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .sri
- ! $Header$
! #bytes in ax
.sri:
pop dx ! return address
2:
jmp dx
9:
+.extern EODDZ
+.extern .trp
mov ax,EODDZ
push ax
jmp .trp
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .sti
- ! $Header$
! #bytes in cx
! destination address in di
.sti:
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .stop
.stop:
- ! $Header$
int 3
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .strhp
+.extern .reghp, .limhp, EHEAP, .fat
.strhp:
- ! $Header$
pop bx
pop ax
mov (.reghp),ax
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .trp
+.extern .trppc, .stop
- ! $Header$
! ax is trap number
.trp:
xor bx,bx
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .unknown
+.extern EILLINS, .fat
.unknown:
- ! $Header$
mov ax,EILLINS
push ax
jmp .fat
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.sect .text
.define .xor
- ! $Header$
! #bytes in cx
.xor:
pop bx ! return address
+.sect .text; .sect .rom; .sect .data; .sect .bss
+
.define begtext,begdata,begbss
.define hol0,.reghp,.limhp,.trppc,.ignmask
-.define ERANGE,ESET,EHEAP,ECASE,EILLINS,EODDZ
+.define ERANGE,ESET,EHEAP,ECASE,EILLINS
+.extern _end
+.extern np
ERANGE = 1
ESET = 2
EODDZ = 19
ECASE = 20
-base = 0x01C0
-topmem = 0xFFF0
-
- .org topmem-16
-.extern __n_line
-maxmem:
-__n_line:
- .space 16
- .errnz __n_line-0xFFE0
-
- .base base
-
- .text
+.sect .text
begtext:
- cld
- xor ax,ax
- mov ss,ax
- mov ds,ax
- mov es,ax
- mov (2),cs
- mov (0),.diverr
- mov sp,maxmem
- mov di,begbss
- mov cx,[[endbss-begbss]/2]&0x7FFF
- ! xor ax,ax ! ax still is 0
- rep stos
- mov ax,envp
- push ax
- mov ax,argv
- push ax
- mov ax,1
- push ax
+ mov bx,sp
+ mov cx,(bx)
+ add bx,2
+ mov ax,cx
+ inc ax
+ shl ax,1
+ add ax,bx
+ push ax
+ push bx
+ push cx
+ mov (np),begbss
+ mov bx,endbss
+ push bx
+ call _brk ! allocate space for bss
+ pop si
+ xor bp,bp
call _m_a_i_n
- call .stop
-.diverr:
- push ax
- mov ax,EIDIVZ
- call .error
- pop ax
- iret
-
- .data
+ int 0x81
+.sect .data
begdata:
hol0:
- .word 0,0
- .word 0,0
+ .data2 0,0
+ .data2 0,0
argv:
- .word 3f
+ .data2 3f
envp:
- .word 0
+ .data2 0
3:
.asciz "PROGRAM"
.reghp:
- .word endbss
+ .data2 endbss
.limhp:
- .word endbss
+ .data2 endbss
.ignmask:
- .word 0
+ .data2 0
.trppc:
- .word 0
+ .data2 0
- .bss
+ .sect .bss
begbss: