Programming in assembly, hack.

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

Programming in assembly, hack.

Tathiane
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
|  
Report Content as Inappropriate

Re: Programming in assembly, hack.

cadet1620
Administrator
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 this post for link to my 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

Loading...