mirror of
https://github.com/DoctorWkt/unix-jun72.git
synced 2026-02-01 22:43:27 +00:00
56 lines
1.5 KiB
Plaintext
56 lines
1.5 KiB
Plaintext
/ in users buffer
|
|
inc u.nread / increment the number of bytes read
|
|
dec u.count / decrement the number of bytes to be read
|
|
bne 1f / any more bytes to read?; yes, branch
|
|
mov (sp)+,r0 / no, do a non-local return to the caller of
|
|
/ 'readi' by:
|
|
ret: / (1) pop the return address off the stack into r0
|
|
mov (sp)+,r1 / (2) pop the i-number off the stack into r1
|
|
1:
|
|
clr *$ps / clear processor status
|
|
rts r0 / return to address currently on top of stack
|
|
|
|
writei:
|
|
clr u.nread / clear the number of bytes transmitted during
|
|
/ read or write calls
|
|
tst u.count / test the byte count specified by the user
|
|
bgt 1f / any bytes to output; yes, branch
|
|
rts r0 / no, return - no writing to do
|
|
1:
|
|
mov r1 ,-(sp) / save the i-node number on the stack
|
|
cmp r1,$40. / does the i-node number indicate a special file?
|
|
bgt dskw / no, branch to standard file output
|
|
asl r1 / yes, calculate the index into the special file
|
|
jmp *1f-2(r1) / jump table and jump to the appropriate routine
|
|
1:
|
|
wtty / tty
|
|
wppt / ppt
|
|
wmem / mem
|
|
wrf0 / rf0
|
|
wrk0 / rk0
|
|
wtap / tap0
|
|
wtap / tap1
|
|
wtap / tap2
|
|
wtap / tap3
|
|
wtap / tap4
|
|
wtap / tap5
|
|
wtap / tap6
|
|
wtap / tap7
|
|
xmtt / tty0
|
|
xmtt / tty1
|
|
xmtt / tty2
|
|
xmtt / tty3
|
|
xmtt / tty4
|
|
xmtt / tty5
|
|
xmtt / tty6
|
|
xmtt / tty7
|
|
/ w1pr / lpr
|
|
|
|
wtty:
|
|
jsr r0,cpass / get next character from user buffer area; if
|
|
/ none go to return address in syswrite
|
|
tst r1 / is character = null
|
|
beq wtty / yes, get next character
|
|
1 :
|
|
mov $240,*$ps / no, set processor priority to five
|