Moving Text Up

If the display is in the last column in the last line, and the display wants to draw more characters, make room in the last line by moving all the existing lines up by one.

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 display text at x: x, y: y, and time: (t + 1) = display text at x: x, y: (y + 1), and time: t

For example, if the following are true:

  • value of cell 27 at time 8 = 1
  • cursor x at time 8 = 39
  • cursor y at time 8 = 11
  • x = 16
  • y = 4
  • display text at x: 16, y: 5, and time: 8 = 107

y 4, which is less than 11. Then we conclude that

display text at x: 16, y: 4, and time: (8 + 1) = display text at x: 16, y: (4 + 1), and time: 8

After some substitutions and simplification, this becomes:

display text at x: 16, y: 4, and time: 9 = 107

Thus, the character that was in location (16, 5) is copied to location (16, 4).

Notice that characters at y = 0 are going to be overwritten by characters at y = 1. But unlike other rows, the old characters at y = 0 do not get copied anywhere, since there aren't any rows above y = 0. Thus, the old characters simply disappear.

Try running the simulator below. When the text completely fills the screen, the display rows will move up by 1.

Time: 0
LW Computer IO Simulator

Comments

Please log in to add comments