mirror of
https://github.com/DoctorWkt/pdp7-unix.git
synced 2026-04-28 04:54:51 +00:00
Merge branch 'master' of https://github.com/DoctorWkt/pdp7-unix
This commit is contained in:
@@ -68,7 +68,7 @@
|
|||||||
lac f.flags
|
lac f.flags
|
||||||
and d1
|
and d1
|
||||||
sna
|
sna
|
||||||
jms 1f
|
jmp 1f
|
||||||
lacq
|
lacq
|
||||||
jms betwen; d0; i.size
|
jms betwen; d0; i.size
|
||||||
jms dacisize
|
jms dacisize
|
||||||
|
|||||||
@@ -36,7 +36,17 @@ maxargs=10
|
|||||||
|
|
||||||
lac d1
|
lac d1
|
||||||
sys intrp " make shell uninterruptable
|
sys intrp " make shell uninterruptable
|
||||||
sys getuid
|
|
||||||
|
" see if reading from a special file
|
||||||
|
cla; sys seek; 1; 0 " try seeking stdin forward
|
||||||
|
sna " new offset non-zero?
|
||||||
|
jmp 1f " no: input is a special file (ttyin,keyboard)
|
||||||
|
dzm prompt " yes: regular file, kill prompt
|
||||||
|
cla; sys seek; 0; 0 " seek file back to start
|
||||||
|
jmp newline
|
||||||
|
|
||||||
|
" stdin is a special file, see if superuser
|
||||||
|
1: sys getuid
|
||||||
sma " <0?
|
sma " <0?
|
||||||
jmp newline " no
|
jmp newline " no
|
||||||
lac hash " yes: superuser
|
lac hash " yes: superuser
|
||||||
|
|||||||
46
src/sys/s2.s
46
src/sys/s2.s
@@ -65,36 +65,36 @@
|
|||||||
jmp sysexit
|
jmp sysexit
|
||||||
|
|
||||||
.seek:
|
.seek:
|
||||||
jms seektell
|
jms seektell " fetch offset & whence (return seek base)
|
||||||
tad u.base
|
tad u.base " add offset
|
||||||
"** 01-s1.pdf page 8
|
"** 01-s1.pdf page 8
|
||||||
spa
|
spa " positive?
|
||||||
jms error
|
jms error " no: error
|
||||||
lmq
|
lmq " save position in MQ
|
||||||
lac f.flags
|
lac f.flags " get file flags
|
||||||
and d1
|
and d1 " get write bit
|
||||||
sna
|
sna " open for write?
|
||||||
jms 1f
|
jmp 1f " no
|
||||||
lacq
|
lacq " yes: get position
|
||||||
jms betwen; d0; i.size
|
jms betwen; d0; i.size " between zero and size?
|
||||||
jms dacisize
|
jms dacisize " no: store new size
|
||||||
jmp 2f
|
jmp 2f
|
||||||
1:
|
1:
|
||||||
lacq
|
lacq " reading: get position
|
||||||
jms betwen; d0; i.size
|
jms betwen; d0; i.size " between zero and size?
|
||||||
lac i.size
|
lac i.size " no: get current size
|
||||||
2:
|
2:
|
||||||
dac f.badd
|
dac f.badd " save as offset
|
||||||
dac u.ac
|
dac u.ac " return in AC
|
||||||
jms fput
|
jms fput " copy fnode back to user area
|
||||||
jmp sysexit
|
jmp sysexit " return to user
|
||||||
|
|
||||||
.tell:
|
.tell:
|
||||||
jms seektell
|
jms seektell " fetch offset & whence (return seek base)
|
||||||
cma
|
cma
|
||||||
tad d1
|
tad d1 " negate base
|
||||||
tad u.base
|
tad u.base " add to user offset
|
||||||
dac u.ac
|
dac u.ac " return in user AC
|
||||||
jmp sysexit
|
jmp sysexit
|
||||||
|
|
||||||
.link:
|
.link:
|
||||||
|
|||||||
23
src/sys/s5.s
23
src/sys/s5.s
@@ -278,20 +278,21 @@ argname: 0
|
|||||||
jms error " failed: return error directly to user
|
jms error " failed: return error directly to user
|
||||||
jmp argname i
|
jmp argname i
|
||||||
|
|
||||||
|
" common code for seek/tell system calls
|
||||||
seektell: 0
|
seektell: 0
|
||||||
jms arg
|
jms arg " fetch 1st arg after sys
|
||||||
dac u.base
|
dac u.base " save in u.base
|
||||||
|
|
||||||
"** 01-s1.pdf page 32
|
"** 01-s1.pdf page 32
|
||||||
jms arg
|
jms arg " fetch 2nd arg (whence??)
|
||||||
dac u.limit
|
dac u.limit " save in u.limit
|
||||||
jms finac
|
jms finac " fetch fnode & inode for fd in AC
|
||||||
lac u.limit
|
lac u.limit " get whence arg back
|
||||||
sna
|
sna " zero?
|
||||||
jmp seektell i
|
jmp seektell i " yes, return zero (relative to start)
|
||||||
sad d1
|
sad d1 " one?
|
||||||
jmp .+3
|
jmp .+3 " yes: return pos (relative to current)
|
||||||
lac i.size
|
lac i.size " no: return file size (relative to end)
|
||||||
jmp seektell i
|
jmp seektell i
|
||||||
lac f.badd
|
lac f.badd
|
||||||
jmp seektell i
|
jmp seektell i
|
||||||
|
|||||||
Reference in New Issue
Block a user