diff --git a/scans/as.s b/scans/as.s index 42a6c1b..8fc5957 100644 --- a/scans/as.s +++ b/scans/as.s @@ -208,7 +208,7 @@ proc1: jmp proc2 jms bufwr jms copyz; buf; 64 - lac lyrand + lac lvrand and o17700 dac bufadd dac 1f @@ -220,7 +220,7 @@ proc1: sys read; buf; 64 proc2: - lac lyrand + lac lvrand and o77 jms betwen; dm1; maxsto dac maxsto @@ -256,12 +256,12 @@ bufwr: 0 sys seek; bufadd: 0; 0 isz maxsto lac bfo - sys write; bufp: buf; maxstp: -1 + sys write; bufp: buf; maxsto: -1 -1 dac maxsto jmp i bufwr -Xnumber: 0 +number: 0 dac 3f lac d1000 dac 2f @@ -273,7 +273,7 @@ Xnumber: 0 lacq tad o60 dac i 8 - iac 2b + lac 2b cll idiv; 10 lacq @@ -334,7 +334,7 @@ betwen: 0 cma tad 2f spa - jmp 2f + jmp 1f lac i betwen dac 3f isz betwen @@ -447,7 +447,7 @@ nf1: lac fname tad d4 dac fname - sys open; frame: 0; 0 + sys open; fname: 0; 0 dac iof sma lac passno @@ -492,20 +492,20 @@ gchar: 0 sad o12 skp jmp 1f - dzm comflc + dzm comflg isz lineno 1: sad o42 - dac comflc + dac comflg dac char - lac comflc + lac comflg sza jmp gchar+1 lac char gch3: dac char - jms betwn; d0; o200 + jms betwen; d0; o200 cla tad lactab dac .+1 @@ -801,12 +801,12 @@ exp2: dac srand lac r+1 dac srand+1 - jmp expb + jmp exp5 exp3: sad d5 jmp exp4 jms error; x> - smp skip + jmp skip exp4: jms pickup jmp i expr @@ -924,7 +924,7 @@ o74: 074 o76: 076 namsiz: -2 -namistp: namlst +namlstp: namlst fnamep: fakename lactab: lac .+1 8;8;8;8;8;8;8;8 @@ -977,4 +977,4 @@ namlst: .=.+4 dot: .=.+6 -cmflx: \ No newline at end of file +cmflx: diff --git a/src/cmd/as.s b/src/cmd/as.s index 42a6c1b..af36131 100644 --- a/src/cmd/as.s +++ b/src/cmd/as.s @@ -1,40 +1,41 @@ +"** 05-1-4.pdf page 32 " as - jms init1 + jms init1 " initialize assm1: lac eofflg - sza - jmp assm2 + sza " saw EOF? + jmp assm2 " no. lac passno - sza - jmp finis - jms init2 + sza " pass==0? + jmp finis " no, pass 2: done + jms init2 " pass 1: init for pass2 assm2: - jms gchar - sad d4 - jmp assm1 - sad d5 - jmp assm1 + jms gchar " get character + sad d4 " comma space or tab? + jmp assm1 " yes, ignore + sad d5 " newline or ';'?? + jmp assm1 " yes, ignore lac char - dac savchr + dac savchr " no, push back jms gpair lac rator - jms betwen; d1; d6 - jmp assm3 + jms betwen; d1; d6 " plus, minus, space comma tab or semi? + jmp assm3 " no jms expr lac passno - sza - jms process - isz dot+1 + sza " pass 1? + jms process " no, process on pass 2 + isz dot+1 " increment "." nop lac dot+1 and o17777 - sad dot+1 - jmp assm1 - jms error; >> - dzm dot+1 + sad dot+1 " overflow? + jmp assm1 " no + jms error; >> " '>' error: past end of memory + dzm dot+1 " start again at zero! jmp assm1 assm3: @@ -43,24 +44,25 @@ assm3: jmp assm4 sza jmp assm6 - lac rator - sza - jmp assm6 + lac rator " fetch operator + sza " ":"? + jmp assm6 " no lac rand+1 - jms betwen; dm1; d10 - jmp assm6 - dac name + jms betwen; dm1; d10 " numeric and 0..9? + jmp assm6 " no + dac name " yes, save as name tad fbxp dac lvrand - lac i lvrand - dac name+1 - isz i lvrand - lac o146 - dac name+2 - dzm name+3 - jms tlookup + lac i lvrand " get fbx entry + dac name+1 " save in second word of name + isz i lvrand " increment fbx entry + lac o146 " get 'f' + dac name+2 " save in third word of name + dzm name+3 " clear fourth word + jms tlookup " look it up -1 - dac fbflg +"** 05-1-4.pdf page 33 + dac fbflg " set fbflg to -1 assm4: lac rand+1 tad d4 @@ -68,10 +70,10 @@ assm4: lac rator sza jmp assm5 - lac dot - dac r - lac dot+1 - dac r+1 + lac dot " load dot type + dac r " save as r type + lac dot+1 " get dot value + dac r+1 " save as r value jmp 1f assm5: @@ -84,87 +86,88 @@ assm5: lac r+1 dac i lvrand lac fbflg - sna - jmp assm1 - dzm fbflg + sna " fb flag set? + jmp assm1 " no + dzm fbflg " clear fb flag dzm name+1 - lac o142 + lac o142 " get 'b' dac name+2 jms lookup jmp assm4 assm6: - jms error; x> + jms error; x> " "x" error -- various errors jmp assm1 -init1: 0 +init1: 0 " init for pass 1 lac d1 - sys write; 1f; 2f-1f - dzm passno - lac o56040 + sys write; 1f; 2f-1f " output I, newline + dzm passno " clear passno + lac o56040 " load ". " dac dot-4 - lac o56056 + lac o56056 " load ".." dac cmflx-4 - lac o40040 + lac o40040 " pad ". " and ".." names with spaces dac dot-3 dac dot-2 dac dot-1 dac cmflx-3 dac cmflx-2 dac cmflx-1 - dzm iof + dzm iof " clear input fd jms init jmp i init1 1: - 0111012 + 0111012 " I\n 2: -init2: 0 +init2: 0 " start pass 2 lac d1 - dac passno - sys write; 1f; 2f-1f +"** 05-1-4.pdf page 34 + dac passno " passno = 1 + sys write; 1f; 2f-1f " output II jms init lac o17 - sys creat; 2f + sys creat; 2f " create a.out dac bfo - sys open; 2f; 0 + sys open; 2f; 0 " open a.out for read too! dac bfi dzm bufadd - jms copyz; buf; 64 + jms copyz; buf; 64 " clear buffer jmp i init2 1: - 0111111;012000 + 0111111;012000 " II\n 2: - 0141056;0157165;0164040;040040 + 0141056;0157165;0164040;040040 " a.out -init: 0 +init: 0 " common init for both passes lac i 017777 - dac narg + dac narg " save arg count lac 017777 tad d1 - dac fname + dac fname " point to first file name -1 dac eofflg jms ioinit - dzm savchr - dzm comflg + dzm savchr " clear saved char + dzm comflg " clear line comment flag lac d1 - dac dot - dzm dot+1 - dzm cmflx - lac d4096 + dac dot " set "." type to one?? + dzm dot+1 " clear "." value?? + dzm cmflx " set ".." type to zero?? + lac d4096 " set ".." value to 4K dac cmflx+1 - dzm fbflg + dzm fbflg " clear f/b flag and array jms copyz; fbxp: fbx; 10 - jmp i init + jmp i init " return finis: - lac iof + lac iof " close input file sys close - jms bufwr - lac bfi + jms bufwr " flush output buffer + lac bfi " close a.out input fd sys close - lac bfo + lac bfo " close a.out output fd sys close -1 tad namsiz @@ -175,26 +178,27 @@ finis: tad char dac 1f lac o17 - sys creat; n.out + sys creat; n.out " create "n.out" dac bfi - sys write; namlst; 1: 0 + sys write; namlst; 1: 0 " write name list lac bfi - sys close + sys close " close n.out sys exit +"** 05-1-4.pdf page 35 n.out: - 0156056;0157165;0164040;040040 + 0156056;0157165;0164040;040040 " n.out process: 0 - lac dot+1 + lac dot+1 " get "." value dac lvrand - lac dot - sad d3 - jmp proc4 - sza - jmp proc1 + lac dot " get "." type?? + sad d3 " three? + jmp proc4 " no, give "." error + sza " zero? + jmp proc1 " no -1 - tad cmflx+1 + tad cmflx+1 " '..' - 1 cma tad lvrand dac lvrand @@ -203,25 +207,25 @@ proc1: lac lvrand spa jmp proc4 - and o17700 - sad bufadd - jmp proc2 - jms bufwr - jms copyz; buf; 64 - lac lyrand + and o17700 " mask to block + sad bufadd " same block as buffer? + jmp proc2 " yes, same block + jms bufwr " different block, write out current block + jms copyz; buf; 64 " clear buffer + lac lvrand and o17700 dac bufadd dac 1f lac bfi - sys seek; 1: 0; 0 + sys seek; 1: 0; 0 " seek to current block from file spa jmp proc2 lac bfi sys read; buf; 64 proc2: - lac lyrand - and o77 + lac lvrand + and o77 " get word within block jms betwen; dm1; maxsto dac maxsto tad bufp @@ -231,7 +235,7 @@ proc2: jmp proc3 sad d3 jmp proc5 - lac cmflx+1 + lac cmflx+1 " get ".." value tad r+1 dac r+1 @@ -243,25 +247,26 @@ proc3: proc4: jms error; .> lac d1 - dac dot - dzm dot+1 + dac dot " set '.' type to 1 +"** 05-1-4.pdf page 36 + dzm dot+1 " clear dot value jmp skip proc5: jms error; u> jmp proc3 -bufwr: 0 +bufwr: 0 " write current buffer to a.out file lac bfo sys seek; bufadd: 0; 0 isz maxsto lac bfo - sys write; bufp: buf; maxstp: -1 + sys write; bufp: buf; maxsto: -1 -1 dac maxsto jmp i bufwr -Xnumber: 0 +number: 0 " print decimal number? dac 3f lac d1000 dac 2f @@ -273,7 +278,7 @@ Xnumber: 0 lacq tad o60 dac i 8 - iac 2b + lac 2b cll idiv; 10 lacq @@ -283,96 +288,116 @@ Xnumber: 0 jmp i number 3: 0 + " get character from buffer + " call with: + " jms getsc; pointer_pointer + " where pointer_pointer contains a pointer to buffer getsc: 0 - lac i getsc - dac sctalp - isz getsc - lac i sctalp - dac sctal - add o400000 - dac i sctalp - ral - lac i sctal - szl - lrss 9 - and o177 - jmp i getsc + lac i getsc " get pointer pointer + dac sctalp " save + isz getsc " skip pointer pointer + lac i sctalp " fetch pointer + dac sctal " save + add o400000 " toggle high bit of pointer + dac i sctalp " save pointer back + ral " rotate high bit into link reg + lac i sctal " load word from buffer + szl " skip if link zero + lrss 9 " link set: get high char from word + and o177 " strip to 7 bits + jmp i getsc " return + " save characters: word after call is addr of pointer, -count pair + " high bit in pointer used to indicate high or low byte next? putsc: 0 - and o177 - lmq - lac i putsc - dac sctalp - isz putsc - lac i sctalp - dac sctal - add o400000 - dac i sctalp - sma cla - jmp 1f - llss 27 - dac i sctal - lrss 9 - jmp i putsc + and o177 " strip character to 7 bits + lmq " save in MQ + lac i putsc " get address of pointer + dac sctalp " save + isz putsc " skip over pointer to pointer +"** 05-1-4.pdf page 37 + lac i sctalp " get pointer + dac sctal " save + add o400000 " toggle sign bit by adding -0 + dac i sctalp " save pointer + sma cla " skip if minus & clear AC + jmp 1f " AC positive + llss 27 " get char in high 9 bits, zero in low + dac i sctal " store word + lrss 9 " shift char back down + jmp i putsc " return 1: - lac i sctal - omq - dac i sctal - lacq - jmp i putsc + lac i sctal " load target word + omq " or in char from MQ + dac i sctal " save word back + lacq " restore character + jmp i putsc " return sctalp: 0 sctal: 0 + " test if between two values (low,high] + " call with value in AC + " jms betwen; lowptr; highptr + " skip returns if AC in range + " AC returned unmodified + " NOTE! + " the test appears to be non-inclusive + " on the low side, and inclusive on the high side + betwen: 0 - dac 2f - lac i betwen - dac 3f - isz betwen - lac i 3f + dac 2f " save value to test + lac i betwen " load range start addr + dac 3f " save + isz betwen " increment return PC + lac i 3f " load range start + cma " complement + tad 2f " AC = AC - start - 1 + spa " still positive? + jmp 1f " no + lac i betwen " load range end addr + dac 3f " save + isz betwen " skip range high on return + lac i 3f " load range high cma - tad 2f - spa - jmp 2f - lac i betwen - dac 3f - isz betwen - lac i 3f - cma - tad d1 - tad 2f - spa + tad d1 " negate AC (~AC + 1) + tad 2f " add test value + spa " if not positive, don't skip on return!! 1: - isz betwen - lac 2f - jmp i betwen + isz betwen " discard "high" (or skip return)! + lac 2f " restore AC + jmp i betwen " return 2: 0 3: 0 + " zero a block of memory + " call with: + " jms copyz; ptr; count copyz: 0 -1 - tad i copyz - dac 8 - isz copyz - lac i copyz - cma + tad i copyz " get address-1 + dac 8 " store in first "index register" + isz copyz " skip over address + lac i copyz " load count + cma " get -count tad d1 - dac 2f - isz copyz + dac 2f " save + isz copyz " skip over count 1: - dzm i 8 - isz 2f - jmp 1b - jmp i copyz + dzm i 8 " increment index, clear word + isz 2f " increment count, skip if done + jmp 1b " not done, loop + jmp i copyz " done: return +"** 05-1-4.pdf page 38 2: 0 error: 0 - lac passno - sza - jmp 1f - isz error - jmp i error + lac passno " get pass number + sza " pass one? + jmp 1f " no, pass two + isz error " pass one: skip error char + jmp i error " return 1: -1 tad mesp @@ -385,7 +410,7 @@ error: 0 sad d5 jmp 1f lac savchr - sad o12 + sad o12 jmp 1f lac lineno jmp 2f @@ -407,330 +432,337 @@ error: 0 jmp i error skip: - lac rator - sad d5 - jmp assm1 + lac rator " get operator + sad d5 " EOL? + jmp assm1 " yes, start from top 1: - jms gchar - sad d5 - jmp assm1 + jms gchar " loop until ';' or NL seen + sad d5 " EOL? + jmp assm1 " yes, start from top jmp 1b ioinit: 0 - jms copyz; iobuf; 64 + jms copyz; iobuf; 64 " clear iobuf lac iof - sys read; iobufp: iobuf; 64 - sna - jms nextfil - lac iobufp - dac tal - -129 - dac talc - jmp i ioinit + sys read; iobufp: iobuf; 64 " read from input + sna " EOF? + jms nextfil " yes, skip to next file + lac iobufp " load iobuf pointer + dac tal " save + -129 " get -bytecount-1 + dac talc " save as count +"** 05-1-4.pdf page 39 + jmp i ioinit " return -nextfil: 0 +nextfil: 0 " advance to next file lac d1 - dac lineno - lac iof - sza - sys close + dac lineno " reset lineno to 1 + lac iof " load input fd + sza " zero? + sys close " no: close nf1: - lac narg - sad d4 - skp - jmp 1f - dzm eofflg - jmp i nextfil + lac narg " load arg count + sad d4 " ==4? (done) + skp " yes, skip + jmp 1f " no + dzm eofflg " flag eof (set to zero) + jmp i nextfil " return 1: - tad dm4 - dac narg - lac fname - tad d4 - dac fname - sys open; frame: 0; 0 - dac iof - sma - lac passno - sna - jmp nextfil i - lac fname - dac 1f + tad dm4 " subtract 4 + dac narg " store narg + lac fname " get fname pointer + tad d4 " subtract 4 + dac fname " save fname + sys open; fname: 0; 0 " open fname + dac iof " save fd + sma " open ok? + lac passno " yes, load pass number + sna " open failed: skip or open ok, pass 2 + jmp nextfil i " pass 1, open OK, return. + lac fname " load filename pointer + dac 1f " save for write + lac d1 " stdout + sys write; 1; 0; 4 " output filename + lac iof " load fd + sma " open ok? + jmp 1f " yes, continue lac d1 - sys write; 1; 0; 4 - lac iof - sma - jmp 1f - lac d1 - sys write; emes; 2 - sys exit + sys write; emes; 2 " output "? \n" + sys exit " quit. 1: lac d1 - sys write; emes+1; 1 - jmp i nextfil + sys write; emes+1; 1 " output newline after filename + jmp i nextfil " return emes: - 040077;012000 + 040077;012000 " question mark, space, newline gchar: 0 - lac savchr - dzm savchr - sza - jmp gch3 - lac eofflg - sza - jmp 1f - lac o12 - jmp gch3 + lac savchr " load saved char + dzm savchr " clear saved char + sza " was there a saved char? + jmp gch3 " yes, process it + lac eofflg " no: get eof flag + sza " seen eof (zero if true) + jmp 1f " no. + lac o12 " yes: get NL + jmp gch3 " process it 1: - isz talc - skp - jms ioinit - jms getsc; tal - sna - jmp gchar+1 - sad o177 - jmp gchar+1 - sad o12 - skp - jmp 1f - dzm comflc - isz lineno + isz talc " increment (negative count): is it zero? + skp " non-zero: skip + jms ioinit " count was zero: call ioinit + jms getsc; tal " fetch character + sna " is char non-zero? + jmp gchar+1 " no: char is zero, get another +"** 05-1-4.pdf page 40 + sad o177 " is char 0177 + jmp gchar+1 " yes, ignore it + sad o12 " is char newline? + skp " yes + jmp 1f " no + dzm comflg " saw newline: clear comflg + isz lineno " increment line number 1: - sad o42 - dac comflc - dac char - lac comflc - sza - jmp gchar+1 - lac char + sad o42 " is char '"'? + dac comflg " yes, set comflg + dac char " save char + lac comflg " load comflg + sza " comflg clear? + jmp gchar+1 " no: ignore reset of line + lac char " get char gch3: - dac char - jms betwn; d0; o200 - cla - tad lactab - dac .+1 - lac 0 - jmp i gchar + dac char " save char in char + jms betwen; d0; o200 " legal char? + cla " no, clear + tad lactab " add to "lac labtab+1" + dac .+1 " save as next instruction + lac 0 " get character class in AC + jmp i gchar " return gsymb: 0 - jms gchar - dac rator - tad jmpsw1 - dac 1f - lac char - sad o74 - jmp lqot - dac namc - jms gchar - lac char - sad o76 - jmp rqot - dac savchr - lac namc - dac char + jms gchar " get char + dac rator " save class + tad jmpsw1 " add table base instruction + dac 1f " save for later + lac char " what was it? + sad o74 " '<'?? + jmp lqot " yes: process as "left quote" + dac namc " no, save as namc + jms gchar " get another + lac char " what was it? + sad o76 " '>'? + jmp rqot " yes: process "right quote" + dac savchr " no: save as savchr + lac namc " restore first char + dac char " resave as "char" 1: - jmp 0 + jmp 0 " jmpsw1[0] + class +jmpsw1: " indexed by character class + jmp .+1 " base instruction (added to class) + jmp i gsymb " 0: ":" return + jmp i gsymb " 1: "=" return + jmp i gsymb " 2: "+" return + jmp i gsymb " 3: "-" return + jmp gs1 " 4: comma, space, tab + jmp i gsymb " 5: EOL (semi, newline) + jmp gs2 " 6: dot, star, letter + jmp gs3 " 7: digits -jmpsw1: - jmp .+1 - jmp i gsymb - jmp i gsymb - jmp i gsymb - jmp i gsymb - jmp gs1 - jmp i gsymb - jmp gs2 - jmp gs3 - -badchr: - jms error; g> +badchr: " here with bad char (class 8) + jms error; g> " error "g" 1: - jms gchar + jms gchar " discard until newline lac char sad o12 +"** 05-1-4.pdf page 41 skp jmp 1b - dac savchr - jmp gsymb+1 + dac savchr " push newline back + jmp gsymb+1 " restart gsymb -lqot: - jms gchar +lqot: " left quote (<) + jms gchar " get another char lac o40 - dac savchr - lac char - alss 9 - jmp 1f + dac savchr " put a space in savchr + lac char " get quoted character + alss 9 " shift up 9 bits + jmp 1f " join with right quote -rqot: - lac namc +rqot: " right quote (>) + lac namc " get previous(?) char 1: dac rand+1 lac d7 dac rator jmp i gsymb -gs1: - jms gchar - sad d4 - jmp gs1 - lac char +gs1: " here with space, tab, comma + jms gchar " get another char + sad d4 " another space? + jmp gs1 " yes, loop + lac char " no, save for later dac savchr - jmp i gsymb + jmp i gsymb " return -gs2: - lac namep - dac tal1 - -7 - dac tal1c - lac char - jms putsc; tal1 +gs2: " here with dot, star, letter + lac namep " load name buffer pointer + dac tal1 " save in temp pointer + -7 " load negative char count + dac tal1c " save as temp counter + lac char " restore char + jms putsc; tal1 " save it in name buffer -gnam1: +gnam1: " here to collect a name jms gchar - jms betwen; d5; d8 - jmp gnam3 + jms betwen; d5; d8 " alphanumeric? + jmp gnam3 " no, done lac char jms putsc; tal1 isz tal1c jmp gnam1 -gnam2: - jms gchar - jms betwen; d5; d8 - skp - jmp gnam2 +gnam2: " here when 8 characters read, eat the rest + jms gchar " next char + jms betwen; d5; d8 " alphanumeric? + skp " no + jmp gnam2 " yes, loop lac char - dac savchr - jms lookup - jmp i gsymb + dac savchr " push last char back + jms lookup " look up symbol + jmp i gsymb " return -gnam3: - lac char +gnam3: " here before 8 characters + lac char " push last char back dac savchr 1: - lac o40 + lac o40 " pad to 8 with spaces +"** 05-1-4.pdf page 42 jms putsc; tal1 isz tal1c jmp 1b jms lookup jmp i gsymb -gs3: - dzm rand+1 +gs3: " here with digit + dzm rand+1 " clear number lac char - sad o60 - jmp 1f - lac d10 + sad o60 " zero? + jmp 1f " yes + lac d10 " no: process as decimal jmp 2f 1: - lac d8 + lac d8 " leading zero: process as octal 2: - dac num2 + dac num2 " save radix num1: - lac rand+1 - cll - mul -num2: 0 - lacq - tad char - tad dm48 - dac rand+1 - jms gchar - sad d7 - jmp num1 - lac char - dac savchr - lac rand+1 - jms betwen; dm1; d10 - jmp i gsymb + lac rand+1 " get number + cll " clear link + mul " mutiply by radix +num2: 0 " (radix stored here) + lacq " get multiply result + tad char " add char + tad dm48 " subtract '0' + dac rand+1 " save + jms gchar " get another + sad d7 " digit? + jmp num1 " yes: process + lac char " no: get it + dac savchr " push back + lac rand+1 " get number + jms betwen; dm1; d10 " between 0..9? + jmp i gsymb " no, return dac name - tad fbxp - dac name+1 - lac i name+1 - dac name+1 - lac savchr - sad o146 - jmp 1f - sad o142 - skp - jmp i gsymb - dzm name+1 -1: - dac name+2 - dzm name+3 - lac d6 - dac rator - jms lookup - dzm savchr + tad fbxp " make index into "fbx" array + dac name+1 " ???save??? (crushed below) + lac i name+1 " fetch fbx array entry + dac name+1 " save fbx count in name + lac savchr " get break character + sad o146 " was it 'f'? + jmp 1f " yes + sad o142 " 'b'? + skp " yes + jmp i gsymb " not f or b, return + dzm name+1 " 'b': clear loaded fbx entry???? +1: " here with DIGITS[fb] + dac name+2 " save f/b in third word of name + dzm name+3 " clear last word of name + lac d6 " class 6: alpha, dot star + dac rator " save as (ope)rator + jms lookup " lookup (create) symbol entry???? + dzm savchr " clear saved char jmp i gsymb + " symbol lookup/creation + " tlookup doesn't create new entries??? tlookup: 0 jmp 1f lookup: 0 - dzm tlookup + dzm tlookup " NOT a tlookup call 1: +"** 05-1-4.pdf page 43 -1 tad namlstp - dac 8 + dac 8 " get namelist ptr in index reg lac namsiz - dac namc + dac namc " negative namelist size in namc lu1: - lac i 8 - sad name - jmp 1f - lac d5 + lac i 8 " get first word of namelist entry + sad name " match name? + jmp 1f " yes + lac d5 " no, skip next 5 words lu2: tad 8 dac 8 - isz namc - jmp lu1 - lac tlookup - sna - jmp 2f + isz namc " at end of list? + jmp lu1 " no, keep going + lac tlookup " yes, reached end + sna " was tlookup? + jmp 2f " no, was lookup lac fnamep - dac rand+1 - jmp i tlookup + dac rand+1 " set rand+1 (value?) to fakename + jmp i tlookup " return 2: - lac name - dac i 8 + lac name " make new entry + dac i 8 " save word one of name lac 8 dac rand+1 lac name+1 - dac i 8 + dac i 8 " save word two lac name+2 - dac i 8 + dac i 8 " save word three lac name+3 - dac i 8 + dac i 8 " save word four lac d3 - dac i 8 - dzm i 8 - -1 + dac i 8 " set type(?) to three + dzm i 8 " clear value?? + -1 " decrement namsiz tad namsiz dac namsiz - jmp i lookup -1: + jmp i lookup " return +1: " here when first word matched lac i 8 - sad name+1 - jmp 1f - lac d4 + sad name+1 " check second word + jmp 1f " matched, keep going + lac d4 " no match: skip ahead four words jmp lu2 1: lac i 8 - sad name+2 - jmp 1f - lac d3 + sad name+2 " does third word match? + jmp 1f " yes, keep going + lac d3 " no, skip ahead three words jmp lu2 1: lac i 8 - sad name+3 - jmp 1f - lac d2 + sad name+3 " final word match? + jmp 1f " yes + lac d2 " no, skip two words jmp lu2 -1: +1: " name matched -3 - tad 8 - dac rand+1 + tad 8 " get next word minus three + dac rand+1 " return as value +"** 05-1-4.pdf page 44 lac tlookup sza jmp i tlookup @@ -739,37 +771,37 @@ namep: name gpair: 0 jms gsymb - lac rator - sad d4 - jmp gpair+1 - jms betwen; dm1; d6 - jmp gp1 + lac rator " get operator + sad d4 " space tab or comma? + jmp gpair+1 " yes, get another + jms betwen; dm1; d6 " anything but a digit? + jmp gp1 " no-- a digit dzm rand dzm rand+1 jmp i gpair -gp1: +gp1: " here with digit sad d7 lac d4 tad dm4 dac rand jms gsymb lac rator - sad d4 - jmp gp2 - jms betwen; dm1; d6 - skp - jmp i gpair - jms error; x> + sad d4 " whitespace? + jmp gp2 " yes + jms betwen; dm1; d6 " anything but digit? + skp " no, a digit + jmp i gpair " yes, return + jms error; x> " here with digit: give 'x' error jmp skip -gp2: - jms gchar - jms betwen; d5; d8 - jmp gp3 - lac char +gp2: " here after whitespace + jms gchar " get next char + jms betwen; d5; d8 " alphanumeric? + jmp gp3 " no + lac char " yes, push back dac savchr jmp i gpair gp3: - lac char + lac char " push back break char dac savchr jms gsymb jmp i gpair @@ -785,14 +817,15 @@ exp5: dac r+1 exp1: lac rator - jms betwen; d1; d5 - jmp exp3 + jms betwen; d1; d5 " plus, minus, comma, space, tab or comma? + jmp exp3 " no dac orator jms gpair jms grand - lac orator - sad d4 - jmp exp2 + lac orator " get operator back + sad d4 " comma space or tab? +"** 05-1-4.pdf page 45 + jmp exp2 " no jms oper; rand jmp exp1 exp2: @@ -801,12 +834,12 @@ exp2: dac srand lac r+1 dac srand+1 - jmp expb + jmp exp5 exp3: sad d5 jmp exp4 jms error; x> - smp skip + jmp skip exp4: jms pickup jmp i expr @@ -853,6 +886,7 @@ opsw: jmp .-1 jmp oplus jmp ominus +"** 05-1-4.pdf page 46 tad r dac r lac r+1 @@ -911,9 +945,10 @@ dm4: -4 o200: 0200 o42: 042 o142: 0142 -o40040: 040040 -o56056: 056056 -o56040: 056040 +o40040: 040040 " space, space +o56056: 056056 " ".." +o56040: 056040 " ". " +"** 05-1-4.pdf page 47 o146: 0146 o17777: 017777 d1000: 1000 @@ -924,22 +959,22 @@ o74: 074 o76: 076 namsiz: -2 -namistp: namlst +namlstp: namlst fnamep: fakename -lactab: lac .+1 +lactab: lac .+1 " character class table (8 unless noted) 8;8;8;8;8;8;8;8 -8;4;5;8;8;8;8;8 +8;4;5;8;8;8;8;8 " TAB=4 NL=5 8;8;8;8;8;8;8;8 8;8;8;8;8;8;8;8 -4;8;8;8;8;8;8;8 -8;8;6;2;4;3;6;8 -7;7;7;7;7;7;7;7 -7;7;0;5;8;1;8;8 -8;6;6;6;6;6;6;6 +4;8;8;8;8;8;8;8 " SP=4 +8;8;6;2;4;3;6;8 " *=6 +=2 ,=4 -=3 .=6 +7;7;7;7;7;7;7;7 " digits=7 +7;7;0;5;8;1;8;8 " :=0 ;=5 ==1 +8;6;6;6;6;6;6;6 " A-Z=6 6;6;6;6;6;6;6;6 6;6;6;6;6;6;6;6 6;6;6;8;8;8;8;8 -8;6;6;6;6;6;6;6 +8;6;6;6;6;6;6;6 " a-z=6 6;6;6;6;6;6;6;6 6;6;6;6;6;6;6;6 6;6;6;8;8;8;8;8 @@ -965,16 +1000,23 @@ r: .=.+2 name: .=.+4 buf: .=.+64 iobuf: .=.+64 -fbx: .=.+10 +fbx: .=.+10 " forward/backward pointers? mes: .=.+20 iof: .=.+1 bfi: .=.+1 bfo: .=.+1 lineno: .=.+1 -fakename: .=.+6 +fakename: .=.+6 " dummy entry returned by tlookup?? namlst: .=.+4 -dot: +dot: " dot type, value .=.+6 -cmflx: \ No newline at end of file +cmflx: " dotdot type, value + + " first four words of name list are symbol (space padded) + " next word is type?? + " 0: initial dotdot type + " 1: initial dot type + " 3: set by "lookup" + " last word is value?? \ No newline at end of file diff --git a/src/sys/sop.s b/src/sys/sop.s index 124ee9d..047a1ba 100644 --- a/src/sys/sop.s +++ b/src/sys/sop.s @@ -25,7 +25,7 @@ sma = 0740100 " OPR: skip on minus AC sza = 0740200 " OPR: skip on zero AC snl = 0740400 " OPR: skip on non-zero link skp = 0741000 " OPR: skip unconditionally -sna = 0741200 " OPR: skip on negative AC +sna = 0741200 " OPR: skip on non-zero AC szl = 0741400 " OPR: skip on zero link rtl = 0742010 " OPR: rotate two left rtr = 0742020 " OPR: rotate two right diff --git a/tools/as7 b/tools/as7 index 943121b..e9ecdda 100755 --- a/tools/as7 +++ b/tools/as7 @@ -298,14 +298,14 @@ sub process_label { # (: and ; can appear in char literals) # handles multiple ';' separated words per line sub parse_line { - # Lose any leading whitespace - $line =~ s{^\s*}{}; - while (1) { $line_error = ' '; # clear listing error indicator return if ($line eq '' || $line =~ m{^"}); # empty or comment: quit + # Lose any leading whitespace + $line =~ s{^\s*}{}; + print "parse_line: '$line'\n" if ($debug); while ($line =~ s{^([a-z0-9\.]+):\s*}{}) { # labels