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

Assembly Language for x86 Processors 1. Simple Addition (1) Write a program that

ID: 3700487 • Letter: A

Question

Assembly Language for x86 Processors

1. Simple Addition (1)

Write a program that clears the screen, locates the cursor near the middle of the screen,prompts the user for two integers, adds the integers, and displays their sum.

2. Simple Addition (2)

Use the solution program from the preceding exercise as a starting point. Let this new program repeat the same steps three times, using a loop. clear the screen after each loop iteration.

3. Use the RandomRange function for the two numbers to add. Display the two numbers in the middle of the window. Ask the user to input the answer. Test the answer to see if it is correct using the je or jne.

Explanation / Answer

.model small
.data
a db "Enter the first number$"
b db "Enter the second number$"
c db "The sum is: $"
d db 00h

.code
start:
mov cx,3

loopstart:

mov ah, 2
mov bh, 1
mov dh, 12
mov dl, 40
int 10h

mov ax,@data
mov ds,ax
mov dx,offset a
mov ah,09h
int 21h

mov ah,01h
int 21h
mov bh,al
mov ah,01h
int 21h
mov bl,al

mov dx,offset b
mov ah,09h
int 21h
mov ah,01h
int 21h
mov ch,al
mov ah,01h
int 21h
mov cl,al
add al,bl
mov ah,00h
aaa
add bh,ah
add bh,ch
mov d,al
mov al,bh
mov ah,00h
aaa
mov bx,ax
add bx,3030h

mov dx,offset c
mov ah,09h
int 21h

mov dl,bh
mov ah,02h
int 21h
mov dl,bl
mov ah,02h
int 21h
mov dl,d
add dl,30h
mov ah,02h
int 21h

dec cx
jnz loopstart
end start

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote