1:         .title  code
   2: 
   3:         .ident  /10may4/
   4: 
   5:         .mcall  (at)always,st.flg,xmit,zwrite
   6:         always
   7:         st.flg
   8: 
   9:         .mcall  (at)genedt,setnz,next,append,zap,error
  10: 
  11:         .globl  objchn, objlen
  12:         .globl  savreg, ioftbl, buftbl, cnttbl
  13: 
  14:         .globl  dmprld, endp1c, endp2c, pcroll, prgttl
  15:         .globl  setdsp, setimm, setrld, stcode
  16: 
  17:         .globl  abserr, clcloc, clcnam, clcsec
  18:         .globl  codrol, endvec, mode,   objsec
  19:         ;.globl	pass,	psaflg,	rolupd,	secrol
  20:         .globl  pass,   rolupd, secrol
  21:         .globl  sector, setpf0, setpf1, setsec, setxpr
  22:         .globl  symbol, symrol, value
  23:         .globl  edmask, ed.abs, ed.pnc
  24:         .globl  dflgbm, opclas
  25: cc.opr  =       040
  26: cc.nam  =       020
  27: cc.sec  =       010
  28: cc.val  =       004
  29: cc.dsp  =       002
  30: 
  31: 
  32: gsdt00= 00*400          ; object module name
  33: gsdt01= 01*400          ; program section name
  34: gsdt02= 02*400          ; internal symbol table
  35: gsdt03= 03*400          ; transfer address
  36: gsdt04= 04*400          ; symbol declaration
  37: gsdt05= 05*400          ; local section name
  38: gsdt06= 06*400          ; version identification
  39: 
  40: blkt01= 01              ; gsd
  41: blkt02= 02              ; gsd end
  42: blkt03= 03              ; text block
  43: blkt04= 04              ; rld block
  44: blkt05= 05              ; isd
  45: blkt06= 06              ; module end
  46: blkt17= 17
  47:         .sbttl  expression to code-roll conversions
  48: 
  49:         xitsec                  ;start in default psect
  50: 
  51: setimm:                         ;
  52:         call    savreg
  53:         call    setxpr
  54:         clr     -(sp)
  55:         bitb    #glbflg,(r3)
  56:         bne     setds3
  57:         bit     #relflg,(r3)
  58:         beq     setdsx
  59:         cmpb    (r2),clcsec
  60:         bne     setds1
  61:         bis     #cc.sec,(sp)
  62:         br      setdsx
  63: 
  64: setdsp:
  65:         call    savreg
  66:         call    setxpr
  67:         mov     #cc.dsp,-(sp)
  68:         bit     #glbflg,(r3)
  69:         bne     setds3
  70:         cmpb    (r2),clcsec
  71:         beq     setds2
  72:         bit     #relflg,(r3)
  73:         beq     setdsx
  74: setds1: call    setsec
  75:         bis     #cc.sec!cc.nam,(sp)
  76:         br      setdsx
  77: 
  78: setds2: clr     (r3)
  79:         clr     (sp)
  80:         movb    <^pl rolsiz>+codrol+1,r0
  81:         ;movb	@(pc)+,r0
  82:         ; .word	<^pl rolsiz>+codrol+1
  83:         inc     r0
  84:         asl     r0
  85:         add     clcloc,r0
  86:         sub     r0,(r4)
  87:         br      setdsx
  88: 
  89: setds3: bis     #cc.nam,(sp)
  90: setdsx: bit     #dflgbm,opclas
  91:         beq     4$
  92:         tstb    (r4)+
  93:         movb    (r4),r0
  94:         beq     1$
  95:         inc     r0
  96:         bne     2$
  97: 1$:     bit     #cc.sec,(sp)
  98:         beq     3$
  99: 2$:     call    abserr
 100: 3$:     clrb    (r4)
 101:         bis     #200,(sp)
 102: 4$:     movb    (sp)+,(r2)
 103:         return
 104:         .globl  limit
 105: 
 106: limit:
 107:         call    setrld
 108: 1$:     inc     r3
 109:         movb    #cc.opr,(r2)+
 110:         movb    r3,(r2)+
 111:         movb    r3,(r2)+
 112:         call    dmprld
 113:         mov     #symbol,r0
 114:         clr     (r0)+
 115:         mov     r3,(r0)+
 116:         mov     #cc.nam*400,(r0)+
 117:         clr     (r0)+
 118:         call    stcode
 119:         cmp     r3,#2
 120:         blo     1$
 121:         return
 122: 
 123:         .globl  ident,  rad50
 124: ident:                          ;"ident" directive
 125:         call    rad50           ;treat as rad 50
 126:         clr     rolupd          ;point to start of code roll
 127:         mov     #prgidn,r2      ;  and to ident block
 128: 1$:     next    codrol          ;get the next entry
 129:         mov     value,(r2)+     ;stuff it
 130:         cmp     r2,#prgidn+4    ;two words?
 131:         blo     1$              ;  no
 132:         mov     #gsdt06,(r2)+   ;yes, set gsd type
 133:         zap     codrol          ;clear code
 134:         return
 135: 
 136: 
 137:         entsec  impure
 138: prgttl: .blkw   4               ;title block
 139: prgidn: .blkw   4               ;ident   "
 140:         xitsec
 141:         .sbttl  object code handlers
 142: 
 143: endp1c:                         ;end pass1 code init
 144:         tstb    ioftbl+objchn   ;any obj file?
 145:         beq     9$              ;  no
 146:         call    objini          ;init output
 147:         mov     #blkt01,@buftbl+objchn  ;set block type 1
 148:         mov     #prgttl,r1      ;set "from" index
 149:         call    gsddmp          ;output gsd block
 150:         mov     #prgidn,r1      ;point to sub-ttl buffer
 151:         tst     4(r1)           ;set?
 152:         beq     1$              ;  no
 153:         call    gsddmp          ;yes, stuff it
 154: 1$:     clr     -(sp)           ;init for sector scan
 155: 2$:     mov     (sp)+,rolupd    ;set scan marker
 156:         next    secrol          ;get the next sector
 157:         beq     6$              ;branch if through
 158:         mov     rolupd,-(sp)    ;save marker
 159:         mov     #value+2,r1
 160:         mov     (r1),-(r1)
 161:         clr     r5
 162:         bisb    -(r1),r5
 163:         movb    #gsdt05/400,(r1)
 164:         ;tst	psaflg				; who cares?  a .csect is a
 165:         ;bne	3$				;special kind of .psect
 166:         ;movb	#gsdt01/400,(r1)		; so dont need this code
 167:         ;bicb	#^c<defflg!relflg>,-(r1)	;	j reeds sept 81.
 168: 3$:     clr     rolupd          ;set for inner scan
 169: 4$:     mov     #symbol,r1
 170:         call    gsddmp          ;output this block
 171: 5$:     next    symrol          ;fetch the next symbol
 172:         beq     2$              ;  finished with this guy
 173:         bit     #glbflg,mode    ;global?
 174:         beq     5$              ;  no
 175:         bit     #regflg,mode    ;is register (prevent god's wrath)
 176:         bne     5$              ;no global registers with ==*
 177:         cmpb    sector,r5       ;yes, proper sector?
 178:         bne     5$              ;  no
 179:         bic     #^c<defflg!200!relflg!glbflg>,mode      ;clear most (leave hk up)
 180:         bis     #gsdt04,mode    ;set type 4
 181:         br      4$              ;output it
 182: 
 183: 
 184: 6$:     bic     #^c<relflg>,endvec+4    ;clear all but rel flag
 185:         bis     #gsdt03+defflg,endvec+4
 186:         mov     #endvec,r1
 187:         call    gsddmp          ;output end block
 188:         call    objdmp          ;dump it
 189:         mov     #blkt02,@buftbl+objchn  ;set "end of gsd"
 190:         call    objdmf
 191:         mov     #blkt17,@buftbl+objchn  ;init for text blocks
 192: 9$:
 193:         inc     pass            ;set for pass 2
 194:         return
 195: 
 196: 
 197: gsddmp:                         ;dump a gsd block
 198:         call    setrld
 199:         xmit    4
 200:         jmp     dmprld
 201: endp2c:
 202:         tst     objpnt          ;any object output?
 203:         beq     1$              ;  no
 204:         call    objdmp          ;yes, dump it
 205: .if     ne,mk.symbol
 206:         tst     out$ym
 207:         beq     22$
 208: .endc
 209: 32$:    mov     #blkt06,@buftbl+objchn  ;set end
 210:         call    objdmf          ;dump it
 211:         .if ndf xedabs
 212:         bit     #ed.abs,edmask  ;abs output?
 213:         bne     1$              ;  no
 214:         mov     objpnt,r0
 215:         mov     endvec+6,(r0)+  ;set end vector
 216:         mov     r0,objpnt
 217:         call    objdmp
 218:         .endc
 219: 1$:     return
 220: 
 221: .if     ne,mk.symbol
 222: 22$:    mov     #blkssym,@buftbl+objchn
 223:         clr     rolupd
 224: 3$:     next    symrol
 225:         beq     31$
 226:         bit     #glbflg,mode
 227:         bne     3$
 228:         mov     #symbol,r1
 229:         call    gsddmp
 230:         br      3$
 231: 
 232: 31$:    tst     objpnt
 233:         beq     30$
 234:         call    objdmp
 235: 30$:
 236:         call    locdmp
 237:         mov     #blksye,@buftbl+objchn
 238:         tst     objpnt
 239:         beq     32$
 240:         call    objdmf
 241:         br      32$
 242: 
 243:         entsec  impure
 244: out$ym: .blkw   1
 245:         xitsec
 246: 
 247: blksye=21
 248: blkssys=22
 249: 
 250: .globl  out$ym
 251: .endc
 252: 
 253:         .sbttl  code roll handlers
 254: 
 255: stcode: append  codrol          ;append to codrol
 256:         return
 257: 
 258:         .globl  pcrcnt
 259: pcroll:                         ;
 260:         next    codrol
 261:         beq     9$
 262:         call    savreg
 263:         movb    sector,r4
 264:         tst     pass
 265:         beq     7$
 266:         inc     pcrcnt
 267:         bne     1$
 268:         call    setpf0
 269: 1$:     call    setpf1
 270:         tst     objpnt
 271:         beq     7$
 272:         .if ndf xedpnc
 273:         bit     #ed.pnc,edmask
 274:         bne     7$
 275:         .endc
 276:         call    setrld
 277:         mov     r4,-(sp)
 278:         mov     #cc.sec!cc.nam!cc.opr,r4
 279:         cmpb    clcsec,objsec
 280:         bne     2$
 281:         cmp     clcloc,objloc
 282:         beq     3$
 283:         bic     #cc.nam,r4
 284: 2$:     mov     #clcnam,r1
 285:         call    pcrolx
 286:         clrb    (r2)+
 287:         call    dmprld
 288: 3$:     mov     (sp)+,r4
 289:         mov     #symbol,r1
 290:         call    pcrolx
 291:         call    dmprld
 292: 7$:     inc     clcloc
 293:         tstb    r4
 294:         bmi     8$
 295:         inc     clcloc
 296: 8$:     movb    clcsec,objsec
 297:         mov     clcloc,objloc
 298:         setnz   r0
 299: 9$:     return
 300: pcrolx:
 301:         movb    r4,(r2)+
 302:         bit     #cc.nam,r4
 303:         beq     3$
 304:         .rept   4
 305:         movb    (r1)+,(r2)+
 306:         .endm
 307:         cmp     -(r1),-(r1)
 308: 3$:     add     #6,r1
 309:         tst     (r1)
 310:         beq     4$
 311:         movb    (r1)+,(r2)+
 312:         bisb    #cc.val,rldtmp
 313:         tstb    r4
 314:         bmi     4$
 315:         movb    (r1)+,(r2)+
 316: 4$:     return
 317: 
 318:         entsec  implin
 319: pcrcnt: .blkw                   ;extension line flag
 320:         entsec  imppas
 321:         .odd
 322: objsec: .blkb   1               ;object file sector
 323: objloc: .blkw   1               ;object file location
 324: 
 325: 
 326: 
 327: 
 328: 
 329:         .if ndf xedpnc
 330:         genedt  pnc,pncset      ;punch control
 331: 
 332: pncset: movb    #377,objsec     ;force sequence break
 333:         return
 334:         .endc
 335: objdmp:                         ;dump the object buffer
 336:         tst     objpnt
 337:         beq     objinx          ;exit if not pre-set
 338:         mov     buftbl+objchn,r0
 339:         tst     (r0)+           ;ignore first word
 340:         cmp     objpnt,r0       ;anything in rld?
 341:         blos    objini          ;  no, just init
 342: objdmf:
 343:         mov     objpnt,@cnttbl+objchn
 344:         sub     buftbl+objchn,@cnttbl+objchn    ;compute byte count
 345:         zwrite  obj
 346: 
 347: objini: mov     buftbl+objchn,objpnt
 348:         add     #2,objpnt       ;reserve word for block type
 349: objinx: return
 350: 
 351: dmprld: tst     objpnt
 352:         beq     setrld
 353:         mov     r1,-(sp)        ;save byte count
 354:         mov     #rldtmp,r1
 355:         mov     r2,r0
 356:         sub     r1,r0
 357:         beq     9$
 358:         add     objpnt,r0
 359:         sub     buftbl+objchn,r0
 360:         cmp     r0,#objlen      ;room to store?
 361:         blos    1$              ;  yes
 362:         call    objdmp          ;no, dump current
 363: 1$:     mov     objpnt,r0       ;return with pointer in r2
 364: 2$:     movb    (r1)+,(r0)+
 365:         cmp     r1,r2
 366:         blo     2$
 367:         mov     r0,objpnt
 368: 9$:     mov     (sp)+,r1
 369: setrld: mov     #rldtmp,r2
 370:         return
 371: 
 372:         entsec  impure
 373: objpnt: .blkw
 374: rldtmp: .blkb   100.
 375:         xitsec
 376: 
 377: 
 378:         xitsec
 379:         .globl  sx.flg ,lsyrol
 380: locdmp:
 381:         call    savreg
 382:         mov     r0,-(sp)
 383:         tst     sx.flg
 384:         beq     9$
 385:         clr     rolupd
 386: 1$:
 387:         next    lsyrol
 388:         beq     2$
 389:         bit     #glbflg,mode
 390:         bne     1$
 391:         call    unlocl
 392:         mov     #symbol,r1
 393:         call    gsddmp
 394:         br      1$
 395: 2$:
 396:         tst     objpnt
 397:         beq     9$
 398:         call    objdmp
 399: 9$:
 400:         mov     (sp)+,r0
 401:         return
 402: 
 403: .globl  dnc ,chrpnt,    getsym,..z
 404: unlocl:
 405:         call    savreg
 406:         mov     r0,-(sp)
 407:         mov     #work.x,r2
 408:         mov     symbol+2,r1
 409:         call    dnc
 410:         movb    #'$,(r2)+
 411:         movb    #0,(r2)+
 412:         call    tor50
 413:         mov     (sp)+,r0
 414:         return
 415:         entsec  mixed
 416: work.x: .blkw   5
 417:         xitsec
 418: tor50:
 419:         call    savreg
 420:         mov     #work.x,r4
 421:         call    1$
 422:         mov     r0,symbol
 423:         mov     #3+work.x,r4
 424:         call    1$
 425:         mov     r0,2+symbol
 426:         return
 427: 1$:
 428:         clr     r3
 429:         tstb    (r4)
 430:         beq     10$
 431:         movb    (r4)+,r0
 432:         br      20$
 433: 10$:    movb    (r4),r0
 434: 20$:    mov     r0,r2
 435:         call    40$
 436:         mov     r0,r3
 437:         mov     r3,r1
 438:         mul     #50,r1
 439:         mov     r1,r3
 440:         tstb    (r4)
 441:         beq     12$
 442:         movb    (r4)+,r0
 443:         br      21$
 444: 12$:    movb    (r4),r0
 445: 21$:    mov     r0,r2
 446:         call    40$
 447:         add     r0,r3
 448:         mov     r3,r1
 449:         mul     #50,r1
 450:         mov     r1,r3
 451:         movb    (r4),r0
 452:         mov     r0,r2
 453:         call    40$
 454:         add     r0,r3
 455:         mov     r3,r0
 456:         return
 457: 40$:
 458:         cmpb    #44,r2
 459:         bne     30$
 460:         mov     #33,r0
 461:         br      9$
 462: 14$:    clr     r0
 463: 9$:     return
 464: 30$:    tstb    r2
 465:         beq     14$
 466:         cmpb    #40,r2
 467:         beq     14$
 468:         movb    r2,r0
 469:         add     #-22,r0
 470:         br      9$
 471:         .end
 472: 
 473:         .end
Last modified: 1982-12-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1668
Valid CSS Valid XHTML 1.0 Strict