Resetting the Cursor's X 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

then cursor x at time (t + 1) = 0

For example, if the following are true:

  • value of cell 27 at time 5 = 1
  • cursor x at time 5 = 39

then cursor x at time (5 + 1) = 0

Thus, the cursor's x value at time 6 is 0.

Try running the simulator below to see the display cursor x value reset to 0 after 40 characters.

Time: 0
LW Computer IO Simulator

Comments

Please log in to add comments