1
0
mirror of https://github.com/livingcomputermuseum/pdp7-unix.git synced 2026-02-11 18:55:18 +00:00
Files
livingcomputermuseum.pdp7-unix/bin/chrm
2016-03-04 13:41:16 +10:00

47 lines
1.8 KiB
Plaintext

010000: 217777 lac 017777 " Go to the argc
010001: 350054 tad d5 " Skip past the argc and argv[0]
010002: 050014 dac 1f " Save argv[1] in the chdir arg below
010003: 050026 dac 2f " and in the unlink as well? Yes, we skip it
010004: 237777 lac 017777 i " How many arguments do we have?
010005: 550053 sad d4
010006: 020016 sys exit " None, so exit
010007: 350055 tad dm4 " Subtract 1
010010: 077777 dac 017777 i " and save in the argc
010011: 020021 sys chdir; dd " chdir to dd
010012: 010046
010013: 020021 sys chdir; 1:0 " and then into the first argument
010014: 000000
010015: 237777 lac 017777 i " Any arguments left?
010016: 550053 sad d4
010017: 020016 sys exit " No, exit the program
010020: 350055 tad dm4 " Subtract 4 from the argc and update it
010021: 077777 dac 017777 i
010022: 210026 lac 2f " Move up to the next filename
010023: 350053 tad d4
010024: 050026 dac 2f " and save it in the unlink arg
010025: 020013 sys unlink; 2:0 " Unlink the file
010026: 000000
010027: 740100 sma
010030: 610015 jmp 1b " Loop back if the unlink was OK, or issue err
010031: 210026 lac 2b " Copy the filename pointer below
010032: 050035 dac 2f
010033: 210052 lac d1 " Write the filename on stdout
010034: 020005 sys write; 2:0; 4
010035: 000000
010036: 000004
010037: 210052 lac d1
010040: 020005 sys write; 1f; 2 " Write " ?\n" on stdout
010041: 010044
010042: 000002
010043: 610015 jmp 1b " and loop back
010044: 040077 040077;012000 " String literal " ?\n"
010045: 012000
010046: 144144 <dd>;040040;040040;040040 " Filename dd
010047: 040040
010050: 040040
010051: 040040
010052: 000001 d1: 1
010053: 000004 d4: 4
010054: 000005 d5: 5
010055: 777774 dm4: -4