1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

help my error

Discussion in 'Assembly Language Programming (ALP) Forum' started by spkenn5, Feb 24, 2010.

  1. spkenn5

    spkenn5 New Member

    Joined:
    Dec 16, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Location:
    somewhere over the rainbow
    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
     
  2. virxen

    virxen New Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    0
    8(hex)+5(hex)=0D(hex)
    8(dec)+5(dec)=13(dec)
     
  3. spkenn5

    spkenn5 New Member

    Joined:
    Dec 16, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Location:
    somewhere over the rainbow
    i noticed that, is it possible for the dumpregs to show it in decimal instead of hex?

    thanks
     

Share This Page