summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--problem4.asm35
1 files changed, 19 insertions, 16 deletions
diff --git a/problem4.asm b/problem4.asm
index 50dd510..9c52c4e 100644
--- a/problem4.asm
+++ b/problem4.asm
@@ -1,23 +1,26 @@
-
-; n^m n at 1, m at 2. both unsigned
-
- mov R0, 0x1
+; n^m n at 1, m at 2. both unsigned store at 30
+ mov R4, 0x1
mov R1, 0x2
- mov R0, [R0]
mov R1, [R1]
- mov R4, R0
- mov R3, 1
+ mov R4, [R4]
+ mov R5, R4
+ inc R2
+ cmp R1, R2
+ jne outer
+ mov R0, R4
+ jmp done
outer:
- mov R2, 1
- inc R3
+ mov R0, 0
inner:
- inc R2
add R0, R4
- cmp R2, R4
+ inc R3
+ cmp R3, R5
jne inner
- cmp R3, R1
+ mov R4, R0
+ mov R3, 0
+ inc R2
+ cmp R2, R1
jne outer
- mov R2, 0x1E
- mov [R2], R0
- halt
-
+done:
+ mov R1, 0x1E
+ mov [R1], R0