Hi, I want to see if I have the correct steps in the program using assembly lang
ID: 3757316 • Letter: H
Question
Hi, I want to see if I have the correct steps in the program using assembly language for 3B or I need to add something else. Thanks.
Code:
; TITLE Adding four 32-bit Integer Variables (3B.asm)
; Program Description:
; This program will contain four 32-bit integer variables and add these values together, saving the result in a variable The sum should still be in the EAX register when you call the library routine DumpRegs.
; Author: Yen Jiu
; Creation Date: September 20, 2018
; Status: Completed
INCLUDE Irvine32.inc
.data
; declaring hexadecimal variables
var1 SDWORD 30050201h
var2 SDWORD 60040102h
var3 SDWORD 72010103h
var4 SDWORD 0B0700105h
.code
main PROC
MOV EAX, var1 ; moving var1 to EAX register
ADD EAX, var2 ; adding var2 to EAX register
ADD EAX, var3 ; adding var3 to EAX register
ADD EAX, var4 ; adding var4 to EAX register
call dumpregs ; displaying registers
call Waitmsg
exit
main ENDP
END main
Output:
Assignment 3A - A program that adds and subtracts 32-bit numbers After installing the assembler on the computer, enter the following program, save it, assemble it and run it. Do not forget to add a comment with your name in it. You will hand in a listing (e.g., addsum.asm) that should include your name TITLE Add and Subtract (AddSum.asm) This program adds and subtracts 32-bit integers Caterina Pentcheva INCLUDE Irvine32.inc .code main PROC mov eax, 10000h EAX- 10000h add eax, 40000h ;EAX = 50000h eax, 20000h EAX 30000h call DumpRegs display registersExplanation / Answer
data segment
abc dd 12345678h
def dd 9ABCDEF0h
ghi dw ?
data ends
code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
mov dl,00h
mov ax, word ptr abc
mov bx, word ptr def
add ax,bx
mov word ptr ghi,ax
mov ax, word ptr abc+2
mov bx, word ptr def+2
adc ax,bx
mov word ptr ghi+2,ax
jnc move
inc dl
move: mov byte ptr ghi+4,dl
int 3
code ends
end start
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.