There is a built-in symbol "KBD" tha you can use here instead of 24576.
@i // if i==n,goto END
D=M
@n
D=D-M
@END
D,JEQ
...
(END)
@END
0;JMP
The Fill program should never enter a halt loop. After filling with white, it needs to recheck the keyboard to see if it needs to fill black. Likewise, after filling black it needs to check if it needs to fill white.
There is a built-in symbol "KBD" tha you can use here instead of 24576.
@i // if i==n,goto END
D=M
@n
D=D-M
@END
D,JEQ
...
(END)
@END
0;JMP
The Fill program should never enter a halt loop. After filling with white, it needs to recheck the keyboard to see if it needs to fill black. Likewise, after filling black it needs to check if it needs to fill white.