version for new assembler
This commit is contained in:
		
							parent
							
								
									d8e018a044
								
							
						
					
					
						commit
						345609b5ac
					
				
					 18 changed files with 386 additions and 270 deletions
				
			
		|  | @ -1,25 +1,44 @@ | ||||||
| TAIL=tail.hermac | TAIL=libhermac_o.a | ||||||
| # Other possibilities are: tail.nascom and tail.cpm
 | # Other possibilities are: tail.nascom and tail.cpm
 | ||||||
|  | MACH=z80 | ||||||
| 
 | 
 | ||||||
| all:		tail.cpm tail.nascom tail.hermac | all:		head_em.o libhermac_o.a libnascom_o.a libcpm_o.a | ||||||
| 
 | 
 | ||||||
| install:	$(TAIL) | install:	head_em.o $(TAIL) | ||||||
| 		../../install head_em.s head_em | 		../../install head_em.o head_em | ||||||
| 		../../install $(TAIL) tail_sys | 		../../install $(TAIL) tail_mon | ||||||
| 
 | 
 | ||||||
| cmp:		$(TAIL) | cmp:		head_em.o $(TAIL) | ||||||
| 		-../../compare head_em.s head_em | 		-../../compare head_em.o head_em | ||||||
| 		-../../compare $(TAIL) tail_sys | 		-../../compare $(TAIL) tail_mon | ||||||
| 
 | 
 | ||||||
| tail.cpm:	mon.cpm.s | head_em.o:	head_em.s | ||||||
|  | 		$(MACH) -I../../../h -c head_em.s | ||||||
|  | 
 | ||||||
|  | libcpm_o.a:	libcpm_s.a | ||||||
|  | 		ASAR=aal ; export ASAR; march . libcpm_o.a | ||||||
|  | 
 | ||||||
|  | libnascom_o.a:	libnascom_s.a | ||||||
|  | 		ASAR=aal ; export ASAR; march . libnascom_o.a | ||||||
|  | 
 | ||||||
|  | libhermac_o.a:	libhermac_s.a | ||||||
|  | 		ASAR=aal ; export ASAR; march . libhermac_o.a | ||||||
|  | 
 | ||||||
|  | libcpm_s.a: | ||||||
| 		@echo Warning: untested, this is an example | 		@echo Warning: untested, this is an example | ||||||
| 		arch cr tail.cpm mon.cpm.s | 		arch cr libcpm_s.a mon.cpm.s | ||||||
|  | 		echo libcpm_s.a > LIST | ||||||
|  | 		arch t libcpm_s.a >> LIST | ||||||
| 
 | 
 | ||||||
| tail.nascom:	mon.s char.nas.s | libnascom_s.a: | ||||||
| 		arch cr tail.nascom mon.s char.nas.s | 		arch cr libnascom_s.a mon.s char.nas.s | ||||||
|  | 		echo libnascom_s.a > LIST | ||||||
|  | 		arch t libnascom_s.a >> LIST | ||||||
| 
 | 
 | ||||||
| tail.hermac:	mon.s char.her.s | libhermac_s.a: | ||||||
| 		arch cr tail.hermac mon.s char.her.s | 		arch cr libhermac_s.a mon.s char.her.s | ||||||
|  | 		echo libhermac_s.a > LIST | ||||||
|  | 		arch t libhermac_s.a >> LIST | ||||||
| 
 | 
 | ||||||
| opr: | opr: | ||||||
| 		make pr | opr | 		make pr | opr | ||||||
|  |  | ||||||
|  | @ -1,4 +1,9 @@ | ||||||
| .define getchar, putchar | .define getchar, putchar | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| 
 | 
 | ||||||
| ! These getchar and putchar routines can be used for HERMAC computer | ! These getchar and putchar routines can be used for HERMAC computer | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,9 +1,14 @@ | ||||||
| .define putchar,getchar | .define putchar,getchar | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| ! output routine in monitor for the nascom | ! output routine in monitor for the nascom | ||||||
| CRT	= 0x013B | CRT	= 0x013B | ||||||
| ! output a charcter | ! output a charcter | ||||||
| ! entry: ascii character in a | ! entry: ascii character in a | ||||||
| .text | .sect .text | ||||||
| putchar: | putchar: | ||||||
| 	push	hl | 	push	hl | ||||||
| 	push	bc | 	push	bc | ||||||
|  | @ -22,11 +27,11 @@ fetch:	inc	hl | ||||||
| 	ld	a,(hl) | 	ld	a,(hl) | ||||||
| 	jr	2b | 	jr	2b | ||||||
| ! conversion table for nascom characters | ! conversion table for nascom characters | ||||||
| tab:	.byte	0x0D,0x00 | tab:	.data1	0x0D,0x00 | ||||||
| 	.byte	0x1B,0x1E | 	.data1	0x1B,0x1E | ||||||
| 	.byte	0x08,0x1D | 	.data1	0x08,0x1D | ||||||
| 	.byte	0x0A,0x1F | 	.data1	0x0A,0x1F | ||||||
| 	.byte	0x7F,0x00 | 	.data1	0x7F,0x00 | ||||||
| 
 | 
 | ||||||
