cc: add initial runtime pieces
authorAlan Cox <alan@linux.intel.com>
Thu, 16 Nov 2017 17:14:49 +0000 (17:14 +0000)
committerAlan Cox <alan@linux.intel.com>
Thu, 16 Nov 2017 17:14:49 +0000 (17:14 +0000)
Need a decent signed divide implementation adding to crun

103 files changed:
Applications/SmallC/Z80/crt0.s [new file with mode: 0644]
Applications/SmallC/Z80/runtime/crun.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__accept.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__exit.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__fork.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__fstat.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__getdirent.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__getfsys.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__getsockaddrs.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__lseek.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys66.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys67.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys68.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys69.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys70.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys71.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys80.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys81.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys82.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys83.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys84.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys85.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys86.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys87.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys88.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__nosys89.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__pause.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__profil.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__recvfrom.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__select.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__sendto.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__shutdown.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__sigdisp.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__stat.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__stime.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__time.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__umount.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/__uname.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_access.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_acct.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_alarm.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_bind.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_brk.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_chdir.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_chmod.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_chown.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_chroot.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_close.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_connect.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_dup.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_dup2.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_execve.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_fchdir.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_fchmod.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_fchown.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_fcntl.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_flock.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_getegid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_geteuid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_getgid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_getgroups.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_getpgrp.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_getpid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_getppid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_getrlimit.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_getsid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_getuid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_ioctl.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_kill.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_link.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_listen.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_memalloc.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_memfree.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_mkdir.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_mknod.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_mount.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_nice.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_open.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_pipe.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_read.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_rename.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_rmdir.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_sbrk.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_setgid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_setgroups.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_setpgid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_setpgrp.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_setrlimit.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_setsid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_setuid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_signal.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_socket.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_sync.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_times.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_uadmin.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_umask.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_unlink.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_utime.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_waitpid.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_write.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/_yield.s [new file with mode: 0644]
Applications/SmallC/Z80/syscall/syscall.s [new file with mode: 0644]
Applications/SmallC/tools/gen-syscall.c [new file with mode: 0644]

