new version for new assembler syntax
This commit is contained in:
		
							parent
							
								
									d899835b31
								
							
						
					
					
						commit
						433346583e
					
				
					 38 changed files with 209 additions and 31 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
tail_em.s.a
 | 
			
		||||
libem_s.a
 | 
			
		||||
aar.s
 | 
			
		||||
blm.s
 | 
			
		||||
cii.s
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,11 +1,12 @@
 | 
			
		|||
all:
 | 
			
		||||
 | 
			
		||||
install:	
 | 
			
		||||
		../../install head_em.s head_em
 | 
			
		||||
		../../install tail_em.s.a tail_em
 | 
			
		||||
		../../install libem_s.a tail_em
 | 
			
		||||
 | 
			
		||||
cmp:
 | 
			
		||||
		-../../compare head_em.s head_em
 | 
			
		||||
		-../../compare tail_em.s.a tail_em
 | 
			
		||||
		-../../compare libem_s.a tail_em
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -13,5 +14,5 @@ opr :
 | 
			
		|||
	make pr | opr
 | 
			
		||||
 | 
			
		||||
pr:
 | 
			
		||||
	@pr head_em.s
 | 
			
		||||
	@arch pv tail_em.s.a | pr -h `pwd`/tail_em.s.a
 | 
			
		||||
	@pr `pwd`/head_em.s
 | 
			
		||||
	@arch pv libem_s.a | pr -h `pwd`/libem_s.a
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define aar
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!R1 contains description address
 | 
			
		||||
!R3 contains element number
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define blm
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!size in R0
 | 
			
		||||
blm:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define cii
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
cii:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define cmi
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!size in R0
 | 
			
		||||
cmi:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define cmi4
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
cmi4:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define cms
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
cms:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define cmu
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!size in R0
 | 
			
		||||
cmu:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define cmu4
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
cmu4:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define csa
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!R1 contains address of jump table
 | 
			
		||||
!R2 contains case index
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define csb
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!R1 contains address of jump table
 | 
			
		||||
!R2 contains case index
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define cuu
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
cuu:
 | 
			
		||||
	popl	RR2, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define dup
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
dup:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define dvu2
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
dvu2:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define dvu4
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
dvu4:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,14 +1,16 @@
 | 
			
		|||
.define	endtext,enddata,endbss,_etext,_edata,_end
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .end ! only for declaration of _end and endbss.
 | 
			
		||||
 | 
			
		||||
	.text
 | 
			
		||||
	.sect .text
 | 
			
		||||
endtext:
 | 
			
		||||
_etext:
 | 
			
		||||
	.align 2
 | 
			
		||||
	.data
 | 
			
		||||
	.align 2
 | 
			
		||||
	.sect .data
 | 
			
		||||
enddata:
 | 
			
		||||
_edata:
 | 
			
		||||
	.bss
 | 
			
		||||
	.align 2
 | 
			
		||||
endbss:
 | 
			
		||||
	.sect .end
 | 
			
		||||
_end:
 | 
			
		||||
endbss:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define exg
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!size (bytes) in R0
 | 
			
		||||
exg:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define gto
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
gto:
 | 
			
		||||
	pop	R3, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,11 @@
 | 
			
		|||
.define  EXIT, F_DUM
 | 
			
		||||
.define  ERANGE, ESET, EHEAP, EILLINS, EODDZ, ECASE, EBADMON
 | 
			
		||||
.define  hol0, trppc, trpim, reghp, argv, envp
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
EXIT	= 0
 | 
			
		||||
F_DUM	= 0
 | 
			
		||||
| 
						 | 
				
			
			@ -13,8 +18,8 @@ EODDZ	= 19
 | 
			
		|||
ECASE   = 20
 | 
			
		||||
EBADMON = 25
 | 
			
		||||
 | 
			
		||||
.text
 | 
			
		||||
			!clear .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
			!clear .sect .bss
 | 
			
		||||
	ldk	R2, $0
 | 
			
		||||
	ld	R3, $endbss
 | 
			
		||||
	ld	R0, R3
 | 
			
		||||
| 
						 | 
				
			
			@ -38,20 +43,20 @@ EBADMON = 25
 | 
			
		|||
	ldl	RR14, $0xC00017FC
 | 
			
		||||
	sc	$0
 | 
			
		||||
 | 
			
		||||
.bss
 | 
			
		||||