| KBD	= 0x69 | KBD	= 0x69 | ||||||
|  get character from keyboard |  get character from keyboard | ||||||
|  |  | ||||||
|  | @ -1,6 +1,11 @@ | ||||||
| .define EARRAY,ERANGE,EILLINS,EILLSIZE,ECASE,EMON,EHEAP | .define EARRAY,ERANGE,EILLINS,EILLSIZE,ECASE,EMON,EHEAP | ||||||
| .define hol0,trapproc,trpim,argv,hp,.reghp,envp,begbss,ignmask | .define hol0,trapproc,trpim,argv,hp,.reghp,envp,begbss,ignmask | ||||||
| .define savebc,savede,savehl,saveix,saveaf,saveiy,ebadmon | .define savebc,savede,savehl,saveix,saveaf,saveiy,ebadmon | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
|    EARRAY = 0 |    EARRAY = 0 | ||||||
|    ERANGE = 1 |    ERANGE = 1 | ||||||
|    EHEAP = 17 |    EHEAP = 17 | ||||||
|  | @ -11,10 +16,9 @@ | ||||||
|    ebadmon=25 |    ebadmon=25 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	.base 0x1000
 | .sect .text | ||||||
| .text |  | ||||||
| 
 | 
 | ||||||
| 				! clear .bss | 				! clear .sect .bss | ||||||
| 	ld sp,0x7ffe		!address of fbase | 	ld sp,0x7ffe		!address of fbase | ||||||
| 	ld de,endbss | 	ld de,endbss | ||||||
| 	ld h,d | 	ld h,d | ||||||
|  | @ -44,37 +48,37 @@ | ||||||
| 
 | 
 | ||||||
| 	jp 0x20 | 	jp 0x20 | ||||||
| 
 | 
 | ||||||
| .bss | .sect .bss | ||||||
| begbss: | begbss: | ||||||
| .data | .sect .data | ||||||
| hol0: | hol0: | ||||||
| 	.word 0,0 | 	.data2 0,0 | ||||||
| 	.word 0,0 | 	.data2 0,0 | ||||||
| saveaf: | saveaf: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| savebc: | savebc: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| savede: | savede: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| savehl: | savehl: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| saveix: | saveix: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| saveiy: | saveiy: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| ignmask: | ignmask: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| hp: | hp: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| trapproc: | trapproc: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| trpim: | trpim: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| argv: | argv: | ||||||
| 	.word 3f
 | 	.data2 3f
 | ||||||
| envp: | envp: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| 3: | 3: | ||||||
| 	.asciz 'PROGRAM' | 	.asciz 'PROGRAM' | ||||||
| .reghp: | .reghp: | ||||||
| 	.word endbss
 | 	.data2 endbss
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,10 @@ | ||||||
| .define .mon | .define .mon | ||||||
| .define uxfinish
 | .define uxfinish
 | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| 
 | 
 | ||||||
| ! monitor instruction | ! monitor instruction | ||||||
| ! a small collection of UNIX system calls implemented under CP/M | ! a small collection of UNIX system calls implemented under CP/M | ||||||
|  | @ -98,21 +103,21 @@ | ||||||
| 	zcount=41 | 	zcount=41 | ||||||
| 	zsave=42 | 	zsave=42 | ||||||
| 
 | 
 | ||||||
| 	.errnz filefcb
 | 	.assert [ filefcb] <> 0 | ||||||
| 
 | 
 | ||||||
| 0:	.space maxfiles*filesize | 0:	.space maxfiles*filesize | ||||||
| 	filearea = 0b+128 | 	filearea = 0b+128 | ||||||
| sibuf: | sibuf: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| 	.space 82
 | 	.space 82
 | ||||||
| siptr:	.space 2 | siptr:	.space 2 | ||||||
| saveargs: | saveargs: | ||||||
| 	.space 128
 | 	.space 128
 | ||||||
| argc:	.space 2 | argc:	.space 2 | ||||||
| ttymode:.byte 9,9,8,21;.short 06310+RAW*040	! raw = 040
 | ttymode:.data1 9,9,8,21;.data2 06310+RAW*040	! raw = 040
 | ||||||
| 
 | 
 | ||||||
| return: | return: | ||||||
| 	.word 0,0 | 	.data2 0,0 | ||||||
| uxinit: | uxinit: | ||||||
| 	xor a | 	xor a | ||||||
| 	ld c,maxfiles | 	ld c,maxfiles | ||||||
|  | @ -155,70 +160,70 @@ uxfinish: | ||||||
| 	jp (hl) | 	jp (hl) | ||||||
| 
 | 
 | ||||||
| systab:	 | systab:	 | ||||||
| 	.word e.mon	! ux_indir | 	.data2 e.mon	! ux_indir | ||||||
| 	.word ux_exit
 | 	.data2 ux_exit
 | ||||||
