flat assembler
Message board for the users of flat assembler.
Index
> Main > How to push String constant(how does stdcall solve it?) |
Author |
|
revolution 20 Mar 2012, 09:34
Code: call @f db 'sometext',0 @@: call myproc Last edited by revolution on 20 Mar 2012, 10:57; edited 1 time in total |
|||
20 Mar 2012, 09:34 |
|
Memnarch 20 Mar 2012, 09:59
Ah thanks.
And in this case the address can be expected in eax? |
|||
20 Mar 2012, 09:59 |
|
Mike Gonta 20 Mar 2012, 10:00
revolution wrote:
Code: jmp @F .1: db 'sometext', 0 @@: push .1 call myproc In fasmx the call instruction is overloaded so the code would look like this: Code: call myproc, 'sometext' Last edited by Mike Gonta on 20 Mar 2012, 10:06; edited 1 time in total |
|||
20 Mar 2012, 10:00 |
|
Memnarch 20 Mar 2012, 10:03
Ah great.
and @F was jumping forward to the next anonymous labe. This method seems more usable in my case. Thanks for your Help |
|||
20 Mar 2012, 10:03 |
|
r22 20 Mar 2012, 11:09
Just a slightly related fyi ... seems like you end up with a lot more false positives on virus scanners when you put constants in your code section.
Unreliable anecdotal evidence: when I was testing something with FASM at work I put a LUT in the .code section instead of properly in .data section and Symantec flagged it when I compiled. Seems like the heuristics check for .code section memory accesses. Anyways put string constants properly in your .data section, also align them by 8 bytes. |
|||
20 Mar 2012, 11:09 |
|
Memnarch 20 Mar 2012, 12:59
@r22: Ah ok. Thanks for the advice.
Another small question (if its allowed to ask it without creating a new thread). Lets say i have 2 string values: Code: str1 db 'string1' str2 db 'string2' Now i need a variable, which points at str1 or str2. Normally i would use lea to get the adress. But is it possible, to define a variable and initialise it with an address of another Variable? so Code: str1 db 'string1' str2 db 'string2' myvar dd [adress of str1] instead of Code: str1 db 'string1' str2 db 'string2' myvar dd ? ... lea [myvar], str1 |
|||
20 Mar 2012, 12:59 |
|
Picnic 20 Mar 2012, 13:21
Code: myvar dd str1 ; define a variable and initialise it with an address of another Variable or Code: mov [myvar], str1 Things are easier in Fasm |
|||
20 Mar 2012, 13:21 |
|
Memnarch 20 Mar 2012, 13:40
Ah thanks,
just noticed, that its not possible to load an address like this if its defined locally(in locals..endl), is this correct? (Sofar it worked only with a globally declared string and a local var) Greets Memnarch |
|||
20 Mar 2012, 13:40 |
|
Mike Gonta 20 Mar 2012, 21:47
Memnarch wrote: just noticed, that its not possible to load an address like this if its defined locally(in locals..endl), is this correct? Code: locals mytext db 'sometext', 0 ; fasm initializes this at runtime endl call someproc, addr mytext fasmx (operating system independent HLL macros). |
|||
20 Mar 2012, 21:47 |
|
Memnarch 21 Mar 2012, 09:19
Thanks Mike.
As for the previous example: When declaring a var and initialising it with the adress of another var, is it possible to add an offset?(Maybe if not directly, its possible to define a struct which has 2 integers, defining a var using it and defining a var for it which points at the second integer) Greets Memnarch |
|||
21 Mar 2012, 09:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.