Sunday, January 16, 2022

Use the array1 & array2 and perform subtraction.

Include irvine32.inc

;AddTwo.asm-adds two 32-bit integer.

;chapter3 example

.386

.model flat,stdcall

.stack 4096

ExitProcess proto,dwExitCode:dword

.data

array1 dword  1,1,1,1,1

array2 dword  2,4,6,9,5

sum dword 5 dup(?)

.code

main proc

mov ebx,OFFSET sum

mov edi,OFFSET array1

mov esi,OFFSET array2

mov ecx,LENGTHOF array1

L1:

mov eax,0

mov edx,0

add eax,[esi]

add edx,[edi]

sub eax,edx

mov [ebx],eax

 

call writeHex

call crlf

add edi,TYPE array1

add esi,TYPE array2

add ebx,4

loop L1

call dumpregs

  invoke ExitProcess,0

  main endp

  end main 

No comments:

Post a Comment