Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   help my error (http://www.go4expert.com/forums/help-my-error-t21088/)

spkenn5 24Feb2010 13:03

help my error
 
hi guys, im having problem in making my fibonacci sequence, so far i've had the code to do everything i wanted except when i try to add eax with ebx, 00000008 + 00000005 it resulted 0000000D instead of 00000013. i wonder what did i do wrong. this is my first time taking the course. here's the code

Code:


INCLUDE C:/Irvine/Irvine32.inc

.data
counter DWORD 12
int1 DWORD 0d
int2 DWORD 1d
nextNum DWORD ?


.code
main PROC
       
        mov                eax,int1                ;
        call        DumpRegs                ; showing F0
        mov                eax,int2                ;
        call        DumpRegs                ; showing F1
        mov        ecx,11                ; setting the amount of loop

       
L1:
        mov eax,int1                ; eax = 0
        mov ebx,int2                ; ebx = 1
        add        eax,ebx                        ; eax = 1 + 0
        mov nextNum,eax        ; nextNum = eax = 1
        mov int1,ebx                ; eax = 1
        mov int2,eax                ; ebx = 1
        call DumpRegs                ; show the registers
       
        loop L1

                       
        exit
main ENDP

END main

thanks

virxen 24Feb2010 16:14

Re: help my error
 
Quote:

Originally Posted by spkenn5 (Post 64671)

00000008 + 00000005 it resulted 0000000D instead of 00000013

8(hex)+5(hex)=0D(hex)
8(dec)+5(dec)=13(dec)

spkenn5 24Feb2010 21:06

Re: help my error
 
i noticed that, is it possible for the dumpregs to show it in decimal instead of hex?

thanks


All times are GMT +5.5. The time now is 22:00.