Browse Source

adapted to new assembler syntax

ceriel 37 years ago
parent
commit
c754f6ca69
54 changed files with 225 additions and 119 deletions
  1. 1 2
      mach/i86/libem/LIST
  2. 27 10
      mach/i86/libem/Makefile
  3. 4 1
      mach/i86/libem/adi.s
  4. 2 1
      mach/i86/libem/and.s
  5. 4 1
      mach/i86/libem/cii.s
  6. 2 1
      mach/i86/libem/cms.s
  7. 2 1
      mach/i86/libem/cmu4.s
  8. 2 1
      mach/i86/libem/com.s
  9. 4 1
      mach/i86/libem/csa2.s
  10. 4 1
      mach/i86/libem/csb2.s
  11. 4 1
      mach/i86/libem/cuu.s
  12. 2 1
      mach/i86/libem/dup.s
  13. 5 1
      mach/i86/libem/dvi.s
  14. 2 1
      mach/i86/libem/dvi4.s
  15. 5 1
      mach/i86/libem/dvu.s
  16. 2 1
      mach/i86/libem/dvu4.s
  17. 4 1
      mach/i86/libem/error.s
  18. 2 1
      mach/i86/libem/exg.s
  19. 4 1
      mach/i86/libem/fakfp.s
  20. 4 1
      mach/i86/libem/fat.s
  21. 2 1
      mach/i86/libem/gto.s
  22. 3 1
      mach/i86/libem/iaar.s
  23. 4 1
      mach/i86/libem/ilar.s
  24. 4 3
      mach/i86/libem/inn.s
  25. 2 1
      mach/i86/libem/ior.s
  26. 4 1
      mach/i86/libem/isar.s
  27. 2 1
      mach/i86/libem/lar2.s
  28. 2 1
      mach/i86/libem/loi.s
  29. 4 1
      mach/i86/libem/mli.s
  30. 2 1
      mach/i86/libem/mli4.s
  31. 3 1
      mach/i86/libem/mon.s
  32. 4 1
      mach/i86/libem/ngi.s
  33. 3 1
      mach/i86/libem/nop.s
  34. 2 2
      mach/i86/libem/print.s
  35. 3 1
      mach/i86/libem/printf.s
  36. 4 1
      mach/i86/libem/rck.s
  37. 5 1
      mach/i86/libem/rmi.s
  38. 2 1
      mach/i86/libem/rmi4.s
  39. 5 1
      mach/i86/libem/rmu.s
  40. 2 1
      mach/i86/libem/rmu4.s
  41. 4 1
      mach/i86/libem/rol.s
  42. 4 1
      mach/i86/libem/ror.s
  43. 2 1
      mach/i86/libem/sar2.s
  44. 5 2
      mach/i86/libem/sbi.s
  45. 6 3
      mach/i86/libem/set.s
  46. 4 1
      mach/i86/libem/sli.s
  47. 4 1
      mach/i86/libem/sri.s
  48. 2 1
      mach/i86/libem/sti.s
  49. 2 1
      mach/i86/libem/stop.s
  50. 3 1
      mach/i86/libem/strhp.s
  51. 3 1
      mach/i86/libem/trp.s
  52. 3 1
      mach/i86/libem/unknown.s
  53. 2 1
      mach/i86/libem/xor.s
  54. 33 50
      mach/i86/libsys/head_em.s

+ 1 - 2
mach/i86/libem/LIST

@@ -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

+ 27 - 10
mach/i86/libem/Makefile

@@ -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

+ 4 - 1
mach/i86/libem/adi.s

@@ -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

+ 2 - 1
mach/i86/libem/and.s

@@ -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

+ 4 - 1
mach/i86/libem/cii.s

@@ -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

+ 2 - 1
mach/i86/libem/cms.s

@@ -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

+ 2 - 1
mach/i86/libem/cmu4.s

@@ -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

+ 2 - 1
mach/i86/libem/com.s

@@ -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

+ 4 - 1
mach/i86/libem/csa2.s

@@ -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

+ 4 - 1
mach/i86/libem/csb2.s

@@ -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

+ 4 - 1
mach/i86/libem/cuu.s

@@ -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

+ 2 - 1
mach/i86/libem/dup.s

@@ -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

+ 5 - 1
mach/i86/libem/dvi.s

@@ -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

+ 2 - 1
mach/i86/libem/dvi4.s

@@ -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)

+ 5 - 1
mach/i86/libem/dvu.s

@@ -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

+ 2 - 1
mach/i86/libem/dvu4.s

@@ -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)

+ 4 - 1
mach/i86/libem/error.s

@@ -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

+ 2 - 1
mach/i86/libem/exg.s

@@ -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

+ 4 - 1
mach/i86/libem/fakfp.s

@@ -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

+ 4 - 1
mach/i86/libem/fat.s

@@ -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

+ 2 - 1
mach/i86/libem/gto.s

@@ -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)

+ 3 - 1
mach/i86/libem/iaar.s

@@ -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

+ 4 - 1
mach/i86/libem/ilar.s

@@ -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

+ 4 - 3
mach/i86/libem/inn.s

@@ -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

+ 2 - 1
mach/i86/libem/ior.s

@@ -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

+ 4 - 1
mach/i86/libem/isar.s

@@ -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

+ 2 - 1
mach/i86/libem/lar2.s

@@ -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

+ 2 - 1
mach/i86/libem/loi.s

@@ -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:

+ 4 - 1
mach/i86/libem/mli.s

@@ -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

+ 2 - 1
mach/i86/libem/mli4.s

@@ -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

+ 3 - 1
mach/i86/libem/mon.s

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

+ 4 - 1
mach/i86/libem/ngi.s

@@ -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

+ 3 - 1
mach/i86/libem/nop.s

@@ -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,' '

+ 2 - 2
mach/i86/libem/print.s

@@ -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:

+ 3 - 1
mach/i86/libem/printf.s

@@ -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

+ 4 - 1
mach/i86/libem/rck.s

@@ -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

+ 5 - 1
mach/i86/libem/rmi.s

@@ -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

+ 2 - 1
mach/i86/libem/rmi4.s

@@ -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)

+ 5 - 1
mach/i86/libem/rmu.s

@@ -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

+ 2 - 1
mach/i86/libem/rmu4.s

@@ -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)

+ 4 - 1
mach/i86/libem/rol.s

@@ -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

+ 4 - 1
mach/i86/libem/ror.s

@@ -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

+ 2 - 1
mach/i86/libem/sar2.s

@@ -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

+ 5 - 2
mach/i86/libem/sbi.s

@@ -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

+ 6 - 3
mach/i86/libem/set.s

@@ -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

+ 4 - 1
mach/i86/libem/sli.s

@@ -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

+ 4 - 1
mach/i86/libem/sri.s

@@ -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

+ 2 - 1
mach/i86/libem/sti.s

@@ -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:

+ 2 - 1
mach/i86/libem/stop.s

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

+ 3 - 1
mach/i86/libem/strhp.s

@@ -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

+ 3 - 1
mach/i86/libem/trp.s

@@ -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

+ 3 - 1
mach/i86/libem/unknown.s

@@ -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

+ 2 - 1
mach/i86/libem/xor.s

@@ -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

+ 33 - 50
mach/i86/libsys/head_em.s

@@ -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: