need help with this work from computer org. please give screenshot of output if
ID: 3888600 • Letter: N
Question
need help with this work from computer org. please give screenshot of output if possible
Need help with this contru nom Compdo ong hhute an assembly la arithmetic operations advandbla&alled; let'= 344 rquage progrom dhds perl oms a Colculate Tne Sum ol tuo voriables lelt ard siaid ond storeln total mesage shoP contains uloRD called 'Atray thod is Deine a charader stzung called messoge thar contains the chanadrn Melo World! Deline an anrau d atatype wlo?b called 1ni intialiaed to ho llas values 1, 2,,, 32and cada to determine lerath Asho lrite assembly bagige d Store this vdue in. variahle callod 'Arrayerth Move the contents dhe varioHe lelt into the EAX Cl CX 0) rraul Call the authonis dumpReg haudioe to display contentsExplanation / Answer
.model small
.data
left dw 034Ch ;left variable declartion
right dw 0C4Eh ;right variable declartion
total dw 01 dup(?),'$' ;total variable
.code
mov ax,@data
mov ds,ax
mov ax,left
mov bx,right
clc
add ax,bx
mov di,offset total ;storing in total
mov [di], ax
mov ah,09h
mov dx,offset total
int 21h
mov ah,4ch
int 21h
end
;program to subtract two numbers
ORG 100H
.MODEL SMALL
.DATA
LEFT DB 5, 2 DUP(?)
RIGHT DB 5, 2 DUP(?)
PROMPT DB 'ENTER FIRST NUMBER:', '$' ;to read LHS number
PROMPT1 DB 'ENTER SECOND NUMBER :', '$' ;to read RHS number
PROMPT2 DB 'RESULT OF FIRST AND SECOND NUMBER IS: ', '$'
.CODE
LEA DX,PROMPT
MOV AH,09H
INT 21H
;======================
MOV AH, 00
INT 16h
MOV LEFT,AL
MOV DL, AL
MOV AH, 2H
INT 21H
;======================
MOV DL,0AH
MOV AH,02H
INT 21H
MOV DL,0DH
MOV AH,02H
INT 21H
LEA DX,PROMPT1
MOV AH,09H
INT 21H
;=================================
MOV AH, 00
INT 16h
MOV RIGHT,AL
MOV DL, AL
MOV AH, 2H
INT 21H
;======================
MOV DL,0AH
MOV AH,02H
INT 21H
MOV DL,0DH
MOV AH,02H
INT 21H
;===============================
SUB LEFT,30H
MOV BH,RIGHT
SUB VAR2,30H
MOV BL,RIGHT
SUB BH,BL
LEA DX,PROMPT2
MOV AH,09H
INT 21H
;==================================
ADD BH,30H
MOV RIGHT,BH
MOV DL, BH
MOV AH, 2H
INT 21H
RET
;program to initialize and display hello world
.model small ;defines the memory model to be used for the ALP
.data ;data segment begins here
msg db 10d,13d,"Hello World$" ;String Hello World gets stored in msg
.code ;code segment begins here
mov ax,@data ;moving base address of data to ax
mov ds,ax ;moving contents of ax into ds
;data section now gets initialized
lea dx,msg ;load the offset address of msg
mov ah,09h ;to display contents at dx
int 21h ;call the kernel
mov ah,4ch ;to terminate the program
int 21h ;call the kernel
end ;end of program
;program to print length of string
DATA SEGMENT
STR DB 'VEERENDRAPATILHV- patelheggere$'
MSG1 DB 10,13,'THE STRING IN THE MEMORY IS : $'
MSG2 DB 10,13,'LENGTH OF THE STRING IS :- $'
LEN DB 0H
DATA ENDS
DISPLAY MACRO MSG
MOV AH,9
LEA DX,MSG
INT 21H
ENDM
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
DISPLAY MSG1
DISPLAY STR
LEA SI,STR
NEXT:
CMP [SI],'$'
JE DONE
INC LEN
INC SI
JMP NEXT
DONE:
DISPLAY MSG2
MOV AL,LEN
ADD AL,30H
MOV DL,AL
MOV AH,2
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.