The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: sydetys on October 20, 2008, 08:26:04 PM

Title: about looping..NOOB
Post by: sydetys on October 20, 2008, 08:26:04 PM
Hi!

..funny..1st my code.



.686p                                   ; create 32 bit code
.mmx
.xmm
.model flat, stdcall                    ; 32 bit memory model
option casemap :none                    ; case sensitive

    include \masm32\include\windows.inc
    include \masm32\include\kernel32.inc
    include \masm32\include\masm32.inc
    include \masm32\include\Comctl32.inc
    include \masm32\include\comdlg32.inc
    include \masm32\include\shell32.inc
    include \masm32\include\oleaut32.inc
    include \masm32\macros\macros.asm
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\msvcrt.inc
    include \masm32\macros\timers.asm
    include \masm32\include\debug.inc
   
 
    includelib \masm32\lib\kernel32.lib
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\msvcrt.lib
    includelib \masm32\lib\Comctl32.lib
    includelib \masm32\lib\comdlg32.lib
    includelib \masm32\lib\shell32.lib
    includelib \masm32\lib\oleaut32.lib
    includelib \masm32\lib\debug.lib


.DATA

.CODE

start:

cls   
   
    mov edx, 10

saatana:

    print chr$("1",0)
    dec edx
    jnz saatana
    print "loppu"
    invoke ExitProcess, 0


end start



Like you see, I am trying to make BASIC loop (this example should print 1  ten times). I copied from MASM help section few lines...won´t work, counter does not decrease.
...any advise...BTW great help in MASM  ::)

thanx
Title: Re: about looping..NOOB
Post by: NightWare on October 20, 2008, 08:33:55 PM
hi, use another register (ebx,esi or edi)
Title: Re: about looping..NOOB
Post by: sydetys on October 20, 2008, 09:33:04 PM
Quote from: NightWare on October 20, 2008, 08:33:55 PM
hi, use another register (ebx,esi or edi)

OOOoooh, great that worked...thaank you..WHY that worked? is it Vista or CPU? I have heard something about "protected registers"...is that it? EAX and EDX are "protected"? I did try this with EAX register previously.
ESI works fine.

If this Is about protected registers..why THESE (EAX, EDX...) are protected?
Title: Re: about looping..NOOB
Post by: Xacker on October 20, 2008, 10:18:28 PM
Quote from: sydetys on October 20, 2008, 09:33:04 PM
OOOoooh, great that worked...thaank you..WHY that worked? is it Vista or CPU? I have heard something about "protected registers"...is that it? EAX and EDX are "protected"? I did try this with EAX register previously.
ESI works fine.

no, but because those are the only registers that don't get messed up with


print chr$("1",0)


they hold their old value, before and after the execution of this macro.