aboutsummaryrefslogtreecommitdiffstats
path: root/atk16_asm
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2024-04-13 22:27:54 +0300
committerJan Tuomi <jan@jantuomi.fi>2024-04-13 22:27:54 +0300
commita36e5e001a4f17505c40b7f7a8f9c1f514f40de1 (patch)
tree7511fff343ef5eb0329e18e5cb5584387c4f653a /atk16_asm
parent46459fc1b753abc83c355440a014c696c0dacd3a (diff)
Fix bugs, add tests
Diffstat (limited to 'atk16_asm')
-rw-r--r--atk16_asm/builtin_asm/std_mem.atk163
1 files changed, 2 insertions, 1 deletions
diff --git a/atk16_asm/builtin_asm/std_mem.atk16 b/atk16_asm/builtin_asm/std_mem.atk16
index 4c6a455..7a7efab 100644
--- a/atk16_asm/builtin_asm/std_mem.atk16
+++ b/atk16_asm/builtin_asm/std_mem.atk16
@@ -7,13 +7,14 @@
stack_stash RD RE
ldi 0 RD ; RD := i (counter), initially 0
@label memset_loop
- subi RB RD RE ; RE := n – i (unused value)
+ sub RB RD RE ; RE := n – i (unused value)
bri zero memset_done ; exit the loop
add RA RD RE ; RE := RA + i (address of the word to set)
str RC RE ; set the word at address RE to value in RC
inc RD ; i := i + 1
+ jpi memset_loop ; repeat the loop
@label memset_done
stack_restore RD RE
return