diff options
author | Michael Abed <michaelabed@gmail.com> | 2012-01-31 09:43:46 -0500 |
---|---|---|
committer | Michael Abed <michaelabed@gmail.com> | 2012-01-31 09:43:46 -0500 |
commit | 99e4960688b1893ff144ed7ba6b4da61e956e2a4 (patch) | |
tree | 54915d6c857caf999dc130062654d8a8ebf72cdc | |
parent | 1dd483b5f351e50ef6373f87cd27b001fb2a29a8 (diff) | |
download | ec327-hw1-99e4960688b1893ff144ed7ba6b4da61e956e2a4.tar.gz ec327-hw1-99e4960688b1893ff144ed7ba6b4da61e956e2a4.tar.bz2 ec327-hw1-99e4960688b1893ff144ed7ba6b4da61e956e2a4.zip |
make exponents actually work
-rw-r--r-- | problem4.asm | 35 |
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 |