	list	off

;
; Cromemco Inc.
; Nov 19, 1984
;

stdin	    equ  0	;standard input channel
stdout	    equ  1	;standard output channel
stderr	    equ  2	;standard error channel

;
; D2 & D3 register modes for _create, _open
;
op_read	    equ  0	;read only
op_write    equ  1	;write only
op_rdwr	    equ  2	;read and write
op_append   equ  3	;append only
op_xread    equ  4	;exclusive read only
op_xwrite   equ  5	;exclusive write only
op_xrdwr    equ  6	;exclusive read and write
op_xappend  equ  7	;exclusive append only

op_truncf   equ  80H	;truncate on create flag
op_condf    equ  40H	;conditional create flag
op_force    equ	 20H	;force open of block device

;
; D2-register file position modes for .setpos
;
fwd_begin   equ	   0	;forward from the beginning of the file
fwd_current equ    1	;forward from the current file position
fwd_end     equ    2	;forward from the end of the file
bak_current equ   -1	;backward from the current file position
bak_end     equ   -2	;backward from the end of the file

;
; D2-register modes for _fstat, _cstat, _fchstat, _cchstat
;
st_all	    equ	 0	;all of inode (128 bytes)
st_owner    equ  1	;D3 = owner
st_group    equ  2	;D3 = group
st_aowner   equ  3	;D3 = owner access, mask
st_agroup   equ  4	;D3 = group access, mask
st_aother   equ  5	;D3 = other access, mask
st_ftype    equ  6	;D3 = file type, special device #
st_size     equ  7	;D3 = file size
st_nlinks   equ  8	;D3 = number of links
st_inum	    equ  9	;D3 = inode number
st_device   equ  10	;D3,D4 = device containing inode
st_tcreate  equ  11	;D3 -> time created
st_tmodify  equ  12	;D3 -> time last modified
st_taccess  equ  13	;D3 -> time last accessed
st_tdumped  equ  14	;D3 -> time last dumped
st_devno    equ  15	;D3,D4 = device # if inode is device
st_pdevno   equ  16	;D3,D4 = device # if inode is device
;
; file types for st_ftype
;
is_ordin	equ	0	;ordinary file
is_direct	equ	1	;directory file
is_char		equ	2	;character device
is_cspec	equ	2	;character special file
is_block	equ	3	;block device
is_bspec	equ	3	;block special file
is_pipe		equ	4	;pipe file
;
; access bits for access flags
;
ac_read		equ	0	;read access bit
ac_exec		equ	1	;execute access bit
ac_writ		equ	2	;write access bit
ac_apnd		equ	3	;append access bit
;
; D2 register modes for _setuser, _getuser, _setgroup, _getgroup
;
id_effective	equ	0	;effective id
id_login	equ	1	;login id
id_program	equ	2	;program id
id_d3		equ	3	;id contained in D3 register
;
; signals
;
sigabort	equ	1	; Abort signal
siguser		equ	2	; User signal
sigkill		equ	3	; Kill signal (not catchable)
sigterm		equ	4	; Terminate signal (catchable)
sigalarm	equ	5	; Alarm clock signal
sigpipe		equ	6	; Broken pipe
sighangup	equ	7	; Hang up
;		equ	8	; Reserved

