1: / disk boot program to load and transfer
   2: / to a unix file system entry
   3: / must be assembled with tty.s and
   4: / appropriate disk driver
   5: 
   6: / entry is made by jsr pc,*$0
   7: / so return can be rts pc
   8: 
   9: core = 24.      / first core loc (in KW) not used
  10: .. = [core*2048.]-512.
  11: start:
  12: 
  13: / copy self to 'core' - 512. bytes
  14: / strip of UNIX execute header if present
  15: 
  16:         mov     $..,sp
  17:         mov     sp,r1
  18:         clr     r0
  19:         cmp     pc,r1
  20:         bhis    2f
  21:         cmp     (r0),$407
  22:         bne     1f
  23:         mov     $20,r0
  24: 1:
  25:         mov     (r0)+,(r1)+
  26:         cmp     r1,$core*2048.
  27:         blo     1b
  28:         jmp     (sp)
  29: 
  30: / clear all of core
  31: 
  32: 2:
  33:         clr     (r0)+
  34:         cmp     r0,sp
  35:         blo     2b
  36: 
  37: / prompt
  38: / read in path name
  39: / breaking on '/' into 14 ch names
  40: 
  41:         mov     $trvect,r5
  42:         mov     $'@,r0
  43:         jsr     pc,(r5)
  44:         mov     $names,r2
  45: 1:
  46:         mov     r2,r1
  47: 2:
  48:         jsr     pc,getc
  49:         cmp     r0,$'\n
  50:         beq     1f
  51:         cmp     r0,$'/
  52:         beq     3f
  53:         movb    r0,(r1)+
  54:         br      2b
  55: 3:
  56:         cmp     r2,r1
  57:         beq     2b
  58:         add     $14.,r2
  59:         br      1b
  60: 1:
  61: 
  62: / start of path name decoding
  63: / start with first name  and root ino
  64: 
  65:         mov     $names,r2
  66:         mov     $1,r0
  67: 
  68: / get next inode
  69: 
  70: 1:
  71:         clr     bno
  72:         jsr     pc,iget
  73:         tst     (r2)
  74:         beq     1f
  75: 
  76: / read next directory looking for next name
  77: 
  78: 2:
  79:         jsr     pc,rmblk
  80:                 br start
  81:         mov     $buf,r1
  82: 3:
  83:         mov     r2,r3
  84:         mov     r1,r4
  85:         add     $16.,r1
  86:         tst     (r4)+
  87:         beq     5f
  88: 4:
  89:         cmpb    (r3)+,(r4)+
  90:         bne     5f
  91:         cmp     r4,r1
  92:         blo     4b
  93:         mov     -16.(r1),r0
  94:         add     $14.,r2
  95:         br      1b
  96: 5:
  97:         cmp     r1,$buf+512.
  98:         blo     3b
  99:         br      2b
 100: 
 101: / last entry was found
 102: / read into 0.
 103: 
 104: 1:
 105:         clr     r2
 106: 1:
 107:         jsr     pc,rmblk
 108:                 br callout
 109:         mov     $buf,r1
 110: 2:
 111:         mov     (r1)+,(r2)+
 112:         cmp     r1,$buf+512.
 113:         blo     2b
 114:         br      1b
 115: 
 116: / subroutine will read in inode
 117: / number specified in r0
 118: iget:
 119:         add     $31.,r0
 120:         mov     r0,r5
 121:         ash     $-4.,r0
 122:         jsr     pc,rblka
 123:         bic     $!17,r5
 124:         ash     $5.,r5
 125:         add     $buf,r5
 126:         mov     $inod,r4
 127: 1:
 128:         mov     (r5)+,(r4)+
 129:         cmp     r4,$addr+16.
 130:         blo     1b
 131:         rts     pc
 132: 
 133: / routine to read in block
 134: / number specified by bno
 135: / after applying file system
 136: / mapping algorithm in inode.
 137: / bno is incremented, success
 138: / return is a skip, error (eof)
 139: / is direct return.
 140: rmblk:
 141:         add     $2,(sp)
 142:         mov     bno,r0
 143:         inc     bno
 144:         bit     $LRG,mode
 145:         bne     1f
 146:         asl     r0
 147:         mov     addr(r0),r0
 148:         bne     rblka
 149: 2:
 150:         sub     $2,(sp)
 151:         rts     pc
 152: / large algorithm
 153: / huge algorithm is not implemented
 154: 1:
 155:         clr     -(sp)
 156:         movb    r0,(sp)
 157:         clrb    r0
 158:         swab    r0
 159:         asl     r0
 160:         mov     addr(r0),r0
 161:         beq     2b
 162:         jsr     pc,rblka
 163:         mov     (sp)+,r0
 164:         asl     r0
 165:         mov     buf(r0),r0
 166:         beq     2b
 167: rblka:
 168:         mov     r0,dska
 169:         br      rblk
 170: 
 171: ba:     buf
 172: wc:     -256.
 173: .bss
 174: end:
 175: inod = ..-1024.
 176: mode = inod
 177: addr = inod+8.
 178: buf = inod+32.
 179: bno = buf+514.
 180: dska = bno+2
 181: names = dska+2
 182: LRG = 10000
 183: .text

Defined functions

ba defined in line 171; never used
core defined in line 9; used 2 times
iget defined in line 118; used 1 times
  • in line 72
rblka defined in line 167; used 3 times
rmblk defined in line 140; used 2 times
start defined in line 11; used 1 times
  • in line 80
wc defined in line 172; never used

Defined variables

LRG defined in line 182; used 1 times
addr defined in line 177; used 3 times
bno defined in line 179; used 4 times
buf defined in line 178; used 8 times
dska defined in line 180; used 2 times
end defined in line 174; never used
inod defined in line 175; used 4 times
mode defined in line 176; used 1 times
names defined in line 181; used 2 times
Last modified: 1975-07-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 460
Valid CSS Valid XHTML 1.0 Strict