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: /* "@(#)tmboot.s	7.1 (Berkeley) 6/5/86" */
   8: 
   9: /*
  10:  * VAX tape boot block for distribution tapes
  11:  * works on unibus tm03
  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: /* TM UBA registers */
  49:         .set    TMER,0
  50:         .set    TMCS,2
  51:         .set    TMBC,4
  52:         .set    TMBA,6
  53: /* TM commands and bits */
  54:         .set    GO,1
  55:         .set    TM_REW,016
  56:         .set    TM_RCOM,02
  57:         .set    TM_SREV,012
  58:         .set    TM_DCLR,010000
  59:         .set    TM_crdy,7
  60:         .set    TM_gapsd,3
  61:         .set    TMDENS,0                /* 1600 bpi */
  62: /* local stack variables */
  63:         .set    tapa,-4         /* desired tape addr */
  64:         .set    mtapa,-8        /* current tape addr */
  65:         .set    name,-8-PTHSIZ  /* operator-typed file name */
  66: /* register usage */
  67:         .set    rUBA,r10
  68:         .set    rTM,r11
  69: /* ===== */
  70: 
  71: /* initialization */
  72: init:
  73:         movl    $RELOC,fp       /* core loc to which to move this program */
  74:         addl3   $name,fp,sp     /* set stack pointer; leave room for locals */
  75:         clrl    r0
  76: 1:
  77:         movc3   $end,(r0),(fp)  /* move boot up to relocated position */
  78:         jmp     start+RELOC
  79: start:
  80:         bsbw    rew                     /* rewind input tape */
  81:         movab   name(fp),r4             /* start of filename storage */
  82:         movzbl  $'=,r0                  /* prompt character */
  83:         bsbw    putc                    /* output char to main console */
  84: /* read in a file name */
  85:         movl    r4,r1                   /* loc at which to store file name */
  86: nxtc:
  87:         bsbw    getc                    /* get input char's in file name */
  88:         cmpb    r0,$012                 /* terminator ? */
  89:         beql    nullc
  90:         movb    r0,(r1)+
  91:         brb     nxtc
  92: nullc:
  93:         subl3   r4,r1,r9                /* size of path name */
  94:         beql    start                   /* dumb operator */
  95:         clrb    (r1)+
  96:         incl    r9
  97: /* user-specified TP filename has been stored at name(fp) */
  98: /* read in entire tp directory contents into low core */
  99: dirred:
 100:         movl    $8,tapa(fp)             /* tp directory starts at block 8 */
 101:         movl    $(NUMDIR*BLKSIZ),r6     /* no. bytes in total dir */
 102:         bsbw    taper                   /* read no. bytes indicated */
 103: /* search entire directory for user-specified file name */
 104:         clrl    r5                      /* dir buff loc = 0 */
 105: nxtdir:
 106:         cmpc3   r9,(r5),(r4)            /* see if dir entry matches filename */
 107:         beql    fndfil                  /* found match */
 108:         acbl    $NUMDIR*BLKSIZ-1,$ENTSIZ,r5,nxtdir
 109:                                         /* see if done with tp dir */
 110:         brw     start                   /* entry not in directory; start over */
 111: /* found desired tp dir entry */
 112: fndfil:
 113:         movzwl  BNUM(r5),tapa(fp)       /* start block no., 2 bytes */
 114:         addl2   $7,tapa(fp)             /* skip 7 boot blocks */
 115:         movzwl  FILSIZ(r5),r6           /* low 2 bytes file size */
 116:         insv    FILSIZ-1(r5),$16,$8,r6  /* file size, high byte */
 117:         cmpl    r6,$RELOC-512           /* check if file fits below stack */
 118:         blss    filok                   /* file o.k. */
 119:         brw     start                   /* file too large */
 120: /* time to read in desired file from tape */
 121: filok:
 122:         movl    r6,r7                   /* save r6 */
 123:         bsbb    taper
 124:         bsbw    rew
 125: /* clear core */
 126:         subl3   r7,$RELOC-4,r0          /* no. bytes to clear */
 127: 1:
 128:         clrb    (r7)+
 129:         sobgtr  r0,1b
 130: /* time to jump to start of file & execute */
 131:         addl3   $20,fp,ap
 132:         clrl    r5
 133:         calls   $0,(r5)
 134:         brw     start
 135: /* taper: movcTAPE (r6),tapa(fp),0 */
 136: rew2:
 137:         bsbb    rew                     /* beginning of tape */
 138: taper0:
 139:         bsbb    rrec                    /* advance 1 block; never want blk 0 */
 140: taper:
 141:         clrl    r0                      /* page no. */
 142:         cmpl    mtapa(fp),tapa(fp)      /* current position .vs. desired */
 143:         bgtr    rew2
 144:         blss    taper0
 145: 1:
 146:         bsbb    rrec
 147:         acbl    $1,$-BLKSIZ,r6,1b
 148:         rsb
 149: /* rew: rewind the tape */
 150: rew:
 151:         clrl    mtapa(fp)               /* current position */
 152:         movw    $TM_REW+TMDENS+GO,TMCS(%rTM)
 153:         rsb
 154: /* rrec: read 1 block from mag tape into page (r0) */
 155: rrec:
 156:         /* pushl r0; movzbl $'r,r0; bsbw putc; movl (sp)+,r0; */
 157:         jsb     tmquiet
 158:         movw    $-BLKSIZ,TMBC(%rTM)
 159:         bisl3   $MRV|MR_BDP1,r0,UBA_MAP(%rUBA)
 160:         movw    $0,TMBA(%rTM)
 161:         movw    $TM_RCOM+TMDENS+GO,TMCS(%rTM)
 162:         jsb     tmquiet
 163:         bisl2   $BNE,UBA_DPR1(%rUBA)
 164:         tstw    TMER(%rTM)
 165:         jgeq    2f
 166:         mnegw   $1,TMBC(%rTM)
 167:         movw    $TM_SREV+TMDENS+GO,TMCS(%rTM)
 168:         jmp     rrec
 169: 2:
 170:         incl    r0                      /* next page no. */
 171:         incl    mtapa(fp)               /* mag tape block position */
 172:         rsb
 173: getc:
 174:         mfpr    $RXCS,r0
 175:         bbc     $RXCS_pd,r0,getc        /* receiver ready ? */
 176:         mfpr    $RXDB,r0
 177:         extzv   $0,$7,r0,r0
 178:         cmpb    r0,$015
 179:         bneq    putc
 180:         bsbb    putc
 181:         movb    $0,r0
 182:         bsbb    putc
 183:         movb    $012,r0
 184: putc:
 185:         mfpr    $TXCS,r2
 186:         bbc     $TXCS_pr,r2,putc        /* transmitter ready ? */
 187:         extzv   $0,$7,r0,r0
 188:         mtpr    r0,$TXDB
 189:         rsb
 190: tmquiet:
 191:         movw    TMCS(%rTM),r2
 192:         bbc     $TM_crdy,r2,tmquiet
 193: 1:
 194:         movw    TMER(%rTM),r2
 195:         blbc    r2,1b                   /* low bit == TUR */
 196:         bbs     $TM_gapsd,r2,1b
 197:         rsb
 198: end:

Defined functions

dirred defined in line 99; never used
end defined in line 198; used 1 times
  • in line 77
filok defined in line 121; used 1 times
fndfil defined in line 112; used 1 times
getc defined in line 173; used 2 times
init defined in line 72; never used
nullc defined in line 92; used 1 times
  • in line 89
nxtc defined in line 86; used 1 times
  • in line 91
nxtdir defined in line 105; used 1 times
putc defined in line 184; used 5 times
rew defined in line 150; used 3 times
rew2 defined in line 136; used 1 times
rrec defined in line 155; used 3 times
start defined in line 79; used 5 times
taper defined in line 140; used 2 times
taper0 defined in line 138; used 1 times
tmquiet defined in line 190; used 3 times
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1025
Valid CSS Valid XHTML 1.0 Strict