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

Defined functions

char defined in line 201; used 1 times
dirred defined in line 102; never used
end defined in line 215; used 1 times
  • in line 74
filok defined in line 124; used 1 times
fndfil defined in line 115; used 1 times
getc defined in line 179; used 2 times
init defined in line 69; never used
nullc defined in line 95; used 1 times
  • in line 92
nxtc defined in line 89; used 1 times
  • in line 94
nxtdir defined in line 108; used 1 times
putc defined in line 190; used 5 times
rew defined in line 153; used 3 times
rew2 defined in line 139; used 1 times
rewind defined in line 209; used 1 times
rrec defined in line 159; used 2 times
setchr defined in line 197; used 1 times
  • in line 81
start defined in line 76; used 5 times
taper defined in line 143; used 2 times
taper0 defined in line 141; used 1 times
tsquiet defined in line 175; used 5 times
tsread defined in line 205; used 3 times
tsstat defined in line 213; used 1 times
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 780
Valid CSS Valid XHTML 1.0 Strict