| 	.word e.mon	! ux_fork | 	.data2 e.mon	! ux_fork | ||||||
| 	.word ux_read
 | 	.data2 ux_read
 | ||||||
| 	.word ux_write
 | 	.data2 ux_write
 | ||||||
| 	.word ux_open
 | 	.data2 ux_open
 | ||||||
| 	.word ux_close
 | 	.data2 ux_close
 | ||||||
| 	.word e.mon	! ux_wait | 	.data2 e.mon	! ux_wait | ||||||
| 	.word ux_creat
 | 	.data2 ux_creat
 | ||||||
| 	.word e.mon	! ux_link | 	.data2 e.mon	! ux_link | ||||||
| 	.word ux_unlink
 | 	.data2 ux_unlink
 | ||||||
| 	.word e.mon	! ux_exec | 	.data2 e.mon	! ux_exec | ||||||
| 	.word e.mon	! ux_chdir | 	.data2 e.mon	! ux_chdir | ||||||
| 	.word ux_time
 | 	.data2 ux_time
 | ||||||
| 	.word e.mon	! ux_mknod | 	.data2 e.mon	! ux_mknod | ||||||
| 	.word e.mon	! ux_chmod | 	.data2 e.mon	! ux_chmod | ||||||
| 	.word e.mon	! ux_chown | 	.data2 e.mon	! ux_chown | ||||||
| 	.word e.mon	! ux_break | 	.data2 e.mon	! ux_break | ||||||
| 	.word e.mon	! ux_stat | 	.data2 e.mon	! ux_stat | ||||||
| 	.word e.mon	! ux_seek | 	.data2 e.mon	! ux_seek | ||||||
| 	.word ux_getpid
 | 	.data2 ux_getpid
 | ||||||
| 	.word e.mon	! ux_mount | 	.data2 e.mon	! ux_mount | ||||||
| 	.word e.mon	! ux_umount | 	.data2 e.mon	! ux_umount | ||||||
| 	.word e.mon	! ux_setuid | 	.data2 e.mon	! ux_setuid | ||||||
| 	.word e.mon	! ux_getuid | 	.data2 e.mon	! ux_getuid | ||||||
| 	.word e.mon	! ux_stime | 	.data2 e.mon	! ux_stime | ||||||
| 	.word e.mon	! ux_ptrace | 	.data2 e.mon	! ux_ptrace | ||||||
| 	.word e.mon	! ux_alarm | 	.data2 e.mon	! ux_alarm | ||||||
| 	.word e.mon	! ux_fstat | 	.data2 e.mon	! ux_fstat | ||||||
| 	.word e.mon	! ux_pause | 	.data2 e.mon	! ux_pause | ||||||
| 	.word e.mon	! ux_utime | 	.data2 e.mon	! ux_utime | ||||||
| 	.word e.mon	! ux_stty | 	.data2 e.mon	! ux_stty | ||||||
| 	.word e.mon	! ux_gtty | 	.data2 e.mon	! ux_gtty | ||||||
| 	.word e.mon	! ux_access | 	.data2 e.mon	! ux_access | ||||||
| 	.word e.mon	! ux_nice | 	.data2 e.mon	! ux_nice | ||||||
| 	.word ux_ftime
 | 	.data2 ux_ftime
 | ||||||
| 	.word e.mon	! ux_sync | 	.data2 e.mon	! ux_sync | ||||||
| 	.word e.mon	! ux_kill | 	.data2 e.mon	! ux_kill | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word e.mon	! ux_dup | 	.data2 e.mon	! ux_dup | ||||||
| 	.word e.mon	! ux_pipe | 	.data2 e.mon	! ux_pipe | ||||||
| 	.word e.mon	! ux_times | 	.data2 e.mon	! ux_times | ||||||
| 	.word e.mon	! ux_prof | 	.data2 e.mon	! ux_prof | ||||||
| 	.word e.mon	! ux_unused | 	.data2 e.mon	! ux_unused | ||||||
| 	.word e.mon	! ux_setgid | 	.data2 e.mon	! ux_setgid | ||||||
| 	.word e.mon	! ux_getgid | 	.data2 e.mon	! ux_getgid | ||||||
| 	.word e.mon	! ux_sig | 	.data2 e.mon	! ux_sig | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word ux_ioctl
 | 	.data2 ux_ioctl
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld	! ux_exece | 	.data2 unimpld	! ux_exece | ||||||
| 	.word e.mon	! ux_umask | 	.data2 e.mon	! ux_umask | ||||||
| 	.word e.mon	! ux_chroot | 	.data2 e.mon	! ux_chroot | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 
 | 
 | ||||||
