Assembly language assignment question

Project 2

Provide the Assembly Language source code fragments that will implement each of following, together with a test plan.

Note: a test plan should include: Normal, Boundary and Error cases

Present your final results in the form of report that summarizes your work:
Introduction: Problem Statement
Method: Design, Pseudo-code(s); place actual pseudo-codes in the Appendix
Solution: Assembly Language Implementations; place actual Assembly Language source codes in the Appendix
Results and Discussion: Test Plan(s),
Snapshots (screen shots) of Running of Test Cases; place Test Plans in the Appendix
Summary and Conclusions
ASM source codes
Test plans
Test Case runs, screen shots

1. Write the program that performs the following
(a) Carry out division of two non-negative integers using repeated subtraction:
Divide EAX by EBX, put quotient in ECX and Remainder in EDX

Initialize Quotient to 0
While Dividend >= Divisor
Increment Quotient
Subtract Divisor from Dividend

(b) Carry out multiplication of two non-negative integers using repeated addition:
Multiply EAX = M by EBX = N, put product in ECX = (MN)

Initialize Product to 0
add M to Product
decrement N
`} UNTIL (N = 0)

2. Use Boolean logic instructions (AND, OR, XOR, NOT) to perform each of the following actions

BoolProc PROC

; (a) Place 0053H in CL; then zero extend CL into EDX (using MOVZX); then change contents of EDX so
; that DL is 0073H

; (b) Set the low-order 8 bits of EAX

; (c) Reset(Clear) the high-order 7 bits of EAX

; (d) Invert bits 23, 17, 15, 13, 9, 8, 7, 3, 2 of EAX

; (e) read 2 characters from the keyboard; then perform AND, OR, XOR on the characters; then display
the results on the screen

; (f) Assume AL contains the ASCII code for an upper case character. Write the code convert the content
into the corresponding lower case character. Test with 2 cases by displaying the results on the

BoolProc ENDP

Write a test program (Main PROC) to check and ensure your code works as intended.

3. (a) read 20 decimal integers from the keyboard; then add them together;
then display the sum on the screen. Use HW Stack PUSH and POP operations, where suitable.

(b) Without using HW Stack PUSH and POP operations at all, read 20 decimal integers; then add them together;
then display the sum on the screen.

4. (a) Declare in memory storage for up to 100 integers, each of with fits into 16-bits.
(b) Ask the user how many sessions (K) to perform
(c) For each session,
x) ask how many integers (N) to handle
xx) Read N decimal integers from the keyboard and store them in the declared memory location
xxx) Subtract the 2nd to N integers from the first integer
xxxx) Display the result on the screen
v) Display the Flag Bits: ZF, SF, OF, CF, PF at the end of the session

5. Write a program to calculate the Fibonacci series up to N. To test your code, set N to be N = 1, 2, 5, 10, 100,
Fib(0) = 0
Fib(1) = 1
Fib(2) = 1
Fib(n) = Fib(n-1) + Fib(n-2), n > 3.