The following guidelines are expected for all homework submissions:
all over the mapon my computer or printer. USE SPACES INSTEAD. You can set up almost every modern text editor to insert spaces whenever you press the TAB key, or you can simply pound the spacebar.
pair programmingwhich is part of the Extreme Programming [Agile] software development method. Agile teams are prevalent in the industry now, so feel free to collaborate in your groups as much as you want, doing the entire assignment together. Only submit ONE copy for the group.
Ccode to call 'nasm' functions; 3) writing functions in
C; 4) writing programs in 'nasm' that call
Cfunctions; and 5) writing programs in
Cthat call 'nasm' functions
stanley/penguin
language as your
guide, write an assembly program using nasm called findGCD.nasm
which
will find the GCD of the two numbers 3113041662
and 11570925
. Read the
two numbers from the keyboard at port stdinand write the result to port
stdout.
findGCDfunc.nasm
.
Change the code to be a nasm function which is able to be called from a Cprogram. Then write a program
gcdFinder.c
containing the code in Cto call your new function. Use the
assert()
functions from the Cassert library to test that your GCD finder code is working properly. You can link the assert library into your program by using
#include <assert.h>
as you've seen in class. Your assembly
code should take the two numbers as arguments which are passed from the Ccode.
1in a sequence of bits. It is used to help guarantee that nothing has gone wrong with the bit sequence during transmission. Parity is calculated based on the number of
1bits in a byte, and a ninth bit, the parity bit, is either set or cleared to achieve the proper parity, either even or odd. For example, for the byte
01101001
, assuming even
parity, the parity bit would be cleared so that the count of 1bits remains even for all nine bits; for the byte
10101110
,
assuming even parity, the parity bit would be set so that the count of
1bits remains even. Note that the parity bit IS NOT PART of the byte, IT IS A NINTH BIT which is separate from the byte in question.
paritygen.nasm
that will count the
onebits in a byte of data and print the proper value for the parity bit assuming we are using odd parity. Note that if there is an even number of ones, your program will print a
1and if there is an odd number it will print a
0.
Cprogram
whichEndIsUp.c
that will
determine whether your computer is big-endian or little-endian as was discussed in class.
Cfunction
makeNBOC.c
that takes a
number as an argument, checks to see if the order needs to be swapped to make Network Byte Order,
and swaps its byte order, if necessary. Modify a copy of your previous program from problem 4,
whichendisup.c
, to make a function that will determine the byte order and if it will
need to be swapped. You can also research the hton()
and ntoh()
functions to do the swapping [if you like]. Write a test program makeNBOtest.c
to
call your new function and display the results of the function call on stdout
using
printf()
.
makeNBON.nasm
which does the
byte order swapping BY CALLING YOUR Cfunction from problem 5. Make your nasm program call the function at least five times with different values to test it.