From 2b4aeb3babfde8486a88591c1aa6264af2423176 Mon Sep 17 00:00:00 2001 From: Phil Budne Date: Tue, 22 Mar 2016 13:05:29 -0400 Subject: [PATCH 1/5] as7: make I/II/filename output match as.s behavior --- tools/as7 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/as7 b/tools/as7 index bd449ca..c8fc3f5 100755 --- a/tools/as7 +++ b/tools/as7 @@ -196,8 +196,8 @@ usage() if ( @ARGV < 1 ); ); # Parse all the files +print STDERR "I\n"; # like the real as foreach my $file (@ARGV) { - print STDERR "I $file\n"; # like the real as parse_file($file); } @@ -206,8 +206,9 @@ $Var{'.'} = $BASE; $stage = 2; open(my $OUT, ">$output") || die "$output"; +print STDERR "II\n"; # like the real as foreach my $file (@ARGV) { - print STDERR "II $file\n"; # like the real as + print STDERR "$file\n"; # like the real as parse_file($file); } From 2d8ee26e03cc32187d2a009c4eda3c483b89cd4b Mon Sep 17 00:00:00 2001 From: Phil Budne Date: Tue, 22 Mar 2016 18:54:17 -0400 Subject: [PATCH 2/5] fixes: handle blank line, 8 character filenames, semi --- src/other/pbsh.s | 148 ++++++++++++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 67 deletions(-) diff --git a/src/other/pbsh.s b/src/other/pbsh.s index 63ed3c0..098d855 100644 --- a/src/other/pbsh.s +++ b/src/other/pbsh.s @@ -39,7 +39,10 @@ newline: lac d1; sys write; prompt; 1 " output prompt jms rline " read line into ibuf lac iipt - dac ipt + dac ipt " reset input pointer + +" parse new command from current input line +" (after ';' or '&') newcom: dzm char " clear saved char dzm infile " clear input redirect file name @@ -68,12 +71,12 @@ newarg: jms blank " skip whitespace jms delim " command sep? - jmp eol " yes + jmp eoc " yes sad lt " input redirect? - jmp redirin + jmp redirin " yes sad gt " output redirect? - jmp redirout - jmp 3f + jmp redirout " yes + jmp savechar " no: save as filename redirin: " saw < dac redirect " flag redirect @@ -87,40 +90,43 @@ redirout: " saw > dac opt " fall -newchar: +newchar: " loop reading a file name jms getc sad o40 " space? jmp eoname " yes - jms delim - jmp eoname -3: jms putc " save + jms delim " no: end of line? + jmp eoname " yes +savechar: + jms putc " no: save isz bcount " loop unless full jmp newchar " here after 8 chars: discard until terminator seen -discard: - jms getc +1: jms getc jms delim " end of line? - jmp eoname + jmp 2f sad o40 - jmp eoname - jmp discard + jmp 2f + jmp 1b + +2: + dac char " save terminator + jmp full " name ended (short) with whitespace or delim " pad out last name to 8 with spaces -" XXX check if ANYTHING read eoname: dac char " save terminator 1: lac o40 - jms putc " no: copy into argv + jms putc " copy into argv isz bcount " loop until full jmp 1b - -" saw end of name -2: lac redirect +full: + lac redirect sza jmp 2f " last name was a redirect file, skip increment +" file was not a redirection: lac argc " increment argc tad d4 dac argc @@ -131,31 +137,31 @@ eoname: 2: dzm redirect " clear redirect flag lac nextarg - dac opt + dac opt " set output pointer - lac char - jms delim - jmp eol + lac char " get terminator + jms delim " end of command? + jmp eoc " yes - lac argc - sad maxargwords - skp - jmp newarg + lac argc " another arg + sad maxargwords " full up? + skp " yes + jmp newarg " no: get another -" too many args, (complain?). for now eat rest of line +" too many args 4: jms getc jms delim skp jmp 4b lac d1; sys write; toomany; ltoomany - jmp newline + jmp newline " ignore rest of line -" here at end of line -eol: - sad delimchar " save eol character +" here at end of command +eoc: + dac delimchar " save command delimiter lac argc " check for empty command line sna " get anything? - jmp 2f " no, go back for another + jmp nextcmd " no, go back for another " check for built-in "chdir" command lac argv0 @@ -170,27 +176,24 @@ eol: sad chdirstr+2 jmp changedir -1: -" comment these out to test "exec" w/o fork - sys fork +" here to execute command (not a builtin) +1: sys fork jmp parent +child: " debug symbol sys open; argv0; 0 " try cwd (no link required) - sma - jmp 1f - " jmp cmderr + sma " error? + jmp 1f " no - sys unlink; exectemp " remove old temp file, if any - sys link; system; argv0; exectemp + sys link; system; argv0; argv0 spa - jmp cmderr - sys open; exectemp; 0 + jmp cmderr + sys open; argv0; 0 spa - jmp cmderr + jmp cmderr dac cmdfd - sys unlink; exectemp + sys unlink; argv0 skp - 1: dac cmdfd " save command file descriptor cla " check for input redirection sad infile " input redirct? @@ -248,28 +251,32 @@ error: " error in child: filename pointer in AC sys exit " chdir command: executed in shell process +" takes a series of directory names to chdir to in turn changedir: -" XXX check if argc == 4 (no directories) and complain?? + lac argc + sad d4 + jmp cherr " need at least one arg! lac argv0p skp -1: lac 0f " increment argvp +1: lac 0f " increment dir pointer tad d4 dac 0f -4 " decrement argc tad argc dac argc sna " done? - jmp 2f " yes: join parent code + jmp nextcmd " yes: join parent code sys chdir; 0:0 sma " error? jmp 1b " no: look for another directory " chdir call failed - lac 0b - dac 0f + lac 0b " get name + dac 0f " store for write lac d1; sys write; 0:0; 4 +cherr: lac d1; sys write; qmnl; 1 - jmp 2f " join parent code + jmp nextcmd " join parent code " here in parent, child pid in AC parent: @@ -290,9 +297,11 @@ parent: jmp newcom " yes: go back without wait lac pid " no: get pid sys smes " hang until child exits -2: lac delimchar + nop +nextcmd: + lac delimchar sad o73 " semi? - jmp newcom " yes: look for another command w/o prompt + jmp newcom " yes: look for another command on line jmp newline " no: output prompt " ================ @@ -330,6 +339,9 @@ rline: 0 law ibuf-1 " Store ibuf pointer in location 8 dac 8 1: +" XXX ttyin returns one char per read, +" but redirected stdin would return two!!! +" push read down into an "rchar" routine?? cla; sys read; char; 1 " Read in one character from stdin sna " read ok? jmp quit " no @@ -383,12 +395,13 @@ putc: 0 d1: 1 d2: 2 o4:d4: 4 +dm8: -8 o12: 012 " newline o17: 017 o40: 040 " space o43: 043 " # o46: 046 " ampersand -o73: 046 " semi +o73: 073 " semi o74:lt: 074 " < o76:gt: 076 " > o100: 0100 " @ @@ -401,9 +414,6 @@ qmnl: ;;; 040040 -exectemp: - ;;; " temporary link for file being exec'ed - chdirstr: ;; Date: Tue, 22 Mar 2016 18:58:06 -0400 Subject: [PATCH 3/5] pbsh.s: comments --- src/other/pbsh.s | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/other/pbsh.s b/src/other/pbsh.s index 098d855..6ff8ae4 100644 --- a/src/other/pbsh.s +++ b/src/other/pbsh.s @@ -341,7 +341,8 @@ rline: 0 1: " XXX ttyin returns one char per read, " but redirected stdin would return two!!! -" push read down into an "rchar" routine?? +" push read down into a "getc" routine?? +" used to do this, but removed it for some reason!!! cla; sys read; char; 1 " Read in one character from stdin sna " read ok? jmp quit " no @@ -441,7 +442,7 @@ nextarg: .=.+1 " next slot in argv to fill bcount: .=.+1 " byte counter for current filename opt: .=.+1 " "output pointer" (may point to in/outfile or into argv) delimchar: .=.+1 " character that terminated line -char: .=.+1 " char that terminated word +char: .=.+1 " char that terminated word (merge into delimchar?) outfile: .=.+4 " buffer for output redirect file name infile: .=.+4 " buffer for input redirect file name From 1016412831158240ca227bf3c5693453559fe975 Mon Sep 17 00:00:00 2001 From: Phil Budne Date: Tue, 22 Mar 2016 18:59:28 -0400 Subject: [PATCH 4/5] add system (super) user --- build/fs/password | 1 + 1 file changed, 1 insertion(+) diff --git a/build/fs/password b/build/fs/password index 4ed5ecf..9548543 100644 --- a/build/fs/password +++ b/build/fs/password @@ -1,2 +1,3 @@ +system:system:system:777777 ken:ken:ken:12 dmr:dmr:dmr:14 From 3c70f48fe826a53786fc63251c6a3ddba3058022 Mon Sep 17 00:00:00 2001 From: Phil Budne Date: Tue, 22 Mar 2016 19:35:00 -0400 Subject: [PATCH 5/5] pbsh.s: read full blocks (readc) so "sh