From 99e4960688b1893ff144ed7ba6b4da61e956e2a4 Mon Sep 17 00:00:00 2001 From: Michael Abed Date: Tue, 31 Jan 2012 09:43:46 -0500 Subject: make exponents actually work --- problem4.asm | 35 +++++++++++++++++++---------------- 1 file 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 -- cgit v1.2.3-54-g00ecf