0% found this document useful (0 votes)
19 views4 pages

Assembly Hw8

The document contains a series of assembly language code snippets that perform various arithmetic operations and data manipulations using the Irvine32 library. It includes examples of multiplication, division, and addition of hexadecimal values, as well as storing results in memory. The code demonstrates basic programming constructs such as loops and procedure calls.

Uploaded by

seongkang05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

Assembly Hw8

The document contains a series of assembly language code snippets that perform various arithmetic operations and data manipulations using the Irvine32 library. It includes examples of multiplication, division, and addition of hexadecimal values, as well as storing results in memory. The code demonstrates basic programming constructs such as loops and procedure calls.

Uploaded by

seongkang05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.


a. 6Ah
b. EAh
c. FDh
d. A9h

2.​ ​
a. 9Ah
b. 6Ah
c. A9h
d. 3Ah

3.​ ax = 2200h, dx = 0002h

4.​ ax = 0306h
5.​
include Irvine32.inc

.data
val1 DWORD ?
val2 DWORD 10
val3 DWORD 2
val4 DWORD 5

.code
main PROC
mov eax, val2
mov ebx, val3
mov ecx, val4
sub ecx, 3

mul ebx ; eax = eax * ebx


div ecx ; eax = eax / ecx

mov val1, eax ; store the result in val1

call WriteHex
call Crlf

exit
main ENDP
END main
6.​ ​

include Irvine32.inc

.data
numbers word 15F2h, 9E89h, 8342h, 99FFh, 7130h
count word 5
result dword ?

.code
main PROC
mov ax, 0
mov dx, 0
mov cx, 5
mov esi, offset numbers

back:
add ax, [esi]
adc dx, 0
add esi, 2
dec cx
jnz back

mov word ptr result, ax


mov word ptr result+2, dx

mov eax, dword ptr result


call WriteHex

; Exit the program


exit
main ENDP
END main
7.​

include Irvine32.inc

.data
arr1 DWORD 12345678h
arr2 DWORD 99999999h
arr3 DWORD ?

.code
main PROC
mov esi, offset arr1
mov edi, offset arr2
mov ebx, offset arr3
mov ecx, 4
clc

back:
mov al, [esi]
adc al, [edi]
mov [ebx], al
inc esi
inc edi
inc ebx
dec ecx
jnz back

exit
main ENDP
END main

You might also like