| emptyfile: | emptyfile: | ||||||
| 	! searches for a free filestructure | 	! searches for a free filestructure | ||||||
|  | @ -902,23 +907,23 @@ ux_getpid: | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| retarea: .word 0	! base of buffer for result values (max 8 bytes) | retarea: .data2 0	! base of buffer for result values (max 8 bytes) | ||||||
| 	 .word 0
 | 	 .data2 0
 | ||||||
| 	 .word 0
 | 	 .data2 0
 | ||||||
| 	 .word 0
 | 	 .data2 0
 | ||||||
| 
 | 
 | ||||||
| trapproc: | trapproc: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| 
 | 
 | ||||||
| nextp:	.byte 0 | nextp:	.data1 0 | ||||||
| 
 | 
 | ||||||
| header: | header: | ||||||
| ntext:	.word 0 | ntext:	.data2 0 | ||||||
| ndata:	.word 0 | ndata:	.data2 0 | ||||||
| nproc:	.word 0 | nproc:	.data2 0 | ||||||
| entry:	.word 0 | entry:	.data2 0 | ||||||
| nline:	.word 0 | nline:	.data2 0 | ||||||
| 
 | 
 | ||||||
| hp:	.word 0 | hp:	.data2 0 | ||||||
| pb:	.word 0 | pb:	.data2 0 | ||||||
| pd:	.word 0 | pd:	.data2 0 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,9 @@ | ||||||
| .define .mon | .define .mon | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| 
 | 
 | ||||||
| ! Monitor call | ! Monitor call | ||||||
| ! Expects on stack:	monitor call number | ! Expects on stack:	monitor call number | ||||||
|  |  | ||||||
|  | @ -1,4 +1,9 @@ | ||||||
| .define	putchr
 | .define	putchr
 | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| ! output routine in monitor | ! output routine in monitor | ||||||
| CRT	= 0x013B | CRT	= 0x013B | ||||||
| ! output a charcter | ! output a charcter | ||||||
|  | @ -21,8 +26,8 @@ fetch:	inc	hl | ||||||
| 	ld	a,(hl) | 	ld	a,(hl) | ||||||
| 	jr	2b | 	jr	2b | ||||||
| ! conversion table for nascom characters | ! conversion table for nascom characters | ||||||
| tab:	.byte	0x0D,0x00 | tab:	.data1	0x0D,0x00 | ||||||
| 	.byte	0x1B,0x1E | 	.data1	0x1B,0x1E | ||||||
| 	.byte	0x08,0x1D | 	.data1	0x08,0x1D | ||||||
| 	.byte	0x0A,0x1F | 	.data1	0x0A,0x1F | ||||||
| 	.byte	0x7F,0x00 | 	.data1	0x7F,0x00 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,9 @@ | ||||||
| .define putchr
 | .define putchr
 | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| 
 | 
 | ||||||
| putchr: | putchr: | ||||||
| 	push hl | 	push hl | ||||||
|  |  | ||||||
|  | @ -1,4 +1,9 @@ | ||||||
| .define _read,_write,_ioctl,_getpid,_open,_close,_exit,_errno | .define _read,_write,_ioctl,_getpid,_open,_close,_exit,_errno | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| _read: | _read: | ||||||
| 	ld (savebc),bc | 	ld (savebc),bc | ||||||
| 	push af | 	push af | ||||||
|  | @ -149,14 +154,14 @@ _close: | ||||||
| 	ret | 	ret | ||||||
| _exit: | _exit: | ||||||
| jp 0x38 | jp 0x38 | ||||||
| .data | .sect .data | ||||||
| _errno: | _errno: | ||||||
| 	.word	0
 | 	.data2	0
 | ||||||
| ! output routine in monitor | ! output routine in monitor | ||||||
| CRT	= 0x013B | CRT	= 0x013B | ||||||
| ! output a charcter | ! output a charcter | ||||||
| ! entry: ascii character in a | ! entry: ascii character in a | ||||||
| .text | .sect .text | ||||||
| !putchr: | !putchr: | ||||||
| !	push	hl | !	push	hl | ||||||
| !	push	bc | !	push	bc | ||||||
|  | @ -175,11 +180,11 @@ CRT	= 0x013B | ||||||
| !	ld	a,(hl) | !	ld	a,(hl) | ||||||
| !	jr	2b | !	jr	2b | ||||||
| !! conversion table for nascom characters | !! conversion table for nascom characters | ||||||
| !tab:	.byte	0x0D,0x00 | !tab:	.data1	0x0D,0x00 | ||||||
| !	.byte	0x1B,0x1E | !	.data1	0x1B,0x1E | ||||||
| !	.byte	0x08,0x1D | !	.data1	0x08,0x1D | ||||||
| !	.byte	0x0A,0x1F | !	.data1	0x0A,0x1F | ||||||
| !	.byte	0x7F,0x00 | !	.data1	0x7F,0x00 | ||||||
| 
 | 
 | ||||||