;
; 68000 exceptions
;
sigtrap0	equ	9	; Trap 0
sigtrap1	equ	10	; Trap 1
sigtrap2	equ	11	; Trap 2
sigtrap3	equ	12	; Trap 3
sigtrap4	equ	13	; Trap 4
sigtrap5	equ	14	; Trap 5
sigtrap6	equ	15	; Trap 6
sigtrap7	equ	16	; Trap 7
sigtrap8	equ	17	; Trap 8
sigtrap9	equ	18	; Trap 9
sigtrapa	equ	19	; Trap 10
sigtrapb	equ	20	; Trap 11
sigtrapc	equ	21	; Trap 12
sigtrapd	equ	22	; Trap 13
sigtrape	equ	23	; Trap 14
sigtrapf	equ	24	; Trap 15
sigbus		equ	25	; Bus error
sigaddress	equ	26	; Address error
sigillegal	equ	27	; Illegal instruction
sigzerodivide	equ	28	; Zero divide error
sigchk		equ	29	; CHK instruction
sigtrapv	equ	30	; TRAPV instruction
sigpriv		equ	31	; Privilege instruction
sigtrace	equ	32	; Trace
sig1010		equ	33	; Line 1010 emulator
sig1111		equ	34	; Line 1111 emulator
sigformat	equ	35	; Format error
siguninit	equ	36	; Uninitialized interrupt vector
;
;
; SYSTEM CALL NUMBERS
; 	system calls commented out are not implemented in current version
;
_makdev	    equ  00H	;makdev(D2,D3,D4,A0)	make device entry
_makdir	    equ  01H	;makdir(A0)		make a directory
_getdir	    equ  02H	;getdir(A0)		get current directory name
_setdir	    equ  03H	;setdir(A0)		change current directory
_mount	    equ  04H	;mount(D1,A0,A1)	mount file system
_unmount    equ  05H	;unmount(D2,A0)		unmount file system
_delete	    equ  06H	;delete(A0)		delete file
_chkdev	    equ  07H	;chkdev(D2,D3,D4)	check for device driver
_create	    equ  08H	;D1=create(D2,D3,A0)	create & open file
_open	    equ  09H	;D1=open(D2,D3,A0)	open file
_chdup	    equ  0AH	;D2=chdup(D1)		duplicate channel
_close	    equ  0BH	;close(D1)		close file
_exchg	    equ  0CH	;exchg(D1,D2)		exchange data in files
_trunc	    equ  0DH	;trunc(D1)		truncate open file
_pipe	    equ  0EH	;D1,D2=pipe()		create a pipe
;           equ  0FH	
_getpos	    equ  10H	;D3=getpos(D1)		get file position
_setpos	    equ  11H	;setpos(D1,D2,D3)	set file position
_getmode    equ  12H	;D3=getmode(D1,D2)	get device characteristics
_setmode    equ  13H	;D3=setmode(D1,D2,D3,D4)set device characteristics
_rdseq	    equ  14H	;D3=rdseq(D1,D3,A0)	read D3 maximum bytes
_wrseq	    equ  15H	;D3=wrseq(D1,D3,A0)	write D3 bytes
_rdbyte	    equ  16H	;D0=rdbyte(D1)		read 1 byte
_wrbyte	    equ  17H	;wrbyte(D1,D0)		write 1 byte
_rdline	    equ  18H	;D3=rdline(D1,D3,A0)	read a line
_wrline	    equ  19H	;D3=wrline(D1,A0)	write a line
;	    equ	 1AH	
_printf	    equ  1BH	;printf(D1,A0)		print formatted string
_error	    equ  1CH	;error(D0,D1,...)	print error message
_fstat	    equ  20H	;D3=fstat(D2,A0,A1)	get file status (inode)
_cstat	    equ  21H	;D3=cstat(D1,D2,A1)	get channel status (inode)
_fchstat    equ  22H	;fchstat(D2,D3,D4,A0,A1)change file status
_cchstat    equ  23H	;cchstat(D1,D2,D3,D4,A1)change channel status
_flink	    equ  24H	;flink(A0,A1)		link to file
_clink	    equ  25H	;clink(D1,A1)		link to open channel
_faccess    equ  26H	;faccess(D2,A0)		test file access
_caccess    equ  27H	;caccess(D1,D2)		test channel access
;	    equ  28H
;	    equ  29H
_getdate    equ  30H	;D0,D1,D2,D3=getdate()	get date
_setdate    equ  31H	;setdate(D1,D2,D3)	set date
_gettime    equ  32H	;D1,D2,D3=gettime()	get time
_settime    equ  33H	;settime(D1,D2,D3)	set time
_getuser    equ  34H	;D3=getuser(D2)		get user id
_setuser    equ  35H	;setuser(D1,D2,D3)	set user id
_getgroup   equ  36H	;D3=getgroup(D2)	get group id
_setgroup   equ  37H	;setgroup(D1,D2,D3)	set group id
_getprior   equ  38H	;D3=getprior()		get process priority
_setprior   equ  39H	;setprior(D3)		set process priority
_getproc    equ  3AH	;D3=getproc()		get process id
;	    equ  3BH
;	    equ	 3CH
;	    equ  3DH
_lock	    equ  3EH	;lock(D2,D3,A0)		lock key
_unlock	    equ  3FH	;unlock(D2,D3,A0)	unlock key
_signal     equ  40H	;A0=signal(D2,A0)	set up to receive a signal
_kill	    equ  41H	;kill(D2,D3)		send a signal
_sleep	    equ	 42H	;sleep(D3)		sleep D3 seconds
_alarm	    equ  43H	;alarm(D3)		set alarm clock
_pause	    equ  44H	;pause()		pause for alarm clock
_wait	    equ  45H	;D1,D2,D3=wait(D1,D3)	wait for child process
_exit	    equ  46H	;exit(D3)		exit process (close files)
_fork	    equ  47H	;D3=fork(A0,A1,D1,D2)   fork a process
_fshell     equ  48H	;D3=fshell(D1,D2,A1)	fork a shell process
_shell	    equ  49H	;shell(A1)		transfer to shell process
;	    equ  4AH	
_fexec	    equ  4BH	;D3=fexec(D1,D2,A0,A1)	fork and execute program
_exec	    equ  4CH	;exec(A0,A1)		execute program
;	    equ  4DH
;	    equ  4EH
;	    equ  4FH
_memory	    equ  50H	;A0=memory(A0,D1,D2,D3)	allocate user memory
_indirect   equ  51H	;indirect(D0...)	system call in D0 register
_update	    equ  52H	;update()		update disk I/O buffers
;	    equ	 52H
;	    equ  54H					
_version    equ  55H	;D3=version()		get system version #
_boot	    equ  56H	;boot(A0,A1,D1)		boot new system

	form
