|
|
1.1 root 1: /*
2: * VAX tape boot block for distribution tapes
3: * works on unibus ts11
4: *
5: * reads a program from a tp directory on a tape and executes it
6: * program must be stripped of the header and is loaded ``bits as is''
7: * you can return to this loader via ``ret'' as you are called ``calls $0,ent''
8: */
9: .set RELOC,0x70000
10: /* a.out defines */
11: .set HDRSIZ,040 /* size of file header for VAX */
12: .set MAGIC,0410 /* file type id in header */
13: .set TSIZ,4 /* text size */
14: .set DSIZ,8 /* data size */
15: .set BSIZ,12 /* bss size */
16: .set TENT,024 /* task header entry loc */
17: /* tp directory definitions */
18: .set FILSIZ,38 /* tp direc offset for file size */
19: .set BNUM,44 /* tp dir offset for start block no. */
20: .set ENTSIZ,64 /* size of 1 TP dir entry, bytes */
21: .set PTHSIZ,32 /* size of TP path name, bytes */
22: .set BLKSIZ,512 /* tape block size, bytes */
23: .set NUMDIR,24 /* no. of dir blocks on tape */
24: .set ENTBLK,8 /* no. of dir entries per tape block */
25: /* processor registers and bits */
26: .set RXCS,32
27: .set RXDB,33
28: .set TXCS,34
29: .set TXDB,35
30: .set RXCS_DONE,0x80
31: .set TXCS_RDY,0x80
32: .set TXCS_pr,7 /* bit position of TXCS ready bit */
33: .set RXCS_pd,7 /* bit position of RXCS done bit */
34: /* UBA registers */
35: .set UBA_DPR1,68
36: .set UBA_MAP,2048
37: .set BNE,0x80000000
38: .set MRV,0x80000000
39: .set MR_BDP1,0x200000
40: /* TS UBA registers */
41: .set TSDB,0
42: .set TSSR,2
43: /* TS commands and bits */
44: .set TSA,0x200 /* page 1, ts command buffer relocation */
45: .set TS_ACK,0100000 /* ack packet */
46: .set TS_CVC,040000 /* clear volume check */
47: .set TS_SETCHR,4 /* set characteristics */
48: .set TS_READ,1 /* read */
49: .set TS_RETRY,01000 /* retry, or with read */
50: .set TS_REWIND,02010
51: /* local stack variables */
52: .set tapa,-4 /* desired tape addr */
53: .set mtapa,-8 /* current tape addr */
54: .set name,-8-PTHSIZ /* operator-typed file name */
55: /* register usage */
56: .set rUBA,r10
57: .set rTS,r11
58: /* ===== */
59:
60: /* initialization */
61: init:
62: movl $RELOC,fp /* core loc to which to move this program */
63: addl3 $name,fp,sp /* set stack pointer; leave room for locals */
64: clrl r0
65: 1:
66: movc3 $end,(r0),(fp) /* move boot up to relocated position */
67: jmp start+RELOC
68: start:
69: ashl $-9,$RELOC,r0
70: bisl3 $MRV,r0,UBA_MAP+4(%rUBA)
71: clrw TSSR(%rTS)
72: bsbw tsquiet
73: movw $TSA+setchr,TSDB(%rTS)
74: bsbw tsquiet
75: bsbw rew /* rewind input tape */
76: movab name(fp),r4 /* start of filename storage */
77: movzbl $'=,r0 /* prompt character */
78: bsbw putc /* output char to main console */
79: /* read in a file name */
80: movl r4,r1 /* loc at which to store file name */
81: nxtc:
82: bsbw getc /* get input char's in file name */
83: cmpb r0,$012 /* terminator ? */
84: beql nullc
85: movb r0,(r1)+
86: brb nxtc
87: nullc:
88: subl3 r4,r1,r9 /* size of path name */
89: beql start /* dumb operator */
90: clrb (r1)+
91: incl r9
92: /* user-specified TP filename has been stored at name(fp) */
93: /* read in entire tp directory contents into low core */
94: dirred:
95: movl $8,tapa(fp) /* tp directory starts at block 8 */
96: movl $(NUMDIR*BLKSIZ),r6 /* no. bytes in total dir */
97: bsbw taper /* read no. bytes indicated */
98: /* search entire directory for user-specified file name */
99: clrl r5 /* dir buff loc = 0 */
100: nxtdir:
101: cmpc3 r9,(r5),(r4) /* see if dir entry matches filename */
102: beql fndfil /* found match */
103: acbl $NUMDIR*BLKSIZ-1,$ENTSIZ,r5,nxtdir
104: /* see if done with tp dir */
105: brw start /* entry not in directory; start over */
106: /* found desired tp dir entry */
107: fndfil:
108: movzwl BNUM(r5),tapa(fp) /* start block no., 2 bytes */
109: addl2 $7,tapa(fp) /* skip 7 boot blocks */
110: movzwl FILSIZ(r5),r6 /* low 2 bytes file size */
111: insv FILSIZ-1(r5),$16,$8,r6 /* file size, high byte */
112: cmpl r6,$RELOC-512 /* check if file fits below stack */
113: blss filok /* file o.k. */
114: brw start /* file too large */
115: /* time to read in desired file from tape */
116: filok:
117: movl r6,r7 /* save r6 */
118: bsbb taper
119: bsbw rew
120: /* clear core */
121: subl3 r7,$RELOC-4,r0 /* no. bytes to clear */
122: 1:
123: clrb (r7)+
124: sobgtr r0,1b
125: /* time to jump to start of file & execute */
126: addl3 $20,fp,ap
127: clrl r5
128: calls $0,(r5)
129: brw start
130: /* taper: movcTAPE (r6),tapa(fp),0 */
131: rew2:
132: bsbb rew /* beginning of tape */
133: taper0:
134: bsbb rrec /* advance 1 block; never want blk 0 */
135: taper:
136: clrl r0 /* page no. */
137: cmpl mtapa(fp),tapa(fp) /* current position .vs. desired */
138: bgtr rew2
139: blss taper0
140: 1:
141: bsbb rrec
142: acbl $1,$-BLKSIZ,r6,1b
143: rsb
144: /* rew: rewind the tape */
145: rew:
146: clrl mtapa(fp) /* current position */
147: movw $TSA+rewind,TSDB(%rTS)
148: bsbb tsquiet
149: rsb
150: /* rrec: read 1 block from mag tape into page (r0) */
151: rrec:
152: /* pushl r0; movzbl $'r,r0; bsbw putc; movl (sp)+,r0; */
153: bisl3 $MRV,r0,UBA_MAP(%rUBA)
154: movw $TS_ACK|TS_CVC|TS_READ,tsread
155: 1:
156: movw $TSA+tsread,TSDB(%rTS)
157: bsbb tsquiet
158: /* bisl2 $BNE,UBA_DPR1(%rUBA) */
159: tstw TSSR(%rTS)
160: bgeq 2f
161: bisw2 $TS_RETRY,tsread
162: brb 1b
163: 2:
164: incl r0 /* next page no. */
165: incl mtapa(fp) /* mag tape block position */
166: rsb
167: tsquiet:
168: tstb TSSR(%rTS)
169: bgeq tsquiet
170: rsb
171: getc:
172: mfpr $RXCS,r0
173: bbc $RXCS_pd,r0,getc /* receiver ready ? */
174: mfpr $RXDB,r0
175: extzv $0,$7,r0,r0
176: cmpb r0,$015
177: bneq putc
178: bsbb putc
179: movb $0,r0
180: bsbb putc
181: movb $012,r0
182: putc:
183: mfpr $TXCS,r2
184: bbc $TXCS_pr,r2,putc /* transmitter ready ? */
185: extzv $0,$7,r0,r0
186: mtpr r0,$TXDB
187: rsb
188: .align 2
189: setchr:
190: .word TS_ACK|TS_CVC|TS_SETCHR
191: .long TSA+char
192: .word 0xe
193: char:
194: .long TSA+tsstat
195: .word 0xe
196: .word 0
197: tsread:
198: .word TS_ACK|TS_CVC|TS_READ
199: .long 0
200: .word BLKSIZ
201: rewind:
202: .word TS_ACK|TS_CVC|TS_REWIND
203: .long 0
204: .word 0
205: tsstat:
206: .space 7*2
207: end:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.