Subject Computer Science Assembly Language Programming

Question

OBJECTIVES:
1. Exercise the integration of C and ASM modules
2. Apply control and logical instructions
3. Understanding abstract specifications
4. Design and implementation schemes

A typical code implementation approach is addressed in three stages: input, processing, and output.
Input stage. In this stage, I/O code is written to access data from the user (using the keyboard), from an input file, or a database.
Procesing stage. This stage transforms data by applying a mapping procedure specified via an algorithm or a set of equations.
Output stage. Some, or all the data that is transformed, is saved back into an output file, a database, or simply displayed at the user request.

This assignment seeks to apply the three-stage implementation approach by writing the assembly code that generates the output of the mod function in two different ways in two different modules:
Use a C main program to do I/O and to call your assembly modules as needed. Design an experiment based on a loop similar to the following:
For k = 2 to k=25 {
n = 4´k
m = k
call your module for equation (1)
call your module for equation (2)
Display your results as follows: k, m, n, value v from eqn 1, value v from eqn. 2
}

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include <stdio.h>
#include <stdlib.h>

// Extern asm functions
int mod1(int m, int n);
int mod2(int m, int n);

// Main function
int main()
{
// Variables
int k; // loop variable
int m; // dividend
int n; // divisor
int v1; // result of mod1
int v2; // result of mod2

// Loop from 2 to 25
for (k = 2; k <= 25; k++)
{
n = 4 * k; // divisor is 4 times k
m = k; // dividend is k
v1 = mod1(m, n); // calculate mod1
v2 = mod2(m, n); // calculate mod2
printf("%d %d %d %d %d\n", k, m, n, v1, v2); // print the result in a line
}
return 0;
}...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Encryption Library
Homework Solution
$35.00
Computer
Science
Assembly
Language
Programming
Encryption
Library
String
Characters
Raid Simulation Program Using Assembly Language
Homework Solution
$150.00
Assembly Language
Programming
Computer Science
Algorithms
Strings
Files
XOR
Commands
Input
Output
Bytes
System Kernel
Loop Counter
Pointers
Memory
Variables
x86 Assembly Language Questions about Registers and Flags
Homework Solution
$8.00
X86
Assembly
Register
Flag
Mode
ESP
CPU
Stack
Status
Variable
Unsigned
Signed
Arithmetic
Operation
Bit
Floating
Point
Data
Negative
Positive
Base
Pointer
Carry
EBP
Interrupt
Signal
Error
FP
Overflow
Underflow
Direction
Trap
Boolean Function Example
Homework Solution
$3.00
Boolean
Function
Output
Input
Table
Truth
Logical
Assembly
Language
Programming
Get help from a qualified tutor
Live Chats