1:         .title  main
   2: 
   3:         .ident  /03apr4/
   4: 
   5:         .mcall  (at)always,ch.mne,st.flg
   6:         always
   7:         ch.mne
   8:         st.flg
   9: 
  10:         .mcall  (at)xmit,param
  11:         .mcall  (at)genedt,gencnd,setnz
  12:         .mcall  (at)search,scanw,next
  13:         .if df  rsx11d
  14:         .mcall  (at)scan
  15:         .endc
  16: 
  17: 
  18:         .globl  endp2l
  19:         .globl  secini, stmnt
  20:         .globl  setmax, propc
  21:         .globl  exmflg, xctpas, xctlin
  22:         .globl  objchn, openo
  23: 
  24: 
  25: ;
  26:         .globl  clcfgs, clcloc, clcmax
  27:         .globl  clcnam, clcsec, cpopj
  28:         .globl  errbts
  29:         .globl  flags,  insert
  30:         .globl  mode,   rellvl
  31:         .globl  rolupd
  32:         .globl  sector, setnb
  33:         .globl  setxpr
  34:         .globl  symbol, value
  35:         .globl  endp1c, endp2c
  36:         .globl  prop1,  endp1,  prop2,  endp2
  37:         .globl  bksiz
  38: 
  39:         .if ndf xswit
  40:         .globl  pass,   prosw
  41:         .endc
  42: 
  43:         .globl  savreg, xmit0
  44: 
  45:         .globl  endflg, endlin
  46:         .globl  getlin
  47:         .sbttl          roll definitions
  48: 
  49:         entsec  rolbas
  50: rolbas  =       .
  51:         entsec  roltop
  52:         entsec  rolsiz
  53:         xitsec
  54: 
  55:         .macro  genrol  name,   limits, size
  56:         entsec  rolbas
  57:         .globl  name'rol
  58: name'rol=       .-rolbas
  59:         .if nb  <limits>
  60:         .word   <^pl limits>
  61:         .iff
  62:         .word   0
  63:         .endc
  64:         entsec  roltop
  65:         .if nb  <limits>
  66:         .word   <^ph limits>
  67:         .iff
  68:         .word   0
  69:         .endc
  70:         entsec  rolsiz
  71:         .word   size*2
  72:         xitsec
  73:         .iif gt size-maxxmt,    maxxmt=size
  74:         .endm   genrol
  75: 
  76:         .iif ndf maxxmt,        maxxmt= 0
  77: 
  78:         .if df  rsx11d
  79:         genrol  reg,    ,4      ;register symbols
  80:         .endc
  81:         genrol  sym,    ,4      ;symbol table
  82:         .if ndf xmacro
  83:         genrol  mac,    ,4      ;macro roll
  84:         genrol  dma,    ,2      ;dummy argument roll
  85:         .endc
  86:         .if ndf xedlsb
  87:         genrol  lsy,    ,4      ;local symbol roll
  88:         .endc
  89:         genrol  sec,    ,5      ;section roll
  90:         genrol  cod,    ,4      ;code roll
  91: 
  92:         genrol  dum,    ,0      ;dummy (separates variable from fixed)
  93: 
  94:         genrol  cnd,cndsec,2    ;conditional arguments
  95:         genrol  swt,swtsec,2    ;command string switches
  96:         genrol  edt,edtsec,3    ;enabl/dsabl
  97:         genrol  lcd,lctsec,1    ;listing control
  98:         genrol  psa,psasec,2    ;psect attributes
  99:         genrol  pst,pstsec,4    ;permanent symbol table
 100:         genrol  crf,crfsec,3    ;cref options
 101:         .sbttl  assembler proper
 102: 
 103:         entsec  impure
 104: 
 105: pass:   .blkw
 106: 
 107: bksiz:  .blkw   2
 108:                                 ;next group must stay together
 109:         entsec  imppas
 110: 
 111: symbol: .blkw   2               ;symbol accumulator
 112: mode:
 113: flags:  .blkb   1               ;flag bits
 114: sector: .blkb   1               ;symbol/expression type
 115: value:  .blkw   1               ;expression value
 116: rellvl: .blkw   1
 117:         .rept   maxxmt-<<.-symbol>/2>   ;end of grouped data
 118:         .blkw
 119:         .endm
 120: 
 121: clcnam: .blkw   2               ;current location counter symbol
 122: clcfgs: .blkb   1
 123: clcsec: .blkb   1
 124: clcloc: .blkw   1
 125: clcmax: .blkw   1
 126: 
 127:         xitsec                  ;return to normal
 128: prop1:                          ;process pass 1
 129:         mov     #regtbl,r1      ;set to init regs
 130:         clr     r2
 131: 2$:     mov     #symbol,r4
 132:         mov     (r1)+,(r4)+     ;set mnemonic
 133:         clr     (r4)+
 134:         .if df  rsx11d
 135:         scan    regrol          ;set indices
 136:         .iff
 137:         search  symrol          ;set indices
 138:         .endc
 139:         mov     #defflg!regflg,(r4)+
 140:         mov     r2,(r4)
 141:         call    insert
 142:         inc     r2
 143:         cmp     r2,#10          ;end?
 144:         blo     2$              ;  no
 145:         br      prop2           ;  yes, exit through pass 2
 146: 
 147:         entsec  dpure
 148: regtbl: .rad50  /r0 r1 r2 r3 r4 r5 sp pc /
 149:         xitsec
 150: prop2:                          ;macro pass 2
 151:         call    xctpas
 152:         call    secini          ;init the sector roll
 153: 3$:     call    getlin          ;get the next input line
 154:         bne     4$              ;  branch if eof
 155:         call    stmnt           ;process the statement
 156: 4$:     call    endlin          ;polish off line
 157:         tst     endflg          ;end seen?
 158:         beq     3$              ;  no, continue
 159:         return
 160: 
 161: 
 162: 
 163: endp1:                          ;end of pass handler
 164:         .if ndf xrel
 165:         call    setmax          ;set max location
 166:         .iftf
 167:         mov     #objchn,r0
 168:         call    openo           ;open output file
 169:         call    endp1c          ;init binary
 170:         clr     rolupd          ;set for re-init scan
 171: 31$:    next    secrol          ;get the next entry
 172:         beq     32$             ;  branch if finished
 173:         clr     value           ;found, reset pc
 174:         call    insert          ;put back in table
 175:         br      31$
 176: 
 177: 32$:
 178:         .endc
 179:         return
 180: 
 181: 
 182: 
 183: 
 184: endp2:                          ;end of pass 2
 185:         .if ndf xrel
 186:         call    setmax          ;set max location
 187:         .endc
 188:         call    endp2c          ;clean up binary
 189:         jmp     endp2l          ;output listing of table
 190:         .if ndf xswit
 191: 
 192: prosw:                          ;process switch
 193:                                 ;in -  ascii in r0
 194:                                 ;out-  .ne. 0 if ok
 195:         call    savreg
 196:         call    setnb
 197:         call    setxpr          ;set expression-type registers
 198:         mov     r0,(r1)+        ;set "symbol"
 199:         call    xctlin          ;zero line-oriented flags
 200:         scanw   swtrol          ;scan for switch
 201:         beq     9$              ;  not found, exit zero
 202:         clr     (r3)            ;clear "mode"
 203:         mov     (r1),(r4)       ;address to "value"
 204:         inc     exmflg          ;flag exec mode
 205:         call    propc           ;process as op-code
 206:         clr     r0              ;assume error
 207:         bis     errbts,r5       ;error or not terminator?
 208:         bne     9$              ;  yes, error
 209:         com     r0              ;ok, set .ne. zero
 210: 9$:     return
 211: 
 212: 
 213:         .endc
 214: 
 215: 
 216:         entsec  implin
 217: exmflg: .blkw                   ;exec mode flag
 218:         xitsec
 219: 
 220: 
 221:         .end
Last modified: 1982-12-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1514
Valid CSS Valid XHTML 1.0 Strict