diff options
author | Michael Abed <michael@pidgey.localdomain> | 2012-01-31 09:41:37 -0500 |
---|---|---|
committer | Michael Abed <michael@pidgey.localdomain> | 2012-01-31 09:41:37 -0500 |
commit | 9f42f81c08f9e51406a6283712144b2cdaa777e2 (patch) | |
tree | 5a59fd20fe886b40a237b932cf4d409301969512 | |
parent | c356b7a1848449b31278659e8b0df503881ed008 (diff) | |
download | ec327-hw1-9f42f81c08f9e51406a6283712144b2cdaa777e2.tar.gz ec327-hw1-9f42f81c08f9e51406a6283712144b2cdaa777e2.tar.bz2 ec327-hw1-9f42f81c08f9e51406a6283712144b2cdaa777e2.zip |
handle mult by 0 (by 1 still broken)
-rw-r--r-- | problem1.asm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/problem1.asm b/problem1.asm index 882eec2..f27fd90 100644 --- a/problem1.asm +++ b/problem1.asm @@ -5,14 +5,21 @@ mov R2, [R5] inc R5 mov R3, [R5] + cmp R3, R4 + je zero sub R1, R2 - mov R2, 0x1 mov R4, R1 + mov R1, 0x0 + mov R5, 0x1 + cmp R3, R5 + je done loop: add R1, R4 - inc R2 - cmp R2, R3 + inc R4 + cmp R4, R3 jne loop +zero: + mov R1, 0x0 +done: mov R2, 0x1E mov [R2], R1 - halt |