1
0
mirror of https://github.com/livingcomputermuseum/pdp7-unix.git synced 2026-04-19 17:23:17 +00:00

finish s1.s; tried to clean up s5-s8; let as7 continue after error

This commit is contained in:
Phil Budne
2016-02-25 20:58:17 -05:00
parent 0b0ea2e637
commit 2cca3d4473
9 changed files with 206 additions and 89 deletions

4
scans/Makefile Normal file
View File

@@ -0,0 +1,4 @@
AS7=../tools/as7 -d
system:
$(AS7) s?.s > output

View File

@@ -6,5 +6,12 @@ For modified versions of these files, look in src/cmds and src/sys.
Details of the files:
s1.s: pages 2-3 of 01-s1.pdf, incomplete and with some cruft at the end
s1.s: pages 2-5 of 01-s1.pdf, incomplete
s2.s: pages 7-
s3.s: pages 14-
s4.s: pages 21-
s5.s: pages 28-
s6.s: pages 34-
sx.s: temp symbol defns (from end of s1.s)
cat.c: pages 21-23 of 06-5-12.pdf

View File

@@ -102,31 +102,94 @@ swap: 0
dac u.ulistp i
ion
jmp dskswap; 07000
lac u.dspbuf
sna
jmp 2f
law dspbuf
jms movdsp
2:
iof
lac o600000
tad 9f+t i
dac 9f+t i
ion
jms dskswap; 06000
lac u.swapret
dac swap
lac o20
dac maxquant
lac u.dspbuf
sza
"** 01-s1.pdf page 4
jms movdsp
3:
dzm uquant
iof
jmp swap i
t = t+1
" For now, this stuff is defined so that
" the assembler doesn't complain about it
swp:
jmp .
.save; .getuid; .open; .read; .write; .creat; .seek; .tell
.close; .link; .unlink; .setuid; .rename; .exit; .time; .intrp
.chdir; .chmod; .chown; badcal; .sysloc; badcal; .capt; .rele
.status; badcal; .sems; .rmes; .fork
swn:
.-swp-1 i
.intrp:
lac u.ac
dac u.intflg
jmp okexit
.sysloc:
lac u.ac
and o1777
jms betwen; d1; locn
jms error
tad locsw
dac .+1
lac ..
dac u.ac
jmp sysexit
locsw:
lac .
iget; inode; userdata; sysdata; copy; copyz; betwen; dskrd
dskwr; dskbuf; dpdata; namei; pbsflgs; alloc; free; dspdata
crdata
locn:
.-locsw-1
pibreak: 23
u.ac: 100
u.mq: 3
u.rq: 3
copy: 7
.savblk: 0
.insys: 0
uquant: 0
betwen: 0
maxquant: 0
laci: 0
swp: 0
badcal: 0
coldentry: 0
halt: 0
dskio: 0
sysdata: 0
dskbuf: 0
o7000: 07000
o20001: 020001
chkint: 0
.save: 0
lookfor: 0
lac .insys
sza
jmp chkint i
lac .int1
sna
jmp 1f
sad u.ofiles+2
jmp 2f
1:
lac .int2
sna
jmp chkint i
sad chkint i
sad u.ofiles+2
skp
jmp chkint i
dzm .int2
jmp 1f
2:
dzm .int1
1:
"** 01-s1.pdf page 5
lac u.intflg
sza
jmp chkint i
-1
dac .insys
ion
isz chkint
jmp chkint i

View File

@@ -2,15 +2,15 @@
" s5
dskswap: 0
cli; ais 3
cll; als 3
dac 9f+t
jms dsktrans; -64; userdata; 9f+t; dskswap
lac 0f+t
lac 9f+t
tad o20
dac 9f+t
jms dsktrans; -4096; 4096; 9f+t; dekswap
isc dskswap
jmp dskswap
jms dsktrans; -4096; 4096; 9f+t; dskswap
isz dskswap
jmp dskswap i
t = t+1
@@ -21,7 +21,7 @@ access: 0
spa
jmp access i
sad i.uid
ird 2
lrs 2
lacq
and mode
sza
@@ -60,8 +60,8 @@ t = t+1
fget: 0
jms betwen; d0; d9
jmp fget i
cli; mul; 3
iacq "** ??
cll; mul; 3
lacq
"** 01-s1.pdf page 29
tad ofilesp
@@ -83,14 +83,14 @@ forall: 0
sad u.limit
jmp 1f
lac u.base
rai
ral
lac u.base i
sni
snl
lrs 9
and o777
jmp forall i
1:
lac u.ount
lac u.count
dac u.ac
jmp sysexit
@@ -157,7 +157,7 @@ icreat: 0
lac u.uid
dac u.uid
-1
dac i.niks
dac i.nlks
dzm i.size
jms copyz; i.dskps; 7
jms iput
@@ -171,9 +171,9 @@ dspput: 0
jmp i dspput
sad o14
jmp 1f
img "** ???
lmq
sad o12
jmp dspni
jmp dspnl
lac dsploc i
sad o400000
jmp dspleft
@@ -195,19 +195,19 @@ dspleft:
dac 8
lac o400000
dac 8 i
cla; liss 18+7
cla; llss 18+7
dac dsploc i
jmp dspput i
dspni: 0
lac dspino
dspnl: 0
lac dsplno
sad d33
jmp 1f
isz dspino
jmp dspni i
isz dsplno
jmp dspnl i
1:
lac o2000
wbi
wbi "** ??
isz dspput
jmp dspput i
@@ -216,12 +216,12 @@ dspinit: 0
dac dsploc
lac o300000
dac dspbuf+3
dzm dspino
dzm dsplno
jmp dspinit i
movdsp: 0
iof
cdf
caf
dac dspbufp
-1
dac .dspb
@@ -237,7 +237,7 @@ argname: 0
jms arg
dac .+2
jms copy; ..; name; 4
lac u.edir
lac u.cdir
jms namei; name
jms error
jmp argname i

