Makefile100644 144 31 1314 6504375761 11222 0ustar wktpupsarcall: hpuboot rmuboot rpuboot rkuboot smuboot rootin rootout tarboot smf mboot hpuboot: hpuboot.s as -o hpuboot hpuboot.s rmuboot: rmuboot.s as -o rmuboot rmuboot.s strip rmuboot rpuboot: rpuboot.s as -o rpuboot rpuboot.s strip rpuboot rkuboot: rkuboot.s as -o rkuboot rkuboot.s strip rkuboot smuboot: smuboot.s as -o smuboot smuboot.s strip smuboot rootin: rootio.c cc -s -20 -DIN rootio.c -o rootin rootout: rootio.c cc -s -20 -DOUT rootio.c -o rootout tarboot: tarboot.s as -o tarboot.tmp tarboot.s strip tarboot.tmp size tarboot.tmp dd if=tarboot.tmp of=tarboot bs=1 skip=16 count=512 rm -f tarboot.tmp smf: smf.c cc -s -20 smf.c -o smf mboot: mboot.s as -o mboot mboot.s strip mboot tarboot.1100644 144 31 2655 6504376006 11320 0ustar wktpupsarc.TH TARBOOT 1M U of T .DA 7 June 1984 .SH NAME tarboot \- boot standalone programs off a tar-format tape .SH SYNOPSIS .B /usr/mdec/tarboot .SH DESCRIPTION .I Tarboot is a standalone bootstrap which will load a program from an (unblocked) tar-format tape on a TM11 or equivalent. When started, it prompts with `=' for a filename; it then rewinds the tape and searches it for a file of that name. The first file of that name is loaded into core and executed. The file may be either a \s-2UNIX\s0 object module compiled as neither shared-text nor split-space, or a Dec absolute-loader load module. .PP The most effective way to use it is to make .I tarboot the very first file on the tape, in which case the Dec block-1 magtape boot will load and start .I tarboot properly. .SH DIAGNOSTICS Not many; it halts if it can't recognize the format of the file, and spins the tape forever if it can't find the file. .SH HISTORY Written at U of T by Henry Spencer. .SH BUGS Dec absolute-loader load modules actually aren't supported yet, although the hooks are there. .PP The response to tape i/o errors is simplistic. .PP Absolute-loader files must be stripped of leading \s-2NUL\s0s. .PP It assumes you have at least 56KB of memory. .PP Attempts to load a program larger than about 54KB will fail because .I tarboot will stomp itself. .PP It should put out a newline before the prompt. .PP It sure would be nice if .I tarboot supported command-line arguments. tarboot.s100644 144 31 11163 6504375761 11443 0ustar wktpupsarc// Tar-format tape boot -- accepts name of file to read off tar tape and // execute. Assumes tm11-compatible tape drive, at least 56KB memory, and // processor with SOB and EIS. halt=0 console=177560 tmaddr=172520 k=1024. me=55.*k // Where boot relocates self to. // Relocate self to top, if not there already. rsrc=r1 rdst=r2 rcnt=r3 cmp pc, $me / Are we up that high already? bhis setup clr rsrc / No: copy us up and transfer control. mov $me, rdst mov $512.\/2, rcnt // /2 for words, not bytes 1: mov (rsrc)+, (rdst)+ sob rcnt, 1b jmp *$me+setup setup: // Set up environment. mov $me+stack, sp // Get name. rptr=r1 mov $me+name, rptr mov $'-, r0 / prompt jsr pc, putch 1: jsr pc, getch cmp r0, $'\n / Is NL? beq 1f movb r0, (rptr)+ / No: save it. br 1b 1: clrb (rptr)+ / supply trailing NUL // Rewind magtape mov $me+tmrew, r0 jsr pc, tm // Master loop. loop: // Get tar header block. mov $me+tmbuf, r0 jsr pc, tm // Check name. rname=r1 rtar=r2 mov $me+buf, rtar mov $me+name, rname 1: cmpb (rname), (rtar)+ bne 2f tstb (rname)+ beq found br 1b 2: // Wasn't it. Damn. Skip rest of file. rskip=r4 jsr pc, getsize div $512., r0 // Convert to block count. tst r1 // Remainder? beq 1f inc r0 // Yes: quotient += 1 1: mov r0, rskip 1: mov $me+tmskip, r0 jsr pc, tm sob rskip, 1b // And go back and try again. br loop found: // Found the file!!! // Try to figure out what it is. mov $me+tmbuf, r0 jsr pc, tm mov buf, r0 cmp r0, $407 // Unix file? beq unixload / cmp r0, $1 // DEC absloader file? / beq decload halt // Je ne comprends pas. unixload: raddr=r2 rcount=r3 rbuf=r4 rbss=r5 // Pick up the header. mov $me+buf+2, rbuf mov (rbuf)+, rcount add (rbuf)+, rcount mov (rbuf)+, rbss add $10, rbuf clr raddr // Copy remainder of first block. mov $[bufsize-20]\/2, r0 sub r0, rcount 1: mov (rbuf)+, (raddr)+ sob r0, 1b // Read blocks until text and data all in. tst rcount beq 2f 1: mov raddr, tmread mov $me+tmread, r0 jsr pc, tm add $512., raddr sub $512., rcount bhi 1b // Fix up raddr after possibly reading more than wanted. 2: add rcount, raddr // rcount has gone negative // Zero out bss area. tst rbss beq 9f 1: clrb (raddr)+ sob rbss, 1b // Rewind the magtape and go. mov $me+tmrew, r0 jsr pc, tm 9: clr pc // jmp *$0 /------------------------------------------------------------------------- / get long-int size from a tar header block (field is octal ascii) getsize: rscan=r2 rtmp=r3 mov $me+buf+124., rscan // 124. is offset to size // Scan leading blanks and zeros. 1: bitb (rscan)+, $7 // (' '&07) == ('0'&07) == 0 beq 1b dec rscan clr r0 clr r1 1: movb (rscan)+, rtmp cmpb rtmp, $40 // SP ends it beq 1f bic $!7, rtmp ashc $3, r0 bis rtmp, r1 br 1b 1: rts pc /------------------------------------------------------------------------- / console i/o -- getch and putch tie together for echoing getch: tks=console+0 tkb=console+2 1: tstb *$tks // Await ready bit. bpl 1b movb *$tkb, r0 // Got it. bic $!177, r0 // Dispose of extraneous bits, if any. jsr pc, putch // Echo it. cmp r0, $'\r // If CR, turn into NL and echo CR-LF. bne 9f mov $'\n, r0 // And fall through into echoing. putch: tps=console+4 tpb=console+6 movb r0, *$tpb // Hit it. 1: tstb *$tps // Await done bit. bpl 1b 9: rts pc // Common return for getch and putch. /----------------------------------------------------------------------- / magtape handling tm: rdev=r1 mov $tmaddr+6, rdev // 6 is offset to bus address mov (r0)+, (rdev) mov (r0)+, -(rdev) // count mov (r0)+, -(rdev) // command // Spin until operation finished. 1: tstb (rdev) bpl 1b // Spin until tape halts. 1: bit $10000, 10(rdev) bne 1b // Success or failure? tst (rdev) bpl 1f // branch on success tst (r0)+ 1: mov (r0), r0 // next-op ptr, either success or failure. bne tm // if nonnull, do it rts pc // Command structures. Contents are: // bus addr // count (negative!) // command // next command on success // next command on failure // A next command of 0 means terminate. cmdrew=60017 cmdskip=60011 cmdback=60013 cmdread=60003 tmrew: 0 0 cmdrew 0 me+tmrew // try again on failure tmskip: 0 -1 cmdskip 0 0 // skip probably did succeed tmbuf: me+buf -512. cmdread 0 me+1f 1: 0 -1 cmdback me+tmbuf me+tmbuf // skip probably did succeed tmread: 0 // in here goes the address -512. cmdread 0 me+1f 1: 0 -1 cmdback me+tmread me+tmread // skip probably did succeed .bss name: .=.+100. stack=name+100. // Not bottom addr -- one word past top. buf=-512. // Below "me". bufsize=512.