.sect .bss
 | 
			
		||||
begbss:
 | 
			
		||||
.data
 | 
			
		||||
.sect .data
 | 
			
		||||
hol0:
 | 
			
		||||
	.word 0,0			! line no
 | 
			
		||||
	.word 0,0			! file
 | 
			
		||||
	.data2 0,0			! line no
 | 
			
		||||
	.data2 0,0			! file
 | 
			
		||||
trppc:
 | 
			
		||||
	.word 0
 | 
			
		||||
	.data2 0
 | 
			
		||||
trpim:
 | 
			
		||||
	.word 0
 | 
			
		||||
	.data2 0
 | 
			
		||||
argv:
 | 
			
		||||
envp:
 | 
			
		||||
	.word 1f
 | 
			
		||||
	.word 0
 | 
			
		||||
	.data2 1f
 | 
			
		||||
	.data2 0
 | 
			
		||||
1:	.asciz	"program"
 | 
			
		||||
reghp:
 | 
			
		||||
	.word endbss
 | 
			
		||||
	.data2 endbss
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define inn
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!bitnr in R1
 | 
			
		||||
!size (bytes) in R2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define lar
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!R1 contains description address
 | 
			
		||||
!R3 contains element number
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define los2
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
los2:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define mon
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
mon:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,14 @@
 | 
			
		|||
.define noop
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
noop:
 | 
			
		||||
	push	*RR14, hol0
 | 
			
		||||
	push	*RR14, $fmt
 | 
			
		||||
	calr	prf
 | 
			
		||||
	ret
 | 
			
		||||
.data
 | 
			
		||||
.sect .data
 | 
			
		||||
fmt:	.asciz	"test %d\n"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define prf
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
prf:
 | 
			
		||||
	ld	R0, hol0+4	!pointer to filename
 | 
			
		||||
| 
						 | 
				
			
			@ -29,8 +34,8 @@ prf:
 | 
			
		|||
	ret
 | 
			
		||||
1:	ld	R0, $name
 | 
			
		||||
	jr	2b
 | 
			
		||||
.data
 | 
			
		||||
.sect .data
 | 
			
		||||
fmt1:	.asciz	"%s, sp = %x, line %d:\n"
 | 
			
		||||
name:	.asciz	"_unknown file_"
 | 
			
		||||
saveprf:
 | 
			
		||||
	.long 0
 | 
			
		||||
	.data4 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define printf
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
printf:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			@ -77,6 +82,6 @@ printn:
 | 
			
		|||
	inc	R3
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
.data
 | 
			
		||||
.sect .data
 | 
			
		||||
buff:
 | 
			
		||||
	.space 256
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define rck
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
rck:
 | 
			
		||||
	ld	R0, RR14($4)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define rmu2
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
rmu2:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define rmu4
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
rmu4:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define sar
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!R1 contains description address
 | 
			
		||||
!R3 contains element number
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,13 @@
 | 
			
		|||
.define saveret
 | 
			
		||||
.define savereg
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
.data
 | 
			
		||||
.sect .data
 | 
			
		||||
saveret:
 | 
			
		||||
	.long 0
 | 
			
		||||
	.data4 0
 | 
			
		||||
savereg:
 | 
			
		||||
	.space 20
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define strhp
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
strhp:
 | 
			
		||||
	popl	RR2, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define sts2
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
sts2:
 | 
			
		||||
	popl	saveret, *RR14
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define trp, fatal
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
fatal:
 | 
			
		||||
	calr	trp
 | 
			
		||||
| 
						 | 
				
			
			@ -34,5 +39,5 @@ trp:
 | 
			
		|||
3:	push	*RR14, $err
 | 
			
		||||
	calr	printf
 | 
			
		||||
	sc	$EXIT
 | 
			
		||||
.data
 | 
			
		||||
.sect .data
 | 
			
		||||
err:	.asciz	"trap error %d\n"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define unknown
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
unknown:
 | 
			
		||||
	push	*RR14, $EODDZ
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,9 @@
 | 
			
		|||
.define xset
 | 
			
		||||
.sect .text
 | 
			
		||||
.sect .rom
 | 
			
		||||
.sect .data
 | 
			
		||||
.sect .bss
 | 
			
		||||
.sect .text
 | 
			
		||||
 | 
			
		||||
!bitnr in R1
 | 
			
		||||
!size (bytes) in R0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue