+/TECS
git clone https://git.julia.blue/+/TECS
3311316
master
1// This file is part of www.nand2tetris.org 2// and the book "The Elements of Computing Systems" 3// by Nisan and Schocken, MIT Press. 4// File name: projects/04/Fill.asm 5 6// Runs an infinite loop that listens to the keyboard input. 7// When a key is pressed (any key), the program blackens the screen, 8// i.e. writes "black" in every pixel. When no key is pressed, the 9// program clears the screen, i.e. writes "white" in every pixel. 10 11@24576 12D =A 13@R0 14M =D 15@START 160 ;JMP 17( CLEAR ) 18@R1 19M =0 20@START 210 ;JMP 22( FILL ) 23@R1 24M= -1 25( START ) 26@SCREEN 27D =A 28@R2 29M =D 30( LOOP ) 31@R1 32D =M 33@R2 34A =M 35M =D 36@R2 37M =M + 1 38D =M 39@R0 40D =D - M 41@CHECK 42D ;JEQ 43@LOOP 440 ;JMP 45( CHECK ) 46@KBD 47D =M 48@CLEAR 49D ;JEQ 50@FILL 510 ;JMP