changeset 867:0198655f2552

Added sources
author boisy
date Thu, 16 Jan 2003 19:54:21 +0000
parents 157ddcf642b2
children f3670cfbf025
files 3rdparty/packages/cc/sources/abort.a 3rdparty/packages/cc/sources/access.a 3rdparty/packages/cc/sources/cfinish.a 3rdparty/packages/cc/sources/change.a 3rdparty/packages/cc/sources/comp.sys 3rdparty/packages/cc/sources/cstart.a 3rdparty/packages/cc/sources/dir.a 3rdparty/packages/cc/sources/id.a 3rdparty/packages/cc/sources/intercept.a 3rdparty/packages/cc/sources/io.a 3rdparty/packages/cc/sources/line.c 3rdparty/packages/cc/sources/make.sys 3rdparty/packages/cc/sources/mem.a 3rdparty/packages/cc/sources/misc.a 3rdparty/packages/cc/sources/mod.a 3rdparty/packages/cc/sources/process.a 3rdparty/packages/cc/sources/prof.c 3rdparty/packages/cc/sources/profdummy.a 3rdparty/packages/cc/sources/rdump.c 3rdparty/packages/cc/sources/signal.a 3rdparty/packages/cc/sources/stat.a 3rdparty/packages/cc/sources/syscall.a 3rdparty/packages/cc/sources/syscommon.a 3rdparty/packages/cc/sources/tidyup.a 3rdparty/packages/cc/sources/time.a
diffstat 25 files changed, 1716 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/abort.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,62 @@
+ use ..../defs/os9defs.a
+
+ psect abort,0,0,1,0,0
+abort: pshs d,x,y,u
+ leax core,pcr
+ ldb #3
+ clra
+ pshs d
+ pshs x
+ lbsr creat
+
+ cmpd #-1
+ bne abort10
+ ldd errno,y
+ os9 F$EXIT
+
+abort10 leas 4,s
+ pshs b
+
+ leax 1,s
+ ldd #16
+ bsr doabort
+
+ leax _cstart,pcr
+ ldd #etext
+ subd #_cstart
+ bsr doabort
+
+ tfr dp,a
+ clrb
+ tfr d,x
+ subd memend,x
+ nega
+ negb
+ sbca #0
+ bsr doabort
+
+ ldb #255
+ os9 F$EXIT
+
+core fcc "core "
+ fcb $0d
+
+doabort pshs d,x
+ lda 6,s
+ leax 2,s
+ ldy #2
+ os9 I$WRITE
+
+ leax 0,s
+ lda 6,s
+ ldy #2
+ os9 I$WRITE
+
+ puls y
+ puls x
+ cmpy #0
+ beq abort20
+ lda 2,s
+ os9 I$WRITE
+abort20 rts
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/access.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,93 @@
+*
+* File access system calls
+*
+
+pmode equ $0b r/w for owner, r for others
+
+ ifp1
+ use ..../defs/os9defs.a
+ endc
+ psect access_a,0,0,2,0,0
+
+* access(name,mode)
+access: ldx 2,s
+ lda 5,s
+
+ os9 I$OPEN
+
+ bcs access10
+ os9 I$CLOSE
+access10 lbra _sysret
+
+* open(name,mode)
+open: ldx 2,s
+ lda 5,s
+
+ os9 I$OPEN
+ lbcs _os9err
+
+ tfr a,b
+ clra
+ rts
+
+* close(fd)
+close: lda 3,s
+ os9 I$CLOSE
+ lbra _sysret
+
+* mknod(name,mode)
+mknod: ldx 2,s
+ ldb 5,s
+ os9 I$MAKDIR
+ lbra _sysret
+
+* creat(fname,mode)
+creat: ldx 2,s
+ lda 5,s
+ tfr a,b proto attr
+ andb #%00100100 save exec bits
+ orb #pmode default modes
+ os9 I$CREATE
+ bcs creat10
+crret tfr a,b
+ clra
+ rts
+
+creat10 cmpb #E$CEF already there?
+ lbne _os9err no - can't cope
+
+ lda 5,s get the mode
+ bita #$80 trying to create a directory?
+ lbne _os9err yes, forget it
+
+ anda #7 access mode bits
+ ldx 2,s get the name again
+ os9 I$OPEN try to open it
+ lbcs _os9err
+
+ pshs a,u
+ ldx #0
+ leau ,x
+ ldb #2
+ os9 I$SETSTT set the file size to zero
+ puls a,u
+ bcc crret
+
+ pshs b
+ os9 I$CLOSE
+ puls b
+ lbra _os9err
+
+* unlink(fname)
+unlink: ldx 2,s
+ os9 I$DELETE
+ lbra _sysret
+
+* dup(fildes)
+dup: lda 3,s
+ os9 I$DUP
+ lbcs _os9err
+ tfr a,b
+ clra
+ rts
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/cfinish.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,13 @@
+ use ...../defs/os9defs.a
+
+ psect cfinish_a,0,0,1,0,0
+* normal exit - buffers flushed if there are any
+exit: lbsr _dumprof profile dump (if necessary)
+ lbsr _tidyup
+
+* abnormal exit - no buffer flushing
+* the argument to either exit entry is taken to be the
+* F$EXIT status
+_exit: ldd 2,s get the exit status
+ os9 F$EXIT and bye-bye!
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/change.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,87 @@
+ ifp1
+ use ..../defs/os9defs.a
+ endc
+Carry equ %00000001
+Write. equ 2 write access
+FD.Att equ 0 FD offset to attr
+FD.Own equ 1 FD offset to owner
+
+Bufsize equ 16 FD info bytes
+
+ psect change,0,0,2,0,0
+
+* chown(fname,owner)
+chown:
+ pshs y,u save registers
+ leas -Bufsize,s reserve buffer space
+ os9 F$ID get user ID
+ bcs chexit bra if error
+ ldb #E$FNA prime for error
+ cmpy #0 superuser?
+ orcc #Carry prime the carry
+ bne chexit bra if not
+
+ bsr openfile open file and read FD
+ bcs chexit bra if error
+
+ pshs a save path number
+ ldd Bufsize+9,s get the new owner id
+ std FD.Own,x modify the FD
+ puls a restore path number
+ ldb #SS.FD write FD code
+ os9 I$SETSTT write the FD
+ bcs chexit bra if error
+ os9 I$CLOSE close the file
+
+* carry set is error exit, clear for normal
+chexit
+ leas Bufsize,s return scratch
+ puls y,u restore regs
+ lbra _sysret return to caller
+
+*
+* open file and fetch file FD
+* Bufsize buffer is at 2,s
+*
+openfile
+ lda #Write. access mode
+ ldx Bufsize+8,s address of name
+ os9 I$OPEN open the file
+ bcc openf10 exit if error
+ rts
+
+openf10
+ leax 2,s get buffer address
+ ldy #Bufsize and size
+ ldb #SS.FD read FD code
+ os9 I$GETSTT read the FD
+ rts
+
+* chmod(fname,perm)
+chmod:
+ pshs y,u save registers
+ leas -Bufsize,s reserve buffer space
+
+ bsr openfile open file and read FD
+ bcs chexit bra if error
+
+ pshs a,y save regs
+ os9 F$ID get user id
+ cmpy #0 super-user?
+ beq chmod10 yes, he can do it
+ ldb #E$FNA prime for error
+ cmpy FD.Own,x user's own file?
+ orcc #Carry prime the carry
+ bne chexit no, return error
+
+chmod10
+ ldb Bufsize+12,s get the new attributes
+ stb FD.Att,x update FD
+ puls a,y restore path number
+ ldb #SS.FD write FD code
+ os9 I$SETSTT write the FD
+ bcs chexit bra if error
+ os9 I$CLOSE close the file
+ bra chexit and exit
+
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/comp.sys	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,6 @@
+t
+cc2 -qro abort.a stat.a io.a misc.a
+cc2 -qro mod.a dir.a mem.a time.a process.a id.a intercept.a syscall.a
+cc2 -qro syscommon.a profdummy.a cfinish.a tidyup.a
+cc2 -qro -e=2 cstart.a change.a signal.a access.a
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/cstart.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,272 @@
+ ifp1
+ use ..../defs/os9defs.a
+ endc
+
+pushzero macro
+ clr ,-s clear a byte on stack
+ endm
+ 
+nfiles equ 2 stdin and stdout at least
+Typ equ 1
+Edit equ 1
+Stk equ nfiles*256+128+256 stdin,stdout,stderr and fudge
+ psect cstart_a,$11,$81,Edit,Stk,_cstart
+
+cr equ $0d
+sp equ $20
+comma equ ',
+dquote equ '"
+squote equ ''
+
+MAXARGS equ 30 allow for 30 arguments
+
+*
+* rob the first dp byte so nothing gets assigned
+* here.  No valid pointer can point to byte zero.
+*
+ vsect dp
+__$$ fcb 0
+ endsect
+
+ vsect
+argv rmb 2*MAXARGS pointers to args
+argc rmb 2 argument counter
+_sttop rmb 2 stack top
+ endsect
+
+* the following are globally known
+ vsect
+memend: rmb 2
+_flacc: rmb 8 floating point & longs accumulator
+_mtop: rmb 2 current non-stack memory top
+_stbot: rmb 2 current stack bottom limit
+errno: rmb 2 global error holder
+ endsect
+
+*
+* move bytes (Y=From addr, U=To addr, X=Count)
+*
+movbytes
+ lda ,y+ get a byte
+ sta ,u+ put a byte
+ leax -1,x dec the count
+ bne movbytes and round again
+ rts
+
+_cstart:
+ pshs y save the top of mem
+ pshs u save the data beginning address
+
+ clra setup to clear
+ clrb 256 bytes
+csta05 sta ,u+ clear dp bytes
+ decb
+ bne csta05
+
+csta10 ldx 0,s get the beginning of data address
+ leau 0,x (tfr x,u)
+ leax end,x get the end of bss address
+ pshs x save it
+ leay etext,pcr point to dp-data count word
+
+ ldx ,y++  get count of dp-data to be moved
+ beq csta15 bra if none
+ bsr movbytes move dp data into position
+
+ ldu 2,s get beginning address again
+csta15 leau dpsiz,u point to where non-dp should start
+ ldx ,y++ get count of non-dp data to be moved
+ beq clrbss
+ bsr movbytes move non-dp data into position
+
+* clear the bss area - starts where
+* the transferred data finished
+ clra
+clrbss cmpu 0,s reached the end?
+ beq reldt bra if so
+ sta ,u+ clear it
+ bra clrbss
+
+* now relocate the data-text references
+reldt ldu 2,s restore to data bottom
+ ldd ,y++ get dat-text ref. count
+ beq reldd
+ leax btext,pcr point to text
+ lbsr patch patch them
+
+* and the data-data refs.
+reldd ldd ,y++ get the count of data refs.
+ beq restack bra if none
+ leax 0,u u was already pointing there
+ lbsr patch
+
+restack leas 4,s reset stack
+ puls x restore 'memend'
+ stx memend,u
+
+* process the params
+* the stack pointer is back where it started so is
+* pointing at the params
+*
+* the objective is to insert null chars at the end of each argument
+* and fill in the argv vector with pointers to them
+
+* first store the program name address
+* (an extra name inserted here for just this purpose
+* - undocumented as yet)
+ sty argv,u
+
+ ldd #1 at least one arg
+ std argc,u
+ leay argv+2,u point y at second slot
+ leax 0,s point x at params
+ lda ,x+ initialize
+
+aloop ldb argc+1,u
+ cmpb #MAXARGS-1 about to overflow?
+ beq final
+aloop10 cmpa #cr is it EOL?
+ beq final yes - reached the end of the list
+
+ cmpa #sp is it a space?
+ beq aloop20 yes - try another
+ cmpa #comma is it a comma?
+ bne aloop30 no - a word has started
+aloop20 lda ,x+ yes - bump
+ bra aloop10              and round again
+
+aloop30 cmpa #dquote quoted string?
+ beq aloop40  yes
+ cmpa #squote the other one?
+ bne aloop60 no - ordinary
+
+aloop40 stx ,y++ save address in vector
+ inc argc+1,u bump the arg count
+ pshs a save delimiter
+
+qloop lda ,x+ get another
+ cmpa #cr eol?
+ beq aloop50
+ cmpa 0,s delimiter?
+ bne qloop
+
+aloop50 puls b clean stack
+ clr -1,x
+ cmpa #cr
+ beq final
+ lda ,x+
+ bra aloop
+
+aloop60 leax -1,x point at first char
+ stx ,y++ put address in vector
+ leax 1,x bump it back
+ inc argc+1,u bump the arg count
+
+* at least one non-space char has been seen
+aloop70 cmpa #cr have
+ beq loopend we
+ cmpa #sp reached
+ beq loopend the end?
+ cmpa #comma comma?
+ beq loopend
+ lda ,x+ no - look further
+ bra aloop70
+
+loopend clr -1,x yes - put in the null byte
+ bra aloop and look for the next word
+
+* now put the pointers on the stack
+final leax argv,u get the address of the arg vector
+ pshs x goes on the stack first
+ ldd argc,u get the arg count
+ pshs d stack it
+ leay 0,u C progs. assume data & bss offset from y
+
+ bsr _fixtop set various variables
+
+ lbsr main call the program
+
+ pushzero put a zero
+ pushzero on the stack
+ lbsr exit and a dummy 'return address'
+
+* no return here
+_fixtop leax end,y get the initial memory end address
+ stx _mtop,y it's the current memory top
+ sts _sttop,y this is really two bytes short!
+ sts _stbot,y
+ ldd #-126 give ourselves some breathing space
+
+* on entry here, d holds the negative of a stack reservation request
+_stkchec:
+_stkcheck:
+ leax d,s calculate the requested size
+ cmpx _stbot,y is it lower than already reserved?
+ bhs stk10 no - return
+ cmpx _mtop,y yes - is it lower than possible?
+ blo fsterr yes - can't cope
+ stx _stbot,y no - reserve it
+stk10 rts and return
+
+fixserr fcc /**** STACK OVERFLOW ****/
+ fcb 13
+
+fsterr leax <fixserr,pcr address of error string
+ ldb #E$MEMFUL MEMORY FULL error number
+
+erexit pshs b stack the error number
+ lda #2 standard error output
+ ldy #100 more than necessary
+ os9 I$WRITLN write it
+ pushzero clear MSB of status
+ lbsr _exit and out
+* no return here
+
+* stacksize()
+* returns the extent of stack requested
+* can be used by programmer for guidance
+* in sizing memory at compile time
+stacksiz:
+ ldd _sttop,y top of stack on entry
+ subd _stbot,y subtract current reserved limit
+ rts
+
+* freemem()
+* returns the current size of the free memory area
+freemem:
+ ldd _stbot,y
+ subd _mtop,y
+ rts
+
+* patch - adjust initialised data which refer to memory locations.
+* entry:
+*       y -> list of offsets in the data area to be patched
+*       u -> base of data
+*       x -> base of either text or data area as appropriate
+*       d =  count of offsets in the list
+*
+* exit:
+*       u - unchanged
+*       y - past the last entry in the list
+*       x and d mangled
+
+patch pshs x save the base
+ leax d,y half way up the list
+ leax d,x top of list
+ pshs x save it as place to stop
+
+* we do not come to this routine with
+* a zero count (check!) so a test at the loop top
+* is unnecessary
+patch10 ldd ,y++ get the offset
+ leax d,u point to location
+ ldd 0,x get the relative reference
+ addd 2,s add in the base
+ std 0,x store the absolute reference
+ cmpy 0,s reached the top?
+ bne patch10 no - round again
+
+ leas 4,s reset the stack
+ rts and return
+
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/dir.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,18 @@
+*
+* Directory change system calls
+*
+
+ use ..../defs/os9defs.a
+ psect dir_a,0,0,1,0,0
+
+* chdir(dirname)
+chdir: lda #1 read permission
+
+chgdir10 ldx 2,s
+ os9 I$CHGDIR
+ lbra _sysret
+
+* chxdir(dirname)
+chxdir: lda #4 execute
+ bra chgdir10
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/id.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,61 @@
+*
+* Identity system calls
+*
+ use ..../defs/os9defs.a
+
+*
+* Equates for level one pointers (sorry!)
+*
+D.Proc equ $4b
+P$User equ $9
+
+ psect id_a,0,0,1,0,0
+
+* getpid()
+getpid: pshs y save data pointer
+ os9 F$ID
+ puls y
+ bcc getp10
+ lbcs _os9err
+
+getp10 tfr a,b
+ clra
+ rts
+
+* getuid()
+getuid: pshs y
+ os9 F$ID
+ bcc getu10
+
+errexit puls y
+ lbra _os9err
+
+getu10 tfr y,d
+ puls y,pc
+
+* setuid()
+setuid:
+ pshs y
+ bsr getuid get user id
+ std -2,s superuser?
+ beq setu10 bra if so
+ ldb #E$FNA not allowed
+ bra errexit
+
+setu10 ldy 4,s get new user id
+ os9 F$SUSER set user id
+ bcc setu20 bra if ok
+
+ cmpb #E$UNKSVC illegal code?
+ bne errexit bra if not
+
+** Illegal code (sorry) ***
+ tfr y,d
+ ldy >D.Proc 
+ std P$User,y
+
+setu20 clra
+ clrb
+ puls y,pc
+ 
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/intercept.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,41 @@
+* 'Signal' and 'intercept' are definitely incompatible and
+* use of both in a program will have undefined results.
+* In order to protect the programmer from this a dummy global
+* label is declared in both relocatable modules which will produce
+* an 'entry name clash' error in the loader if an attempt is made
+* to use both.
+
+ use ..../defs/os9defs.a
+ psect intercept_a,0,0,1,0,0
+
+ vsect
+intsave rmb 2 place for C routine address
+ endsect
+
+_sigint:
+* intercept(func)
+intercep:
+intercept:
+ pshs u save register variable
+
+ tfr y,u set data are pointer
+ ldx 4,s get C function address
+ stx intsave,y save it for the receiver
+ leax receiver,pcr get the address for OS-9
+
+ os9 F$ICPT call os9
+ puls u restore register variable
+
+ lbra _sysret
+
+* This is where OS-9 will pass control when the process has been
+* sent a signal. All that is needed is to run the intercept routine
+* and execute 'rti'.
+receiver
+ tfr u,y set the data pointer
+ clra clear the MSB
+ pshs d stack the signal number
+ jsr [intsave,y] go run the routine
+ leas 2,s reset the stack
+ rti and return
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/io.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,119 @@
+*
+* File i/o system calls
+*
+
+ use ..../defs/os9defs.a
+ psect io_a,0,0,2,0,0
+
+* read(fd,buf,count)
+read: pshs y
+ ldx 6,s
+ lda 5,s
+ ldy 8,s
+ pshs y save the count for later
+ os9 I$READ
+
+read1 bcc rdexit no problem if carry clear
+ cmpb #E$EOF is the error EOF?
+ bne read10 bra if not
+ clra return zero bytes on EOF
+ clrb
+ puls x,y,pc
+
+read10 puls x,y reset stack and data pointer
+ lbra _os9err report error
+
+rdexit tfr y,d return read/write count in d
+ puls x,y,pc reset stack & data pointer and return
+
+* readln(fildes,buffer,count)
+readln: pshs y save data pointer
+ lda 5,s get path number
+ ldx 6,s get buffer address
+ ldy 8,s get byte count
+
+ pshs y save request for later
+ os9 I$READLN call os9
+ bra read1
+
+* write(fd,buf,count)
+write: pshs y save data pointer
+ ldy 8,s get count
+ beq write10
+ lda 5,s get file number
+ ldx 6,s get buffer address
+
+ os9 I$WRITE
+
+write1 bcc write10
+ puls y
+ lbra _os9err
+
+write10 tfr y,d
+ puls y,pc
+
+* writeln(fildes,buffer,count)
+writeln: pshs y save data pointer
+
+ ldy 8,s get count
+ beq write10
+ lda 5,s get path number
+ ldx 6,s get buffer address
+
+ os9 I$WRITLN call os9
+ bra write1
+
+* lseek(fd,offset,type)
+lseek: pshs u save the register variable
+ ldd 10,s get type
+ bne lseek10
+ ldu #0
+ ldx #0
+ bra doseek
+
+lseek10 cmpd #1 from here?
+ beq here
+ cmpd #2 from the end?
+ beq end
+* bad type
+ ldb #E$SEEK
+
+lserr clra
+ std errno,y
+ ldd #-1
+ leax _flacc,y
+ std 0,x
+ std 2,x
+ puls u,pc
+
+* from the end
+end lda 5,s get path number
+ ldb #2 get file size code
+ os9 I$GETSTT
+ bcs lserr
+
+ bra doseek
+
+here lda 5,s
+ ldb #5
+ os9 I$GETSTT
+ bcs lserr
+
+doseek tfr u,d work on the LSW first
+ addd 8,s
+ std _flacc+2,y
+ tfr d,u
+ tfr x,d
+ adcb 7,s
+ adca 6,s
+ bmi lserr seek is before beginning of file
+ tfr d,x
+ std _flacc,y
+
+ lda 5,s path number
+ os9 I$SEEK
+ bcs lserr
+
+ leax _flacc,y
+ puls u,pc
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/line.c	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,19 @@
+/* line:  list lines of file with numbers */
+
+#include <stdio.h>
+
+main(argc,argv)
+char **argv;
+{
+     char line[256];
+     register int count = 0;
+
+     if(--argc)
+          if(freopen(*++argv,"r",stdin) == NULL) {
+               fprintf(stderr,"can't open file: %s\n",*argv);
+               exit(errno);
+          }
+
+     while(gets(line))
+          printf("%5d %s\n",++count,line);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/make.sys	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,8 @@
+t
+-x
+del syslib.l
+x
+merge >temp1 abort.r signal.r change.r stat.r access.r io.r misc.r mod.r
+merge >temp2 dir.r mem.r time.r process.r id.r intercept.r syscall.r
+merge >syslib.l temp1 temp2 syscommon.r cfinish.r profdummy.r tidyup.r
+del temp1 temp2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/mem.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,75 @@
+*
+* Memory request system calls
+*
+ use ..../defs/os9defs.a
+ psect mem_a,0,0,3,0,0
+
+ vsect
+spare rmb 2
+ endsect
+
+* sbrk(size)   get memory from system
+sbrk: ldd memend,y get hi bound
+ pshs d save it
+ ldd 4,s get the size required
+ cmpd spare,y any spare left?
+ blo sbrk20
+
+* have to get some from the system
+ addd memend,y add current size
+ pshs y save data pointer
+ subd 0,s adjust for base
+ os9 F$MEM re-size memory
+ tfr y,d save high bound
+ puls y restore data ptr
+ bcc sbrk10 bra if no error
+ ldd #-1 return error code
+ leas 2,s junk scratch
+ rts
+
+sbrk10 std memend,y save new memory address
+ addd spare,y add in spare bytes
+ subd 0,s less old base
+ std spare,y is new spare value
+
+* now spare is big enough
+sbrk20 leas 2,s junk scratch
+ ldd spare,y get spare count
+ pshs d
+ subd 4,s less size
+ std spare,y updated value
+ ldd memend,y get hi bound
+ subd ,s++ base of free memory
+ pshs d save
+
+ clra
+ ldx 0,s
+sbrk30 sta ,x+ clear out the new memory
+ cmpx memend,y
+ blo sbrk30
+
+ puls d,pc
+
+* ibrk(size)   get memory within data allocation
+ibrk: ldd 2,s get the size required
+ addd _mtop,y add in the current top
+ bcs ibrk20 if it wraps round - error
+ cmpd _stbot,y overlap stack?
+ bhs ibrk20 yes - error
+ pshs d no - save top
+ ldx _mtop,y reset to bottom
+
+ clra
+sbloop cmpx 0,s reached the end?
+ bhs ibrk10 yes - done
+ sta ,x+ no - clear and bump
+ bra sbloop
+
+ibrk10 ldd _mtop,y return value
+ puls x restore new top
+ stx _mtop,y and save for next time
+ rts
+
+ibrk20 ldd #-1 return memory full
+ rts
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/misc.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,43 @@
+*
+* Miscellaneous system calls
+*
+
+ use ..../defs/os9defs.a
+ psect misc_a,0,0,1,0,0
+
+* lock(flag)
+lock: rts
+
+* pause()
+pause: ldx #0
+ clrb
+ os9 F$SLEEP
+ lbra _os9err
+
+* sync()
+sync: rts
+
+* crc(start,count,accum)
+crc: pshs y,u save reg. variable and data pointer
+ ldx 6,s get start pointer
+ ldy 8,s get byte count
+ ldu 10,s get address of accumulator
+ os9 F$CRC call os9
+ puls y,u,pc no error output
+
+* prerr(fildes,error)
+prerr: lda 3,s get path number
+ ldb 5,s get error code
+ os9 F$PERR call os9
+ lbcs _os9err
+ rts
+
+* tsleep(ticks)
+tsleep:
+ ldx 2,s get sleep time
+ os9 F$SLEEP call os9
+ lbcs _os9err
+ tfr x,d return ticks remaining in d reg
+ rts
+ endsect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/mod.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,49 @@
+*
+* Module access system calls
+*
+
+shiftla macro
+ rept \1
+ lsla
+ endr
+ endm
+
+ use ..../defs/os9defs.a
+ psect mod_a,0,0,1,0,0
+
+* modlink(modname,type,language)
+modlink: pshs y,u save environment
+ ldx 6,s get module name pointer
+ lda 9,s get type
+ shiftla 4 shift to m.s nibble
+ ora 11,s and language
+
+ os9 F$LINK call os9
+
+* the only value returned is a pointer to the module
+* other values can be found in the module itself
+modcom
+ tfr u,d C return value always in d reg.
+ puls y,u restore environment
+ lbcs _os9err
+ rts
+
+* modload(modname,type,language)
+modload: pshs y,u save environment
+ ldx 6,s get module name pointer
+ lda 9,s get type
+ shiftla 4
+ ora 11,s and type
+
+ os9 F$LOAD call os9
+
+ bra modcom common code
+
+* munlink(mod)
+munlink: pshs u save register variable
+ ldu 4,s get module pointer
+
+ os9 F$UNLINK call os9
+ puls u restore register variable
+ lbra _sysret usual return
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/process.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,82 @@
+*
+* Process system calls
+*
+ use ..../defs/os9defs.a
+ psect process_a,0,0,2,0,0
+
+* kill(pid,signal)
+kill: lda 3,s get process id
+ ldb 5,s get signal number
+ os9 F$SEND
+ lbra _sysret
+
+* wait(status)
+wait: clra clear these so
+ clrb signal can be detected
+ os9 F$WAIT
+ lbcs _os9err
+
+ ldx 2,s
+ beq wait10
+ stb 1,x
+ clr ,x
+
+wait10 tfr a,b
+ clra
+ rts
+
+* setpr(pid,priority)
+setpr: lda 3,s get process id
+ ldb 5,s get priority
+ os9 F$SPRIOR call os9
+ lbra _sysret
+
+* chain(modname,paramsize,paramp,type,language,datasize)
+*
+* This call can never return to the caller. The stack pointer
+* must be adjusted to point into the direct page which, in general,
+* contains global variables belonging to the program. OS-9 will
+* therefore overwrite these values making the state of the program
+* undefined after the call.
+* In addition, we cannot report the error here because the module
+* name string could easily be in the direct page.
+chain:
+ leau 0,s save the sp
+ leas $ff,y set the stack into the direct page
+
+ ldx 2,u get the module name pointer
+ ldy 4,u get the parameter area size
+ lda 9,u get the type
+ lsla
+ lsla
+ lsla
+ lsla
+ ora 11,u and the language
+ ldb 13,u get the data size
+ ldu 6,u get the parameter area beginning address
+
+ os9 F$CHAIN go do it
+
+* return here indicates an error
+ os9 F$EXIT error code already in b reg.
+
+* os9fork(modname,paramsize,paramp,language,type,datasize)
+os9fork: pshs y,u save environment
+
+ ldx 6,s get module name
+ ldy 8,s get parameter area size
+ ldu 10,s get parameter area pointer
+ lda 13,s get language
+ ora 15,s and type
+ ldb 17,s get data size
+
+ os9 F$FORK call os9
+
+* return here indicates either error or parent
+ puls y,u restore environment
+ lbcs _os9err
+ tfr a,b make an integer out of it
+ clra
+* NOTE: the x register return value (points past name) is ignored
+ rts
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/prof.c	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,60 @@
+/*   C program profiler
+
+     The -P option of the compiler generates code at the beginning
+     of each function that calls _prof with the function's absolute
+     address and a pointer to the name of the function.  This version
+     of _prof just tallies the number of times a function is called.
+     It could possibly be modified to trace the execution of functions.
+*/
+
+#include <stdio.h>
+
+#define MAXFUNC 63       /* maximum number of unique functions */
+
+typedef struct profstr {
+     int (*func)();
+     char *fname;
+     long count;
+     } prof;
+
+static prof pfs[MAXFUNC];
+static prof *pfree=pfs;
+static prof *pmax=&pfs[MAXFUNC];
+
+_prof(afunc,name)
+int (*afunc)();
+char *name;
+{
+     register prof *p;
+
+/* linear search for the function addr (not quick, but easy) */
+     for(p=pfs; p<pfree; ++p)
+          if(p->func == afunc) {        /* function found, bump count */
+               ++p->count;
+               return;
+          }
+
+     if(pfree > pmax) {       /* no more room? */
+          p=pfree-1;
+          p->fname = p->fname ? "????????" : name; /* put it here */
+          ++p->count;
+     }
+     else {                   /* enter the function in table */
+          p=pfree++;
+          p->fname=name;      /* pointer to function */
+          p->func = afunc;    /* pointer to function name */
+          p->count = 1;
+     }
+}
+
+/* _dumprof() is called by exit() at program end.
+          It may be called at any time to get a count */
+_dumprof()
+{
+     register prof *p;
+
+     pflinit();
+     fflush(stdout);          /* flush stdout first */
+     for(p=pfs; p<pfree; ++p)      /* dump names and counts */
+          fprintf(stderr," %8s() %ld\n",p->fname,p->count);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/profdummy.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,6 @@
+* dummy profile dump
+ psect profdummy_a,0,0,0,0,0,0
+
+_dumprof:
+ rts
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/rdump.c	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,278 @@
+#include <stdio.h>
+
+/* rdump:  prints formatted dump of .r and .l files
+
+     rdump [opts] <file>[ <file>] [opts]
+
+     options:
+          -g - add global definition info
+          -r - add reference info
+          -o - add reference and local offset info
+          -a - all of the above
+*/
+
+/* symbol table types */
+
+/* symbol definition/reference type/location */
+
+/* type flags */
+#define CODENT      0x04        /* data/code flag */
+/* data type flags */
+#define DIRENT      0x02        /* global/direct flag */
+#define INIENT      0x01        /* clear/init. data flag */
+
+/* location flags */
+#define CODLOC      0x20        /* data/code flag */
+#define DIRLOC      0x10        /* global/direct flag */
+#define LOC1BYT     0x08        /* two/one byte size flag */
+#define LOCMASK     (CODLOC|DIRLOC)
+
+#define NEGMASK     0x40        /* negate on resolution */
+#define RELATIVE    0x80        /* relative reference */
+
+/* misc. constants */
+#define ROFSYNC     0x62CD2387
+#define SYMLEN      9         /* Length of symbols */
+#define MAXNAME     16        /* length of module name */
+
+/* definition/reference */
+typedef struct {
+     char r_flag; /* type/location */
+     unsigned r_offset;
+} def_ref;
+
+/* rof header structure */
+typedef struct {
+     long h_sync;
+     unsigned h_tylan;
+     char h_valid;
+     char h_date[5];
+     char h_edit;
+     char h_spare;
+     unsigned h_glbl;
+     unsigned h_dglbl;
+     unsigned h_data;
+     unsigned h_ddata;
+     unsigned h_ocode;
+     unsigned h_stack;
+     unsigned h_entry;
+} binhead;
+
+#define MAXSOURCE 20
+#define puts(s) fputs(s,stdout)
+#define mc(c) ((c)&0xff)
+
+#define DEF 1
+#define REF 2
+
+direct char *snames[MAXSOURCE],*fname;
+direct int scount;
+direct int gflag,rflag,oflag;
+
+binhead hd;
+FILE *in;
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+
+     register char *p;
+
+     while (--argc>0) {
+          if(*(p=*++argv)=='-') {
+               while(*++p) switch(*p) {
+                    case 'g': gflag=1; break;
+                    case 'r': rflag=1; break;
+                    case 'o': oflag=1; break;
+                    case 'a': gflag=rflag=oflag=1; break;
+                    default:  error("unknown option -%c",*p);
+               }
+               done: ;
+          }
+          else {
+               if(scount==MAXSOURCE) error(0,"too many source files");
+               snames[scount++]=*argv;
+          }
+     }
+     pass1();
+}
+
+pass1()
+{
+     int count;
+
+     if(scount == 0)
+          return;
+
+     for(count=0; count<scount; ++count) {
+          fname = snames[count];
+          if((in = fopen(fname,"r")) == NULL) {
+               printf("can't open '%s'",fname);
+               continue;
+          }
+
+          for(;;) {
+               if(fread(&hd,sizeof(hd),1,in) == 0)
+                    break;
+
+               if(hd.h_sync != ROFSYNC) {
+                    printf("'%s' is not a relocatable module",fname);
+                    break;
+               }
+
+               showhead();
+               showglobs();
+
+/* skip code and initialized data */
+               fseek(in,(long)(hd.h_ocode + hd.h_ddata + hd.h_data),1);
+
+               showrefs();
+               showlcls();
+
+          }
+          fclose(in);
+     }
+}
+
+showhead()
+{
+     int c;
+
+     puts("\nModule name: ");
+     while(c=getc(in))
+          putchar(c);
+     if(ferror(in)) ferr(fname);
+
+     printf("\nTyLa/RvAt:   %02x/%02x\n",mc(hd.h_tylan>>8),mc(hd.h_tylan));
+     printf("Asm valid:   %s\n",hd.h_valid ? "No" : "Yes");
+     printf("Create date: %.3s %2d, %4d %02d:%02d\n",
+          &("JanFebMarAprMayJunJulAugSepOctNovDec"[(mc(hd.h_date[1])-1)*3]),
+          mc(hd.h_date[2]),1900+mc(hd.h_date[0]),
+          mc(hd.h_date[3]),mc(hd.h_date[4]));
+     printf("Edition:     %2d\n",hd.h_edit);
+       puts("  Section    Init Uninit\n");
+     printf("   Code:     %04x\n",hd.h_ocode);
+     printf("     DP:       %02x   %02x\n",hd.h_ddata,hd.h_dglbl);
+     printf("   Data:     %04x %04x\n",hd.h_data,hd.h_glbl);
+     printf("  Stack:     %04x\n",hd.h_stack);
+     printf("Entry point: %04x\n",hd.h_entry);
+}
+showglobs()
+{
+     register unsigned count,offset;
+     char sym[SYMLEN+1],flag;
+
+     count=getw(in);          /* global def count */
+     if(gflag)
+          printf("\n%u global symbols defined:\n",count);
+
+     while(count--) {
+          getname(sym);
+          flag=getc(in);
+          offset=getw(in);
+          if(gflag) {
+               printf(" %9s %04x ",sym,offset);
+               ftext(flag,DEF);
+          }
+     }
+}
+
+getname(s)
+register char *s;
+{
+     while(*s++ = getc(in));
+     *s = '\0';
+     if(ferror(in)) ferr(fname);
+}
+
+ftext(c,ref)
+char c;
+int ref;
+{
+
+     printf("(%02x) ",mc(c));
+     if(ref & REF) {
+          if(c & CODLOC)
+               puts("in code");
+          else puts(c & DIRLOC ? "in dp data" : "in non-dp data");
+
+          puts(c & LOC1BYT ? "/byte" : "/word");
+          if(c & NEGMASK)
+               puts("/neg");
+          if(c & RELATIVE)
+               puts("/pcr");
+     }
+     if(ref & DEF) {
+          if(ref & REF)
+               puts(" - ");
+          if(c & CODENT)
+               puts("to code");
+          else {
+               puts(c & DIRENT ? "to dp" : "to non-dp");
+               puts(c & INIENT ? " data" : " bss");
+          }
+     }
+     putchar('\n');
+}
+showrefs()
+{
+     register unsigned count,rcount;
+     def_ref ref;
+     char sym[SYMLEN+1];
+     int fflag;
+
+     count=getw(in);
+     if(rflag)
+          printf("\n%u external references:\n",count);
+
+     while(count--) {
+          getname(sym);
+          rcount=getw(in);
+          if(rflag)
+               printf(" %9s ",sym);
+          fflag=0;
+          while(rcount--) {
+               fread(&ref,sizeof(ref),1,in);
+               if(ferror(in)) ferr(fname);
+               if(rflag && oflag) {
+                    if(fflag)
+                         puts("           ");
+                    else fflag=1;
+                    printf("%04x ",ref.r_offset);
+                    ftext(ref.r_flag,REF);
+               }
+          }
+          if(rflag && !oflag)
+               putchar('\n');
+     }
+}
+showlcls()
+{
+     register unsigned count;
+     def_ref ref;
+
+     count=getw(in);
+     if(oflag)
+          printf("\n%u local references\n",count);
+
+     while(count--) {
+          fread(&ref,sizeof(ref),1,in);
+          if(ferror(in)) ferr(fname);
+          if(oflag) {
+               printf("   %04x ",ref.r_offset);
+               ftext(ref.r_flag,DEF | REF);
+          }
+     }
+}
+error(s1,s2,s3,s4)
+{
+     fprintf(stderr,"rdump: ");
+     fprintf(stderr,s1,s2,s3,s4);
+     putc('\n',stderr);
+     exit(1);
+}
+ferr(s)
+{
+     error("error reading '%s'",s);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/signal.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,155 @@
+ use ..../defs/os9defs.a
+* signal system call
+*
+* The main objective here is to maintain a table of
+* signals and the user functions to be executed
+* when the respective signals are received.
+*
+* Because OS-9 signals can range from 0 to 255
+* the table will have to be dynamic to conserve space.
+*
+
+ psect signal,0,0,2,0,0
+
+* 'Signal' and 'intercept' are definitely incompatible and
+* use of both in a program will have undefined results.
+* In order to protect the programmer from this a dummy global
+* label is declared in both relocatable modules which will produce
+* an 'entry name clash' error in the loader if an attempt is made
+* to use both.
+
+
+MAXENTS equ 20 maximum number of simultaneous signal traps
+Zero equ %00000100
+
+* table entry structure
+* csect 0
+*sig rmb 1 signal number to be trapped
+*func rmb 2 address of trap function
+*entsiz equ *
+* endsect
+sig equ 0
+func equ 1
+entsiz equ 3
+
+ vsect
+table rmb entsiz*MAXENTS
+etable rmb 0 end of table
+flag rmb 1 indicates 'intercept' already done
+ endsect
+
+* signal(sig,func)
+_sigint:
+signal: ldd 2,s get the signal number
+ tstb lsb 0?
+ beq sigerr signal 0 can't be caught or ignored
+ tsta greater than 255?
+ bne sigerr
+ bsr lookup find a suitable entry
+ bne signal10 branch if entry found
+
+sigerr ldd #-1 error indication
+ rts
+
+signal10 ldd func,x get the old entry function
+ pshs d save it
+ ldd 6,s get the new function
+ std func,x store in the structure
+ bne signal20 if not 0 branch
+
+* the new 'function' is reset (0)
+ clr sig,x reset the signal byte
+sigexit puls d,pc return the old entry
+
+* value for 'func' is 1 or a real address - set it
+signal20 ldb 5,s get the signal
+ stb sig,x store it
+ tst flag,y have we intercepted before?
+ bne sigexit yes - no more to do
+
+ exg y,u set the local storage into u
+ leax intrupt,pcr get the address of the interrupt routine
+ os9 F$ICPT
+
+ exg y,u reset local storage into y
+ puls d get the old value into d
+
+ bcs sigerr error?
+
+ inc flag,y indicate that we've done it
+ rts all done
+
+* Table lookup function:
+*
+* find an entry in the table whose 'sig' matches the b reg.
+* failing that, the first empty entry
+* failing that, zero
+* return result in x reg. and set the z bit accordingly
+*
+lookup clr ,-s set up a null
+ clr ,-s 'empty' pointer
+ leax etable,y get table end address
+ pshs x save it
+
+ leax table,y start at the beginning
+
+loop cmpx 0,s end yet?
+ beq eloop yes - exit loop
+
+ cmpb sig,x match?
+ bne signal30 no - continue
+ leas 4,s clean up stack
+ andcc #^Zero indicate success
+ rts and return
+
+signal30 lda sig,x if the entry is not empty
+ ora 2,s or the 'empty' pointer
+ ora 3,s is not null
+ bne signal40 then continue
+ stx 2,s else save address of empty entry
+
+signal40 leax entsiz,x bump to next
+ bra loop and round again
+
+eloop
+* we have traversed the table without finding a match
+ ldx 2,s get the empty entry pointer
+ leas 4,s clean the stack
+ rts and return
+
+
+* This is the entry point for all received signals.
+* If an entry is found matching the signal then
+*       if the function address is not 1 then
+*               the function is executed
+*       an 'rti' is executed
+* else
+*       the program exits with the signal as status
+*
+intrupt leay 0,u point to the data
+ bsr lookup
+ beq intr10 any entry returned?
+ pshs x save the entry pointer
+ ldx func,x get the function address
+ bne intr30 empty entry?
+
+* no matching entry - simulate condition of no 'intercept'
+intr10 os9 F$EXIT status still in B reg.
+
+intr20 cmpx #1 is it 'ignore'?
+ bne intr30 no - execute
+ leas 2,s reset stack
+ rti and resume
+
+intr30 clra clear the MSB of the signal arg
+ pshs d put it on the stack for the function
+ jsr 0,x go run the function
+
+ puls d,x get the entry pointer back
+ clra
+ clrb
+ sta sig,x clear the entry
+ std func,x and its func. address
+
+ rti and that's it!
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/stat.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,72 @@
+*
+*  Status system calls
+*
+
+ ifp1
+ use ..../defs/os9defs.a
+ endc
+ psect stat_a,0,0,1,0,0
+
+* getstat(code,path,buffer)
+getstat:
+ lda 5,s get the path number
+ ldb 3,s get the code
+ beq getst30 code 0?
+ cmpb #1 code 1?
+ beq getst40
+ cmpb #6 code 6?
+ beq getst40
+
+ cmpb #2
+ beq getst10
+ cmpb #5
+ beq getst10
+
+* can't do other codes
+ ldb #208 illegal service request
+ lbra _os9err
+
+* codes 2 or 5
+getst10 pshs u
+ os9 I$GETSTT
+ bcc getst20
+ puls u restore register variable
+ lbra _os9err
+
+getst20 stx [8,s] store MSW
+ ldx 8,s get address of destination
+ stu 2,x store LSW
+ puls u restore register variable
+ clra
+ clrb
+ rts
+
+* code 0 - 32 bytes into buffer
+getst30 ldx 6,s
+getst40 os9 I$GETSTT
+ lbra _sysret
+
+* setstat(code,path,buffer)
+* OR setstat(code,path,offset)
+setstat:
+ lda 5,s get path number
+ ldb 3,s get code
+ beq setst10
+
+ cmpb #2
+ beq setst20
+
+ ldb #208 illegal code
+ lbra _os9err
+
+setst10 ldx 6,s get buffer address
+ os9 I$SETSTT
+ lbra _sysret
+
+setst20 pshs u save register variable
+ ldx 8,s get MSW
+ ldu 10,s get LSW
+ os9 I$SETSTT
+ puls u
+ lbra _sysret
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/syscall.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,62 @@
+*
+*  Universal OS-9 system call
+*
+*
+*  calling syntax:  os9(code,registers)
+*                   char code;
+*                   struct registers *reg;
+*
+*       regs structure:
+*
+*       struct registers {
+*               char rg_cc, rg_a, rg_b, rg_dp;
+*               unsigned rg_x, rg_y, rg_u;
+*               };
+
+m$rts equ $39 rts instruction
+m$os9 equ $103f os9 call instruction
+carry equ %00000001 carry bit
+
+ csect
+R$CC rmb 1
+R$D rmb 0
+R$A rmb 1
+R$B rmb 1
+R$DP rmb 1
+R$X rmb 2
+R$Y rmb 2
+R$U rmb 2
+R$PC rmb 2
+R$Size rmb 0
+ endsect
+
+ psect syscall_a,0,0,1,0,0
+_os9: pshs u,y save register variable & data ptr
+ lda 7,s get function code
+ ldb #m$rts and rts instruction
+ pshs d
+ ldd #m$os9 os9 call code
+ pshs d
+ ldu 12,s get user register ptr
+ ldd R$D,u init regs for system call
+ ldx R$X,u
+ ldy R$Y,u
+ ldu R$U,u
+ jsr 0,s execute system call
+ pshs cc,u save regs
+ ldu 15,s get user register ptr
+ leau R$U,u copy regs to user struct
+ pshu a,b,dp,x,y
+ puls a,x
+ sta ,-u
+ stx R$U,u
+ leas 4,s junk the system call code
+ puls u,y restore regs
+ bita #carry carry on?
+ beq os9.a bra if not
+ ldd #-1 return error
+ rts
+os9.a clra return no error
+ clrb
+ rts
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/syscommon.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,12 @@
+ psect syscommon_a,0,0,1,0,0
+_os9err: clra
+ std errno,y indicate in system error indicator
+ ldd #-1 return error status
+ rts
+
+_sysret:
+* normal return sequence
+ bcs _os9err
+ clra return
+ clrb zero
+ rts
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/tidyup.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,5 @@
+ psect tidyup_a,0,0,1,0,0
+
+_tidyup:
+ rts
+ endsect
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/time.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,18 @@
+*
+* Time system calls
+*
+
+
+ use ..../defs/os9defs.a
+ psect time_a,0,0,1,0,0
+
+* setime(buffer)
+setime: ldx 2,s
+ os9 F$STIME call os9
+ lbra _sysret usual return
+
+* getime(buffer)
+getime: ldx 2,s
+ os9 F$TIME call os9
+ lbra _sysret
+ endsect