News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

about looping..NOOB

Started by sydetys, October 20, 2008, 08:26:04 PM

Previous topic - Next topic

sydetys

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

NightWare

hi, use another register (ebx,esi or edi)

sydetys

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?

Xacker

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.