From 4025e16dd8ea8ebd28d30e4d61911e42bdc77ffd Mon Sep 17 00:00:00 2001 From: Sean O'Connor Date: Wed, 10 Sep 2025 15:48:45 -0400 Subject: [PATCH] project04: complete --- 04/fill/Fill.asm | 2 +- 04/mult/Mult.asm | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/04/fill/Fill.asm b/04/fill/Fill.asm index 4548e4b..c6751b6 100644 --- a/04/fill/Fill.asm +++ b/04/fill/Fill.asm @@ -15,7 +15,7 @@ (LOOP) // main loop // check kb input - @KBD // sel kb reg + @KBD // sel kb D=M // load kb value to data @FILL_BLACK // sel fill black D;JNE // jump if key pressed (jump not equal? non-zero) diff --git a/04/mult/Mult.asm b/04/mult/Mult.asm index 744375d..2ac09f9 100644 --- a/04/mult/Mult.asm +++ b/04/mult/Mult.asm @@ -7,7 +7,10 @@ // (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.) // The algorithm is based on repetitive addition. -// excuse excessive comments here.. +// excuse excessive comments here.. this is how I did asm in 306. +// to multiply, we add r0 to r2, r1 times. +// after each cycle (addition), we decrement r1. +// when r1 is zero, then we're done. // init r2 to 0 @2 // sel r2 @@ -25,8 +28,8 @@ @2 // sel r2 D=M // load r2 to data @0 // sel r0 - D=D+M // add r0 to r2 (r2 in mem, r0 in data) - @2 // sel r2 + D=D+M // add r0 to r2 (r2 in data, r0 in mem) + @2 // sel r2 again M=D // store result in r2 // r1 -= 1 (decrement)