flat assembler
Message board for the users of flat assembler.

Index > Windows > Equivalent statements

Author
Thread Post new topic Reply to topic
prana



Joined: 28 Aug 2003
Posts: 51
prana 02 Sep 2003, 16:08
What are the equivalent of the following directives in FASM?

filename DB 100h dup (0)

and how can I write

mov ax, @data
mov es, ax

Lastly, can I use the .MODEL or .DATA kind of directives?

I'm new to fasm, so pls consider this idiotic questions! Embarassed

Thanks.
Post 02 Sep 2003, 16:08
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8363
Location: Kraków, Poland
Tomasz Grysztar 02 Sep 2003, 16:22
For the first statement, you can write it this way:
Code:
filename: times 100h db 0    

but if you only want to reserve a space for filename, not necessarily filling it with zeros, it's better to do it simply:
Code:
filename rb 100h    


Answer for the later questions depends on what output format you are using. Because you are posting in the Windows forum, I'm assuming you mean the PE format (altough you'd be aswell using COFF format with some external linker), but in such case you are programming in flat mode, without segments, and modifying segment registers is not recommended at all (it can only crash your program).
You can think of a FORMAT directive as a some kind of equivalent for MODEL directive, but it's a bit different. For Windows programs you always use "format PE", this is the flat model, and you have to define sections for data, code, etc. There are also macroinstructions that make it simpler, look at the HELLO example in the FASMW package - it uses the package of macroinstructions, which emulate such things as .CODE or .DATA for you.
Post 02 Sep 2003, 16:22
View user's profile Send private message Visit poster's website Reply with quote
prana



Joined: 28 Aug 2003
Posts: 51
prana 02 Sep 2003, 18:33
Thanks Privalov!

And yes, my mistake Embarassed I actually wanted to ask about this

mov ax, @data
mov es, ax

in DOS console.
Post 02 Sep 2003, 18:33
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8363
Location: Kraków, Poland
Tomasz Grysztar 02 Sep 2003, 18:42
That is, with MZ format?
Post 02 Sep 2003, 18:42
View user's profile Send private message Visit poster's website Reply with quote
prana



Joined: 28 Aug 2003
Posts: 51
prana 02 Sep 2003, 18:45
Yes.
Post 02 Sep 2003, 18:45
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8363
Location: Kraków, Poland
Tomasz Grysztar 02 Sep 2003, 19:07
Use just a name of your data segment, look at MULTISEG example in the DOS distribution of fasm.
Post 02 Sep 2003, 19:07
View user's profile Send private message Visit poster's website Reply with quote
prana



Joined: 28 Aug 2003
Posts: 51
prana 03 Sep 2003, 04:59
Ok found it.

Thanks a lot! Very Happy
Post 03 Sep 2003, 04:59
View user's profile Send private message Reply with quote
kaafe



Joined: 15 Oct 2003
Posts: 18
kaafe 15 Oct 2003, 23:34
then what about

filename DB 100 dup (?)
Post 15 Oct 2003, 23:34
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8363
Location: Kraków, Poland
Tomasz Grysztar 16 Oct 2003, 00:12
You can do:
Code:
filename: times 100h db ?    

but the most simple (and recommended) variant was already posted above, it's:
Code:
filename rb 100h    
Post 16 Oct 2003, 00:12
View user's profile Send private message Visit poster's website Reply with quote
kaafe



Joined: 15 Oct 2003
Posts: 18
kaafe 17 Oct 2003, 01:59
how can be an instruction does both thing? Does
Code:
filename rb 100h    
initialized or not. I suppose local variables are zeroed every time but if global, like this example?
Post 17 Oct 2003, 01:59
View user's profile Send private message Reply with quote
aaro



Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro 18 Oct 2003, 11:51
Globals are zeroed, locals can be anything
Post 18 Oct 2003, 11:51
View user's profile Send private message Reply with quote
hitertan



Joined: 12 Mar 2004
Posts: 15
Location: China
hitertan 26 Mar 2004, 09:03
ha ha!I have found answer a more time in this message borad!

_________________
i like assembly language and i study it in my pleasure time
tanshunquan@hotmail.com
Post 26 Mar 2004, 09:03
View user's profile Send private message MSN Messenger 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.