From 9f42f81c08f9e51406a6283712144b2cdaa777e2 Mon Sep 17 00:00:00 2001 From: Michael Abed Date: Tue, 31 Jan 2012 09:41:37 -0500 Subject: handle mult by 0 (by 1 still broken) --- problem1.asm | 15 +++++++++++---- 1 file 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 -- cgit v1.2.3-54-g00ecf