flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Plue
What does
Code: and eax, eax
jz something Does it jump to something if eax is not 0? _________________ Roses are red Violets are blue Some poems rhyme And some don't. |
|||
![]() |
|
Plue
vid wrote: This is one way how to test if eax is equal to zero, without modifying it Works: Code: format PE GUI 4.0 include '%fasminc%\win32a.inc' start: invoke GetAsyncKeyState, 65 and eax, eax ;cmp eax, 0 jnz exit invoke Sleep, 1 jmp start exit: invoke MessageBox, 0, msg, msg,0 invoke ExitProcess,0 msg db "pressed",0 data import library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ ExitProcess, 'ExitProcess',\ Sleep, "Sleep" import user,\ MessageBox, "MessageBoxA",\ GetAsyncKeyState, 'GetAsyncKeyState' end data Does not work: Code: format PE GUI 4.0 include '%fasminc%\win32a.inc' start: invoke GetAsyncKeyState, 65 ;and eax, eax cmp eax, 0 jnz exit invoke Sleep, 1 jmp start exit: invoke MessageBox, 0, msg, msg,0 invoke ExitProcess,0 msg db "pressed",0 data import library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ ExitProcess, 'ExitProcess',\ Sleep, "Sleep" import user,\ MessageBox, "MessageBoxA",\ GetAsyncKeyState, 'GetAsyncKeyState' end data [/code] _________________ Roses are red Violets are blue Some poems rhyme And some don't. |
|||
![]() |
|
SDragon
Quote: Does not work It works okay on my machine. Try also test eax, eax; it doesn't write to the register. |
|||
![]() |
|
Plue
Strange it works now.
|
|||
![]() |
|
vid
and -> ZF is set if result is zero
cmp -> ZF is set if arguments of equal (eg. if result of subtraction of numbers is zero) |
|||
![]() |
|
shism2
cmp eax, 0
je exit |
|||
![]() |
|
Matrix
hi!
you can use this, it will work instead of and, smaller in size than cmp... Code:
or eax,eax
jz .zero
|
|||
![]() |
|
RedGhost
Code:
test eax, eax
jz label
apparently its better than or, or so i've read in this forum ![]() _________________ redghost.ca |
|||
![]() |
|
shism2
red ghost is correct
![]() Thats what I've read on this forum too lol |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.