summaryrefslogtreecommitdiff
path: root/projects/hack-as/test/conventional.asm
blob: 5510424d188570cdf5507f565201a140dab11dd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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