a7 is updated with Phil's stdin reading patch. I've written a few more
utilities and modified the v1 man pages for them. Fixed a typo (missing line) in src/cmd/as.s.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
" Warren's version of mv. mv file1 file2
|
||||
|
||||
main:
|
||||
|
||||
lac 017777 i " Load the pointer pointer in 017777
|
||||
sad d8 " to see if we have two
|
||||
jmp nofiles " No arguments, stop now
|
||||
lac 017777 " Move five words past the argument word count
|
||||
tad d5 " so that AC points at the first argument
|
||||
dac name1 " and save it
|
||||
tad d4 " Then do the same for the second name
|
||||
dac name2
|
||||
|
||||
sys rename; name1:0; name2:0 " Rename the file
|
||||
spa
|
||||
jmp badfile " Print out an error on failure
|
||||
sys exit
|
||||
|
||||
|
||||
nofiles:
|
||||
lac d8
|
||||
sys write; 1f; 5 " Write "No files\n" to stderr
|
||||
sys exit " and exit
|
||||
|
||||
1: <tw>; <o 040; <fi>;<le>;<s 012
|
||||
|
||||
badfile:
|
||||
lac name1 " Get the pointer to the filename
|
||||
dac 1f " Store it in 1f below
|
||||
lac d8 " Load fd 8 which is stderr
|
||||
sys write; 1:0; 4 " Write the four words of the filename
|
||||
lac d8
|
||||
sys write; 1f; 2 " and then write " ?\n"
|
||||
sys exit
|
||||
|
||||
1: 040;077012 " String literal: " ?\n"
|
||||
|
||||
d1: 1
|
||||
d4: 4
|
||||
d5: 5
|
||||
d8: 8
|
||||
Reference in New Issue
Block a user