Programming in assembly, hack.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Programming in assembly, hack.

souz21
Write a program that verifies if two numbers one is multiple of the other. The result must be saved in memory.

I have to write this program using this project assembly 6, hack.

Can anyone give me examples of how to use this language?
Reply | Threaded
Open this post in threaded view
|

Re: Programming in assembly, hack.

cadet1620
Administrator
This post was updated on .
Tathiane wrote
Write a program that verifies if two numbers one is multiple of the other. The result must be saved in memory.

I have to write this program using this project assembly 6, hack.

Can anyone give me examples of how to use this language?
Chapter 4 presents the Hack assembly language. See Introduction to Hack Assembly Lannguage, which includes an example program.

Because the Hack computer does not include multiplication or division hardware, there are no multiplication or division instructions in the assembly language. To solve your problem, you must either write a division algorithm algorithm or you must find an algorithm that that can check divisibility without using division.

The good news is that there is such an algorithm. Research greatest common divisor. There is a version of Euclid's GCD algorithm that only requires subtraction.

--Mark