flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
LocoDelAssembly 19 Nov 2005, 13:44
Take in mind that the execution of the program begins at "start:" or the label you put in ".end" which is "start" in this case.
This will work: Code: include 'C:\fasmw164\INCLUDE\win32ax.inc' msgBoxCaption db '???',0 msgBoxText db 'Not Equal too',0 msgBoxText1 db 'Equal too',0 start: mov ax, 10 mov bx, 10 cmp ax,bx jne start2 jmp start1 start2: push MB_OK push msgBoxCaption push msgBoxText push NULL call [MessageBox] jmp exitP start1: push MB_OK push msgBoxCaption push msgBoxText1 push NULL call [MessageBox] jmp exitP exitP: invoke ExitProcess,0 .end start ; Put this always at the end of the code. Check .end macro in win32ax.inc to see why |
|||
![]() |
|
jacko221 20 Nov 2005, 04:27
thank you very much locodelassembly, i will look up on macro and find out more about it. Hopefully it will help me when i make w32 applications.
Thanks again Jack. |
|||
![]() |
|
jdawg 03 Dec 2005, 21:06
Here are two macros I use for min and max that could help. Though I'm sure if you asked one of the senoir members you could get more effecient ones.
Code: macro min a,b { mov eax,a mov ecx,b cmp eax,ecx jg RetB ;return b (in eax) if eax<ecx jmp finish RetB: mov eax,b finish: } macro max a,b { mov eax,a mov ecx,b cmp eax,ecx jl RetB ;return b (in eax) if eax>ecx jmp finish RetB: mov eax,b finish: } They look the same, but notice the subtle "jg" and "jl". That's all it takes. The pros probably know a better way though. |
|||
![]() |
|
r22 04 Dec 2005, 06:29
If your processor supports cmovXX instructions (most do now)
;;Unsigned min mov eax, a mov ecx, b cmp eax,ecx cmova eax,ecx ;;Unsigned max mov eax, a mov ecx, b cmp eax,ecx cmovb eax,ecx ;;Signed min mov eax, a mov ecx, b cmp eax,ecx cmovg eax,ecx ;;Signed max mov eax, a mov ecx, b cmp eax,ecx cmovl eax,ecx I used to like the novell SBB AND ADD method but after benchmarking using CMOV is fastest. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.