| KBD	= 0x69 | KBD	= 0x69 | ||||||
| ! get character from keyboard | ! get character from keyboard | ||||||
|  |  | ||||||
|  | @ -1,25 +1,44 @@ | ||||||
| TAIL=tail.hermac | TAIL=libhermac_o.a | ||||||
| # Other possibilities are: tail.nascom and tail.cpm
 | # Other possibilities are: tail.nascom and tail.cpm
 | ||||||
|  | MACH=z80 | ||||||
| 
 | 
 | ||||||
| all:		tail.cpm tail.nascom tail.hermac | all:		head_em.o libhermac_o.a libnascom_o.a libcpm_o.a | ||||||
| 
 | 
 | ||||||
| install:	$(TAIL) | install:	head_em.o $(TAIL) | ||||||
| 		../../install head_em.s head_em | 		../../install head_em.o head_em | ||||||
| 		../../install $(TAIL) tail_sys | 		../../install $(TAIL) tail_mon | ||||||
| 
 | 
 | ||||||
| cmp:		$(TAIL) | cmp:		head_em.o $(TAIL) | ||||||
| 		-../../compare head_em.s head_em | 		-../../compare head_em.o head_em | ||||||
| 		-../../compare $(TAIL) tail_sys | 		-../../compare $(TAIL) tail_mon | ||||||
| 
 | 
 | ||||||
| tail.cpm:	mon.cpm.s | head_em.o:	head_em.s | ||||||
|  | 		$(MACH) -I../../../h -c head_em.s | ||||||
|  | 
 | ||||||
|  | libcpm_o.a:	libcpm_s.a | ||||||
|  | 		ASAR=aal ; export ASAR; march . libcpm_o.a | ||||||
|  | 
 | ||||||
|  | libnascom_o.a:	libnascom_s.a | ||||||
|  | 		ASAR=aal ; export ASAR; march . libnascom_o.a | ||||||
|  | 
 | ||||||
|  | libhermac_o.a:	libhermac_s.a | ||||||
|  | 		ASAR=aal ; export ASAR; march . libhermac_o.a | ||||||
|  | 
 | ||||||
|  | libcpm_s.a: | ||||||
| 		@echo Warning: untested, this is an example | 		@echo Warning: untested, this is an example | ||||||
| 		arch cr tail.cpm mon.cpm.s | 		arch cr libcpm_s.a mon.cpm.s | ||||||
|  | 		echo libcpm_s.a > LIST | ||||||
|  | 		arch t libcpm_s.a >> LIST | ||||||
| 
 | 
 | ||||||
| tail.nascom:	mon.s char.nas.s | libnascom_s.a: | ||||||
| 		arch cr tail.nascom mon.s char.nas.s | 		arch cr libnascom_s.a mon.s char.nas.s | ||||||
|  | 		echo libnascom_s.a > LIST | ||||||
|  | 		arch t libnascom_s.a >> LIST | ||||||
| 
 | 
 | ||||||
| tail.hermac:	mon.s char.her.s | libhermac_s.a: | ||||||
| 		arch cr tail.hermac mon.s char.her.s | 		arch cr libhermac_s.a mon.s char.her.s | ||||||
|  | 		echo libhermac_s.a > LIST | ||||||
|  | 		arch t libhermac_s.a >> LIST | ||||||
| 
 | 
 | ||||||
| opr: | opr: | ||||||
| 		make pr | opr | 		make pr | opr | ||||||
|  |  | ||||||
|  | @ -1,4 +1,9 @@ | ||||||
| .define getchar, putchar | .define getchar, putchar | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| 
 | 
 | ||||||
| ! These getchar and putchar routines can be used for HERMAC computer | ! These getchar and putchar routines can be used for HERMAC computer | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,9 +1,14 @@ | ||||||
| .define putchar,getchar | .define putchar,getchar | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| ! output routine in monitor for the nascom | ! output routine in monitor for the nascom | ||||||
| CRT	= 0x013B | CRT	= 0x013B | ||||||
| ! output a charcter | ! output a charcter | ||||||
| ! entry: ascii character in a | ! entry: ascii character in a | ||||||
| .text | .sect .text | ||||||
| putchar: | putchar: | ||||||
| 	push	hl | 	push	hl | ||||||
| 	push	bc | 	push	bc | ||||||
|  | @ -22,11 +27,11 @@ fetch:	inc	hl | ||||||
| 	ld	a,(hl) | 	ld	a,(hl) | ||||||
| 	jr	2b | 	jr	2b | ||||||
| ! conversion table for nascom characters | ! conversion table for nascom characters | ||||||
| tab:	.byte	0x0D,0x00 | tab:	.data1	0x0D,0x00 | ||||||
| 	.byte	0x1B,0x1E | 	.data1	0x1B,0x1E | ||||||
| 	.byte	0x08,0x1D | 	.data1	0x08,0x1D | ||||||
| 	.byte	0x0A,0x1F | 	.data1	0x0A,0x1F | ||||||
| 	.byte	0x7F,0x00 | 	.data1	0x7F,0x00 | ||||||
| 
 | 
 | ||||||
