From ec61018d15ba4ad0a41e1ab44d7e1ecb5f2870d2 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 12 Dec 2017 14:30:43 +0100 Subject: finished project 4 --- projects/04/fill/Fill.asm | 64 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) (limited to 'projects/04/fill/Fill.asm') diff --git a/projects/04/fill/Fill.asm b/projects/04/fill/Fill.asm index 8f24a95..16d63e2 100644 --- a/projects/04/fill/Fill.asm +++ b/projects/04/fill/Fill.asm @@ -11,4 +11,66 @@ // "white" in every pixel; // the screen should remain fully clear as long as no key is pressed. -// Put your code here. \ No newline at end of file +// Put your code here. + +(BEGIN) +@KBD +D=M + +@BLACK +D;JNE + +@WHITE +0;JMP + +(BLACK) +@8191 +D=A +@i +M=D + +(LOOPB) +@i +D=M +@j +M=D +@SCREEN +D=A +@j +M=M+D +A=M +M=-1 +@i +M=M-1 +D=M +@LOOPB +D+1;JGT + +@BEGIN +0;JMP + +(WHITE) +@8191 +D=A +@i +M=D + +(LOOPW) +@i +D=M +@j +M=D +@SCREEN +D=A +@j +M=M+D +A=M +M=0 +@i +M=M-1 +D=M +@LOOPW +D+1;JGT + +@BEGIN +0;JMP -- cgit v1.2.3