adapted to new assembler syntax

This commit is contained in:
ceriel 1987-01-08 10:13:48 +00:00
parent 5cc2c0ccfc
commit c754f6ca69
54 changed files with 225 additions and 119 deletions

View file

@ -1,4 +1,4 @@
tail_em.a
libem_s.a
adi.s
and.s
cii.s
@ -50,4 +50,3 @@ trp.s
stop.s
printf.s
print.s
tail.s

View file

@ -1,16 +1,33 @@
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

View file

@ -1,7 +1,8 @@
.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
@ -20,6 +21,8 @@
push dx
jmp bx
9:
.extern EODDZ
.extern .trp
mov ax,EODDZ
push ax
jmp .trp

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .and
! $Header$
! #bytes in cx
.sect .text
.and:
pop bx ! return address
mov di,sp

View file

@ -1,7 +1,8 @@
.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
@ -31,6 +32,8 @@
jmp di
9:
push ax ! push low source
.extern EILLINS
.extern .fat
mov ax,EILLINS
push ax
jmp .fat

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .cms
! $Header$
! #bytes in cx
.sect .text
.cms:
pop bx ! return address
mov dx,sp

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .cmu4
.sect .text
.cmu4:
! $Header$
pop bx ! return address
xor ax,ax
pop cx

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .com
! $Header$
! #bytes in cx
.sect .text
.com:
pop bx ! return address
mov di,sp

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .csa2
.sect .text
.csa2:
! $Header$
! si, descriptor address
! bx, index
mov dx,(si) ! default
@ -16,6 +17,8 @@
mov bx,dx
test bx,bx
jnz 2f
.extern ECASE
.extern .fat
mov ax,ECASE
push ax
jmp .fat

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .csb2
.sect .text
.csb2:
! $Header$
!si, descriptor address
!dx, index
lods
@ -19,6 +20,8 @@
2:
test bx,bx
jnz 3f
.extern ECASE
.extern .fat
mov ax,ECASE
push ax
jmp .fat

View file

@ -1,11 +1,12 @@
.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
@ -29,6 +30,8 @@
jmp di
9:
push ax ! to help debugging ?
.extern EILLINS
.extern .fat
mov ax,EILLINS
push ax
jmp .fat

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .dup
! $Header$
! #bytes in cx
.sect .text
.dup:
pop bx ! return address
mov si,sp

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .dvi
! $Header$
! #bytes in ax
.sect .text
.dvi:
pop bx ! return address
cmp ax,2
@ -24,12 +25,15 @@
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

View file

@ -1,3 +1,4 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .dvi4
yl=2
@ -5,8 +6,8 @@ yh=4
xl=6
xh=8
.sect .text
.dvi4:
! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .dvu
! $Header$
! #bytes in ax
.sect .text
.dvu:
pop bx ! return address
cmp ax,2
@ -24,12 +25,15 @@
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

View file

@ -1,3 +1,4 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .dvu4
yl=2
@ -5,8 +6,8 @@ yh=4
xl=6
xh=8
.sect .text
.dvu4:
! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)

View file

@ -1,10 +1,11 @@
.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
@ -16,6 +17,8 @@
mov cx,ax
mov bx,1
sal bx,cl
.extern .ignmask
.extern .trp
test bx,(.ignmask)
jne 2f
call .trp

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define .exg
! $Header$
! #bytes in cx
.sect .text
.exg:
pop bx ! return address
mov dx,cx

View file

@ -1,3 +1,5 @@
.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
@ -35,8 +37,9 @@
.cuf:
.cfu:
.cff:
! $Header$
pop bx ! return address
.extern EILLINS
.extern .fat
mov ax,EILLINS
push ax
jmp .fat

View file

@ -1,7 +1,10 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .fat
.fat:
! $Header$
.extern .trp
.extern .stop
call .trp
call .stop
! no return

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .gto
.gto:
! $Header$
mov bp,4(bx)
mov sp,2(bx)
jmp (bx)

View file

@ -1,10 +1,12 @@
.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

View file

@ -1,13 +1,16 @@
.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

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .inn
! $Header$
! #bytes in cx
! bit # in ax
.inn:
@ -24,6 +25,6 @@
! 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

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .ior
! $Header$
! #bytes in cx
.ior:
pop bx ! return address

