Incrementing The Cursor's Y Position

If the display has reached the end of a line, then move the cursor to the beginning of the next line. More formally,

if the following are true:
  • value of cell 27 at time t = 1
  • cursor x at time t = 39
  • cursor y at time t < 11

then cursor y at time (t + 1) = (cursor y at time t) + 1

For example, suppose that the following are true:

  • value of cell 27 at time 40 = 1
  • cursor x at time 40 = 39
  • cursor y at time 40 = 0

The cursor's y value is 0. Thus, the cursor's y value is less than 11. Then we conclude that

cursor y at time (40 + 1) = (cursor y at time 40) + 1

After some substitutions and simplification, this becomes:

cursor y at time 41 = 1

Try running the simulator below to see the display cursor y value increase after 40 characters.

Time: 0
LW Computer IO Simulator

Comments

Please log in to add comments