summaryrefslogtreecommitdiff
path: root/projects/hack-as/test/conventional.asm
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2022-08-21 22:08:53 +0800
committerFrederick Yin <fkfd@fkfd.me>2022-08-21 22:08:53 +0800
commit6b9d8f151cc04a0590a7fed80ae5b8eb3928952a (patch)
treed1aa6304c866ee761fbb7109ef0c2494bec45636 /projects/hack-as/test/conventional.asm
parentdcb924797d68f8de0755471b679d9256516360a9 (diff)
Move hack-as up one directory
Diffstat (limited to 'projects/hack-as/test/conventional.asm')
-rw-r--r--projects/hack-as/test/conventional.asm32
1 files changed, 32 insertions, 0 deletions
diff --git a/projects/hack-as/test/conventional.asm b/projects/hack-as/test/conventional.asm
new file mode 100644
index 0000000..5510424
--- /dev/null
+++ b/projects/hack-as/test/conventional.asm
@@ -0,0 +1,32 @@
+// conventional asm a sane person would write
+// draw a rectangle on top left of screen
+// width 16px, height specified in RAM[0]
+@0
+D=M
+@INFINITE_LOOP
+D;JLE // reject if height is negative
+@counter
+M=D
+@SCREEN
+D=A
+@address
+M=D
+(LOOP)
+ @address
+ A=M
+ M=-1
+ @address
+ D=M
+ @32
+ D=D+A
+ @address
+ M=D
+ @counter
+ MD=M-1
+ @LOOP
+ D;JGT
+
+(INFINITE_LOOP)
+ @INFINITE_LOOP
+ 0;JMP
+