1: / disk boot program to load and transfer 2: / to a unix entry 3: 4: / entry is made by jsr pc,*$0 5: / so return can be rts pc 6: 7: core = 28. 8: .. = [core*2048.]-512. 9: 10: / establish sp and check if running below 11: / intended origin, if so, copy 12: / program up to 'core' K words. 13: start: 14: mov $..,sp 15: mov sp,r1 16: cmp pc,r1 17: bhis 2f 18: clr r0 19: cmp (r0),$407 20: bne 1f 21: mov $20,r0 22: 1: 23: mov (r0)+,(r1)+ 24: cmp r1,$end 25: blo 1b 26: jmp (sp) 27: 28: / clear core to make things clean 29: 2: 30: clr (r0)+ 31: cmp r0,sp 32: blo 2b 33: 34: / at origin, read pathname, 35: / initialize rp 36: mov $drive,*$hpcs2 37: mov $preset+go,*$hpcs1 38: mov $fmt22,*$hpof 39: 40: / spread out in array 'names', one 41: / component every 14 bytes. 42: mov $names,r1 43: 1: 44: mov r1,r2 45: 2: 46: jsr pc,getc 47: cmp r0,$'\n 48: beq 1f 49: cmp r0,$'/ 50: beq 3f 51: movb r0,(r2)+ 52: br 2b 53: 3: 54: cmp r1,r2 55: beq 2b 56: add $14.,r1 57: br 1b 58: 59: / now start reading the inodes 60: / starting at the root and 61: / going through directories 62: 1: 63: mov $names,r1 64: mov $2,r0 65: 1: 66: clr bno 67: jsr pc,iget 68: tst (r1) 69: beq 1f 70: 2: 71: jsr pc,rmblk 72: br start 73: mov $buf,r2 74: 3: 75: mov r1,r3 76: mov r2,r4 77: add $16.,r2 78: tst (r4)+ 79: beq 5f 80: 4: 81: cmpb (r3)+,(r4)+ 82: bne 5f 83: cmp r4,r2 84: blo 4b 85: mov -16.(r2),r0 86: add $14.,r1 87: br 1b 88: 5: 89: cmp r2,$buf+512. 90: blo 3b 91: br 2b 92: 93: / read file into core until 94: / a mapping error, (no disk address) 95: 1: 96: clr r1 97: 1: 98: jsr pc,rmblk 99: br 1f 100: mov $buf,r2 101: 2: 102: mov (r2)+,(r1)+ 103: cmp r2,$buf+512. 104: blo 2b 105: br 1b 106: / relocate core around 107: / assembler header 108: 1: 109: clr r0 110: cmp (r0),$407 111: bne 2f 112: 1: 113: mov 20(r0),(r0)+ 114: cmp r0,sp 115: blo 1b 116: / enter program and 117: / restart if return 118: 2: 119: jsr pc,*$0 120: br start 121: 122: / get the inode specified in r0 123: iget: 124: add $15.,r0 125: mov r0,r5 126: ash $-3.,r0 127: bic $!17777,r0 128: mov r0,dno 129: clr r0 130: jsr pc,rblk 131: bic $!7,r5 132: ash $6,r5 133: add $buf,r5 134: mov $inod,r4 135: 1: 136: mov (r5)+,(r4)+ 137: cmp r4,$inod+64. 138: blo 1b 139: rts pc 140: 141: / read a mapped block 142: / offset in file is in bno. 143: / skip if success, no skip if fail 144: / the algorithm only handles a single 145: / indirect block. that means that 146: / files longer than 10+128 blocks cannot 147: / be loaded. 148: rmblk: 149: add $2,(sp) 150: mov bno,r0 151: cmp r0,$10. 152: blt 1f 153: mov $10.,r0 154: 1: 155: mov r0,-(sp) 156: asl r0 157: add (sp)+,r0 158: add $addr+1,r0 159: movb (r0)+,dno 160: movb (r0)+,dno+1 161: movb -3(r0),r0 162: bne 1f 163: tst dno 164: beq 2f 165: 1: 166: jsr pc,rblk 167: mov bno,r0 168: inc bno 169: sub $10.,r0 170: blt 1f 171: ash $2,r0 172: mov buf+2(r0),dno 173: mov buf(r0),r0 174: bne rblk 175: tst dno 176: bne rblk 177: 2: 178: sub $2,(sp) 179: 1: 180: rts pc 181: 182: drive = 0 183: cyl = 0. 184: read = 70 185: preset = 20 186: go = 1 187: fmt22 = 10000 188: 189: hpcs1 = 176700 190: hpda = hpcs1+6 191: hpcs2 = hpcs1+10 192: hpds = hpcs1+12 193: hpof = hpcs1+32 194: hpca = hpcs1+34 195: 196: / rp0456 disk driver. 197: / low order address in dno, 198: / high order in r0. 199: rblk: 200: mov r1,-(sp) 201: mov dno,r1 202: div $22.*19.,r0 203: add $cyl,r0 204: mov r0,*$hpca 205: clr r0 206: div $22.,r0 207: swab r0 208: bis r1,r0 209: mov $hpda,r1 210: mov r0,(r1) 211: mov $buf,-(r1) 212: mov $-256.,-(r1) 213: mov $read+go,-(r1) 214: 1: 215: tstb (r1) 216: bge 1b 217: mov (sp)+,r1 218: rts pc 219: 220: tks = 177560 221: tkb = 177562 222: / read and echo a teletype character 223: getc: 224: mov $tks,r0 225: inc (r0) 226: 1: 227: tstb (r0) 228: bge 1b 229: mov tkb,r0 230: bic $!177,r0 231: cmp r0,$'A 232: blo 1f 233: cmp r0,$'Z 234: bhi 1f 235: add $'a-'A,r0 236: 1: 237: 238: tps = 177564 239: tpb = 177566 240: / print a teletype character 241: putc: 242: tstb *$tps 243: bge putc 244: mov r0,*$tpb 245: cmp r0,$'\r 246: bne 1f 247: mov $'\n,r0 248: br putc 249: 1: 250: rts pc 251: 252: end: 253: inod = ..-1024. 254: addr = inod+12. 255: buf = inod+64. 256: bno = buf+512. 257: dno = bno+2 258: names = dno+2 259: reset = 5