mirror of
https://github.com/DoctorWkt/unix-jun72.git
synced 2026-04-09 22:48:11 +00:00
- fixed some O/0, in/ln, and unicode issues.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
/ size of directory
|
||||
mov r0,u.base / set buffer address for write to top of directory
|
||||
clr u.off / clear file offset used in 'seek' and 'tell'
|
||||
add u.count,r0 / r0 polnts to the header of the next directory
|
||||
add u.count,r0 / r0 points to the header of the next directory
|
||||
jsr r0,writei / write the directory and i-node onto drum
|
||||
br 1b / do next directory
|
||||
.endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/ u5 - unix
|
||||
mget:
|
||||
mov *u.fofp,mq / file offset ln mq
|
||||
mov *u.fofp,mq / file offset in mq
|
||||
clr ac / later to be high sig
|
||||
mov $-8,lsh / divide ac/mq by 256.
|
||||
mov mq,r2
|
||||
@@ -12,7 +12,7 @@ mget:
|
||||
mov 1.dskp(r2),r1 / r1 has physical block number
|
||||
bne 2f / lf physical block num is zero then need a new block
|
||||
/ for file
|
||||
jsr rO,alloc / allocate a new block
|
||||
jsr r0,alloc / allocate a new block
|
||||
mov r1,i.dskp(r2) / physical block number stored in i-node
|
||||
jsr r0,setimod / set inode modified byte (imod)
|
||||
jsr r0,clear / zero out disk/drum block just allocated
|
||||
@@ -37,7 +37,7 @@ mget:
|
||||
dec r3
|
||||
bgt 1b
|
||||
jsr r0,dskwr / write new indirect block on disk
|
||||
mov r1,i.dskp / put pointer to indirect block ln i—node
|
||||
mov r1,i.dskp / put pointer to indirect block in i-node
|
||||
bis $10000,i.flgs / set large file blt in i.flgs word of i-node
|
||||
jsr r0,setimod / set i-node modified flag
|
||||
br mget
|
||||
|
||||
10
pages/e05-02
10
pages/e05-02
@@ -1,5 +1,5 @@
|
||||
mov r1,i.dskp(r2) / put block number of new block in i-node
|
||||
jsr r0,setimod / set i—node modified byte
|
||||
jsr r0,setimod / set i-node modified byte
|
||||
jsr r0,clear / clear new block
|
||||
2:
|
||||
jsr r0,dskrd / read in indirect block
|
||||
@@ -11,10 +11,10 @@
|
||||
/ sought in r1
|
||||
bne 2f / if no block exists
|
||||
jsr r0,alloc / allocate a new block
|
||||
mov r1,(r2) / put new block number into proper location ln
|
||||
mov r1,(r2) / put new block number into proper location in
|
||||
/ indirect block
|
||||
mov (sp)+,r1 / get block number of indirect block
|
||||
mov (r2),—(sp) / save block number of new block
|
||||
mov (r2),-(sp) / save block number of new block
|
||||
jsr r0,wslot
|
||||
jsr r0,dskwr / write newly modified indirect block back out
|
||||
/ on disk
|
||||
@@ -24,8 +24,8 @@
|
||||
tst (sp)+ / bump stack pointer
|
||||
rts r0
|
||||
alloc:
|
||||
mov r2,—(sp) / save r2, r3 on stack
|
||||
mov r3,—(sp)
|
||||
mov r2,-(sp) / save r2, r3 on stack
|
||||
mov r3,-(sp)
|
||||
mov $systm,r2 / start of inode and free storage map for drum
|
||||
tst cdev
|
||||
beq 1f / drum ls device
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
br 2f
|
||||
free:
|
||||
mov r2,-(sp) / save r2, r3
|
||||
mov r3,—(sp)
|
||||
mov r3,-(sp)
|
||||
jsr r0,3f / set up bit mask and word no. in free storage map
|
||||
/ for block
|
||||
bis r3,(r2) / set free storage block bit; indicates free block
|
||||
@@ -39,7 +39,7 @@ free:
|
||||
add $systm+2,r2 / address of word of free storage map for drum
|
||||
/ with block bit in it
|
||||
tst cdev
|
||||
beq 1f / cdev = O indicates device is drum
|
||||
beq 1f / cdev = 0 indicates device is drum
|
||||
add $mount-systm,r2 / address of word of free storage map for
|
||||
/ mountable device with bit of block to be
|
||||
/ freed
|
||||
|
||||
10
pages/e05-04
10
pages/e05-04
@@ -4,7 +4,7 @@
|
||||
/ read/write bits
|
||||
asrb r2
|
||||
1:
|
||||
bit r2,(r0)+ / test read—write flags against argument in
|
||||
bit r2,(r0)+ / test read-write flags against argument in
|
||||
/ access call
|
||||
bne 1f
|
||||
tstb u.uid
|
||||
@@ -13,14 +13,14 @@
|
||||
1:
|
||||
rts r0
|
||||
setimod:
|
||||
movb $1,imod / set current i—node modified bytes
|
||||
movb $1,imod / set current i-node modified bytes
|
||||
mov s.time,i.mtim / put present tlme into file modified time
|
||||
mov s.time+2,i.mtim+2
|
||||
rts r0
|
||||
imap: / get the byte that has the allocation bit for the i—number contained
|
||||
imap: / get the byte that has the allocation bit for the i-number contained
|
||||
/ in r1
|
||||
mov $1,mq / put 1 in the mq
|
||||
mov r1,r2 / r2 now has i—number whose byte in the map we
|
||||
mov r1,r2 / r2 now has i-number whose byte in the map we
|
||||
/ must find
|
||||
sub $41.,r2 / r2 has i-41
|
||||
mov r2,r3 / r3 has i-41
|
||||
@@ -36,7 +36,7 @@ imap: / get the byte that has the allocation bit for the i—number contained
|
||||
/ block for drum
|
||||
tst cdev / is the device the disk
|
||||
beg 1f / yes
|
||||
add $mount—systm,r2 / for mounted device, r2 points to 1st word
|
||||
add $mount-systm,r2 / for mounted device, r2 points to 1st word
|
||||
/ of its super block
|
||||
1:
|
||||
add (r2)+,(sp) / get byte address of allocation bit
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
icalc: / i-node i is located in block (i+31.)/16. and begins 32.*
|
||||
/ (i+31)mod16 bytes from its start
|
||||
add $31.,r1 / add 31. to i-number
|
||||
mov r1,—(sp) / save i+.31. on stack
|
||||
mov r1,-(sp) / save i+.31. on stack
|
||||
asr r1 / divide by 16.
|
||||
asr r1
|
||||
asr r1
|
||||
@@ -43,7 +43,7 @@ icalc: / i-node i is located in block (i+31.)/16. and begins 32.*
|
||||
bic $!17,(sp) / zero all but last 4 bits; gives (i+31.) mod 16
|
||||
mov (sp)+,mq / calculate offset in data buffer; 32.*(i+31.)mod16
|
||||
mov $5,lsh / for i-node i.
|
||||
add mq,r5 / r5 points to flrst word ln i-node i.
|
||||
add mq,r5 / r5 points to flrst word in i-node i.
|
||||
mov $inode,r1 / inode is address of first word of current i-node
|
||||
mov $16.,r3
|
||||
tst (r0)+ / branch to 2f when argument in icalc call = 0
|
||||
|
||||
10
pages/e06-01
10
pages/e06-01
@@ -4,9 +4,9 @@ read:
|
||||
tst u.count / is number of bytes to be read greater than 0
|
||||
bgt 1f / yes, branch
|
||||
rts r0 / no, nothing to read; return to caller
|
||||
1: ·
|
||||
mov r1,-(sp) / save 1—number on stack
|
||||
cmp r1,$40. / want to read a special file (1—nodes 1,...,40 are
|
||||
1:
|
||||
mov r1,-(sp) / save i-number on stack
|
||||
cmp r1,$40. / want to read a special file (i-nodes 1,...,40 are
|
||||
/ for special files)
|
||||
ble 1f / yes, branch
|
||||
jmp dskr / no, jmp to dskr; read file with 1.-node number (:1)
|
||||
@@ -31,14 +31,14 @@ read:
|
||||
rcvt / tty0
|
||||
rcvt / tty1
|
||||
rcvt / tty2
|
||||
rcvt / tty3 ‘
|
||||
rcvt / tty3
|
||||
rcvt / tty4
|
||||
rcvt / tty5
|
||||
rcvt / tty6
|
||||
zcvt / ety7
|
||||
rcrd/ crd
|
||||
rtty: / read from console tty
|
||||
mov tty+[8*ntty]—8+6,r5 / r5 is the address of the 4th word of
|
||||
mov tty+[8*ntty]-8+6,r5 / r5 is the address of the 4th word of
|
||||
/ of the control and status block _
|
||||
tst 2(r5) / for the console tty; this word points to the console
|
||||
/ tty bufTer
|
||||
|
||||
@@ -8,7 +8,7 @@ rppt: / read paper tape`
|
||||
/ places
|
||||
br ret / it 1n r1; 1f there 1s no problem with reader, it
|
||||
/ also enables read bit Ln prs
|
||||
jsr rO,passc / place character in users buffer area
|
||||
jsr r0,passc / place character in users buffer area
|
||||
br rppt
|
||||
|
||||
rmem: / transfer characters from memory to a user area of core
|
||||
@@ -17,7 +17,7 @@ rmem: / transfer characters from memory to a user area of core
|
||||
inc *u.fofp / increment file offset to point to 'next' char 1n
|
||||
/ memory file
|
||||
movb (r1),r1 / get character from memory file, put it in r1
|
||||
jsr rO,passc / move this character to the next byte of the
|
||||
jsr r0,passc / move this character to the next byte of the
|
||||
/ users core area
|
||||
br mem / continue
|
||||
1:
|
||||
@@ -26,8 +26,8 @@ rcrd:
|
||||
|
||||
dskr:
|
||||
mov (sp),r1 / i-number in r1
|
||||
jsr r0,iget / get i-node (r1) into i—node section of core
|
||||
mov i.size,r2 / file size ln bytes in r2
|
||||
jsr r0,iget / get i-node (r1) into i-node section of core
|
||||
mov i.size,r2 / file size in bytes in r2
|
||||
sub *u.fofp,r2 / subtract file offset
|
||||
blos ret
|
||||
cmp r2,u.count / are enough bytes left in file to carry out read
|
||||
|
||||
12
pages/e06-03
12
pages/e06-03
@@ -2,22 +2,22 @@
|
||||
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)+,rO / no, do a non—local return to the caller of
|
||||
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 rO
|
||||
ret: / (1) pop the return address off the stack into r0
|
||||
mov (sp)+,r1 / (2) pup the i-number off the stack into r1
|
||||
1 : .
|
||||
clr *$ps / clear processor status
|
||||
rts rO / return to address currently on top of stack
|
||||
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 rO / no, return - no writing to do
|
||||
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?
|
||||
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
|
||||
@@ -35,7 +35,7 @@ writei:
|
||||
wtap / tap5
|
||||
wtap / tap6
|
||||
wtap / tap7
|
||||
xmtt / ttyO
|
||||
xmtt / tty0
|
||||
xmtt / tty1
|
||||
xmtt / tty2
|
||||
xmtt / tty3
|
||||
|
||||
12
pages/e06-04
12
pages/e06-04
@@ -8,8 +8,8 @@
|
||||
jsr r0,startty / attempt to output character on tty
|
||||
br wtty
|
||||
2:
|
||||
mov r1,—(sp) / place character on stack
|
||||
jsr rO,sleep; 1 / put process to sleep
|
||||
mov r1,-(sp) / place character on stack
|
||||
jsr r0,sleep; 1 / put process to sleep
|
||||
mov (sp)+,r1 / remove character from stack
|
||||
br 1b / try again to place character in clist and output
|
||||
|
||||
@@ -30,7 +30,7 @@ wppt:
|
||||
/ br w1pr
|
||||
|
||||
wmem: / transfer characters from a user area of core to memory file
|
||||
jsr rO,cpass / get next character from users area of core and
|
||||
jsr r0,cpass / get next character from users area of core and
|
||||
/ put it in r1
|
||||
mov r1,-(sp) / put character on the stack
|
||||
mov *u.fofp,r1 / save file offset in r1
|
||||
@@ -41,10 +41,10 @@ wmem: / transfer characters from a user area of core to memory file
|
||||
br wmem / continue
|
||||
1:
|
||||
jmp error / ?
|
||||
dskw: / write routine for non—special files
|
||||
dskw: / write routine for non-special files
|
||||
mov (sp),r1 / get an i-node number from the stack into r1
|
||||
jsr r0,iget / write i—node out (if modified), read i-node 'r1'
|
||||
/ into i—node area of core
|
||||
jsr r0,iget / write i-node out (if modified), read i-node 'r1'
|
||||
/ into i-node area of core
|
||||
mov *u.fofp,r2 / put the file offset [(u.off) or the offset in
|
||||
/ the fsp entry for this file] in r2
|
||||
add u.count,r2 / no. of bytes to be written + file offset is
|
||||
|
||||
16
pages/e06-05
16
pages/e06-05
@@ -1,13 +1,13 @@
|
||||
mov r2,i.size / yes, increase the f11e size to file offset +
|
||||
/ no. of data bytes
|
||||
jsr rO,setimod / set imod=1 (1.e., core inode has been
|
||||
jsr r0,setimod / set imod=1 (1.e., core inode has been
|
||||
/ modified), stuff tlme of modiflcatlon into
|
||||
/ core image of i-node
|
||||
1:
|
||||
jsr r0,mget / get the block no. in which to write the next data
|
||||
/ byte
|
||||
bit *u.fofp,$777 / test the lower 9 bits of the file offset
|
||||
bne 2f / if its non-zero, branch; if zero, file offset = O,
|
||||
bne 2f / if its non-zero, branch; if zero, file offset = 0,
|
||||
/ 512, 1024,...(i.e., start of new block)
|
||||
cmp u.count,$512. / if zero, is there enough data to fill an
|
||||
/ entire block? (i.e., no. of
|
||||
@@ -19,8 +19,8 @@
|
||||
/ into an I/O buffer
|
||||
3:
|
||||
jsr r0,wslot / set write and inhibit bits in I/O queue, proc.
|
||||
/ status=O, r5 points to 1st word of data
|
||||
jsr rO,sioreg / r3 = no. of bytes of data, r1 = address of data,
|
||||
/ status=0, r5 points to 1st word of data
|
||||
jsr r0,sioreg / r3 = no. of bytes of data, r1 = address of data,
|
||||
/ r2 points to location in buffer in which to
|
||||
/ start writing data
|
||||
2:
|
||||
@@ -35,21 +35,21 @@
|
||||
cpass: / get next character from user area of core and put it in r1
|
||||
tst u.count / have all the characters been transferred (i.e.,
|
||||
/ u.count, # of chars. left .
|
||||
beg 1f / to be transferred = O?) yes, branch
|
||||
beg 1f / to be transferred = 0?) yes, branch
|
||||
dec u.count / no, decrement u.count
|
||||
movb *u.base,r1 / take the character pointed to by u.base and
|
||||
/ put it ln r1
|
||||
/ put it in r1
|
||||
inc u.nread / increment no. of bytes transferred
|
||||
inc u.base / increment the buffer address to point to the
|
||||
rts r0 / next byte
|
||||
1:
|
||||
mov (sp)+,r0 / put return address of calling routine into r0
|
||||
mov (sp)+,r1 / i.-number in r1
|
||||
rts r0 / non—local return
|
||||
rts r0 / non-local return
|
||||
sioreg:
|
||||
mov *u.fofp,r2 / file offset (in bytes) is moved to r2
|
||||
mov r2,r3 / and also to r3
|
||||
bis $177000,r3 / set bits 9,...,15. of file offset ln r3
|
||||
bis $177000,r3 / set bits 9,...,15. of file offset in r3
|
||||
blc $l777,r2 / calculate file offset mod 512.
|
||||
add r5,r2 / r2 now points to 1st byte in system buffer where
|
||||
/ data is to be placed
|
||||
|
||||
@@ -42,7 +42,7 @@ starxmt:
|
||||
movb tty+3(r2),0f / yes, make byte 4 arg of "getc"
|
||||
inc 0f / increment arg to make it tty output list of
|
||||
/ clist
|
||||
jsr r0,getc; 0:.. / obtain next character ln clist for tty
|
||||
jsr r0,getc; 0:.. / obtain next character in clist for tty
|
||||
/ out and place in r1
|
||||
br 1f / if no entry in clist to be output, return to
|
||||
/ calling routine
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
/ (character leftover after "lf" )
|
||||
2:
|
||||
movb (r2),r3 / place present column count in r3
|
||||
beq 1f / return to calling routlne if count = 0
|
||||
beq 1f / return to calling routine if count = 0
|
||||
clrb (r2) / col clear column count
|
||||
asr r3
|
||||
asr r3
|
||||
|
||||
Reference in New Issue
Block a user