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

  1. / Hand-entered code to load the first record off the virtual tape.
  2. / Copyright 1998 Warren Toomey    wkt@cs.adfa.oz.au
  3. / Space optimised by John Holden at Sydney Uni
  4.  
  5. / The following registers are used:
  6. /    r0 holds the char to be sent or received
  7. /    r1 holds the base (where the next data char is to go)
  8. /    r2 holds the count, from 0 to 512
  9. /    r3 holds the address of KL11 unit 1
  10. /    r5 is used data pointer for outputing words
  11.  
  12. .. = 70000
  13.  
  14. .text
  15.  
  16. start:
  17.     mov    pc,sp        / Initialise the stack pointer
  18.     clr    r1        / Set the base to zero
  19.     mov    $176500, r3    / Set the base address of KL11 unit 1
  20.  
  21. outblk:
  22.     mov    $datalst,r4    / get data list
  23. 1:
  24.     movb    (r4)+,r0    / get item
  25.     bmi    3f        / list done
  26. 2:
  27.     tstb    4(r3)        / test ready bit
  28.     bpl     2b        / do nothing
  29.     movb    r0,6(r3)    / output character
  30.     br    1b        / and loop for next byte
  31. 3:
  32.     inc    block        / bump clock counter
  33.  
  34.     jsr    pc, getc    / get the reply
  35.     beq    4f        / If not zero, jump to address 0, i.e exit
  36.     clr    pc
  37.  
  38. 4:
  39.     mov     $1000, r2    / Set count to 512
  40. 5:
  41.     jsr    pc, getc    / Get a data character
  42.     movb    r0, (r1)+    / Save at base and increment it
  43.     dec    r2        / Decrement data count
  44.     bne    5b        / and loop if any left to get
  45.     br    outblk        / End of data, go back and get another block
  46.  
  47. getc:
  48.     tstb    (r3)        / test for ready bit
  49.     bpl     getc        / do nothing
  50.     movb    2(r3),r0    / get character
  51.     rts    pc
  52.  
  53. .data
  54. datalst:
  55.     .byte    31.        / command bytes
  56.     .byte    42.        / command bytes
  57.     .byte    0        / boot command
  58.     .byte    0        / record number
  59. block:    0            / block number
  60.     -1            / end of data marker. Assumes that there are
  61.                 / never more than 127 boot blocks
  62.