diff --git a/Applications/SmallC/Z80/crt0.s b/Applications/SmallC/Z80/crt0.s
new file mode 100644 (file)
index 0000000..7415258
--- /dev/null
@@ -0,0 +1,43 @@
+               .code
+
+; start at 0x100
+start:         jp start2
+               .byte 'F'
+               .byte 'Z'
+               .byte 'X'
+               .byte '1'
+
+;
+;      Borrowed idea from UMZIX - put the info in known places then
+;      we can write "size" tools
+;
+;      This is confusing. SDCC doesn't produce a BSS, instead it
+;      produces an INITIALIZED (which everyone else calls DATA) and a
+;      DATA which everyone else would think of as BSS.
+;
+;      FIXME: we need to automate the load page setting
+;
+               .byte 0x01              ; page to load at
+               .word 0                 ; chmem ("0 - 'all'")
+               .word __code_size               ; gives us code size info
+               .word __data_size               ; gives us data size info
+               .word __bss_size                ; bss size info
+               .word 0                 ; spare
+
+start2:
+               ld hl, 4
+               add hl, sp
+               ld (_environ), hl
+               pop de                  ; argc
+               pop hl                  ; argv
+               push hl
+               ld (___argv), hl        ; needed for stuff like err()
+               push de
+               ld hl, _exit            ; return vector
+               push hl
+               jp _main                ; go
+
+               .data
+
+_environ:      .word 0
+___argv:       .word 0
diff --git a/Applications/SmallC/Z80/runtime/crun.s b/Applications/SmallC/Z80/runtime/crun.s
new file mode 100644 (file)
index 0000000..ed258a0
--- /dev/null
@@ -0,0 +1,298 @@
+;
+;      Runtime support routines for the compiler itself. These are
+;      generated by the compiler in the compiled code
+;
+;      Converted from 8080 to Z80 and tidied up a bit. Some optimized
+;      Z80 routines used.
+;
+;      
+;
+       .code
+
+       .export ccgchar
+       .export ccgint
+       .export ccpchar
+       .export ccpint
+       .export ccsxt
+       .export ccor
+       .export ccand
+       .export ccxor
+       .export cceq
+       .export ccne
+       .export ccgt
+       .export ccle
+       .export ccge
+       .export cclt
+       .export ccuge
+       .export ccult
+       .export ccugt
+       .export ccule
+       .export ccasr
+       .export ccasl
+       .export ccsub
+       .export ccneg
+       .export cccom
+       .export cclneg
+       .export ccboot
+       .export ccmul
+       .export ccumul
+       .export ccdiv
+;      .export ccudiv
+       .export cccase
+       .export cccallhl
+
+ccgchar:
+       ld      a,(hl)
+ccsxt:
+       ld      l,a
+       rlca
+       sbc     a,a
+       ld      h,a
+       ret
+ccgint:
+       ld      a,(hl)
+       inc     hl
+       ld      h,(hl)
+       ld      l,a
+       ret
+ccpchar:
+       ld      a,l
+       ld      (de),a
+       ret
+ccpint:
+       ld      a,l
+       ld      (de),a
+       inc     de
+       ld      a,h
+       ld      (de),a
+       ret
+ccor:  ld      a,h
+       or      d
+       ld      h,a
+       ld      a,l
+       or      e
+       ld      l,a
+       ret
+ccxor: ld      a,h
+       xor     d
+       ld      h,a
+       ld      a,l
+       xor     e
+       ld      e,a
+       ret
+ccand: ld      a,h
+       and     d
+       ld      h,a
+       ld      a,l
+       and     e
+       ld      e,a
+       ret
+cceq:  call    cccmp
+       ret     z
+       dec     hl
+       ret
+ccne:  call    cccmp
+       ret     nz
+       dec     hl
+       ret
+ccgt:  ex      de,hl
+       call    cccmp
+       ret     c
+       dec     hl
+       ret
+ccle:  call    cccmp
+       ret     c
+       ret     z
+       dec     hl
+       ret
+ccge:  call    cccmp
+       ret     nc
+       dec     hl
+       ret
+cclt:  call    cccmp
+       ret     c
+       dec     hl
+       ret
+ccuge: call    ccucmp
+       ret     nc
+       dec     hl
+       ret
+ccult: call    ccucmp
+       ret     c
+       dec     hl
+       ret
+ccule: call    ccucmp
+       ret     z
+       ret     c
+       dec     hl
+       ret
+cccmp:
+       ld      a,e
+       sub     l
+       ld      e,a
+       ld      a,d
+       sub     h
+       ld      hl,1
+       jp      m,cccmp1
+       or      e
+       ret
+cccmp1:        or      e
+       scf
+       ret
+
+ccucmp:
+       ld      a,d
+       cp      h
+       jr      nz,ccret1
+       ld      a,e
+       cp      l
+ccret1:
+       ld      hl,1
+       ret
+
+ccasr: ld      a,l
+       or      a
+       ret     z
+ccasrl:
+       sra     d
+       rr      e
+       dec     a
+       jr      nz,ccasrl
+       ret
+ccasl: ld      a,l
+       or      a
+       ret     z
+ccasll:        sla     e
+       rl      d
+       dec     a
+       jr      nz,ccasll
+       ret
+ccsub: ex      de,hl
+       or      a
+       sbc     hl,de
+       ret
+ccneg: call    cccomm
+       inc     hl
+       ret
+cccom: ld      a,h
+       cpl
+       ld      h,a
+       ld      a,l
+       cpl
+       ld      l,a
+       ret
+cclneg:        ld      a,h
+       or      l
+       jr      nz,ret0
+       inc     hl
+       ret
+ret0:  ld      hl,0
+       ret
+ccbool:        ld      a,h
+       or      l
+       ret     z
+       ld      hl,#1
+       ret
+
+;
+;      These might want to live somewhere else as they are bigger
+;
+;      HL = DE * HL (signed)
+;
+ccumul:
+ccmul: push    bc
+       ld      a,h
+       ld      c,l
+       ld      b,16
+ccmul_1:
+       add     hl,hl
+       sla     c
+       rla
+       jr      nc, ccmul_2
+       add     hl,de
+ccmul_2:
+       djnz    ccmul_1
+       pop     bc
+       ret
+
+;
+;      Outputs HL = DE/HL and DE = DE % HL
+;
+ccudiv:
+       push    bc
+       ex      de,hl
+       ld      a,h
+       ld      b,8
+       ld      c,l
+       ld      hl,0
+ccdiv_1:
+       rla
+       adc     hl,hl
+       sbc     hl,de
+       jr      nc, ccdiv_2
+       add     hl,de
+ccdiv_2:
+       djnz    ccdiv_1
+       rla
+       cpl
+       ld      b,a
+       ld      a,c
+       ld      c,b
+       ld      b,8
+ccdiv_3:
+       rla
+       adc     hl,hl
+       sbc     hl,de
+       jr      nc, ccdiv_4
+       add     hl,de
+ccdiv_4:
+       djnz    ccdiv_3
+       rla
+       cpl
+       ex      de,hl
+       ld      h,c
+       ld      l,a
+       pop     bc
+       ret
+
+;
+;      As above but signed
+;
+;ccdiv:        TODO
+
+cccase:
+       ex      de,hl
+       pop     hl
+cccase1:
+       call    cccase4
+       ld      a,e
+       cp      c
+       jr      nz,cccase2
+       ld      a,d
+       cp      b
+       jr      nz,cccase2
+       call    cccase4
+       jr      z,cccase3
+       push    bc
+       ret
+cccase2:
+       call    cccase4
+       jr      nz,cccase1
+cccase3:
+       dec     hl
+       dec     hl
+       dec     hl
+       ld      d,(hl)
+       dec     hl
+       ld      e,(hl)
+       ex      de,hl
+cccallhl:
+       jp      (hl)
+cccase4:
+       ld      c,(hl)
+       inc     hl
+       ld      b,(hl)
+       inc     hl
+       ld      a,c
+       or      b
+       ret
diff --git a/Applications/SmallC/Z80/syscall/__accept.s b/Applications/SmallC/Z80/syscall/__accept.s
new file mode 100644 (file)
index 0000000..44f40a4
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __accept
+
+__accept:
+       ld hl, 94
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__exit.s b/Applications/SmallC/Z80/syscall/__exit.s
new file mode 100644 (file)
index 0000000..4602ba0
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __exit
+
+__exit:
+       ld hl, 0
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__fork.s b/Applications/SmallC/Z80/syscall/__fork.s
new file mode 100644 (file)
index 0000000..9b46cac
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __fork
+
+__fork:
+       ld hl, 32
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__fstat.s b/Applications/SmallC/Z80/syscall/__fstat.s
new file mode 100644 (file)
index 0000000..8e9abca
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __fstat
+
+__fstat:
+       ld hl, 16
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__getdirent.s b/Applications/SmallC/Z80/syscall/__getdirent.s
new file mode 100644 (file)
index 0000000..9847725
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __getdirent
+
+__getdirent:
+       ld hl, 24
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__getfsys.s b/Applications/SmallC/Z80/syscall/__getfsys.s
new file mode 100644 (file)
index 0000000..541598f
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __getfsys
+
+__getfsys:
+       ld hl, 22
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__getsockaddrs.s b/Applications/SmallC/Z80/syscall/__getsockaddrs.s
new file mode 100644 (file)
index 0000000..9dba91a
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __getsockaddrs
+
+__getsockaddrs:
+       ld hl, 95
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__lseek.s b/Applications/SmallC/Z80/syscall/__lseek.s
new file mode 100644 (file)
index 0000000..f659028
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __lseek
+
+__lseek:
+       ld hl, 9
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys66.s b/Applications/SmallC/Z80/syscall/__nosys66.s
new file mode 100644 (file)
index 0000000..7f5eebc
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys66
+
+__nosys66:
+       ld hl, 66
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys67.s b/Applications/SmallC/Z80/syscall/__nosys67.s
new file mode 100644 (file)
index 0000000..8fd9f80
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys67
+
+__nosys67:
+       ld hl, 67
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys68.s b/Applications/SmallC/Z80/syscall/__nosys68.s
new file mode 100644 (file)
index 0000000..e5df38c
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys68
+
+__nosys68:
+       ld hl, 68
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys69.s b/Applications/SmallC/Z80/syscall/__nosys69.s
new file mode 100644 (file)
index 0000000..9658cb4
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys69
+
+__nosys69:
+       ld hl, 69
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys70.s b/Applications/SmallC/Z80/syscall/__nosys70.s
new file mode 100644 (file)
index 0000000..70deb0f
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys70
+
+__nosys70:
+       ld hl, 70
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys71.s b/Applications/SmallC/Z80/syscall/__nosys71.s
new file mode 100644 (file)
index 0000000..cdf557a
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys71
+
+__nosys71:
+       ld hl, 71
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys80.s b/Applications/SmallC/Z80/syscall/__nosys80.s
new file mode 100644 (file)
index 0000000..fcf2ad4
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys80
+
+__nosys80:
+       ld hl, 80
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys81.s b/Applications/SmallC/Z80/syscall/__nosys81.s
new file mode 100644 (file)
index 0000000..b768c02
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys81
+
+__nosys81:
+       ld hl, 81
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys82.s b/Applications/SmallC/Z80/syscall/__nosys82.s
new file mode 100644 (file)
index 0000000..1e11f30
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys82
+
+__nosys82:
+       ld hl, 82
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys83.s b/Applications/SmallC/Z80/syscall/__nosys83.s
new file mode 100644 (file)
index 0000000..a6e468b
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys83
+
+__nosys83:
+       ld hl, 83
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys84.s b/Applications/SmallC/Z80/syscall/__nosys84.s
new file mode 100644 (file)
index 0000000..33df767
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys84
+
+__nosys84:
+       ld hl, 84
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys85.s b/Applications/SmallC/Z80/syscall/__nosys85.s
new file mode 100644 (file)
index 0000000..a78b790
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys85
+
+__nosys85:
+       ld hl, 85
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys86.s b/Applications/SmallC/Z80/syscall/__nosys86.s
new file mode 100644 (file)
index 0000000..3383d30
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys86
+
+__nosys86:
+       ld hl, 86
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys87.s b/Applications/SmallC/Z80/syscall/__nosys87.s
new file mode 100644 (file)
index 0000000..54a9ce7
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys87
+
+__nosys87:
+       ld hl, 87
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys88.s b/Applications/SmallC/Z80/syscall/__nosys88.s
new file mode 100644 (file)
index 0000000..21c899e
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys88
+
+__nosys88:
+       ld hl, 88
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__nosys89.s b/Applications/SmallC/Z80/syscall/__nosys89.s
new file mode 100644 (file)
index 0000000..a1227d2
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __nosys89
+
+__nosys89:
+       ld hl, 89
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__pause.s b/Applications/SmallC/Z80/syscall/__pause.s
new file mode 100644 (file)
index 0000000..14f6ebe
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __pause
+
+__pause:
+       ld hl, 37
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__profil.s b/Applications/SmallC/Z80/syscall/__profil.s
new file mode 100644 (file)
index 0000000..887acdd
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __profil
+
+__profil:
+       ld hl, 56
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__recvfrom.s b/Applications/SmallC/Z80/syscall/__recvfrom.s
new file mode 100644 (file)
index 0000000..1ed6a46
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __recvfrom
+
+__recvfrom:
+       ld hl, 97
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__select.s b/Applications/SmallC/Z80/syscall/__select.s
new file mode 100644 (file)
index 0000000..30aabdf
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __select
+
+__select:
+       ld hl, 72
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__sendto.s b/Applications/SmallC/Z80/syscall/__sendto.s
new file mode 100644 (file)
index 0000000..58ed1e8
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __sendto
+
+__sendto:
+       ld hl, 96
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__shutdown.s b/Applications/SmallC/Z80/syscall/__shutdown.s
new file mode 100644 (file)
index 0000000..12a6a08
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __shutdown
+
+__shutdown:
+       ld hl, 98
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__sigdisp.s b/Applications/SmallC/Z80/syscall/__sigdisp.s
new file mode 100644 (file)
index 0000000..25ac735
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __sigdisp
+
+__sigdisp:
+       ld hl, 59
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__stat.s b/Applications/SmallC/Z80/syscall/__stat.s
new file mode 100644 (file)
index 0000000..c93a17b
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __stat
+
+__stat:
+       ld hl, 15
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__stime.s b/Applications/SmallC/Z80/syscall/__stime.s
new file mode 100644 (file)
index 0000000..ac0371d
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __stime
+
+__stime:
+       ld hl, 28
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__time.s b/Applications/SmallC/Z80/syscall/__time.s
new file mode 100644 (file)
index 0000000..57bc840
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __time
+
+__time:
+       ld hl, 27
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__umount.s b/Applications/SmallC/Z80/syscall/__umount.s
new file mode 100644 (file)
index 0000000..72a6695
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __umount
+
+__umount:
+       ld hl, 34
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/__uname.s b/Applications/SmallC/Z80/syscall/__uname.s
new file mode 100644 (file)
index 0000000..8e886cf
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export __uname
+
+__uname:
+       ld hl, 54
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_access.s b/Applications/SmallC/Z80/syscall/_access.s
new file mode 100644 (file)
index 0000000..83b4b17
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _access
+
+_access:
+       ld hl, 12
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_acct.s b/Applications/SmallC/Z80/syscall/_acct.s
new file mode 100644 (file)
index 0000000..f189fa0
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _acct
+
+_acct:
+       ld hl, 63
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_alarm.s b/Applications/SmallC/Z80/syscall/_alarm.s
new file mode 100644 (file)
index 0000000..9ad407c
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _alarm
+
+_alarm:
+       ld hl, 38
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_bind.s b/Applications/SmallC/Z80/syscall/_bind.s
new file mode 100644 (file)
index 0000000..9adecd9
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _bind
+
+_bind:
+       ld hl, 92
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_brk.s b/Applications/SmallC/Z80/syscall/_brk.s
new file mode 100644 (file)
index 0000000..86233ae
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _brk
+
+_brk:
+       ld hl, 30
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_chdir.s b/Applications/SmallC/Z80/syscall/_chdir.s
new file mode 100644 (file)
index 0000000..0706e64
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _chdir
+
+_chdir:
+       ld hl, 10
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_chmod.s b/Applications/SmallC/Z80/syscall/_chmod.s
new file mode 100644 (file)
index 0000000..c1de97d
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _chmod
+
+_chmod:
+       ld hl, 13
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_chown.s b/Applications/SmallC/Z80/syscall/_chown.s
new file mode 100644 (file)
index 0000000..67a094a
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _chown
+
+_chown:
+       ld hl, 14
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_chroot.s b/Applications/SmallC/Z80/syscall/_chroot.s
new file mode 100644 (file)
index 0000000..f637eb2
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _chroot
+
+_chroot:
+       ld hl, 46
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_close.s b/Applications/SmallC/Z80/syscall/_close.s
new file mode 100644 (file)
index 0000000..d36f3bd
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _close
+
+_close:
+       ld hl, 2
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_connect.s b/Applications/SmallC/Z80/syscall/_connect.s
new file mode 100644 (file)
index 0000000..56fac39
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _connect
+
+_connect:
+       ld hl, 93
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_dup.s b/Applications/SmallC/Z80/syscall/_dup.s
new file mode 100644 (file)
index 0000000..77987cb
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _dup
+
+_dup:
+       ld hl, 17
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_dup2.s b/Applications/SmallC/Z80/syscall/_dup2.s
new file mode 100644 (file)
index 0000000..180c230
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _dup2
+
+_dup2:
+       ld hl, 36
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_execve.s b/Applications/SmallC/Z80/syscall/_execve.s
new file mode 100644 (file)
index 0000000..9751d55
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _execve
+
+_execve:
+       ld hl, 23
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_fchdir.s b/Applications/SmallC/Z80/syscall/_fchdir.s
new file mode 100644 (file)
index 0000000..866e9b3
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _fchdir
+
+_fchdir:
+       ld hl, 48
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_fchmod.s b/Applications/SmallC/Z80/syscall/_fchmod.s
new file mode 100644 (file)
index 0000000..79d2888
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _fchmod
+
+_fchmod:
+       ld hl, 49
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_fchown.s b/Applications/SmallC/Z80/syscall/_fchown.s
new file mode 100644 (file)
index 0000000..6ad60d9
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _fchown
+
+_fchown:
+       ld hl, 50
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_fcntl.s b/Applications/SmallC/Z80/syscall/_fcntl.s
new file mode 100644 (file)
index 0000000..4097e02
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _fcntl
+
+_fcntl:
+       ld hl, 47
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_flock.s b/Applications/SmallC/Z80/syscall/_flock.s
new file mode 100644 (file)
index 0000000..ec12c71
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _flock
+
+_flock:
+       ld hl, 60
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_getegid.s b/Applications/SmallC/Z80/syscall/_getegid.s
new file mode 100644 (file)
index 0000000..8849be5
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _getegid
+
+_getegid:
+       ld hl, 45
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_geteuid.s b/Applications/SmallC/Z80/syscall/_geteuid.s
new file mode 100644 (file)
index 0000000..191fda6
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _geteuid
+
+_geteuid:
+       ld hl, 44
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_getgid.s b/Applications/SmallC/Z80/syscall/_getgid.s
new file mode 100644 (file)
index 0000000..45c1a4f
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _getgid
+
+_getgid:
+       ld hl, 41
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_getgroups.s b/Applications/SmallC/Z80/syscall/_getgroups.s
new file mode 100644 (file)
index 0000000..498c9e0
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _getgroups
+
+_getgroups:
+       ld hl, 74
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_getpgrp.s b/Applications/SmallC/Z80/syscall/_getpgrp.s
new file mode 100644 (file)
index 0000000..f8ad313
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _getpgrp
+
+_getpgrp:
+       ld hl, 61
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_getpid.s b/Applications/SmallC/Z80/syscall/_getpid.s
new file mode 100644 (file)
index 0000000..8eec6c2
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _getpid
+
+_getpid:
+       ld hl, 18
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_getppid.s b/Applications/SmallC/Z80/syscall/_getppid.s
new file mode 100644 (file)
index 0000000..a206929
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _getppid
+
+_getppid:
+       ld hl, 19
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_getrlimit.s b/Applications/SmallC/Z80/syscall/_getrlimit.s
new file mode 100644 (file)
index 0000000..b266ee6
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _getrlimit
+
+_getrlimit:
+       ld hl, 75
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_getsid.s b/Applications/SmallC/Z80/syscall/_getsid.s
new file mode 100644 (file)
index 0000000..ee02cc4
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _getsid
+
+_getsid:
+       ld hl, 79
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_getuid.s b/Applications/SmallC/Z80/syscall/_getuid.s
new file mode 100644 (file)
index 0000000..617ef1e
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _getuid
+
+_getuid:
+       ld hl, 20
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_ioctl.s b/Applications/SmallC/Z80/syscall/_ioctl.s
new file mode 100644 (file)
index 0000000..3cfcaee
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _ioctl
+
+_ioctl:
+       ld hl, 29
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_kill.s b/Applications/SmallC/Z80/syscall/_kill.s
new file mode 100644 (file)
index 0000000..13b813b
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _kill
+
+_kill:
+       ld hl, 39
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_link.s b/Applications/SmallC/Z80/syscall/_link.s
new file mode 100644 (file)
index 0000000..bc1535c
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _link
+
+_link:
+       ld hl, 5
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_listen.s b/Applications/SmallC/Z80/syscall/_listen.s
new file mode 100644 (file)
index 0000000..d89b596
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _listen
+
+_listen:
+       ld hl, 91
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_memalloc.s b/Applications/SmallC/Z80/syscall/_memalloc.s
new file mode 100644 (file)
index 0000000..6e79828
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _memalloc
+
+_memalloc:
+       ld hl, 64
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_memfree.s b/Applications/SmallC/Z80/syscall/_memfree.s
new file mode 100644 (file)
index 0000000..3f97718
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _memfree
+
+_memfree:
+       ld hl, 65
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_mkdir.s b/Applications/SmallC/Z80/syscall/_mkdir.s
new file mode 100644 (file)
index 0000000..bf5ba46
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _mkdir
+
+_mkdir:
+       ld hl, 51
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_mknod.s b/Applications/SmallC/Z80/syscall/_mknod.s
new file mode 100644 (file)
index 0000000..3463376
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _mknod
+
+_mknod:
+       ld hl, 4
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_mount.s b/Applications/SmallC/Z80/syscall/_mount.s
new file mode 100644 (file)
index 0000000..9b92aca
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _mount
+
+_mount:
+       ld hl, 33
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_nice.s b/Applications/SmallC/Z80/syscall/_nice.s
new file mode 100644 (file)
index 0000000..c095645
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _nice
+
+_nice:
+       ld hl, 58
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_open.s b/Applications/SmallC/Z80/syscall/_open.s
new file mode 100644 (file)
index 0000000..1f17317
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _open
+
+_open:
+       ld hl, 1
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_pipe.s b/Applications/SmallC/Z80/syscall/_pipe.s
new file mode 100644 (file)
index 0000000..3689f3b
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _pipe
+
+_pipe:
+       ld hl, 40
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_read.s b/Applications/SmallC/Z80/syscall/_read.s
new file mode 100644 (file)
index 0000000..0d504a5
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _read
+
+_read:
+       ld hl, 7
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_rename.s b/Applications/SmallC/Z80/syscall/_rename.s
new file mode 100644 (file)
index 0000000..eba2ece
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _rename
+
+_rename:
+       ld hl, 3
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_rmdir.s b/Applications/SmallC/Z80/syscall/_rmdir.s
new file mode 100644 (file)
index 0000000..8bab732
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _rmdir
+
+_rmdir:
+       ld hl, 52
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_sbrk.s b/Applications/SmallC/Z80/syscall/_sbrk.s
new file mode 100644 (file)
index 0000000..e0be95b
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _sbrk
+
+_sbrk:
+       ld hl, 31
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_setgid.s b/Applications/SmallC/Z80/syscall/_setgid.s
new file mode 100644 (file)
index 0000000..c718049
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _setgid
+
+_setgid:
+       ld hl, 26
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_setgroups.s b/Applications/SmallC/Z80/syscall/_setgroups.s
new file mode 100644 (file)
index 0000000..5556edb
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _setgroups
+
+_setgroups:
+       ld hl, 73
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_setpgid.s b/Applications/SmallC/Z80/syscall/_setpgid.s
new file mode 100644 (file)
index 0000000..d8fdc44
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _setpgid
+
+_setpgid:
+       ld hl, 77
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_setpgrp.s b/Applications/SmallC/Z80/syscall/_setpgrp.s
new file mode 100644 (file)
index 0000000..95e3f92
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _setpgrp
+
+_setpgrp:
+       ld hl, 53
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_setrlimit.s b/Applications/SmallC/Z80/syscall/_setrlimit.s
new file mode 100644 (file)
index 0000000..ef82605
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _setrlimit
+
+_setrlimit:
+       ld hl, 76
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_setsid.s b/Applications/SmallC/Z80/syscall/_setsid.s
new file mode 100644 (file)
index 0000000..cb93e12
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _setsid
+
+_setsid:
+       ld hl, 78
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_setuid.s b/Applications/SmallC/Z80/syscall/_setuid.s
new file mode 100644 (file)
index 0000000..bc30e8b
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _setuid
+
+_setuid:
+       ld hl, 25
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_signal.s b/Applications/SmallC/Z80/syscall/_signal.s
new file mode 100644 (file)
index 0000000..e10cda2
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _signal
+
+_signal:
+       ld hl, 35
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_socket.s b/Applications/SmallC/Z80/syscall/_socket.s
new file mode 100644 (file)
index 0000000..5b7afe3
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _socket
+
+_socket:
+       ld hl, 90
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_sync.s b/Applications/SmallC/Z80/syscall/_sync.s
new file mode 100644 (file)
index 0000000..8dde179
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _sync
+
+_sync:
+       ld hl, 11
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_times.s b/Applications/SmallC/Z80/syscall/_times.s
new file mode 100644 (file)
index 0000000..7664d68
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _times
+
+_times:
+       ld hl, 42
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_uadmin.s b/Applications/SmallC/Z80/syscall/_uadmin.s
new file mode 100644 (file)
index 0000000..f0decdb
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _uadmin
+
+_uadmin:
+       ld hl, 57
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_umask.s b/Applications/SmallC/Z80/syscall/_umask.s
new file mode 100644 (file)
index 0000000..db1ebe7
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _umask
+
+_umask:
+       ld hl, 21
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_unlink.s b/Applications/SmallC/Z80/syscall/_unlink.s
new file mode 100644 (file)
index 0000000..cd8b556
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _unlink
+
+_unlink:
+       ld hl, 6
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_utime.s b/Applications/SmallC/Z80/syscall/_utime.s
new file mode 100644 (file)
index 0000000..906b083
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _utime
+
+_utime:
+       ld hl, 43
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_waitpid.s b/Applications/SmallC/Z80/syscall/_waitpid.s
new file mode 100644 (file)
index 0000000..6de2d73
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _waitpid
+
+_waitpid:
+       ld hl, 55
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_write.s b/Applications/SmallC/Z80/syscall/_write.s
new file mode 100644 (file)
index 0000000..2f868ad
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _write
+
+_write:
+       ld hl, 8
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/_yield.s b/Applications/SmallC/Z80/syscall/_yield.s
new file mode 100644 (file)
index 0000000..94d73cc
--- /dev/null
@@ -0,0 +1,7 @@
+       .code
+
+       .export _yield
+
+_yield:
+       ld hl, 62
+       jp __syscall
diff --git a/Applications/SmallC/Z80/syscall/syscall.s b/Applications/SmallC/Z80/syscall/syscall.s
new file mode 100644 (file)
index 0000000..5bebfe6
--- /dev/null
@@ -0,0 +1,19 @@
+               .export __syscall
+
+               .code
+__syscall:
+               ex      (sp), hl                ; hl is now return addr
+                                               ; stack is syscall
+               ex      de, hl                  ; save return addr in de
+               rst     0x30
+               ex      de, hl                  ; undo the magic
+               ex      (sp), hl
+               ex      de, hl                  ; return with HL
+               ret     nc                      ; ok
+               ld      (_errno), hl            ; error path
+               ld      hl, 0xffff
+               ret
+
+               .data
+
+_errno:                .word   0
diff --git a/Applications/SmallC/tools/gen-syscall.c b/Applications/SmallC/tools/gen-syscall.c
new file mode 100644 (file)
index 0000000..8f0fe7f
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ *     Generate the syscall functions. For Z80 at the moment. Extend to
+ *     do the others as well
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "syscall_name.h"
+
+static char namebuf[128];
+
+/*
+ *     For Z80 it's kind of simple - load the call number and jump
+ *     to the common helper.
+ */
+static void write_Z80_call(int n)
+{
+  FILE *fp;
+  snprintf(namebuf, 128, "Z80/syscall/_%s.s", syscall_name[n]);
+  fp = fopen(namebuf, "w");
+  if (fp == NULL) {
+    perror(namebuf);
+    exit(1);
+  }
+  fprintf(fp, "\t.code\n\n");
+  fprintf(fp, "\t.export _%s\n\n", syscall_name[n]);
+  fprintf(fp, "_%s:\n\tld hl, %d\n", syscall_name[n], n);
+  fprintf(fp, "\tjp __syscall\n");
+  fclose(fp);
+}
+
+static void write_Z80_call_table(void)
+{
+  int i;
+  for (i = 0; i < NR_SYSCALL; i++)
+    write_Z80_call(i);
+}
+
+static void write_Z80_makefile(void)
+{
+  int i;
+  FILE *fp = fopen("Z80/syscall/Makefile", "w");
+  if (fp == NULL) {
+    perror("Makefile");
+    exit(1);
+  }
+  fprintf(fp, "SRCS = syscall.s\n", syscall_name[0]);
+  for (i = 0; i < NR_SYSCALL; i++)
+    fprintf(fp, "SRCS += _%s.s\n", syscall_name[i]);
+  fprintf(fp, "\nsyscall.a: $(SRCS)\n");
+  fprintf(fp, "\t$(CROSS_AR) rc syslib.lib $(OBJS)\n\n");
+  fprintf(fp, "$(OBJS): %%.o: %%.s\n");
+  fprintf(fp, "\t$(CROSS_AS) $<\n\n");
+  fprintf(fp, "clean:\n");
+  fprintf(fp, "\trm -f $(OBJS) $(SRCS) syscall.a *~\n\n");
+  fclose(fp);
+}
+
+int main(int argc, char *argv[])
+{
+  write_Z80_makefile();
+  write_Z80_call_table();
+  exit(0);
+}