Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Implement in x 8 6 ( 3 2 - bit ) assembly code for the following calculations, according to the specified requirements. a

1. Implement in x86(32-bit) assembly code for the following calculations, according to the specified requirements.
a. Y =(2c(AB)+ aA^2+ bB^2)^4, if (A >0 and B <0)
=(A/B)/(DE), if (B >0 and D >0 and E >0)
=0, otherwise.
b. Create and use as function modules, PROCedures: ProductXYZ(), SquareX(), DivXY(),
c. ProductXYZ(X,Y,Z):
Input arguments: Passed via the system Stack
Ouput result: passed through a Register
Function: compute:V = X*Y; W = V*Z; return W as result
V and W are treated as local variables
d. SquareX(X):
Input arguments: passed via the system Stack
Output result: passed through a Register
Function: compute W = X*X; return W as result
W is treated as a local variable.
e. DivXY(X, Y):
Input arguments: passed via Registers
Output results: passed via registers
Function: compute Q = quotient of (X/Y), R = remainder of (X/Y).
Return Q, R as results.
Q and R are treated as local variables.
2.(Extra Credit) Implement the code in Problem in x86(64-bit) assembly
programming.
3. Do the following problems:
a. Write x86(32-bit programming) ASL code to generate Pascals Triangle for a
given N.
b. Write x86(64-bit programming) ASL non-recursive code to generate Fibonacci
sequence for a given N.
4. Create Your Problems:
Create at least 3 to 5 to questions using concepts involved in x86 ASL Programming
Procedures or subroutines available (64-bit versions are also presumed to be available):
CombNK():
Inputs: EBX: N, EDX: K
Output: EAX
Implement: C(N, K)
TwoExponentN():
Input: EBX: N
Output: EAX: R
Implement: R =2^N
MUL operation
IMUL operation
DIV operation
IDIV operation
MultProc()
Inputs: EAX: P, EBX: Q
Outputs: EDX:EAX
Implements: P x Q
// see MUL instruction operation
DivProc():
Inputs: EDX:EAX: P // Dividend
EBX: D // Divisor
Outputs: EAX: Q // Quotient
EDX: R // Remainder
Implements: (P / D)=(Q x D)+ R
ApproxEDiv():
Inputs: _
Outputs: EAX: E
Implements appropriate integer approximation for (1/e)
ApproxSqRT():
Inputs: EDX: V
Outputs: EAX: S
Implements appropriate integer approximation for S = V^(1/2)
(2024) Prof. Amenyo. York College, CUNY, Final Exam, Spring 20246
ReadInput():
Inputs: EDI: pointer to input storage area
ECX: size of input storage area
Outputs: EDI: pointer to content read
ECX: size of actual content read
EAX: status of ReadInput: 0 means Success
Implements: get Input data from Interactive source
WriteOutput():
Inputs: ESI: pointer to storage area of data to be displayed
ECX: size of output data
Outputs: EAX: status of WriteOutput: 0 means Success
// Can also use Input and Output functions from C, C++, Java, Python, K. Irvines ASL Library, as long
as clearly indicated.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions