mirror of
https://github.com/DoctorWkt/unix-jun72.git
synced 2026-04-03 04:38:11 +00:00
added missing pages; fixed one mult defined
This commit is contained in:
56
pages/e01-07
Normal file
56
pages/e01-07
Normal file
@@ -0,0 +1,56 @@
|
||||
tst r1 / positive i-number ?
|
||||
bge error1 / yes, error 1 negative i-number means write
|
||||
neg r1 / make it positive
|
||||
jsr r0,writei / write data
|
||||
1:
|
||||
mov u.nread,*u.r0 / put no. of bytes transferred into (u.r0)
|
||||
br sysret1
|
||||
|
||||
rw1:
|
||||
jsr r0,arg; u.base / get buffer pointer
|
||||
jsr r0,arg; u.count / get no. of characters
|
||||
mov *u.r0,r1 / put file descriptor (index to u.fp table) in r1
|
||||
jsr r0,getf / get i-number of the file in r1
|
||||
rts r0
|
||||
|
||||
sysopen:
|
||||
jsr r0,arg2 / get sys args into u.namep and on stack
|
||||
jsr r0,namei / i-number of file in r1
|
||||
br error2 / file not found
|
||||
tst (sp) / is mode = 0 (2nd arg of call, 0 means, open for read)
|
||||
beq 1f / yes, leave i-number positive
|
||||
neg r1 / open for writing so make i-number negative
|
||||
1:
|
||||
jsr r0,iopen / ooen file whose i-number is in r1
|
||||
tst (sp)+ / pop the stack and test the mode
|
||||
beq op1 / is open for read op1
|
||||
|
||||
op0:
|
||||
neg r1 / make i-number positive if open for writing
|
||||
op1:
|
||||
clr r2 / clear registers
|
||||
clr r3
|
||||
1: / scan the list of entries in fsp table
|
||||
tstb u.fp(r2) / test the entry in the u.fp list
|
||||
beq 1f / if byte in list is 0 branch
|
||||
inc r2 / bump r2 so next byte can be checked
|
||||
cmp r2,$10. / reached end of list?
|
||||
blt 1b / no, go back
|
||||
br error2 / yes, error (no files open)
|
||||
1:
|
||||
tst fsp(r3) / scan fsp entries
|
||||
beq 1f / if 0 branch
|
||||
add $8.,r3 / add 8 to r3 to bump it to next entry mfsp table
|
||||
cmp r3,$[nfiles*8.] / done scanning
|
||||
blt 1b / no, back
|
||||
br error2 / yes, error
|
||||
1: / r2 has index to u.fp list, r3, has index to fsp table
|
||||
mov r1,fsp(r3) / put i-number of open file into next available
|
||||
mov cdev,fsp+2(r3) / entry in fsp table, put # of device in
|
||||
/ next word
|
||||
clr fsp+4(r3)
|
||||
clr fsp+6(r3) / clear the next two words
|
||||
asr r3
|
||||
asr r3 / divide by 8 to get number of the fsp entry-1
|
||||
asr r3
|
||||
inc r3 / add 1 to get fsp entry number
|
||||
56
pages/e01-08
Normal file
56
pages/e01-08
Normal file
@@ -0,0 +1,56 @@
|
||||
movb r3,u.fp(r2) / move entry number into next available slot
|
||||
/ in u.fp list
|
||||
mov r2,*u.r0 / move index to u.fp list into r0 loc on stack
|
||||
br sysret2
|
||||
|
||||
error2:
|
||||
jmp error / see 'error' routine
|
||||
sysret2:
|
||||
jmp sysret / see 'sysret' routine
|
||||
|
||||
syscreat: / name, mode
|
||||
jsr r0,arg2 / put file name in u.namep put mode on stack
|
||||
jsr r0,namei / get the i-number
|
||||
br 2f / if file doesn't exist 2f
|
||||
neg r1 / if file already exists make i-number negative
|
||||
/ (open for writing)
|
||||
jsr r0,iopen /
|
||||
jsr r0,itrunc / truncate to 0 length
|
||||
br op0
|
||||
2: / file doesn't exist
|
||||
mov (sp)+,r1 / put the mode in r1
|
||||
bic $!377,r1 / clear upper byte
|
||||
jsr r0,maknod / make an i-node for this file
|
||||
mov u.dirbuf,r1 / put i-number for this new file in r1
|
||||
br op0 / open the file
|
||||
|
||||
sysmkdir: / make a directopy
|
||||
jsr r0,arg2 / point u.namep to the file name
|
||||
jsr r0,namei / get the i-number
|
||||
br .+4 / if file not found branch around error
|
||||
br error2 / directory already exists (error)
|
||||
tstb u.uid / is user the super user
|
||||
bne error2 / no, not allowed
|
||||
mov (sp)+,r1 / put the mode in r1
|
||||
bic $!317,r1 / all but su and ex
|
||||
bis $40000,r1 / directory flag
|
||||
jsr r0,maknod / make the i-node for the directory
|
||||
br sysret2 /
|
||||
|
||||
sysclose: / close the file
|
||||
mov *u.r0,r1 / move index to u.fu list into r1
|
||||
jsr r0,fclose / close the file
|
||||
br error2 / unknown file descriptor
|
||||
br sysret2
|
||||
|
||||
sysemt:
|
||||
jsr r0,arg; 30 / put the argument of the sysemt call in loc 30
|
||||
cmp 30,$core / was the argument a lower address than core
|
||||
blo 1f / yes, rtssvm
|
||||
cmp 30,$ecore / no, was it higher than core and less than
|
||||
/ "ecore"
|
||||
blo 2f / yes, sysret2
|
||||
1:
|
||||
mov $rtssym,30
|
||||
2:
|
||||
br sysret2
|
||||
55
pages/e01-09
Normal file
55
pages/e01-09
Normal file
@@ -0,0 +1,55 @@
|
||||
sysilgins: / calculate proper illegal instruction trap address
|
||||
jsr r0,arg; 10 / take address from sysilgins call , put
|
||||
/ it in loc 8.,
|
||||
cmp 10,$core / making it the illegal instruction trap address
|
||||
blo 1f / is the address a user core address? yes, go to 2f
|
||||
cmp 10,$ecore
|
||||
blo 2f
|
||||
1:
|
||||
mov $fpsym,10 / no, make 'fpsum' the illegal instruction trap
|
||||
/ address for the system
|
||||
2:
|
||||
br sysret2 / return to the caller via 'sysret'
|
||||
|
||||
sysmdate: / change the modification time of a file
|
||||
jsr r0,arg; u.namep / point u.namep to the file name
|
||||
jsr r0,namei / get its i-number
|
||||
br error2 / no, such file
|
||||
jsr r0,iget / get i-node into core
|
||||
cmpb u.uid,i.uid / is user same as owner
|
||||
beq 1f / yes
|
||||
tstb u.uid / no, is user the super user
|
||||
bne error2 / no, error
|
||||
1:
|
||||
jsr r0,setimod / fill in modification data, time etc.
|
||||
mov 4(sp),i.mtim / move present time to
|
||||
mov 2(sp),i.mtim+2 / modification time
|
||||
br sysret2
|
||||
|
||||
sysstty: / set mode of typewriter, 3 consequtive word arguments
|
||||
jsr r0,gtty / r1 will have offset to tty block, r2 has source
|
||||
mov r2,-(sp)
|
||||
mov r1,-(sp) / put r1 and r2 on the stack
|
||||
1: / flush the clist wait till typewriter is quiescent
|
||||
mov (sp),r1 / restore r1 to tty block offset
|
||||
movb tty+3(r1),0f / put cc offset into getc argument
|
||||
mov $240,*$ps / set processor priority to 5
|
||||
jsr r0,getc; 0:../ put character from clist in r1
|
||||
br .+4 / list empty, skip branch
|
||||
br 1b / get another character until list is empty
|
||||
mov 0b,r1 / move cc offset to r1
|
||||
inc r1 / bump it for output clist
|
||||
tstb cc(r1) / is it 0
|
||||
beq 1f / yes, no characters to output
|
||||
mov r1,0f / no, put offset in sleep arg
|
||||
jsr r0,sleep; 0:.. / put tty output process to sleep
|
||||
br 1b / trv to calm it down again
|
||||
1:
|
||||
mov (sp)+,r1
|
||||
mov (sp)+,r2 / restore registers
|
||||
mov (r2)+,r3 / put reader control status in r3
|
||||
beq 1f / if 0, 1f
|
||||
mov r3,rcsr(r1) / move r.c. status to reader control status
|
||||
/ register
|
||||
1:
|
||||
mov (r2)+,r3 / move pointer control status to r3
|
||||
32
pages/e01-10
Normal file
32
pages/e01-10
Normal file
@@ -0,0 +1,32 @@
|
||||
beq 1f / if 0 1f
|
||||
mov r3,tcsr(r1) / move p.c. status to printer control status reg
|
||||
1:
|
||||
mov (r2)+,tty+4(r1) / move to flag byte of tty block
|
||||
jmp sysret2 / return to user
|
||||
|
||||
sysgtty: / get status of typewriter, 3 consequtive word arguments
|
||||
jsr r0,gtty / r1 will have offset to tty block, r2 has
|
||||
/ destination
|
||||
mov rcsr(r1),(r2)+ / put reader control status in 1st word
|
||||
/ of dest
|
||||
mov tcsr(r1),(r2)+ / put printer control status in 2nd word
|
||||
/ of dest
|
||||
mov tty+4(r1),(r2)+ / put mode in 3rd word
|
||||
jmp sysret2 / return to user
|
||||
|
||||
gtty:
|
||||
jsr r0,arg; u.off / put first arg in u.off
|
||||
mov *u.r0,r1 / put file descriptor in r1
|
||||
jsr r0,getf / get the i-number of the file
|
||||
tst r1 / is it open for reading
|
||||
bgt 1f / yes
|
||||
neg r1 / no, i-number is negative, so make it positive
|
||||
1:
|
||||
sub $14.,r1 / get i-number of tty0
|
||||
cmp r1,$ntty-1 / is there such a typewriter
|
||||
bhis error9 / no, error
|
||||
asl r1 / 0%2
|
||||
asl r1 / 0%4 / yes
|
||||
asl r1 / 0%8 / multiply by 8 so r1 points to tty block
|
||||
mov u.off,r2 / put argument in r2
|
||||
rts r0 / return
|
||||
@@ -33,6 +33,7 @@ seektell:
|
||||
sysintr: / set interrupt handling
|
||||
jsr r0,arg; u.intr / put the argument in u.intr
|
||||
br 1f / go into quit routine
|
||||
sysquit:
|
||||
jsr r0,arg; u.quit / put argument in u.quit
|
||||
1:
|
||||
mov u.ttyp,r1 / move pointer to control tty buffer to r1
|
||||
|
||||
Reference in New Issue
Block a user