View File

@@ -37,7 +37,7 @@ itrunc: 0
jmp 1b
lac i.flags
and o577777
dac i.flacs
dac i.flags
jmp itrunc i
t = t+4
@@ -54,7 +54,7 @@ namei: 0
-8
tad i.size
cma
irss 3
lrss 3
dac 9f+t
sna
jmp namei i
@@ -94,13 +94,13 @@ t = t+2
iget: 0
dac ii
cli; idiv; 5
cll; idiv; 5
dac 9f+t
tad d2
dac 9f+i+1
jms dskrd
lac 9f+t
cli; mul; 12
cll; mul; 12
lacq
tad dskbufp
dac 9f+t
@@ -151,14 +151,14 @@ dget: 0
alss 3
dac 9f+t
jms pget
fac 9f+t+1
dac 9f+t+1
jms dskrd
lac 9f+t
and o77
tad dskbufp
dac 9f+t+2
dac .+2
jms copy; ..; dnode; 8
jms copy; ..; inode; 8
lac 9f+t
tad d8
jms betwen; d0; i.size
@@ -173,7 +173,7 @@ dput: 0
jms dskrd
lac 9f+t+2
dac .+3
jms copy; dnode; ..; 8
jms copy; inode; ..; 8
lac 9f+t+1
jms dskwr
jmp dput i
@@ -181,11 +181,11 @@ dput: 0
t = t+3 "** first t not there (hole from hole punch?)
pget: 0
irss 6
lrss 6
dac 9f+t
lac i.flags
"** 01-s1.pdf page 36
"** 01-s1.pdf page 37
and o200000
sza
@@ -193,7 +193,7 @@ pget: 0
lac 9f+t
jms betwen; d0; d6
jmp 1f
rad idskpp
tad idskpp
dac 9f+t
lac 9f+t i
sna
@@ -203,8 +203,8 @@ pget: 0
1:
jms alloc
dac 9f+t+1
jms copy; idskps; dskbuf; 7
jms copyz; dskbuf+7; 6467 "** NUMBER UNCLEAR 64-7???
jms copy; i.dskps; dskbuf; 7
jms copyz; dskbuf+7; 64-7 "** NUMBER UNCLEAR
lac 9f+t+1
jms dskwr
lac 9f+t+1
@@ -247,8 +247,8 @@ iwrite: 0
"** 01-s1.pdf page 38
dac oread
lac cslp
dac iread
lac cskp
dac iwrite
jmp 1f
@@ -282,7 +282,7 @@ iread: 0
1:
lac 9f+t
jms pget
das 9f+t+3
dac 9f+t+3
jms dskrd
lac 9f+t
and o77
@@ -331,7 +331,7 @@ finac: 0
sma
jms error
lac f.i
jms ihet
jms iget
jms finac i
dacisize: 0

View File

@@ -3,20 +3,20 @@
pibreak:
dac .ac "** CROSSED OUT....
dpsf
lpsf
jmp 1f
dpcf
dprs
lpcf
dprs "** ??
dac dpstat
sma rad
sma ral
jmp 2f
dprc
dprc "** ??
dac dpchar
-1
dac dpread
lac dpstat
rai
ral
2:
sma
jmp piret
@@ -28,7 +28,7 @@ pibreak:
jmp 1f
lpb
dac pbsfigs
dac pbsflgs
isz s.tim+1
skp
isz s.tim
@@ -251,7 +251,7 @@ ttyrestart: 0
lpb
dac pbsflgs+1
"** 01-s1.pdf page 44
"** 01-s1.pdf page 45
and o2000
sna

View File

