ASSEMBLY LANGUAGE HELP: Integer arithmetic and machine language

0 pts ended
Write an assembly language which computes the following:

int y, w, Sum;

Type program in a neat, systematic way.

My code that didn't compile:

; This program does some basic arithmetic
.model small
.stack 100h

Y dw 2000d
w dw ?
Sum dw ?

main proc
mov ax,@data
mov ds,ax

;Sum = 36 + Y + Y/4 + Y/100

;divide y by 100
mov ax,Y
IDIV 100d

;store that in w
mov w,ax

;divide y by 4
mov ax,Y

;recall w into bx
mov bx,w

;sum y/4 and y/100
add ax,bx

;recall the value of Y and add to the sum of y/4 and y/100
mov bx, Y
add ax,bx

;add 36 to it
add ax, 36d

;store answer in sum
mov Sum,ax

;recall the value of Sum%7 add 1
mov bx,Sum
add bx,1
mov ax,bx

;print answer
mov ax,4C00h
int 21h
main endp
end main

Answers (0)

Step-by-step solutions to problems in 2,500 textbooks
Fast expert answers 24/7 Ask a question