Re: we have a mult.asm. Can anyone do it for division.asm
it was similar to the mult.asm. but i am looking something like this for the division.
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/04/Mult.asm
// Multiplies R0 and R1 and stores the result in R2.
// (R0, R1, R2 refer to RAM, RAM, and RAM, respectively.)
M=0 // Initialize sum to 0
M=D // Initialize count to the value at RAM
D;JEQ // Check if count is 0, if so, goto END
M=M+D // Add RAM to sum
M=M-1 // Decrement count by 1
0;JMP // Loop again
M=D // Write sum to RAM