1: rti = 2
   2: .globl rm
   3: .globl ck
   4: .globl loop
   5: .globl oct
   6: .globl argc
   7: .globl arg
   8: .globl tfiget
   9: .globl asmem
  10: .globl qflag
  11: .globl vflag
  12: .globl getspq
  13: .globl q
  14: .globl ask
  15: .globl getword
  16: .globl r
  17: .globl w
  18: .globl  output
  19: .globl buffer
  20: .globl bufend
  21: .globl fv
  22: .globl  getsp
  23: .globl release
  24: .globl nothere
  25: .globl getn
  26: .globl getchar
  27: .globl rewind
  28: .globl iflag
  29: .globl inter
  30: /	output buffer
  31: /	r2 = last char in buffer + 1
  32: /	r2 returned at beginning of buffer
  33: /
  34: output:
  35:         sub     $buffer,r2
  36:         blos    1f
  37:         mov     r2,0f
  38:         mov     $1,r0
  39:         sys     write; buffer; 0:..
  40:         mov     $buffer,r2
  41: 1:
  42:         rts     pc
  43: /
  44: /
  45: /	routine to find the string pointed to by r0
  46: /	in either memory or curly
  47: /	r1 = where to look
  48: /
  49: /	returns error set if string not there
  50: /	returns r1 = header of string if there
  51: getsp:
  52:         mov     r0,-(sp)
  53:         mov     asmem,r1
  54:         jsr     pc,rewind       /memory
  55: 3:
  56:         jsr     pc,getword
  57:         bes     1f
  58:         mov     r0,r1
  59:         jsr     pc,rewind
  60:         mov     (sp),r2
  61: 2:
  62:         jsr     pc,getchar
  63:         bes     2f
  64:         tstb    (r2)
  65:         beq     4f
  66:         cmpb    r0,(r2)+
  67:         beq     2b
  68: 4:
  69:         mov     asmem,r1
  70:         add     $2,r(r1)
  71:         br      3b
  72: 2:
  73:         tstb    (r2)
  74:         bne     4b
  75:         mov     r1,r2
  76:         mov     asmem,r1
  77:         jsr     pc,getword
  78:         tst     (sp)+
  79:         rts     pc
  80: 1:
  81:         mov     (sp)+,r0
  82:         sec
  83:         rts     pc
  84: /
  85: /	finds header of string with name same as that pointed to by r0
  86: /	taking into account ? and *
  87: getspq:
  88:         mov     r0,-(sp)
  89:         mov     asmem,r1
  90:         tst     qflag
  91:         bgt     1f
  92:         jsr     pc,rewind
  93: 1:
  94:         jsr     pc,getword
  95:         bes     1f
  96:         mov     r0,r1
  97:         jsr     pc,rewind
  98:         mov     (sp),r2
  99: 2:
 100:         cmpb    (r2),$'*
 101:         bne     3f
 102:         clr     strflg
 103:         mov     $2,qflag
 104:         inc     r2
 105:         tstb    (r2)
 106:         beq     6f
 107:         mov     r2,ch
 108: 3:
 109:         jsr     pc,getchar
 110:         bes     2f
 111:         tstb    (r2)
 112:         bne     3f
 113:         cmp     $2,qflag
 114:         bne     4f
 115:         mov     ch,r2
 116: 3:
 117:         cmpb    (r2),$'?
 118:         bne     3f
 119:         inc     r2
 120:         tst     qflag
 121:         bne     2b
 122:         mov     $1,qflag
 123:         br      2b
 124: 3:
 125:         cmpb    r0,(r2)+
 126:         bne     5f
 127:         inc     strflg
 128:         br      2b
 129: 5:
 130:         cmp     $2,qflag
 131:         bne     4f
 132:         tst     strflg
 133:         bne     4f
 134:         dec     r2
 135:         br      2b
 136: 4:
 137:         mov     asmem,r1
 138:         add     $2,r(r1)
 139:         br      1b
 140: 2:
 141:         tstb    (r2)
 142:         bne     4b
 143: 6:
 144:         mov     r1,r2
 145:         mov     asmem,r1
 146:         jsr     pc,getword
 147:         tst     (sp)+
 148:         rts     pc
 149: 1:
 150:         mov     $-1.,qflag
 151:         mov     (sp)+,r0
 152:         sec
 153:         rts     pc
 154: /
 155: /	tfiget
 156: /	jsr	r5,tfiget
 157: /
 158: tfiget:
 159:         clr     r0
 160:         sys     read; ch; 1
 161:         bes     1f
 162:         tst     iflag
 163:         beq 9f; jmp loop; 9:
 164:         tst     r0
 165:         beq     1f
 166:         movb    ch,r0
 167:         rts     pc
 168: 1:      jmp     q
 169: /
 170: /	routine to print file name and error message
 171: /	r2 = next free byte in buffer
 172: /
 173: nothere:
 174:         mov     $buffer,r2
 175: 1:
 176:         tstb    (r1)
 177:         beq     1f
 178:         movb    (r1)+,(r2)+
 179:         br      1b
 180: 1:
 181:         sub     $buffer,r2
 182:         mov     r2,0f
 183:         mov     $1,r0
 184:         sys     write; buffer; 0:..
 185:         mov     $1,r0
 186:         sys     write; err4; 16.
 187:         rts     pc
 188: /
 189: /
 190: /	routine to put characters from string in buffer
 191: /	r1 = header of string
 192: /	on return r2 = next free byte in buffer
 193: /
 194: getn:
 195:         mov     $buffer,r2
 196:         jsr     pc,rewind
 197: 1:
 198:         jsr     pc,getchar
 199:         bes     1f
 200:         movb    r0,(r2)+
 201:         cmp     r2,$bufend
 202:         bhis    1f
 203:         br      1b
 204: 1:      rts     pc
 205: /
 206: ask:
 207:         mov     r2,-(sp)
 208:         mov     r0,r1
 209:         jsr     pc,getn
 210:         movb    $' ,(r2)+
 211:         jsr     pc,output
 212:         jsr     pc,tfiget
 213:         cmpb    $'\n,r0
 214:         bne     1f
 215: 2:
 216:         mov     asmem,r1
 217:         add     $2,r(r1)
 218:         mov     (sp)+,r2
 219:         sec
 220:         rts     pc
 221: 1:
 222:         cmpb    r0,$'y
 223:         beq     4f
 224:         cmpb    r0,$'q
 225:         beq     3f
 226: 1:
 227:         tst     iflag
 228:         bne     2b
 229:         jsr     pc,tfiget
 230:         cmpb    $'\n,r0
 231:         bne     1b
 232:         br      2b
 233: 4:
 234:         tst     iflag
 235:         bne     2b
 236:         jsr     pc,tfiget
 237:         cmpb    $'\n,r0
 238:         bne     1b
 239:         mov     asmem,r1
 240:         mov     (sp)+,r2
 241:         clc
 242:         rts     pc
 243: 3:
 244:         tst     iflag
 245:         bne     2b
 246:         jsr     pc,tfiget
 247:         cmpb    $'\n,r0
 248:         bne     1b
 249:         mov     (sp)+,r2
 250:         jmp     loop
 251: inter:
 252:         inc     iflag
 253:         rti
 254: /	to remove an entry from asmem - r points to name ptr
 255: /
 256: rm:
 257:         mov     r3,-(sp)
 258:         mov     asmem,r1
 259:         mov     r(r1),r3
 260:         sub     $4,r(r1)
 261:         mov     r(r1),r2
 262:         mov     r2,-(sp)
 263: 1:
 264:         mov     r3,r(r1)
 265:         jsr     pc,getword
 266:         bes     1f
 267:         mov     r(r1),r3
 268:         mov     r2,r(r1)
 269:         jsr     pc,alterword
 270:         mov     r(r1),r2
 271:         br      1b
 272: 1:
 273:         mov     r2,w(r1)
 274:         mov     (sp)+,r(r1)
 275:         mov     (sp)+,r3
 276:         rts     pc
 277: /
 278: /	check that header pointed to by r2 released
 279: /
 280: ck:
 281:         mov     r2,-(sp)
 282:         mov     l(r2),r0
 283:         sub     a(r2),r0
 284:         sub     $hblk,r2
 285:         jsr     pc,log2
 286:         asl     r0
 287:         mov     r0,ch
 288:         mov     frlist(r0),r0
 289: 1:
 290:         beq     1f
 291:         cmp     r2,r0
 292:         beq     2f
 293:         add     $hblk,r0
 294:         mov     (r0),r0
 295:         br      1b
 296: 2:
 297:         mov     ch,r0
 298:         inc     freeb(r0)
 299:         mov     (sp)+,r2
 300:         rts     pc
 301: 1:
 302:         mov     (sp)+,r2
 303:         sec
 304:         rts     pc
 305: oct:
 306:         mov     r1,-(sp)
 307:         mov     r0,r1
 308:         clr     r0
 309:         div     $8.,r0
 310:         mov     r1,-(sp)
 311:         add     $'0,(sp)
 312:         tst     r0
 313:         beq     1f
 314:         jsr     r5,oct
 315: 1:
 316:         movb    (sp)+,ch
 317:         mov     $1,r0
 318:         sys     write; ch; 1
 319:         mov     (sp)+,r1
 320:         rts     r5
 321: 
 322: decml:
 323:         mov     r1,-(sp)
 324:         mov     r0,r1
 325:         clr     r0
 326:         div     $10.,r0
 327:         mov     r1,-(sp)
 328:         add     $'0,(sp)
 329:         tst     r0
 330:         beq     1f
 331:         jsr     r5,decml
 332: 1:
 333:         movb    (sp)+,ch
 334:         mov     $1,r0
 335:         sys     write; ch; 1
 336:         mov     (sp)+,r1
 337:         rts     r5
 338: /
 339: /
 340: iflag:  0
 341: qflag:  0
 342: vflag:  0
 343:         .data
 344: err4:   < not in memory.\n>
 345: err1:   <Cannot open file >
 346: end1:   .even
 347:         .bss
 348: freeh:  .=.+2
 349: freeb:  .=.+32.
 350: freen:
 351: ch:     .=.+2
 352: strflg: .=.+2
 353: buffer: .=.+512.
 354: bufend: .=.+2
 355: argc = buffer + 20.
 356: arg = buffer + 256.
 357: fv:     .=.+2
 358:         .text