View file

@ -1,13 +1,16 @@
.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

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .lar2
.lar2:
! $Header$
pop bx ! return address
! di, descriptor address
! ax, index

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .loi
! $Header$
! #bytes in cx
! source address in si
.loi:

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .mli
! $Header$
! #bytes in ax
.mli:
pop bx ! return address
@ -22,6 +23,8 @@
push dx
jmp .mli4
9:
.extern EODDZ
.extern .trp
mov ax,EODDZ
push ax
jmp .trp

View file

@ -1,6 +1,7 @@
.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

View file

@ -1,5 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .mon
.mon:
! $Header$
.extern .stop
call .stop

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .ngi
! $Header$
! #bytes in ax
.ngi:
pop bx ! return address
@ -22,6 +23,8 @@
push ax
jmp bx
9:
.extern EODDZ
.extern .trp
mov ax,EODDZ
push ax
jmp .trp

View file

@ -1,11 +1,13 @@
.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,' '

View file

@ -1,10 +1,11 @@
.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:
@ -33,7 +34,6 @@ printd:
1:
xchg ax,dx
addb al,'0'
.errnz printc - .
! argument in ax
printc:

View file

@ -1,7 +1,9 @@
.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

View file

@ -1,6 +1,7 @@
.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:
@ -11,6 +12,8 @@
ret
2:
push ax
.extern ERANGE
.extern .error
mov ax,ERANGE
call .error
pop ax

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .rmi
! $Header$
! #bytes in ax
.rmi:
pop bx ! return address
@ -24,12 +25,15 @@
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

View file

@ -1,3 +1,5 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .rmi4
yl=2
@ -6,7 +8,6 @@ xl=6
xh=8
.rmi4:
! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .rmu
! $Header$
! #bytes in ax
.rmu:
pop bx ! return address
@ -24,12 +25,15 @@
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

View file

@ -1,3 +1,5 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .rmu4
yl=2
@ -6,7 +8,6 @@ xl=6
xh=8
.rmu4:
! $Header$
mov si,sp ! copy of sp
mov bx,yl(si)
mov ax,yh(si)

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .rol
! $Header$
! #bytes in ax
.rol:
pop dx ! return address
@ -28,6 +29,8 @@
2:
jmp dx
9:
.extern EODDZ
.extern .trp
mov ax,EODDZ
push ax
jmp .trp

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .ror
! $Header$
! #bytes in ax
.ror:
pop dx ! return address
@ -29,6 +30,8 @@
2:
jmp dx
9:
.extern EODDZ
.extern .trp
mov ax,EODDZ
push ax
jmp .trp

View file

@ -1,7 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .sar2
.sar2:
! $Header$
pop bx ! return address
! si, descriptor address
! ax, index

View file

@ -1,6 +1,7 @@
.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
@ -18,10 +19,12 @@
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

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .set
! $Header$
! #bytes in cx
! bit # in ax
.set:
@ -25,11 +26,13 @@
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

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .sli
! $Header$
! #bytes in ax
.sli:
pop dx ! return address
@ -27,6 +28,8 @@
2:
jmp dx
9:
.extern EODDZ
.extern .trp
mov ax,EODDZ
push ax
jmp .trp

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .sri
! $Header$
! #bytes in ax
.sri:
pop dx ! return address
@ -27,6 +28,8 @@
2:
jmp dx
9:
.extern EODDZ
.extern .trp
mov ax,EODDZ
push ax
jmp .trp

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .sti
! $Header$
! #bytes in cx
! destination address in di
.sti:

View file

@ -1,4 +1,5 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .stop
.stop:
! $Header$
int 3

View file

@ -1,7 +1,9 @@
.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

View file

@ -1,6 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .trp
.extern .trppc, .stop
! $Header$
! ax is trap number
.trp:
xor bx,bx

View file

@ -1,7 +1,9 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .unknown
.extern EILLINS, .fat
.unknown:
! $Header$
mov ax,EILLINS
push ax
jmp .fat

View file

@ -1,6 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .xor
! $Header$
! #bytes in cx
.xor:
pop bx ! return address

View file

@ -1,6 +1,10 @@
.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
@ -10,66 +14,45 @@ EILLINS = 18
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: