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: /* "@(#)htboot.s	7.1 (Berkeley) 6/5/86" */
   8: 
   9: 
  10: /*
  11:  * VAX tape boot block for distribution tapes
  12:  * works on massbus tu10/te16/tu45/tu77
  13:  *
  14:  * reads a program from a tp directory on a tape and executes it
  15:  * program must be stripped of the header and is loaded ``bits as is''
  16:  * you can return to this loader via ``ret'' as you are called ``calls $0,ent''
  17:  */
  18:         .set    RELOC,0x70000
  19: /* a.out defines */
  20:         .set    HDRSIZ,040      /* size of file header for VAX */
  21:         .set    MAGIC,0410      /* file type id in header */
  22:         .set    TSIZ,4          /* text size */
  23:         .set    DSIZ,8          /* data size */
  24:         .set    BSIZ,12         /* bss size */
  25:         .set    TENT,024        /* task header entry loc */
  26: /* tp directory definitions */
  27:         .set    FILSIZ,38       /* tp direc offset for file size */
  28:         .set    BNUM,44         /* tp dir offset for start block no. */
  29:         .set    ENTSIZ,64       /* size of 1 TP dir entry, bytes */
  30:         .set    PTHSIZ,32       /* size of TP path name, bytes */
  31:         .set    BLKSIZ,512      /* tape block size, bytes */
  32:         .set    NUMDIR,24       /* no. of dir blocks on tape */
  33:         .set    ENTBLK,8        /* no. of dir entries per tape block */
  34: /* processor registers and bits */
  35:         .set    RXCS,32
  36:         .set    RXDB,33
  37:         .set    TXCS,34
  38:         .set    TXDB,35
  39:         .set    RXCS_DONE,0x80
  40:         .set    TXCS_RDY,0x80
  41:         .set    TXCS_pr,7       /* bit position of TXCS ready bit */
  42:         .set    RXCS_pd,7       /* bit position of RXCS done bit */
  43: /* MBA registers */
  44:         .set    MBA_CSR,0       /* configuration and status register */
  45:         .set    MBA_CR,4        /* MBA control reg */
  46:         .set    MBA_SR,8        /* MBA status reg */
  47:         .set    MBA_VAR,12      /* MBA virt addr reg */
  48:         .set    MBA_BCR,16      /* MBA byte count reg */
  49:         .set    MBA_MAP,0x800   /* start of MBA map reg's */
  50:         .set    MRV,0x80000000
  51: /* TE16/TU45/TU77 mba registers */
  52:         .set    HTCS1,0         /* HT control 1 reg */
  53:         .set    HTDS,4          /* status reg */
  54:         .set    HTER,8          /* error reg */
  55:         .set    HTAS,16         /* attention summary */
  56:         .set    HTFC,20         /* frame count */
  57:         .set    HTTC,36         /* HT tape control */
  58: /* HT commands */
  59:         .set    GO,1            /* GO bit */
  60:         .set    HT_REW,6        /* rewind, on-line */
  61:         .set    HT_DCLR,010     /* drive clear */
  62:         .set    HT_SREV,032     /* space reverse */
  63:         .set    HT_RCOM,070     /* read forward */
  64: /* HT bits */
  65:         .set    ERR,040000      /* composite error bit in status reg */
  66:         .set    TCHAR,012300    /* unit 0, odd parity, PDP11, 1600 BPI NRZ, */
  67:                                 /* abort on error - for tape controller */
  68:         .set    DRDY,0200       /* HT/drive ready in status reg */
  69:         .set    HT_pd,7         /* bit position of HT DRDY bit */
  70:         .set    HT_pe,14        /* bit position of HT ERROR bit */
  71: /* local stack variables */
  72:         .set    tapa,-4         /* desired tape addr */
  73:         .set    mtapa,-8        /* current tape addr */
  74:         .set    name,-8-PTHSIZ  /* operator-typed file name */
  75: /* register usage */
  76:         .set    rMBA,r10
  77:         .set    rHT,r11
  78: 
  79: /* initialization */
  80: init:
  81:         mull2   $0x80,%rHT
  82:         addl2   $0x400,%rHT
  83:         addl2   %rMBA,%rHT
  84:         movl    $RELOC,fp       /* core loc to which to move this program */
  85:         addl3   $name,fp,sp     /* set stack pointer, leaving room for locals */
  86:         clrl    r0
  87: 1:
  88:         movc3   $end,(r0),(fp)  /* move boot up to relocated position */
  89:         jmp     start+RELOC
  90: start:
  91:         movl    $1,MBA_CR(%rMBA)        /* MBA init */
  92:         movl    $TCHAR,HTTC(%rHT)       /* drive no., etc. */
  93:         movl    $HT_DCLR+GO,HTCS1(%rHT) /* drive clear */
  94:         bsbw    rew                     /* rewind input tape */
  95:         movab   name(fp),r4             /* start of filename storage */
  96:         movzbl  $'=,r0                  /* prompt character */
  97:         bsbw    putc                    /* output char to main console */
  98: /* read in a file name */
  99:         movl    r4,r1                   /* loc at which to store file name */
 100: nxtc:
 101:         bsbw    getc                    /* get input char's in file name */
 102:         cmpb    r0,$012                 /* terminator ? */
 103:         beql    nullc
 104:         movb    r0,(r1)+
 105:         brb     nxtc
 106: nullc:
 107:         subl3   r4,r1,r9                /* size of path name */
 108:         beql    start                   /* dumb operator */
 109:         clrb    (r1)+
 110:         incl    r9
 111: /* user-specified TP filename has been stored at name(fp) */
 112: /* read in entire tp directory contents into low core */
 113: dirred:
 114:         movl    $8,tapa(fp)             /* tp directory starts at block 8 */
 115:         movl    $(NUMDIR*BLKSIZ),r6     /* no. bytes in total dir */
 116:         bsbw    taper                   /* read no. bytes indicated */
 117: /* search entire directory for user-specified file name */
 118:         clrl    r5                      /* dir buff loc = 0 */
 119: nxtdir:
 120:         cmpc3   r9,(r5),(r4)            /* see if dir entry matches filename */
 121:         beql    fndfil                  /* found match */
 122:         acbl    $NUMDIR*BLKSIZ-1,$ENTSIZ,r5,nxtdir
 123:                                         /* see if done with tp dir */
 124:         brw     start                   /* entry not in directory; start over */
 125: /* found desired tp dir entry */
 126: fndfil:
 127:         movzwl  BNUM(r5),tapa(fp)       /* start block no., 2 bytes */
 128:         addl2   $7,tapa(fp)             /* skip 7 boot blocks */
 129:         movzwl  FILSIZ(r5),r6           /* low 2 bytes file size */
 130:         insv    FILSIZ-1(r5),$16,$8,r6  /* file size, high byte */
 131:         cmpl    r6,$RELOC-512           /* check if file fits below stack */
 132:         blss    filok                   /* file o.k. */
 133:         brw     start                   /* file too large */
 134: /* time to read in desired file from tape */
 135: filok:
 136:         movl    r6,r7                   /* save r6 */
 137:         bsbb    taper
 138:         bsbw    rew
 139: /* clear core */
 140:         subl3   r7,$RELOC-4,r0          /* no. bytes to clear */
 141: 1:
 142:         clrb    (r7)+
 143:         sobgtr  r0,1b
 144: /* time to jump to start of file & execute */
 145:         addl3   $20,fp,ap
 146:         clrl    r5
 147:         calls   $0,(r5)
 148:         brw     start
 149: /* taper: movcTAPE (r6),tapa(fp),0 */
 150: rew2:
 151:         bsbb    rew                     /* beginning of tape */
 152: taper0:
 153:         bsbb    rrec                    /* advance 1 block; never want blk0 */
 154: taper:
 155:         clrl    r0                      /* page no. */
 156:         cmpl    mtapa(fp),tapa(fp)      /* current position .vs. desired */
 157:         bgtr    rew2
 158:         blss    taper0
 159: 1:
 160:         bsbb    rrec
 161:         acbl    $1,$-BLKSIZ,r6,1b
 162:         rsb
 163: /* rew: rewind the tape */
 164: rew:
 165:         clrl    mtapa(fp)               /* current position */
 166:         movl    $HT_REW+GO,HTCS1(%rHT)  /* rewind */
 167:         rsb
 168: /* rrec: read 1 block from mag tape into page (r0) */
 169: rrec:
 170:         /* pushl r0; movzbl $'r,r0; bsbw putc; movl (sp)+,r0; */
 171:         movl    HTDS(%rHT),r2
 172:         bbc     $HT_pd,r2,rrec          /* HT & drive ready ? */
 173:         movl    $-BLKSIZ,MBA_BCR(%rMBA)
 174:         bisl3   $MRV,r0,MBA_MAP(%rMBA)
 175:         clrl    MBA_VAR(%rMBA)
 176:         movl    $HT_RCOM+GO,HTCS1(%rHT) /* read forward */
 177: 1:
 178:         movl    HTDS(%rHT),r2
 179:         bbc     $HT_pd,r2,1b
 180:         movl    HTER(%rHT),r2
 181:         bbc     $HT_pe,r2,2f            /* any read errors ? */
 182:         clrl    HTDS(%rHT)              /* clear status - try to recover */
 183:         mnegl   $1,HTFC(%rHT)           /* frame count for backspace */
 184:         movl    $HT_SREV+GO,HTCS1(%rHT) /* space reverse */
 185:         brb     rrec
 186: 2:
 187:         incl    r0                      /* next page no. */
 188:         incl    mtapa(fp)               /* mag tape block position */
 189:         rsb
 190: getc:
 191:         mfpr    $RXCS,r0
 192:         bbc     $RXCS_pd,r0,getc        /* receiver ready ? */
 193:         mfpr    $RXDB,r0
 194:         extzv   $0,$7,r0,r0
 195:         cmpb    r0,$015
 196:         bneq    putc
 197:         bsbb    putc
 198:         movb    $0,r0
 199:         bsbb    putc
 200:         movb    $012,r0
 201: putc:
 202:         mfpr    $TXCS,r2
 203:         bbc     $TXCS_pr,r2,putc        /* transmitter ready ? */
 204:         extzv   $0,$7,r0,r0
 205:         mtpr    r0,$TXDB
 206:         rsb
 207: end:

Defined functions

dirred defined in line 113; never used
end defined in line 207; used 1 times
  • in line 88
filok defined in line 135; used 1 times
fndfil defined in line 126; used 1 times
getc defined in line 190; used 2 times
init defined in line 80; never used
nullc defined in line 106; used 1 times
nxtc defined in line 100; used 1 times
nxtdir defined in line 119; used 1 times
putc defined in line 201; used 5 times
rew defined in line 164; used 3 times
rew2 defined in line 150; used 1 times
rrec defined in line 169; used 4 times
start defined in line 90; used 5 times
taper defined in line 154; used 2 times
taper0 defined in line 152; used 1 times
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 727
Valid CSS Valid XHTML 1.0 Strict