|
I have run the code as described in the book. However, when I press a key only a portion (approx 1/15) of the screen blackens. I tried to figure it out but failed. Here is the pseudo-code:
scradr = SCREEN
row = 256
col = 32
INFINITE_LOOP:
i = 0
k = KBD
if k == 0 goto NOT_PRESSED
PRESSED:
if i >= row goto INFINITE_LOOP
j = 0
PRESSED_INNER_LOOP:
if j >= col goto BREAK_INNER_LOOP
RAM[scradr+i+j] = -1
j = j + 1
goto PRESSED_INNER_LOOP
BREAK_INNER_LOOP:
i = i + 1
goto PRESSED
NOT_PRESSED:
if i >= row goto INFINITE_LOOP
j = 0
NOT_PRESSED_INNER_LOOP:
if j >= col goto BREAK_INNER_LOOP_2
RAM[scradr+i+j] = 0
j = j + 1
goto NOT_PRESSED_INNER_LOOP
BREAK_INNER_LOOP_2:
i = i + 1
goto NOT_PRESSED
Can someone please say how can this be solved?
|