Hi I'm new to assembly and I'm having trouble getting this simple program to run, I got through the syntax but can't seem to get an output.My assignment was to declare two arrays, add 2 to each element in the two arrays, then use the xchg function to swap the elements in reverse order, for example swap the 1st element of array 1 with last element of array 2 and continue.
; Example assembly language program -- adds two numbers
; Author: R. Detmer
; Date: 1/2008
.586
.MODEL FLAT
INCLUDE io.h ; header file for input/output
.STACK 4096
.DATA
numb DWORD ?
date DWORD ?
prompt1 BYTE "Array element is", 0
array1 DWORD 21H,22H,23H,24H,25H
array2 DWORD 31H,32H,33H,34H,35H
number1 BYTE 11 DUP (?), 0
.CODE
_MainProc PROC
mov esi, 0
mov ebx, 5
forA:
add array1[esi],2
add esi, 4
loop forA
mov ecx,0
mov ebx,5
forB:
sub array2[ecx],2
add ecx,4
loop forB
mov esi,0
mov ecx,16
mov ebx, 5
loopone:
mov eax,array1[esi]
xchg array2[ecx],eax
mov array1[esi],eax
add esi,4
sub ecx,4
loop loopone
endFor:
mov esi,0
mov ebx, 5
forD:
mov eax, array1[esi]
dtoa number1, eax
output prompt1, number1
add esi,4
loop forD
ret
_MainProc ENDP
END ; end of source code