| KBD	= 0x69 | KBD	= 0x69 | ||||||
|  get character from keyboard |  get character from keyboard | ||||||
|  |  | ||||||
|  | @ -1,6 +1,11 @@ | ||||||
| .define EARRAY,ERANGE,EILLINS,EILLSIZE,ECASE,EMON,EHEAP | .define EARRAY,ERANGE,EILLINS,EILLSIZE,ECASE,EMON,EHEAP | ||||||
| .define hol0,trapproc,trpim,argv,hp,.reghp,envp,begbss,ignmask | .define hol0,trapproc,trpim,argv,hp,.reghp,envp,begbss,ignmask | ||||||
| .define savebc,savede,savehl,saveix,saveaf,saveiy,ebadmon | .define savebc,savede,savehl,saveix,saveaf,saveiy,ebadmon | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
|    EARRAY = 0 |    EARRAY = 0 | ||||||
|    ERANGE = 1 |    ERANGE = 1 | ||||||
|    EHEAP = 17 |    EHEAP = 17 | ||||||
|  | @ -11,10 +16,9 @@ | ||||||
|    ebadmon=25 |    ebadmon=25 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	.base 0x1000
 | .sect .text | ||||||
| .text |  | ||||||
| 
 | 
 | ||||||
| 				! clear .bss | 				! clear .sect .bss | ||||||
| 	ld sp,0x7ffe		!address of fbase | 	ld sp,0x7ffe		!address of fbase | ||||||
| 	ld de,endbss | 	ld de,endbss | ||||||
| 	ld h,d | 	ld h,d | ||||||
|  | @ -44,37 +48,37 @@ | ||||||
| 
 | 
 | ||||||
| 	jp 0x20 | 	jp 0x20 | ||||||
| 
 | 
 | ||||||
| .bss | .sect .bss | ||||||
| begbss: | begbss: | ||||||
| .data | .sect .data | ||||||
| hol0: | hol0: | ||||||
| 	.word 0,0 | 	.data2 0,0 | ||||||
| 	.word 0,0 | 	.data2 0,0 | ||||||
| saveaf: | saveaf: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| savebc: | savebc: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| savede: | savede: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| savehl: | savehl: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| saveix: | saveix: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| saveiy: | saveiy: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| ignmask: | ignmask: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| hp: | hp: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| trapproc: | trapproc: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| trpim: | trpim: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| argv: | argv: | ||||||
| 	.word 3f
 | 	.data2 3f
 | ||||||
| envp: | envp: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| 3: | 3: | ||||||
| 	.asciz 'PROGRAM' | 	.asciz 'PROGRAM' | ||||||
| .reghp: | .reghp: | ||||||
| 	.word endbss
 | 	.data2 endbss
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,10 @@ | ||||||
| .define .mon | .define .mon | ||||||
| .define uxfinish
 | .define uxfinish
 | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| 
 | 
 | ||||||
| ! monitor instruction | ! monitor instruction | ||||||
| ! a small collection of UNIX system calls implemented under CP/M | ! a small collection of UNIX system calls implemented under CP/M | ||||||
|  | @ -98,21 +103,21 @@ | ||||||
| 	zcount=41 | 	zcount=41 | ||||||
| 	zsave=42 | 	zsave=42 | ||||||
| 
 | 
 | ||||||
| 	.errnz filefcb
 | 	.assert [ filefcb] <> 0 | ||||||
| 
 | 
 | ||||||
| 0:	.space maxfiles*filesize | 0:	.space maxfiles*filesize | ||||||
| 	filearea = 0b+128 | 	filearea = 0b+128 | ||||||
| sibuf: | sibuf: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| 	.space 82
 | 	.space 82
 | ||||||
| siptr:	.space 2 | siptr:	.space 2 | ||||||
| saveargs: | saveargs: | ||||||
| 	.space 128
 | 	.space 128
 | ||||||
| argc:	.space 2 | argc:	.space 2 | ||||||
| ttymode:.byte 9,9,8,21;.short 06310+RAW*040	! raw = 040
 | ttymode:.data1 9,9,8,21;.data2 06310+RAW*040	! raw = 040
 | ||||||
| 
 | 
 | ||||||
| return: | return: | ||||||
| 	.word 0,0 | 	.data2 0,0 | ||||||
| uxinit: | uxinit: | ||||||
| 	xor a | 	xor a | ||||||
| 	ld c,maxfiles | 	ld c,maxfiles | ||||||
|  | @ -155,70 +160,70 @@ uxfinish: | ||||||
| 	jp (hl) | 	jp (hl) | ||||||
| 
 | 
 | ||||||
| systab:	 | systab:	 | ||||||
| 	.word e.mon	! ux_indir | 	.data2 e.mon	! ux_indir | ||||||
| 	.word ux_exit
 | 	.data2 ux_exit
 | ||||||
| 	.word e.mon	! ux_fork | 	.data2 e.mon	! ux_fork | ||||||
| 	.word ux_read
 | 	.data2 ux_read
 | ||||||