Defined functions

ask declared in line 14; defined in line 206; used 2 times
ck declared in line 3; defined in line 280; used 3 times
decml defined in line 322; used 1 times
getn declared in line 25; defined in line 194; used 3 times
getsp declared in line 22; defined in line 51; used 5 times
getspq declared in line 12; defined in line 87; used 5 times
iflag declared in line 28; defined in line 340; used 19 times
inter declared in line 29; defined in line 251; used 3 times
nothere declared in line 24; defined in line 173; used 3 times
oct declared in line 5; defined in line 305; used 4 times
output declared in line 18; defined in line 34; used 13 times
qflag declared in line 10; defined in line 341; used 14 times
rm declared in line 2; defined in line 256; used 4 times
tfiget declared in line 8; defined in line 158; used 7 times
vflag declared in line 11; defined in line 342; used 12 times

Defined variables

arg declared in line 7; defined in line 356; used 9 times
argc declared in line 6; defined in line 355; used 3 times
bufend declared in line 20; defined in line 354; used 8 times
buffer declared in line 19; defined in line 353; used 27 times
ch defined in line 351; used 10 times
end1 defined in line 346; never used
err1 defined in line 345; never used
err4 defined in line 344; used 1 times
freeb defined in line 349; used 1 times
freeh defined in line 348; never used
freen defined in line 350; never used
fv declared in line 21; defined in line 357; used 1 times
  • in line 21
strflg defined in line 352; used 3 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 564
Valid CSS Valid XHTML 1.0 Strict