10 ! a small collection of UNIX system calls implemented under CP/M
84 ! Structure of filearea maintained by this implementation
85 ! First iobuffer of 128 bytes
86 ! Then the fcb area of 36 bytes
87 ! The number of bytes left in the buffer, 1 byte
88 ! The iopointer into the buffer, 2 bytes
89 ! The openflag 0 unused, 1 reading, 2 writing, 1 byte
90 ! The filedescriptor starting at 3, 1 byte
91 ! The number of CTRL-Zs that have been absorbed, 1 byte
92 ! The byte read after a sequence of CTRL-Zs, 1 byte
95 filesize=128+36+1+2+1+1+1+1
97 filefcb=0 ! pointers point to fcb
106 .assert [ filefcb] <> 0
108 0: .space maxfiles*filesize
117 ttymode:.data1 9,9,8,21;.data2 06310+RAW*040 ! raw = 040
145 ld (return),ix ! return adres
146 pop de ! system call number
149 jr nz,unimpld ! too big
151 and 0300 ! only 64 system calls
163 .data2 e.mon ! ux_indir
165 .data2 e.mon ! ux_fork
170 .data2 e.mon ! ux_wait
172 .data2 e.mon ! ux_link
174 .data2 e.mon ! ux_exec
175 .data2 e.mon ! ux_chdir
177 .data2 e.mon ! ux_mknod
178 .data2 e.mon ! ux_chmod
179 .data2 e.mon ! ux_chown
180 .data2 e.mon ! ux_break
181 .data2 e.mon ! ux_stat
182 .data2 e.mon ! ux_seek
184 .data2 e.mon ! ux_mount
185 .data2 e.mon ! ux_umount
186 .data2 e.mon ! ux_setuid
187 .data2 e.mon ! ux_getuid
188 .data2 e.mon ! ux_stime
189 .data2 e.mon ! ux_ptrace
190 .data2 e.mon ! ux_alarm
191 .data2 e.mon ! ux_fstat
192 .data2 e.mon ! ux_pause
193 .data2 e.mon ! ux_utime
194 .data2 e.mon ! ux_stty
195 .data2 e.mon ! ux_gtty
196 .data2 e.mon ! ux_access
197 .data2 e.mon ! ux_nice
199 .data2 e.mon ! ux_sync
200 .data2 e.mon ! ux_kill
204 .data2 e.mon ! ux_dup
205 .data2 e.mon ! ux_pipe
206 .data2 e.mon ! ux_times
207 .data2 e.mon ! ux_prof
208 .data2 e.mon ! ux_unused
209 .data2 e.mon ! ux_setgid
210 .data2 e.mon ! ux_getgid
211 .data2 e.mon ! ux_sig
222 .data2 unimpld ! ux_exece
223 .data2 e.mon ! ux_umask
224 .data2 e.mon ! ux_chroot
229 ! searches for a free filestructure
230 ! returns pointer in iy, 0 if not found
282 ld (ix+iopointer+1),h
310 ld h,(ix+iopointer+1)
315 ld (ix+iopointer+1),h
324 ld h,(ix+iopointer+1)
330 ld (ix+iopointer+1),h
344 ld (ix+iopointer+1),h
387 ! parses file name pointed to by hl and fills in fcb
388 ! of the file pointed to by ix.
389 ! recognizes filenames as complicated as 'b:file.zot'
390 ! and as simple as 'x'
405 cp ':' ! drive specified ?
412 inc a ! now 1<= a <= 16
415 ld b,8 ! filename maximum of 8 characters
428 and 0337 ! UPPER case
444 ret ! filenames longer than 8 are truncated
445 2: ld a,' ' ! fill with spaces
449 3: ld b,3 ! length of extension
537 rtn: ld ix,(return) ; jp (ix)
566 ld ix,(return) ; jp (ix)
597 pop hl ! file mode, not used under CP/M
615 pop hl ! remove params
656 ld (ix+iopointer+1),h
685 !end of no echo interface
696 ld hl,sibuf+1 ! read from console assumed
699 dec hl ! go read console line
700 ld (hl),80 ! max line length
713 ld (siptr),hl ! ready for transfer
726 inc b ! bytes remaining
728 pop de ! bytes wanted (probably 512)
730 ld ix,(siptr) ! copy from
731 xor a ! find out minimum of ramaining and wanted
733 jr nz,3f ! more than 255 wanted (forget that)
736 jp m,3f ! not enough remaining
757 ld ix,(return) ; jp (ix)
770 ! warning: this may not work if zcount overflows
819 pop hl ! buffer address
825 ld b,e ! count now in 'db'
834 ld ix,(return) ; jp (ix)
879 ld ix,(return) ; jp (ix)
902 ld hl,12345 ! nice number
910 retarea: .data2 0 ! base of buffer for result values (max 8 bytes)