| 	.word ux_write
 | 	.data2 ux_write
 | ||||||
| 	.word ux_open
 | 	.data2 ux_open
 | ||||||
| 	.word ux_close
 | 	.data2 ux_close
 | ||||||
| 	.word e.mon	! ux_wait | 	.data2 e.mon	! ux_wait | ||||||
| 	.word ux_creat
 | 	.data2 ux_creat
 | ||||||
| 	.word e.mon	! ux_link | 	.data2 e.mon	! ux_link | ||||||
| 	.word ux_unlink
 | 	.data2 ux_unlink
 | ||||||
| 	.word e.mon	! ux_exec | 	.data2 e.mon	! ux_exec | ||||||
| 	.word e.mon	! ux_chdir | 	.data2 e.mon	! ux_chdir | ||||||
| 	.word ux_time
 | 	.data2 ux_time
 | ||||||
| 	.word e.mon	! ux_mknod | 	.data2 e.mon	! ux_mknod | ||||||
| 	.word e.mon	! ux_chmod | 	.data2 e.mon	! ux_chmod | ||||||
| 	.word e.mon	! ux_chown | 	.data2 e.mon	! ux_chown | ||||||
| 	.word e.mon	! ux_break | 	.data2 e.mon	! ux_break | ||||||
| 	.word e.mon	! ux_stat | 	.data2 e.mon	! ux_stat | ||||||
| 	.word e.mon	! ux_seek | 	.data2 e.mon	! ux_seek | ||||||
| 	.word ux_getpid
 | 	.data2 ux_getpid
 | ||||||
| 	.word e.mon	! ux_mount | 	.data2 e.mon	! ux_mount | ||||||
| 	.word e.mon	! ux_umount | 	.data2 e.mon	! ux_umount | ||||||
| 	.word e.mon	! ux_setuid | 	.data2 e.mon	! ux_setuid | ||||||
| 	.word e.mon	! ux_getuid | 	.data2 e.mon	! ux_getuid | ||||||
| 	.word e.mon	! ux_stime | 	.data2 e.mon	! ux_stime | ||||||
| 	.word e.mon	! ux_ptrace | 	.data2 e.mon	! ux_ptrace | ||||||
| 	.word e.mon	! ux_alarm | 	.data2 e.mon	! ux_alarm | ||||||
| 	.word e.mon	! ux_fstat | 	.data2 e.mon	! ux_fstat | ||||||
| 	.word e.mon	! ux_pause | 	.data2 e.mon	! ux_pause | ||||||
| 	.word e.mon	! ux_utime | 	.data2 e.mon	! ux_utime | ||||||
| 	.word e.mon	! ux_stty | 	.data2 e.mon	! ux_stty | ||||||
| 	.word e.mon	! ux_gtty | 	.data2 e.mon	! ux_gtty | ||||||
| 	.word e.mon	! ux_access | 	.data2 e.mon	! ux_access | ||||||
| 	.word e.mon	! ux_nice | 	.data2 e.mon	! ux_nice | ||||||
| 	.word ux_ftime
 | 	.data2 ux_ftime
 | ||||||
| 	.word e.mon	! ux_sync | 	.data2 e.mon	! ux_sync | ||||||
| 	.word e.mon	! ux_kill | 	.data2 e.mon	! ux_kill | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word e.mon	! ux_dup | 	.data2 e.mon	! ux_dup | ||||||
| 	.word e.mon	! ux_pipe | 	.data2 e.mon	! ux_pipe | ||||||
| 	.word e.mon	! ux_times | 	.data2 e.mon	! ux_times | ||||||
| 	.word e.mon	! ux_prof | 	.data2 e.mon	! ux_prof | ||||||
| 	.word e.mon	! ux_unused | 	.data2 e.mon	! ux_unused | ||||||
| 	.word e.mon	! ux_setgid | 	.data2 e.mon	! ux_setgid | ||||||
| 	.word e.mon	! ux_getgid | 	.data2 e.mon	! ux_getgid | ||||||
| 	.word e.mon	! ux_sig | 	.data2 e.mon	! ux_sig | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word ux_ioctl
 | 	.data2 ux_ioctl
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld	! ux_exece | 	.data2 unimpld	! ux_exece | ||||||
| 	.word e.mon	! ux_umask | 	.data2 e.mon	! ux_umask | ||||||
| 	.word e.mon	! ux_chroot | 	.data2 e.mon	! ux_chroot | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 	.word unimpld
 | 	.data2 unimpld
 | ||||||
| 
 | 
 | ||||||
| emptyfile: | emptyfile: | ||||||
| 	! searches for a free filestructure | 	! searches for a free filestructure | ||||||
|  | @ -902,23 +907,23 @@ ux_getpid: | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| retarea: .word 0	! base of buffer for result values (max 8 bytes) | retarea: .data2 0	! base of buffer for result values (max 8 bytes) | ||||||
| 	 .word 0
 | 	 .data2 0
 | ||||||
