home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / src / cmd / standalone / mtboot.s < prev    next >
Encoding:
Text File  |  1998-02-03  |  2.1 KB  |  196 lines

  1. / tape boot program to load and transfer
  2. / the next item on the tape.
  3.  
  4. / entry is made by jsr pc,*$0
  5. / so return can be rts pc
  6.  
  7. core = 24.
  8. halt=0
  9. .. = [core*2048.]-512.
  10. start:
  11.     mov    $..,sp
  12.     mov    sp,r1
  13.     cmp    pc,r1
  14.     bhis    2f
  15.     clr    r0
  16.     cmp    (r0),$407
  17.     bne    1f
  18.     mov    $20,r0
  19. 1:
  20.     mov    (r0)+,(r1)+
  21.     cmp    r1,$core*2048.
  22.     blo    1b
  23.     jmp    (sp)
  24.  
  25. 2:
  26.     mov    $1f,*$4
  27.     mov    $340,*$6
  28.     tst    *$htcs1
  29.     mov    $htrew,rew
  30.     mov    $htread,tread
  31.     br    2f
  32. 1:
  33.     mov    $tmread,tread
  34.     mov    $tmrew,rew
  35. 2:
  36.     jsr    pc,*rew
  37.     mov    $2,tapa
  38.     mov    $-256.,wc
  39.     jsr    pc,*tread
  40.  
  41.     mov    *$2,r0
  42.     add    *$4,r0
  43.     sub    $512.,r0
  44.     asr    r0
  45.     neg    r0
  46.     bge    1f
  47.  
  48.     mov    r0,wc
  49.     mov    $3,tapa
  50.     mov    $512.,ba
  51.     jsr    pc,*tread
  52. 1:
  53.     jsr    pc,*rew
  54.     clr    r0
  55.     mov    $20,r1
  56.     mov    sp,r4
  57.     clc
  58.     ror    r4
  59. 1:
  60.     mov    (r1)+,(r0)+
  61.     sob    r4,1b
  62.     jsr    pc,*$0
  63.     br    .
  64.  
  65. htcs1 = 172440
  66. htba  = 172444
  67. htfc  = 172446
  68. htcs2 = 172450
  69. htds  = 172452
  70. httc  = 172472
  71.  
  72. P800 = 1300
  73. P1600 = 2300
  74. PIP = 20000
  75. RESET = 40
  76. MOL = 10000
  77. ERR = 40000
  78. REV = 33
  79. READ = 71
  80. REW = 7
  81.  
  82. htread:
  83. 1:
  84.     mov    ba,mtma
  85.     cmp    mtapa,tapa
  86.     beq    1f
  87.     bhi    2f
  88.     jsr    pc,hrrec
  89.     br    1b
  90. 2:
  91.     jsr    pc,htrew
  92.     br    1b
  93. 1:
  94.     mov    wc,r1
  95. 1:
  96.     jsr    pc,hrrec
  97.     add    $256.,r1
  98.     bmi    1b
  99.     rts    pc
  100.  
  101. hrrec:
  102.     mov    $htds,r0
  103.     tstb    (r0)
  104.     bpl    hrrec
  105.     bit    $PIP,(r0)
  106.     bne    hrrec
  107.     bit    $MOL,(r0)
  108.     beq    hrrec
  109.     mov    $htfc,r0
  110.     mov    $-512.,(r0)
  111.     mov    mtma,-(r0)
  112.     mov    $-256.,-(r0)
  113.     mov    $READ,-(r0)
  114. 1:
  115.     tstb    (r0)
  116.     bpl    1b
  117.     bit    $ERR,(r0)
  118.     bpl    1f
  119.     mov    $RESET,*$htcs2
  120.     mov    $-1,*$htfc
  121.     mov    $REV,(r0)
  122.     br    hrrec
  123. 1:
  124.     add    $512.,mtma
  125.     inc    mtapa
  126.     rts    pc
  127.  
  128. htrew:
  129.     mov    $RESET,*$htcs2
  130.     mov    $P800,*$httc
  131.     mov    $REW,*$htcs1
  132.     clr    mtapa
  133.     rts    pc
  134.  
  135.  
  136. mts = 172520
  137. mtc = 172522
  138. mtbrc = 172524
  139. mtcma = 172526
  140.  
  141. tmread:
  142. 1:
  143.     mov    ba,mtma
  144.     cmp    mtapa,tapa
  145.     beq    1f
  146.     bhi    2f
  147.     jsr    pc,tmrrec
  148.     br    1b
  149. 2:
  150.     jsr    pc,tmrew
  151.     br    1b
  152. 1:
  153.     mov    wc,r1
  154. 1:
  155.     jsr    pc,tmrrec
  156.     add    $256.,r1
  157.     bmi    1b
  158.     rts    pc
  159.  
  160. tmrrec:
  161.     mov    $mts,r0
  162.     bit    $2,(r0)+        / rewind status
  163.     bne    tmrrec
  164.     tstb    (r0)+        / cu ready
  165.     bpl    tmrrec
  166.     inc     r0
  167.     mov    $-512.,(r0)+    / byte count
  168.     mov    mtma,(r0)    / bus address
  169.     mov    $mtc,r0
  170.     mov    $60003,(r0)        / read 800bpi
  171. 1:
  172.     tstb    (r0)
  173.     bpl    1b
  174.     tst    (r0)+
  175.     bpl    1f
  176.     mov    $-1,(r0)
  177.     mov    $60013,-(r0)        / backspace
  178.     br    tmrrec
  179. 1:
  180.     add    $512.,mtma
  181.     inc    mtapa
  182.     rts    pc
  183.  
  184. tmrew:
  185.     mov    $60017,*$mtc
  186.     clr    mtapa
  187.     rts    pc
  188.  
  189. mtapa:    0
  190. mtma:    0
  191. tapa:    0
  192. wc:    0
  193. ba:    0
  194. rew:    0
  195. tread:    0
  196.