;* error code definitions -- RVH  Jan 30,1979

?badchan	equ	1	;bad channel #
?toomany	equ	2	;channel already open
?notopen	equ	3	;channel not open
?endfile	equ	4	;end-of-file
?ioerror	equ	5	;I/O error
?filtable	equ	6	;file table exhausted
?notexist	equ	7	;file does not exist
?badname	equ	8	;bad file name
?diraccess	equ	9	;directory access
?filaccess	equ	0ah	;file access
?exists		equ	0bh	;file already exists
?nospace	equ	0ch	;no disk space left
?noinode	equ	0dh	;no inodes left
?inotable	equ	0eh	;inode table exhausted
?badcall	equ	0fh	;illegal system call
?filsize	equ	10h	;file size too big
?mnttable	equ	11h	;mount table exhausted
?notdir		equ	12h	;not a directory
?isdir		equ	13h	;is a directory
?priv		equ	14h	;privileged system call
?notblk		equ	15h	;not a block special device
?fsbusy		equ	16h	;file system busy
?notordin	equ	17h	;not an ordinary file
?notmount	equ	18h	;device not mounted
?nochild	equ	19h	;no child processes
?nomemory	equ	1ah	;not enough memory
?ovflo		equ	1bh	;divide overflow
?argtable	equ	1ch	;argument table exhausted
?arglist	equ	1dh	;bad argument list
?numlinks	equ	1eh	;too many number of links
?difdev		equ	1fh	;cross-device link
?nodevice	equ	20h	;no special device
?usrtable	equ	21h	;user process table exhausted
?badvalue	equ	22h	;value out of range
?notconn	equ	23h	;I/O device not connected
?devopen	equ	24h	;device open error
?diruse		equ	25h	;directory in use (delete)
?filuse		equ	26h	;file in use (exclusive access)
?nomatch	equ	27h	;no match on ambiguous name
?chnaccess	equ	28h	;channel access
?notcromix	equ	29h	;not a cromix disk
?badfree	equ	2ah	;bad free list
?badinum	equ	2bh	;bad inode number
?readonly	equ	2ch	;device mounted for read only
?noproc		equ	2dh	;process does not exist
?signal		equ	2eh	;system call was aborted
?badpipe	equ	2fh	;bad call on a pipe
?locked		equ	30h	;locked
?deadlock	equ	31h	;deadlocked
?lcktable	equ	32h	;lock table exhausted
?tapeio		equ	33h	;tape I/O error
?badio		equ	34h	;bad I/O
?not68000	equ	35h	;68000 programs cannot run under Z80
?badformat	equ	36h	;bad file format
?runaway	equ	37h	;runaway program aborted
?cdossim	equ	38h	;CDOS simmulator required
?corrupt	equ	39H	;system image corrupted

	list	on
