diff --git a/notes.txt b/notes.txt index 0a04fe2..f128971 100644 --- a/notes.txt +++ b/notes.txt @@ -83,6 +83,16 @@ e00-06 e00-10 - left "/ect/init" typo -------------------- +e09-01 + - I'm using tabs between opcode and operands now + - left "bic $!77,r1" although written comment says "? !177" +e09-02 + - left "movb tty+38r0),r1" as is. There's a write in + correction for "(" instead of "8". This concerns me as it + means there are probably some errors in this listing as + the paren is most likely the right character here. + +-------------------- e10-01 e10-02 - I used tabs for the first tab stop and spaced out to the next step. diff --git a/pages/e09-01 b/pages/e09-01 new file mode 100644 index 0000000..b32e309 --- /dev/null +++ b/pages/e09-01 @@ -0,0 +1,56 @@ +/ u9 -- unix + +trcv: + jsr rO,1f + jsr rO,1f + jsr rO,1f + jsr rO,1f + jsr rO,1f + jsr rO,1f + jsr rO,1f + jsr rO,1f +1: + mov r1,-(sp) + mov r2,-(sp) + mov r3,-(sp) + mov clockp,-(sp) + mov $s.syst+2,clockp + sub $trcv+4,r0 / 0%4 / calculate offset for tty causing + asl r0 / 0%8 / this interrupt + mov rcsr(r0),r2 + mov rcbr(r0),r1 + tst r2 + blt 1f / error + tst tty+6(r0) + beq 1f + bit $40,r2 / parlty + bne 3f / branch if set + tstb tty+4(r0) + blt 4f / 37 parity not allowed + br 2f +3: + bitb $100,tty+4(r0) + beq 2f / non-37 parity not allowed +4: + bic !77,r1 + bit $40,tty+4(r0) + bne 3f / raw + cmp r1,$177 + beq 5f + cmp r1,$34 + bne 3f +5: + mov tty+6(rO),r0 + beq 2f + movb r1,6(r0) / interrupt or quit + jsr r0,wakeall + br 2f +3: + cmp r1,$15 / or + bne 3f + bit $20,tty+4(r0) + beq 3f + mov $12,r1 +3: + bitb $4,tty+4(r0) + diff --git a/pages/e09-02 b/pages/e09-02 new file mode 100644 index 0000000..e7451d1 --- /dev/null +++ b/pages/e09-02 @@ -0,0 +1,56 @@ + beq 3f + cmp r1,$'A + blo 3f + cmp r1,$'Z + bhi 3f + add $40,r1 +3: + movb tty+3(r0),0f + jsr rO,putc; 0:.. / put char on input clist + br 2f + bitb $10,tty+4(r0) / echo + bne 4f / branch echo bit set + cmp r1,$12 + bne 3f + bitb $20,tty+4(r0) / cr + beq 3f +4: + cmp r1,$4 / is char input an eot + beq 1f + mov r1,-(sp) / put char on stack + movb tty+3(r0),0f + inc 0f + jsr r0,putc; 0:.. / put char just input on output clist + bx: .+2 + jsr r0,starxmt + mov (sp)+,r1 +3: + bitb $40,tty+4(r0) / raw + bne 1f / branch if raw bit set + cmp r1,$12 + beq 1f + movb tty+38r0),r1 + cmpb cc(r1),$15. + blo 2f +1: + movb tty+3(r0),0f + jsr r0,wakeup; runq; 0:.. / call wakeup for process +2: + jmp retisp +txmt: + jsr r0,1f + jsr r0,1f + jsr r0,1f + jsr r0,1f + jsr r0,1f + jsr r0,1f + jsr r0,1f + jsr r0,1f +1: + mov r1,-(sp) + mov r2,-(sp) + mov r3,-(sp) + mov clockp,-(sp) + mov $s.syst+2,clockp + sub $txmt+4,r0 / 0%4 / offset in cc + diff --git a/pages/e09-03 b/pages/e09-03 new file mode 100644 index 0000000..2928179 --- /dev/null +++ b/pages/e09-03 @@ -0,0 +1,55 @@ +asl r0 / 0%8 +jsr r0,starxmt +jmp retisp +xmttoz +mov r0,—(sp) +mov 2(sp),:O / O%2+6 +sub $5,rO +asl r0 +asl ro / 09622 +jsr r0,starxmt +mov (sp)+,20 +rts rO +starxmt: +mov (sp),r1 / 0%8 r1 contains Bxtty number _ _ +movb tty+3(r1),r1 / place contents of 4th byte of tty +/ buf in r1 (cc,cf,cl offset) +cmpb cc+1(r1),$10. / is char count for tty output greater +/ than or equal to 10 +bbl 1f / yes N N +mov r1,0f / no, make offset an arg of wakeup +inc Of / increment arg of wakeup +jsr rO,wakeup; runq+2; 0:.. / wakeup process identified +/ by wlist +1: / entry specified by argument in O: +mov (sp),r1 / O%B / r1 contains Bxtty number +asr r1 +asr r1 +asr r1 / OZ1 r1 contalns tty number +tstb toutt+3(r1) / is tout entry for tty output e 0 +bne 1f / no, return to calling routine +mov (sp),r2 / yes, place (Bxtty number) lnto r2 +tstb tcsr(r2) / does tt 's tcsr register = O (ls ready +/ mt e 0{ +bge 1f / yes, return to calling routine _ " +movb tty+2(r2),r1 / no, place third byte of tty buf +/ into r1 (char left over after lf) +clrb tty+2(r2) / clear third byte +tst r1 / is third byte = 0 +bne 3f / no, r1 contains a non nul character “ +movb tty+3(r2),O£ / yes, make byte 4 arg of getc +inc Of / increment arg to make it tty output list of +/ clist +jsr r0,getc; 0:.. / obtain next character ln cllst for tty +/ out and place in r1 +br 1f / if no entry in cllst to be output, return to +/ calling routine +3: +bic $!177,r1 / zero out blts 7-1§ of r1 +movb partab(r1),r3 / move partab entry (identified by +/ r1) into r3 +bge 3f / if entry 1s greater than or equal to 0 (digit +/ 2, far left digit : 0) branch +bisb 200,r1 / lf entry is less than O add 128 to ASC11 +/ code for char to be output + diff --git a/pages/e09-04 b/pages/e09-04 new file mode 100644 index 0000000..94d4fd2 --- /dev/null +++ b/pages/e09-04 @@ -0,0 +1,56 @@ +blc $I177,r3 / to make it teletype code and then clear +/ bits 7-15 of r3 +3: +mov (sp),r2 / rz contains Bxtty number +blt $4,1.·czr(r2) / 1s carrier present for tty +beq starxmt / no carrler flush +mov :1,-(sp) ,/ yes, place character to be output on stack +cmp r1,$11 / is character ht +bne 3f / no +bltb $2,tty+4(r2) / ls tab to space flag_for_tty set +/ (blt 1 of byte 5 in tty buffer area) +beq 3f / no +mov $240,(sp) / yes, change character to space +3: +mov (sp)+,tcbr(r2) / place char to be output in tty output +/ buffer __ _ +add $tty+1,r2 / place addr of 2nd byte of tty buf +jmp 1f-2(r3) ; area in r2 (which is the column count) and +then +lncb (r2) / normal / jmp to location determined by digits +/ 0 and 1 of character's entry in partab which +I, / / is now in r3 +, rts r0 non—pr:Lntlng +br 1f / bs +br 2f / nl (llne feed) +br 3f / tab (horizontal tab) +br 4f / vert (vertical tab) +br 5f / cr +1: __ _ +decb (r2) f col decrement column count ln byte 2 of tty +area +bge 1f / if count >O return to calllnq routine +clrb (r2) / col set column count = 0 +br 1f +2: +blt $1,r1 / is bit 0 of ASC11 char = 1 (char = lf) +bne 2f / es __ +bitb $20,3(r2) / cr flag is blt 4 of Sth byte of "tty +/ area = 1 +beq 2f / no (only lf to be handled) n __ +movb $15,1(r.‘2) / place cr in 3rd byte of __tty area +/ (character leftover after lf ) +2: +movb (r2),r3 / place present column count in r3 +beq 1f / return to calling routlne if count = 0 +clrb (r2) / col clear column count +asr r3 +asr r3 +asr r3 +asr r3 / delay = col/16 +add $;,r3 / start to determine tout entry for tty output +br 2 +3: _ __ +bitb $2,3(r2) / is blt 1 of 5th byte of tty area e 1 +/ (tab to space blt set) + diff --git a/pages/e09-05 b/pages/e09-05 new file mode 100644 index 0000000..a0d8442 --- /dev/null +++ b/pages/e09-05 @@ -0,0 +1,55 @@ +beq 3f / no +lncb (r2) / increment column count +bltb $7,(r2) / are bits D, 1 and 2 set at col GEF +beq 1f / no +movb $11,1(r2) / yes, place ht in another tab next time +br if / grdubyte of tty area (character left over after +/ 1f .) +3: +movb (r2),r3 / place column count ln r3 +blsb $7,(r2) / make bits O, 1 and 2 of column count :1 +lncb (r2) / increment column count +bis $l7,r3 / clear bits 3-15 of r3 +neg r3 / delay e dcol start to determine tout entry for +/ tty out +br 2f / by neg r3 +4: +mov $176.,r3 / delay = lots start to determine tout entry +br 2f +5: +mov s10.,r3 f cr delay 160ms for tn30D start to determine +tout +clrb (r2) / set column count = 0 entry +2: +add $5,r3 / time for this char increment value for tout +/ entry by 5 ) +mov (sp),r2 / O%B r2 contains Sxtty number +asr r2 +asr r2 - +asr r2 / O%1 r2 contains tty number +movb r3,toutt+3(r2) / place value for tout entry into tout +/ table +1: +rts rO / return +partab: / contains 3 digits for each character; digit 2y1s used +/ to determine lf 200 is to added to ASC11 code digits 0 +/ and 1 are used to determine value for jump table. +.byte 002,202,202,002,002,002,002,202 +.byte 204,010,006,212,012,214,202,0¤2 gpl' +.byte 202,0D2,002,202,002,602,202,002 ]wZV”4” Nut +.byte 0O2,202,202,002,202,002,0U2,202 +.byte 200,000,000,200,000,200,200,000 +.byte 000,200,200,000,200,000,000,20O +.byte OOO,200,200,00G,200,000,000,2OO +.byte 200,000,000,200,000,200,200,000 +.byte 200,000,000,200,000,200,200,000 +.byte 000,200,200,000,200,000,000,200 +.byte OOO,200,200,000,200,000,000,200 +.byte ZOO,'U0,000,200,000,200,200,000 +.byte OOC,¥OO,ZO0,000,200,000,00U,2OO +.byte 200,000,000,200,000,200,200,000 +.byte 200,000,000,200,DO0,200,200,000 +.byte OOO,200,200,000,200,000,000,2D2 +xmtt: * +jar r0,cpass / get next character from user buffer area + diff --git a/pages/e09-06 b/pages/e09-06 new file mode 100644 index 0000000..871b540 --- /dev/null +++ b/pages/e09-06 @@ -0,0 +1,56 @@ +tst r1 / is character nul +beq xmtt / yes, get next character +1: +mov $240,*sps / set processor priority equal to 5 +mov (sp),r2 / r2 contains 1 node number of file +asl :2 / O%2+2B / multlply inode number by 2 +sub $21.,::2 / 0%247 / subtract 21 from 2x inumber to +/ get cc, cf, cl offset +mov r2,0f / make offset arg of putc +cmpb cc(r2),$50. / is char count for device greater than +/ or equal to SO +bhls 2f / yes +jsr r0,putc; 0:.. / find locatlcn in freelist to assign to +/ device and +br 2f / place char in list, if none available branch +/ to put process to sleep +mov :0,-(sp) / place calling routines return address on +/ stack +mov Ob,rO / place offset into cc, cl and cf tables in rO +sub $7,rO / subtract seven from offset +asl :0 / multiply by 2 +asl r0 / 0%8 / multiply by 2 (r0 contains Bxtty number) +jar r0,starxmt / attempt to output character +mov (sp)+,r0 / pop stack +br xmtt / get next character +2: +mov r1,—(sp) / place character on stack +mov Ob,Of / make offset into cc, cf, cl table arg of +/ sleep (identifies location in wlist) +jsr rD,sleep; 0:.. / put process to sleep +mov (sp)+,r1 / remove character from stack +br 1b / try again +rcvt: / read tty +sub $28.,1:*1 / 0962 r1 contains Zxtty number +asl :1 +asl r1 / r1 contains Bxtty number +mov r1,—(sp) +mov tty+6(r1),r5 / r5 contains address of 4th word in +/ tty area +tst 2(rS) / is char count e 0 +bne 1f / no +bltb $40,tty+4(r1) / raw flag set? +beq 2f / no +tst —(sp) / yes, decrement sp +js: rO,rcvch / get character from cllst +tst (sp)+ / increment sp +mov (59)+;:*2 / r2 contains Bxtty number +bltb $4,rcsr(r2) / is carrier detect bit on +beq 3f / no +jsr r0,passc / yes, place character in users buffer area +3: +jmp ret +2: +jsr r0,canon; rcvch / process a line of characters in +/ cllst and place results in tty buffer + diff --git a/pages/e09-07 b/pages/e09-07 new file mode 100644 index 0000000..182168a --- /dev/null +++ b/pages/e09-07 @@ -0,0 +1,55 @@ +/ area +1: +tst (sp)+ / increment sp +1: +tst 2(r5) / is char count for tty buffer = 0 +beg 1f / yes +movb *4(r5),r1 / no, move character pointer to r1 +inc 4(r5) / increment character pointer +dec 2(r5) / decrement character count +jsr rO,passc § place character, whose address is in +r1, in +br 1b / user buffer area. Then get next character. +1: +jmp ret +rcvch: +mov 4(sp),r2 / O%B r2 contains Sxtty number +mov $4,r1 +bit r1,rcsr(r2) / is carrier detection bit on +bne 1f / yes +bic $1,rcsr(r2) / no, clear data terminal ready bit +rts rO +1: +movb tty+3(r2),Of / make cc offset arg for ugetcu +mov $240,*$ps / set processor priority = 5 +jsr r0,qetc; 0:.. / get next character off clist +br 2f / clist empty +clr *$ps / set processor priority = O +rts r0 +2= W N .. n +mov 0b,Of / make getc arg an arg for sleep +mov :5,-(sp) / save tty buffer address on stack +jsr rO,sleep; 0:.. +mov (sp)+,r5 +br rcvch +ocvt: +sub $2S.,r1 / O%2 calculate tty table offset +mov r1 ,1*2 +an r1 / 0%:1 +asl t1 / O%B +mov 1:1,—(sp) +add $6,r2 / calculate clist id clist offset +movb r2,tty+3(r1) / pu: clist id 1n tty table +1: +mov (sp),r1 +bit $4,rcsr(r1) / carrier detect bit set +bne 1f / if so, branch +mov $511,rcsr(r1) / set ready, speed, interrupt enable, +/ supervisor transmit +movb tty+3(r1),Df / put clist id in sleep argument +jsr rO,s1eep; 0;.. +br 1b +1: +mov tty+6(r1),r5 / put tty buffer address in r5 +tstb (rE) / first byte of tty buffer e 0 + diff --git a/pages/e09-08 b/pages/e09-08 new file mode 100644 index 0000000..17f5c3b --- /dev/null +++ b/pages/e09-08 @@ -0,0 +1,21 @@ + bne 1f / if not, branch + mov $511,rcsr(r1) / set control bits for receiver + mov $511,tcsr(r1) / set control bits for transmitter + mcvb $210,tty+4(r1) / put 210 in tty table word 3 / set flags +1: + incb (r5) / inc first byte of tty buffer + tst (sp)+ + tst u.ttyp / is there a process control tty + bne 1f / yes, then branch + mov r5,u.ttyp / no, make this tty the process control tty + br 1f / return + +ccvt: + sub $28.,r1 + asl r1 / 0%4 + asl r1 + mov tty+6(r1),r5 + decb (r5) +1: + jmp sret +