I've restructured the alternative version of PDP-7 Unix so that the

source code is now in src/alt. All the files in src/sys and src/cmd
are only annotated versions of the files in scans/.
The build/Makefile has been updated so that it can build the
original PDP-7 Unix or the alternative version.
Phil has fixed the Graphics-2 code, so that there is no need to
have any #ifdef code in the original kernel.
This commit is contained in:
Warren Toomey
2016-03-21 16:01:36 +10:00
parent f63ad33d10
commit 94fd5d49e0
9 changed files with 22 additions and 162 deletions
+20 -19
View File
@@ -11,6 +11,7 @@ PDP7=pdp7
# source dirs # source dirs
SYSSRC=../src/sys SYSSRC=../src/sys
CMDSRC=../src/cmd CMDSRC=../src/cmd
ALTSRC=../src/alt
OTHERSRC=../src/other OTHERSRC=../src/other
TESTSRC=../src/tests TESTSRC=../src/tests
@@ -23,16 +24,16 @@ BINARIES=../binaries/
all: cmd others a.rim image.fs copybinaries all: cmd others a.rim image.fs copybinaries
# Make alternative everything: no dd but . and .. # Make alternative everything: no dd but . and ..
alt: altcmd altothers alta.rim altimage.fs alt: altcmd altothers alt/a.rim alt/image.fs
# The run rule has no dependencies so that the system can be booted easily # The run rule has no dependencies so that the system can be booted easily
# and frequently with make run. However, you have to manually make all first! # and frequently with make run. However, you have to manually make all first!
run: run:
$(PDP7) unixv0.simh $(PDP7) unixv0.simh
# Alternative run, use the altimage.fs # Alternative run, use the alt/image.fs
altrun: altrun:
$(PDP7) altunixv0.simh $(PDP7) alt/unixv0.simh
# Warm boot Unix kernel: boots into init and a login prompt # Warm boot Unix kernel: boots into init and a login prompt
a.rim: a.rim:
@@ -40,10 +41,11 @@ a.rim:
$(AS) -n -f list -o a.lst $(SYSSRC)/sop.s $(SYSSRC)/s[1-8].s $(AS) -n -f list -o a.lst $(SYSSRC)/sop.s $(SYSSRC)/s[1-8].s
# Alternative kernel: no dd, but . and .. # Alternative kernel: no dd, but . and ..
alta.rim: alt/a.rim:
$(AS) -f rim -o alta.rim -DNO_DD $(SYSSRC)/sop.s $(SYSSRC)/s[1-8].s $(AS) -f rim -o alt/a.rim $(SYSSRC)/sop.s $(SYSSRC)/s1.s \
$(AS) -n -f list -o alta.lst -DNO_DD $(SYSSRC)/sop.s $(SYSSRC)/s[1-8].s $(ALTSRC)/s2.s $(SYSSRC)/s[3-8].s
$(AS) -n -f list -o alt/a.lst $(SYSSRC)/sop.s $(SYSSRC)/s1.s \
$(ALTSRC)/s2.s $(SYSSRC)/s[3-8].s
# Cold boot Unix kernel: attempts to build a minimal filesystem. # Cold boot Unix kernel: attempts to build a minimal filesystem.
# Don't use this one! # Don't use this one!
@@ -57,9 +59,9 @@ image.fs: cmd others
$(FSCK) image.fs $(FSCK) image.fs
# Alternate filesystem image: . and .. but no dd # Alternate filesystem image: . and .. but no dd
altimage.fs: altcmd altothers alt/image.fs: altcmd altothers
$(MKFS) -1 -2 -3 -o altimage.fs altproto $(MKFS) -1 -2 -3 -o alt/image.fs alt/proto
$(FSCK) -3 altimage.fs $(FSCK) -3 alt/image.fs
copybinaries: copybinaries:
@@ -68,9 +70,8 @@ copybinaries:
cp a.rim $(BINARIES) cp a.rim $(BINARIES)
clean: clean:
rm -f a.rim image.fs a.lst n.out altimage.fs alta.rim alta.lst rm -f a.rim image.fs a.lst n.out alt/image.fs alt/a.rim alt/a.lst
rm -rf $(BINDIR) rm -rf $(BINDIR) $(TESTDIR)
rm -rf $(TESTDIR)
rm -rf $(BINARIES) rm -rf $(BINARIES)
dirs: dirs:
@@ -83,8 +84,8 @@ cmd: dirs $(BINDIR)/as $(BINDIR)/cat $(BINDIR)/check $(BINDIR)/chmod \
# Alternate commands: no dd, but . and .. # Alternate commands: no dd, but . and ..
altcmd: dirs $(BINDIR)/as $(BINDIR)/cat $(BINDIR)/check $(BINDIR)/chmod \ altcmd: dirs $(BINDIR)/as $(BINDIR)/cat $(BINDIR)/check $(BINDIR)/chmod \
$(BINDIR)/chown $(BINDIR)/altchrm $(BINDIR)/cp $(BINDIR)/ds $(BINDIR)/ed \ $(BINDIR)/chown $(BINDIR)/altchrm $(BINDIR)/cp $(BINDIR)/ds \
$(BINDIR)/altinit $(BINDIR)/ed $(BINDIR)/altinit
$(BINDIR)/as: $(CMDSRC)/as.s $(BINDIR)/as: $(CMDSRC)/as.s
$(AS) $(ASARGS) -o $(BINDIR)/as $(CMDSRC)/as.s $(AS) $(ASARGS) -o $(BINDIR)/as $(CMDSRC)/as.s
@@ -104,8 +105,8 @@ $(BINDIR)/chown: $(CMDSRC)/chown.s
$(BINDIR)/chrm: $(CMDSRC)/chrm.s $(BINDIR)/chrm: $(CMDSRC)/chrm.s
$(AS) $(ASARGS) -o $(BINDIR)/chrm $(CMDSRC)/chrm.s $(AS) $(ASARGS) -o $(BINDIR)/chrm $(CMDSRC)/chrm.s
$(BINDIR)/altchrm: $(OTHERSRC)/wktchrm.s $(BINDIR)/altchrm: $(ALTSRC)/chrm.s
$(AS) $(ASARGS) -o $(BINDIR)/altchrm -DNO_DD $(OTHERSRC)/wktchrm.s $(AS) $(ASARGS) -o $(BINDIR)/altchrm $(ALTSRC)/chrm.s
$(BINDIR)/cp: $(CMDSRC)/cp.s $(BINDIR)/cp: $(CMDSRC)/cp.s
$(AS) $(ASARGS) -o $(BINDIR)/cp $(CMDSRC)/cp.s $(AS) $(ASARGS) -o $(BINDIR)/cp $(CMDSRC)/cp.s
@@ -120,8 +121,8 @@ $(BINDIR)/init: $(CMDSRC)/init.s
$(AS) $(ASARGS) -o $(BINDIR)/init $(CMDSRC)/init.s $(AS) $(ASARGS) -o $(BINDIR)/init $(CMDSRC)/init.s
# Alternative init: no dd directory # Alternative init: no dd directory
$(BINDIR)/altinit: $(CMDSRC)/init.s $(BINDIR)/altinit: $(ALTSRC)/init.s
$(AS) $(ASARGS) -DNO_DD -o $(BINDIR)/altinit $(CMDSRC)/init.s $(AS) $(ASARGS) -o $(BINDIR)/altinit $(ALTSRC)/init.s
# The commands that did not come from the scans # The commands that did not come from the scans
others: dirs $(BINDIR)/sh $(BINDIR)/wktcat $(BINDIR)/wktcp $(BINDIR)/date \ others: dirs $(BINDIR)/sh $(BINDIR)/wktcat $(BINDIR)/wktcp $(BINDIR)/date \
View File
@@ -5,8 +5,8 @@ show cpu
set tti unix set tti unix
set rb ena set rb ena
att rb altimage.fs att rb alt/image.fs
show dev show dev
load -S alta.rim load -S alt/a.rim
dep pc 0100 dep pc 0100
-6
View File
@@ -124,11 +124,7 @@ login:
2: 2:
lac nchar lac nchar
sys setuid " Set the user's user-id sys setuid " Set the user's user-id
#ifdef NO_DD
sys chdir; dotdot " Change into the root directory (out of system)
#else
sys chdir; dd " Change into the "dd" directory sys chdir; dd " Change into the "dd" directory
#endif
sys chdir; dir " and then the user's home directory sys chdir; dir " and then the user's home directory
lac d2 " Close file descriptor 2 lac d2 " Close file descriptor 2
@@ -253,8 +249,6 @@ m3:
m3s = .-m3 m3s = .-m3
dd: dd:
<dd>;040040;040040;040040 <dd>;040040;040040;040040
dotdot:
<..>;040040;040040;040040
dir: dir:
040040;040040;040040;040040 040040;040040;040040;040040
-8
View File
@@ -1,8 +0,0 @@
#Readme
This area is a place to write and try out kernel-mode test code. We can
try out drivers, test the disk routines etc. The idea is to bring pieces
of the real kernel in, test them, and keep incorporating stuff until we
reach a working kernel.
List filenames and comments here.
-71
View File
@@ -1,71 +0,0 @@
" Code to test the teleprinter output. Some code borrowed from s7.s
iof = 0700002 " PIC: interrupts off
ion = 0700042 " PIC: interrupts on
tsf = 0700401 " TTY: skip if flag set
tcf = 0700402 " TTY: clear flag
tls = 0700406 " TTY: load buffer, select
. = 020
iof " Interrupts off, do we need this?
1: tsf " Is the teleprinter ready to print?
jmp 1b " No, loop back
tcf " Clear the ready flag
jms ttyrestart " Print out a character
hlt " and halt for now
ttyrestart: 0
lac ttydelay " Is the ttydelay positive?
spa
jmp ttyrestart i " Yes, can't print the character yet
lac nttychar
dzm nttychar
sza
jmp 3f
isz ttydelay " Increment the tty delay towards zero
lac d2 " Why 2?
jms getchar " Get a character to print
jmp 2f " Why the jump, does getchar skip? Yes if no char
3:
tls " Send the character to the teleprinter
sad o12
jms putcr " It's a newline, also send a CR?
sad o15
skp " It was CR, so now insert a delay
jmp ttyrestart i " Not CR, so return from the routine
lac ttydelay " Add 020 to the ttydelay
tad o20
rcr " Rotate right once
cma " Invert the AC
dac ttydelay " and save back in ttydelay
jmp ttyrestart i " Now return from the routine
2:
" lac sfiles+1
" jms wakeup
" dac sfiles+1
jmp ttyrestart i " Now return from the routine
getchar: 0
lac d65 " For now, return ASCII A
isz getchar
jmp i getchar
putcr: 0
lac o15
dac nttychar
cla
jmp putcr i
d2: 2
d65: 64
o12: 012
o15: 015
o20: 020
ttydelay: 0
nttychar: .=.+1
-41
View File
@@ -1,41 +0,0 @@
" 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
-10
View File
@@ -6,11 +6,6 @@
" sys status; dir_name_ptr; file_name_ptr " sys status; dir_name_ptr; file_name_ptr
" NO_DD version: sys status; file_name_ptr " NO_DD version: sys status; file_name_ptr
.status: .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 jms arg " fetch directory name pointer
dac .+5 dac .+5
jms arg " fetch file name pointer jms arg " fetch file name pointer
@@ -18,7 +13,6 @@
lac u.cdir " get current working directory lac u.cdir " get current working directory
jms namei; .. " look up source directory jms namei; .. " look up source directory
jms error " not found: return error to user jms error " not found: return error to user
#endif
jms namei; .. " look up file jms namei; .. " look up file
jms error " not found: return error jms error " not found: return error
jms iget " read file inode jms iget " read file inode
@@ -110,11 +104,7 @@
dac 1f dac 1f
jms arg jms arg
dac 2f dac 2f
#ifdef NO_DD
lac u.cdir " Search the current directory
#else
lac d4 " Search the directory at i-num 4 lac d4 " Search the directory at i-num 4
#endif
jms namei; 0:0 " for the first argument jms namei; 0:0 " for the first argument
jms error " Didn't find it jms error " Didn't find it
jms namei; 1:0 " In the i-num found by 1st namei, jms namei; 1:0 " In the i-num found by 1st namei,
-5
View File
@@ -4,8 +4,6 @@
pibreak: " priority interrupt break processing "chain" pibreak: " priority interrupt break processing "chain"
dac .ac " save interrupt AC dac .ac " save interrupt AC
"** CROSSED OUT.... "** CROSSED OUT....
#ifdef GRAPHICS2
dpsf dpsf
jmp 1f " disable the Graphics-2 I/O jmp 1f " disable the Graphics-2 I/O
@@ -26,7 +24,6 @@ pibreak: " priority interrupt break processing "chain"
-1 -1
dac dpwrite dac dpwrite
jmp piret "** END OF CROSSOUT jmp piret "** END OF CROSSOUT
#endif
1: clsf " clock overflow (line frequency ticks)? 1: clsf " clock overflow (line frequency ticks)?
jmp 1f " no jmp 1f " no
@@ -90,7 +87,6 @@ cnop: " fetched as constant in iread
dac .dspb dac .dspb
jmp piret jmp piret
dsprestart: dsprestart:
#ifdef GRAPHICS2
lac d1 lac d1
dac .dspb " set .dsbp = 1 dac .dspb " set .dsbp = 1
lac dspbufp " load display buf pointer lac dspbufp " load display buf pointer
@@ -109,7 +105,6 @@ dsprestart:
dac .lpba " save dac .lpba " save
rlpd " G-2: resume after light pen stop rlpd " G-2: resume after light pen stop
jmp piret jmp piret
#endif
1: ksf " (TTY) keyboard flag set? 1: ksf " (TTY) keyboard flag set?
jmp 1f " no jmp 1f " no