flat assembler
Message board for the users of flat assembler.

Index > Main > [Solved] Manipulating reserve data

Author
Thread Post new topic Reply to topic
Aulendil



Joined: 13 Jul 2014
Posts: 14
Aulendil
Hi,

I am struggling to initialize reserve data in the way I think it should work. I am in real mode.

I have the following code (snippets):

So this will reserve me 10 words:

Code:
TEST rw 10    


Now I want to initialize the first word with data:

Code:
mov [TEST], 1    


Next I want to initialize the second word with data:

Code:
mov [TEST+1], 1    


How come when I print out the above two locations in memory, one contains 1 (dec), the other contains 256 (dec).

What I want is to have the first two reserved words to each have the value of 1.

Am I getting the words/bytes mixed up? Does the +1 when addressing memory mean the next address?

This is what I want to have initialized:

[0000 0000 0000 0001]
[0000 0000 0000 0001]

But instead it *seems* to be:

[0000 0001 0000 0001]
[0000 0001 0000 0000]

Any answers would be much appreciated, treat me gentle!
Post 13 Jul 2014, 14:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
Each word uses up two bytes so you need to use this for the second word:
Code:
mov [TEST+2],1    
Post 13 Jul 2014, 14:40
View user's profile Send private message Visit poster's website Reply with quote
Aulendil



Joined: 13 Jul 2014
Posts: 14
Aulendil
Thanks.
Post 13 Jul 2014, 15:12
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
Welcome to the FASM forum Smile
Post 13 Jul 2014, 16:03
View user's profile Send private message Reply with quote
Aulendil



Joined: 13 Jul 2014
Posts: 14
Aulendil
Thanks Smile I've been an avid forum reader for a few years now, just starting to get into writing something serious.
Post 13 Jul 2014, 18:02
View user's profile Send private message Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
Aulendil wrote:

This is what I want to have initialized:

[0000 0000 0000 0001]
[0000 0000 0000 0001]

But instead it *seems* to be:

[0000 0001 0000 0001]
[0000 0001 0000 0000]

Any answers would be much appreciated, treat me gentle!


Just define

TEST rd 10 (reserve dword)
Post 13 Jul 2014, 21:53
View user's profile Send private message Send e-mail 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-2020, Tomasz Grysztar.

Powered by rwasa.