flat assembler
Message board for the users of flat assembler.

Index > Main > error: value out of range.

Author
Thread Post new topic Reply to topic
Bob++



Joined: 12 Feb 2013
Posts: 92
Bob++ 23 Mar 2013, 21:09
why am I getting "error: value out of range." in the following code?
Code:
        mov eax,dword ptr "abcdlol$"
    

I want to put the address of
Code:
"abcdlol"    
into eax registers but looks like isn't this value that fasm is copying into eax..
Post 23 Mar 2013, 21:09
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 23 Mar 2013, 22:27
fasm is trying to "cast" the string as int and then use it as pointer, but the string transforms into a very large int and you get the error (but even if it succeeded it wouldn't get you what you want). You need to declare your string somewhere else:
Code:
your_code:
mov eax, string
.
.
.
your_data_area:
string db "abcdlol$"    
Post 23 Mar 2013, 22:27
View user's profile Send private message Reply with quote
Bob++



Joined: 12 Feb 2013
Posts: 92
Bob++ 24 Mar 2013, 00:43
Thanks for your answer,LocoDelAssembly.I know thtat it's possible with db,but I wanted to do this by "directly". For example,in C language the following code hold the address's of string at memory.

Code:
int *p = "abc";
    


Some assemblies support it too,I thought that the fasm could too.
Post 24 Mar 2013, 00:43
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20301
Location: In your JS exploiting you and your system
revolution 24 Mar 2013, 00:56
If you use the 'win32ax.inc' include then you can do this with invoke.
Code:
invoke Something,'Hello World!'    
It places the text into the code stream and makes a call to get the address:
Code:
call next_instruction
db 'Hello World!',0
next_instruction:
call [Something]    
Post 24 Mar 2013, 00:56
View user's profile Send private message Visit poster's website Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 24 Mar 2013, 01:04
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 21:21; edited 1 time in total
Post 24 Mar 2013, 01:04
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20301
Location: In your JS exploiting you and your system
revolution 24 Mar 2013, 01:19
HaHaAnonymous: It was just an example of how to place text strings. Of course you can use it anywhere that you need strings if you wish to. The reason I posted that example is because it is something that is already in the fasm download and the reader can examine it and modify it as needed for their situation.
Post 24 Mar 2013, 01:19
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.