1: / 2: / 3: 4: / fx8 -- read source line 5: 6: .globl getline 7: .globl isagn 8: .globl levzer 9: 10: .globl error 11: .globl getc 12: .globl chrtab 13: 14: getline: 15: mov r3,-(sp) 16: clr holquo 17: clr r3 / line number 18: clr line 19: mov $line,r1 20: 1: 21: jsr pc,get 22: sub $'0,r0 23: cmp r0,$9 24: bhi 1f 25: mpy $10.,r3 26: add r0,r3 27: br 1b 28: 1: 29: add $'0,r0 30: movb r0,ch 31: mov r3,efno 32: 1: 33: mov lino, ifno 34: inc ifno 35: jsr pc,get 36: cmp r0,$'\n / nl 37: beq 1f 38: cmp r0,$'' 39: beq 2f 40: cmp r0,$'" 41: bne 3f 42: 2: 43: mov r0,holquo 44: add $4,r1 / room for h count 45: mov r1,-(sp) 46: 2: 47: jsr pc,get 48: cmp r0,$'\n 49: beq 4f 50: cmp r0,holquo 51: beq 2f 52: bis $200,r0 53: movb r0,(r1)+ 54: cmp r1,$eline-1 55: blo 2b 56: 4: 57: tst (sp)+ 58: br err1 59: 2: 60: mov (sp)+,r3 61: mov r1,-(sp) 62: sub r3,r1 63: movb $'h,-(r3) 64: clr r0 65: div $10.,r0 66: add $'0,r1 67: movb r1,-(r3) 68: mov r0,r1 69: clr r0 70: div $10.,r0 71: add $'0,r1 72: movb r1,-(r3) 73: add $'0,r0 74: movb r0,-(r3) 75: mov (sp)+,r1 76: clr holquo 77: br 1b 78: 3: 79: cmp r0,$'h 80: bne 2f 81: clr r3 / quote count 82: mov r1,-(sp) 83: 3: 84: cmp r1,$line 85: blos 4f 86: movb -(r1),r0 87: cmpb chrtab(r0),$4 / digit? 88: beq 3b 89: cmpb chrtab(r0),$2 / test letter 90: beq 3f 91: cmp r0,$'* 92: beq 3f 93: inc r1 94: 4: 95: cmp r1,(sp) 96: bhis 4f 97: movb (r1)+,r0 98: sub $'0,r0 99: mpy $10.,r3 100: add r0,r3 101: br 4b 102: 4: 103: mov r3,r0 104: beq 3f 105: mov r0,holquo 106: mov (sp)+,r1 107: movb $'h,(r1)+ 108: 4: 109: jsr pc,get 110: cmp r0,$'\n 111: bne 5f 112: mov r0,ch 113: mov $' ,r0 114: 5: 115: bis $200,r0 116: movb r0,(r1)+ 117: cmp r1,$eline-1 118: bhis err1 119: dec holquo 120: bne 4b 121: br 1b 122: 3: 123: mov (sp)+,r1 124: mov $'h,r0 125: 2: 126: movb r0,(r1)+ 127: cmp r1,$eline-1 128: blo 1b 129: err1: 130: jsr r5,error; 1. 131: 1: 132: clrb (r1)+ 133: mov (sp)+,r3 134: tstb line 135: bne 1f 136: jmp getline 137: 1: 138: rts r5 139: 140: isagn: 141: jsr r5,levzer; '= 142: br 1f 143: br 3f 144: 1: 145: mov r0,-(sp) 146: jsr r5,levzer; ', 147: br 4f 148: jsr r5,levzer; '( 149: br 1f 150: tst (sp)+ 151: 2: 152: rts r5 153: 1: 154: cmp (sp)+,r0 155: blt 2b 156: mov r1,-(sp) 157: mov r0,r1 158: inc r1 159: jsr r5,levzer; ') 160: br 1f 161: 1: 162: mov (sp)+,r1 163: cmpb 1(r0),$'= 164: bne 3f 165: rts r5 166: 167: levzer: 168: mov r1,r0 169: clr -(sp) 170: 1: 171: tst (sp) 172: bne 2f 173: cmpb (r0),(r5) 174: beq 1f 175: 2: 176: cmpb (r0),$'( 177: bne 2f 178: inc (sp) 179: 2: 180: cmpb (r0),$') 181: bne 2f 182: dec (sp) 183: blt 5f 184: 2: 185: tstb (r0)+ 186: bne 1b 187: 5: 188: tst (r5)+ 189: 1: 190: 4: 191: tst (sp)+ 192: 3: 193: tst (r5)+ 194: rts r5 195: 196: get: 197: movb ch,r0 198: beq 1f 199: clrb ch 200: rts pc 201: 1: 202: jsr pc,get1 203: cmp r0,$'\n 204: bne 2f 205: jsr pc,get1 206: cmp r0,$'& 207: beq 1b 208: movb r0,ch1 209: mov $'\n,r0 210: 2: 211: tst holquo 212: bne 1f 213: cmp $' ,r0 214: beq 1b 215: cmp $'\t,r0 216: beq 1b 217: 1: 218: cmp r0,$4 / test EOT 219: bne 1f 220: mov $1,r0 221: sys write; mes; emes-mes 222: mov $1,r0 / syntax errors detected 223: sys exit 224: 1: 225: rts pc 226: 227: get1: 228: movb ch1,r0 229: beq 1f 230: clrb ch1 231: br 2f 232: 1: 233: jsr r5,getc; ibuf 234: bcs 1f 235: bic $!177,r0 236: beq 1b 237: cmp r0,$'\n 238: bne 2f 239: inc lino 240: 2: 241: tst nlflg 242: beq 2f 243: clr nlflg 244: cmp r0,$'c 245: bne 2f 246: 3: 247: jsr pc,get1 248: cmp r0,$'\n 249: beq 1b 250: cmp r0,$4 251: bne 3b 252: 2: 253: cmp r0,$'\n 254: bne 2f 255: inc nlflg 256: 2: 257: rts pc 258: 1: 259: mov $4,r0 260: rts pc 261: 262: .data 263: nlflg: 1 264: .text 265: mes: 266: <EOF on input\n\0> 267: emes: 268: .bss 269: lino: .=.+2