@@ -102,7 +102,7 @@ q2:
.+2;0;.+2;0;.+2;0;.+2;0;.+2;0;.+2;0;.+2;0;.+2;0;.+2;0;.+2;0
.+2;0;.+2;0;.+2;0;.+2;0;.+2;0;.+2;0;.+2;0;.+2;0;.+2;0;.+2;0
dsploc: .=.+1
dspinc: .=.+1
dsplno: .=.+1
dspbuf:
0065057;0147740;0160000
.=.+30
@@ -113,11 +113,11 @@ coldentry:
clon
law 3072
vcga
jsp dspinit
jms dspinit
law dspbuf
jsp movdsp
jms movdsp
cla
jsp dskio; 06000
jms dskio; 06000
jms copy; dskbuf; sysdata; ulist-sysdata
lac d3
jms namei; initf
@@ -194,7 +194,7 @@ inode:
i.flags: .=.+1
i.dskps: .=.+7
i.uid: .=.+1
i.lks: .=.+1
i.nlks: .=.+1
i.size: .=.+1
i.uniq: .=.+1
.= inode+12

22
scans/sx.s Normal file
View File

@@ -0,0 +1,22 @@
" For now, this stuff is defined so that
" the assembler doesn't complain about it
.save: 0
alloc: 0
betwen: 0
chkint: 0
copy: 7
copyz: 0
dskio: 0
dskrd: 0
dsktrans: 0
dskwr: 0
error: 0
free: 0
halt: 0
laci: 0
lookfor: 0
o7000: 07000
o70000: 070000
swp: 0

View File

@@ -21,6 +21,8 @@ my $origline; # The current input line of code
my $stage = 1; # Pass one or pass two
my $debug = 0; # Run in debug mode
my $errors = 0; # set to non-zero on error
my %Undef; # undefined symbols: only complain once
### Main program ###
@@ -87,13 +89,25 @@ for my $i ( 0 .. $#Mem ) {
}
}
exit(0);
exit($errors);
my $file; # global for error messages
my $lineno;
sub err {
my $msg = shift;
$errors = 1; # exit status
print STDERR "$file:$lineno: $msg\n";
return 0;
}
# Open and parse the given file
sub parse_file {
my $file = shift;
$file = shift;
open( my $IN, "<", $file ) || die("Cannot read $file: $!\n");
$lineno = 0;
while ( my $line = <$IN> ) {
$lineno++;
# Lose the end of line and any leading/trailing whitespace
# Discard any comments and preceding comment whitespace
@@ -111,12 +125,12 @@ sub parse_file {
# Split into a section with possible labels and a
# statement section with definitely no labels. The ?
# makes the first pattern less greedy.
#print("cmd is >$cmd<\n");
print("cmd is >$cmd<\n");
$cmd =~ m{(.*?)([^:]*$)};
my $labelsect = $1;
my $statement = $2;
#print(">$labelsect< >$statement<\n");
#print(">$labelsect< >$statement<\n");
# Split $labelsect into labels using the : character
my @labellist = split( /:\s*/, $labelsect );
@@ -147,9 +161,9 @@ sub parse_label {
}
# It's a textual label, check if it's been defined before
die("Label $label defined multiple times\n")
if ( defined( $Label{$label} ) );
if ( defined( $Label{$label} ) ) {
err("Label $label defined multiple times\n") if ( $stage == 1 );
}
# Otherwise, save its value
$Label{$label} = $Var{'.'};
#printf( "Set absolute label %s to 0%o\n", $label, $Label{$label} );
@@ -202,6 +216,7 @@ sub parse_statement {
sub parse_expression {
my $expression = shift;
print "exp: $expression\n";
# If it's a defined variable ( . , .. , etc.)
# return the value
return ( $Var{$expression} )
@@ -426,7 +441,11 @@ sub parse_expression {
#print("Did a subtraction and got $diff\n");
return ($diff);
}
die("I have no idea what $expression is in pass two\n") if ( $stage == 2 );
if ( $stage == 2 ) {
err("undefined: $expression") unless (defined $Undef{$expression});
$Undef{$expression} = 1;
}
return 0;
}
# Add two expression together
@@ -463,18 +482,20 @@ sub find_relative_label {
my $curlocation = $Var{'.'};
# Error check: no labels at all
die("No relative labels\n") if ( !defined( $Rlabel{$label} ) );
if ( !defined( $Rlabel{$label} ) ) {
return err("relative label $label not defined\n");
}
# Get the list of possible locations for this label
my $locarray = $Rlabel{$label};
# Error check: no locations
die("No relative labels\n") if ( @{$locarray} == 0 );
return err("No relative labels") if ( @{$locarray} == 0 );
# Error check: forward but no next location, or backward but no previous
die("No forward label\n")
return err("No forward label $label")
if ( ( $direction eq 'f' ) && ( $curlocation > $locarray->[-1] ) );
die("No backward label\n")
return err("No backward label $label")
if ( ( $direction eq 'b' ) && ( $curlocation < $locarray->[0] ) );
# Search forward for a location larger then the current one