Read Data From Disk

If the disk is in "read" mode and the disk has not yet finished reading in data from disk to memory, then copy the value from the next disk location to the memory cell. More formally,

if the following are true:
  • value of cell 49 at time t = 1
  • value of cell 48 at time t = 0
  • disk bytes read at time t < value of cell 46 at time t

then value of cell (30 + (disk bytes read at time t)) at time (t + 1) = disk byte at index: ((value of cell 47 at time t) + (disk bytes read at time t)) time: t

For example, suppose that the following are true:

  • value of cell 46 at time 162 = 3
  • value of cell 47 at time 162 = 3
  • value of cell 48 at time 162 = 0
  • value of cell 49 at time 162 = 1
  • disk bytes read at time 162 = 0
  • disk byte at index: 3 time: 162 = 98

Disk "bytes read" (0) is less than the value of cell 46 (3), so we can conclude that:

value of cell (30 + (disk bytes read at time 162)) at time (162 + 1) = disk byte at index: ((value of cell 47 at time 162) + (disk bytes read at time 162)) time: 162

After some substitutions and simplification, this becomes:

value of cell 30 at time 163 = 98

click here for the full proof.

Try running the simulator below to see the disk copy values from the disk to memory cells starting at cell #30.

Time: 0
LW Computer IO Simulator

Comments

Please log in to add comments