homework 3
use AND instead of DIV fixes #1
setup and cleanup stack pointer
All programs were written, compiled, and tested on a 64-bit Intel CPU running Linux.
Write a procedure in i7 assembly language to find the largest prime less than 1000. Use the Sieve of Eratosthenes algorithm, and appropriate address jumps when looping. Embed it in a C or C++ program to do the I/O.
> make primes
> ./bin/primes 10
Write a procedure in i7 assembly language to implement the Russian Peasant multiplication algorithm using shifting. Embed it in a C or C++ program to do the I/O.
> make rpm
> ./bin/rpm 20 12
Write a procedure in i7 assembly language to accept a binary number of length less than or equal to 8, interpret it as a 2's complement number of 8 bits, and return the ASCII string for the number, suppressing the leading zeroes but printing either a +
or -
in front. Examples: 00001111 or 1111 becomes +1111\0, 11001111 becomes -11001\0. Note: the character 0
is 30 in hex or 48 in decimal.
> make binstring
> ./bin/binstring 1111