flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
LocoDelAssembly 08 Jun 2009, 19:41
Code: include 'win32ax.inc' ; To be used in 32-bit code only ; WARNING: push and pop may not work well when used with multiple params macro push arg { common local ..label if arg eq eip call ..label ..label: else push arg end if } macro pop arg { common if arg eq eip retn else push arg end if } macro mov dest, src { common if dest eq eip jmp src else mov dest, src end if } start: push msg push @f mov eip, showMessage @@: invoke ExitProcess, 0 msg db "Hello world", 0 proc showMessage, msg invoke MessageBox, 0, "Testing program", [msg], MB_ICONINFORMATION leave pop eip endp .end start There was another thread already talking about this (in which I provided similar code), if someone finds it please post the link. |
|||
![]() |
|
pal 08 Jun 2009, 19:53
LocoDelAssembly wrote: There was another thread already talking about this (in which I provided similar code), if someone finds it please post the link. Ahh sorry I forgot to look. Thanks for the code though. So I assume there is no way to directly access the eip register? |
|||
![]() |
|
LocoDelAssembly 08 Jun 2009, 20:33
Nop, except for 64-bit code, in that case:
Code: use64 lea rax, [rip] ; fasm accepts the following but I'm unsure if are valid (not recommended to use as them assume addresses below 4 GB) lea rax, [eip] lea eax, [rip] lea eax, [eip] |
|||
![]() |
|
pal 08 Jun 2009, 21:42
Ahh thank you very much man.
I aint worked with macros much, but is there a link or something as to where I can find out what sort of code they get compiled into (there is a file in TOOLS\WIN32\PREPSRC.ASM ?), if that isn't too much to ask. |
|||
![]() |
|
LocoDelAssembly 08 Jun 2009, 21:45
Code: start: push msg push @f mov eip, showMessage Code: start: push msg call @f @@: jmp showMessage |
|||
![]() |
|
pal 09 Jun 2009, 06:41
Ahh nice one. I'll have a play around with the macros later on tongith. Thanks again.
|
|||
![]() |
|
MazeGen 09 Jun 2009, 07:29
LocoDelAssembly wrote:
Yes, not recommended, but valid (= encodeable). See also this bugreport: http://board.flatassembler.net/topic.php?t=5942 |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.