mirror of
https://github.com/DoctorWkt/pdp7-unix.git
synced 2026-01-27 12:42:28 +00:00
49 lines
1.8 KiB
Plaintext
49 lines
1.8 KiB
Plaintext
010000: 020003 sys open; curdir; 0 " Open up the currect directory
|
|
010001: 010046
|
|
010002: 000000
|
|
010003: 741100 spa
|
|
010004: 020016 sys exit " Unable, so die now
|
|
010005: 050053 dac fd " Save the fd
|
|
010006: 210053 lac fd
|
|
010007: 020004 sys read; buf; 64
|
|
010010: 010060
|
|
010011: 000100
|
|
010012: 741100 spa " Skip if result was >= 0
|
|
010013: 610043 jmp fileend " Result was -ve, so error result
|
|
010014: 741200 sna " Skip if result was >0
|
|
010015: 610043 jmp fileend " Result was zero, so nothing left to read
|
|
010016: 050056 dac count
|
|
010017: 210057 lac ibufptr " Point bufptr at the base of the buffer
|
|
010020: 050024 dac bufptr
|
|
010021: 450024 isz bufptr " Move up to the filename
|
|
010022: 210054 lac d1
|
|
010023: 020005 sys write; bufptr:0; 4 " Write a filename out to stdout
|
|
010024: 000000
|
|
010025: 000004
|
|
010026: 210054 lac d1
|
|
010027: 020005 sys write; newline; 1 " followed by a newline
|
|
010030: 010052
|
|
010031: 000001
|
|
010032: 210024 lac bufptr " Add 7 to the bufptr
|
|
010033: 350055 tad d7
|
|
010034: 050024 dac bufptr
|
|
010035: 777770 -8
|
|
010036: 350056 tad count " Decrement the count of words by 8
|
|
010037: 050056 dac count
|
|
010040: 740200 sza " Anything left in the buffer to print?
|
|
010041: 610021 jmp printloop " Yes, stuff left to print
|
|
010042: 610006 jmp fileloop " Nothing in the buffer, try reading some more
|
|
010043: 210053 lac fd
|
|
010044: 020011 sys close
|
|
010045: 020016 sys exit
|
|
010046: 056040 curdir: <. 040; 040040; 040040; 040040 " i.e. "."
|
|
010047: 040040
|
|
010050: 040040
|
|
010051: 040040
|
|
010052: 012000 newline: 012000
|
|
010053: 000000 fd: 0
|
|
010054: 000001 d1: 1 " stdout fd
|
|
010055: 000007 d7: 7
|
|
010056: 000000 count: 0
|
|
010057: 010060 ibufptr: buf " Constant pointer to the buffer
|