| 	 .word 0
 | 	 .data2 0
 | ||||||
| 	 .word 0
 | 	 .data2 0
 | ||||||
| 
 | 
 | ||||||
| trapproc: | trapproc: | ||||||
| 	.word 0
 | 	.data2 0
 | ||||||
| 
 | 
 | ||||||
| nextp:	.byte 0 | nextp:	.data1 0 | ||||||
| 
 | 
 | ||||||
| header: | header: | ||||||
| ntext:	.word 0 | ntext:	.data2 0 | ||||||
| ndata:	.word 0 | ndata:	.data2 0 | ||||||
| nproc:	.word 0 | nproc:	.data2 0 | ||||||
| entry:	.word 0 | entry:	.data2 0 | ||||||
| nline:	.word 0 | nline:	.data2 0 | ||||||
| 
 | 
 | ||||||
| hp:	.word 0 | hp:	.data2 0 | ||||||
| pb:	.word 0 | pb:	.data2 0 | ||||||
| pd:	.word 0 | pd:	.data2 0 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,9 @@ | ||||||
| .define .mon | .define .mon | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| 
 | 
 | ||||||
| ! Monitor call | ! Monitor call | ||||||
| ! Expects on stack:	monitor call number | ! Expects on stack:	monitor call number | ||||||
|  |  | ||||||
|  | @ -1,4 +1,9 @@ | ||||||
| .define	putchr
 | .define	putchr
 | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| ! output routine in monitor | ! output routine in monitor | ||||||
| CRT	= 0x013B | CRT	= 0x013B | ||||||
| ! output a charcter | ! output a charcter | ||||||
|  | @ -21,8 +26,8 @@ fetch:	inc	hl | ||||||
| 	ld	a,(hl) | 	ld	a,(hl) | ||||||
| 	jr	2b | 	jr	2b | ||||||
| ! conversion table for nascom characters | ! conversion table for nascom characters | ||||||
| tab:	.byte	0x0D,0x00 | tab:	.data1	0x0D,0x00 | ||||||
| 	.byte	0x1B,0x1E | 	.data1	0x1B,0x1E | ||||||
| 	.byte	0x08,0x1D | 	.data1	0x08,0x1D | ||||||
| 	.byte	0x0A,0x1F | 	.data1	0x0A,0x1F | ||||||
| 	.byte	0x7F,0x00 | 	.data1	0x7F,0x00 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,9 @@ | ||||||
| .define putchr
 | .define putchr
 | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| 
 | 
 | ||||||
| putchr: | putchr: | ||||||
| 	push hl | 	push hl | ||||||
|  |  | ||||||
|  | @ -1,4 +1,9 @@ | ||||||
| .define _read,_write,_ioctl,_getpid,_open,_close,_exit,_errno | .define _read,_write,_ioctl,_getpid,_open,_close,_exit,_errno | ||||||
|  | .sect .text | ||||||
|  | .sect .rom | ||||||
|  | .sect .data | ||||||
|  | .sect .bss | ||||||
|  | .sect .text | ||||||
| _read: | _read: | ||||||
| 	ld (savebc),bc | 	ld (savebc),bc | ||||||
| 	push af | 	push af | ||||||
|  | @ -149,14 +154,14 @@ _close: | ||||||
| 	ret | 	ret | ||||||
| _exit: | _exit: | ||||||
| jp 0x38 | jp 0x38 | ||||||
| .data | .sect .data | ||||||
| _errno: | _errno: | ||||||
| 	.word	0
 | 	.data2	0
 | ||||||
| ! output routine in monitor | ! output routine in monitor | ||||||
| CRT	= 0x013B | CRT	= 0x013B | ||||||
| ! output a charcter | ! output a charcter | ||||||
| ! entry: ascii character in a | ! entry: ascii character in a | ||||||
| .text | .sect .text | ||||||
| !putchr: | !putchr: | ||||||
| !	push	hl | !	push	hl | ||||||
| !	push	bc | !	push	bc | ||||||
|  | @ -175,11 +180,11 @@ CRT	= 0x013B | ||||||
| !	ld	a,(hl) | !	ld	a,(hl) | ||||||
| !	jr	2b | !	jr	2b | ||||||
| !! conversion table for nascom characters | !! conversion table for nascom characters | ||||||
| !tab:	.byte	0x0D,0x00 | !tab:	.data1	0x0D,0x00 | ||||||
| !	.byte	0x1B,0x1E | !	.data1	0x1B,0x1E | ||||||
| !	.byte	0x08,0x1D | !	.data1	0x08,0x1D | ||||||
| !	.byte	0x0A,0x1F | !	.data1	0x0A,0x1F | ||||||
| !	.byte	0x7F,0x00 | !	.data1	0x7F,0x00 | ||||||
| 
 | 
 | ||||||
| KBD	= 0x69 | KBD	= 0x69 | ||||||
| ! get character from keyboard | ! get character from keyboard | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue