Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Project 1 1. Provide a complete Assembly Language program that implements each o

ID: 3859415 • Letter: P

Question

Project 1

1. Provide a complete Assembly Language program that implements each of following problems; then run a test plan on each one. Note: a test plan should include: Normal, Boundary and Error cases

A. First, use 32-bit programming.

B. Second, use 64-bit programming.

2. Present your final results in the form of a Report that summarizes your work:

Title

Author

Revision

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

Acknowledgements

References

Appendix:

Pseudo-codes

Assembly source codes.

Test plans. Test Case runs, screen shots

1. I/O Programming a. Display a message, such as “Hello World”, on the screen.

b. Prompt the user for their Id (an integer value), then display it as part of text on the screen

c. Prompt the user for their last name, first name and middle name; then display the text strings on separate lines on the screen.

d. Repeatedly perform the action required in (1c), until the user asks to stop.

2. Arithmetic Operations

a. Prompt the user for the values of A, B, C. Calculate: D = A + B+ C; E = A – B – C + D; F = A – (B – C); G = 5B + 7A – 8C; H = – ( – A + 2B – C + D). Finally display the values for A, B, C, D, E, F, G, H. Display also the values in all the registers at the end.

b. Prompt the user for the values of Length, Width. Calculate and display: Perimeter = 2*Length + 2*Width; Area = Length * Width; Ratio = Area / Perimeter (display as quotient and remainder).

Explanation / Answer

1) a) First, use 32-bit programming:

Taken as a example Hello world

section .text
global_start ;must be declared for linker (ld)
  
_start: ;tells linker entry point
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
  
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel

section .data
msg db 'Hello, world!', 0xa ;string to be printed
len equ $ - msg ;length of the string

b) example taken as a Hello world :

section .text
;initially declares the linker ID
global_start   
;start which speifies the entry point
_start:   
;specifies the message length
mov edx,len   
;writing the message
mov ecx,msg
;file descriptor (stdout)
mov ebx,1
;system call number (sys_write)
mov eax,4   
;call kernel
int 0x80
;system call number (sys_exit)
mov eax,1
;call kernel
int 0x80
section .data
;string to be printed
msg db 'Hello, world!', 0xa
;length of the string
len equ $ - msg