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.
Instructions
addi dst=10 src=0 imm=65
addi dst=11 src=0 imm=66
addi dst=12 src=0 imm=67
addi dst=13 src=0 imm=68
addi dst=14 src=0 imm=69
addi dst=15 src=0 imm=70
addi dst=16 src=0 imm=71
addi dst=17 src=0 imm=72
addi dst=18 src=0 imm=73
addi dst=19 src=0 imm=74
addi dst=20 src=0 imm=75
addi dst=21 src=0 imm=76
addi dst=22 src=0 imm=77
addi dst=23 src=0 imm=78
addi dst=24 src=0 imm=79
addi dst=25 src=0 imm=80
addi dst=26 src=0 imm=16
addi dst=27 src=0 imm=1
jump imm=0
# | Memory Cell Value |
---|---|
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 |
Computer A
Program Counter 0
Number Printed | Cursor X | Cursor Y |
---|---|---|
0 | 0 | 0 |
DISPLAY_A
Time 0
LW Computer I/O Simulator
Comments
Please log in to add comments