What am I doing wrong? (Simple Assembly Loop)

Posted by sunnyohno on Stack Overflow See other posts from Stack Overflow or by sunnyohno
Published on 2010-02-03T06:10:22Z Indexed on 2010/05/04 20:18 UTC
Read the original article Hit count: 219

Filed under:
|
|
|

http://imgur.com/gjUbV.jpg

It won't let me post the picture. Btw, Someone from Reddit.programming sent me over here. So thanks!

TITLE MASM Template

; Description
;
; Revision date:

INCLUDE Irvine32.inc
.data
myArray BYTE 10, 20, 30, 40, 50, 60, 70, 80, 90, 100

.code
main PROC
    call Clrscr
    mov esi, OFFSET myArray
    mov ecx, LENGTHOF myArray
    mov eax, 0
L1:
    add eax, [esi]
    inc esi
    loop L1
    call WriteInt
    exit
main ENDP
END main

Results in:

-334881242

© Stack Overflow or respective owner

Related posts about assembly

Related posts about loop