This is the beginnings of a alternative version of the PDP-7 Unix

system which corresponds to a later development point, around mid-1971,
where the system had lost the "dd" directory and gained . and ..
entries. This is close to the system as described in
http://www.tuhs.org/Archive/PDP-11/Distributions/research/McIlroy_v0/UnixEditionZero.txt
except there are no pathnames.

To use this version: cd build; make alt; make altrun
This commit is contained in:
Warren Toomey
2016-03-21 14:28:50 +10:00
parent 098c8a9e28
commit f63ad33d10
9 changed files with 183 additions and 11 deletions
+8 -2
View File
@@ -124,8 +124,12 @@ login:
2:
lac nchar
sys setuid " Set the user's user-id
sys chdir; dd " and change into the "dd" directory
sys chdir; dir
#ifdef NO_DD
sys chdir; dotdot " Change into the root directory (out of system)
#else
sys chdir; dd " Change into the "dd" directory
#endif
sys chdir; dir " and then the user's home directory
lac d2 " Close file descriptor 2
sys close
@@ -249,6 +253,8 @@ m3:
m3s = .-m3
dd:
<dd>;040040;040040;040040
dotdot:
<..>;040040;040040;040040
dir:
040040;040040;040040;040040
+41
View File
@@ -0,0 +1,41 @@
" Alternative chrm: chrm file [file file ...]
"
" Unlink the named files
lac 017777 " Go to the argc
tad d1 " Skip past the argc
dac 2f " Save pointing at cmd name, we will skip later
lac 017777 i " How many arguments do we have?
sad d4
sys exit " None, so exit
tad dm4 " Subtract 1
dac 017777 i " and save in the argc
1:
lac 017777 i " Any arguments left?
sna
sys exit " No, exit the program
tad dm4 " Subtract 4 from the argc and update it
dac 017777 i
lac 2f " Move up to the next filename
tad d4
dac 2f " and save it in the unlink arg
sys unlink; 2:0 " Unlink the file
sma
jmp 1b " Loop back if the unlink was OK, or issue err
lac 2b " Copy the filename pointer below
dac 2f
lac d1 " Write the filename on stdout
sys write; 2:0; 4
lac d1
sys write; 1f; 2 " Write " ?\n" on stdout
jmp 1b " and loop back
1:
040077;012000 " String literal " ?\n"
dd:
<dd>;040040;040040;040040 " Filename dd
d1: 1
d4: 4
d5: 5
dm4: -4
+6
View File
@@ -23,7 +23,9 @@ argloop:
jmp setlong
lac argptr " It wasn't -l, so save it as the dir to open
#ifndef NO_DD
dac 8f
#endif
dac 9f
skp
@@ -79,7 +81,11 @@ entryloop:
lac bufptr
dac statfile " Copy the pointer to the status call
lac statbufptr " Get the file's details into the statbuf
#ifdef NO_DD
sys status; statfile:0
#else
sys status; 8:curdir; statfile:0
#endif
spa
jms fileend
+11
View File
@@ -4,7 +4,13 @@
" file status (stat) system call
" AC/ pointer to status (inode) buffer + i-num (13 words)
" sys status; dir_name_ptr; file_name_ptr
" NO_DD version: sys status; file_name_ptr
.status:
#ifdef NO_DD
jms arg " fetch file name pointer
dac .+3
lac u.cdir " get current working directory
#else
jms arg " fetch directory name pointer
dac .+5
jms arg " fetch file name pointer
@@ -12,6 +18,7 @@
lac u.cdir " get current working directory
jms namei; .. " look up source directory
jms error " not found: return error to user
#endif
jms namei; .. " look up file
jms error " not found: return error
jms iget " read file inode
@@ -103,7 +110,11 @@
dac 1f
jms arg
dac 2f
#ifdef NO_DD
lac u.cdir " Search the current directory
#else
lac d4 " Search the directory at i-num 4
#endif
jms namei; 0:0 " for the first argument
jms error " Didn't find it
jms namei; 1:0 " In the i-num found by 1st namei,