flat assembler
Message board for the users of flat assembler.

Index > DOS > segments

Author
Thread Post new topic Reply to topic
avcaballero



Joined: 02 Feb 2004
Posts: 203
Location: Madrid - Spain
avcaballero 24 Aug 2005, 07:40
Hello

I can do the following in masm:

cmp bx, offset es:nameproc

How can do the same in fasm?

Thank you
Post 24 Aug 2005, 07:40
View user's profile Send private message Visit poster's website Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng 24 Aug 2005, 07:56
One answer:
Code:
lea ax, [es:nameproc]
cmp bx,ax
    
Post 24 Aug 2005, 07:56
View user's profile Send private message MSN Messenger Reply with quote
gunblade



Joined: 19 Feb 2004
Posts: 209
gunblade 24 Aug 2005, 08:21
or just
Code:
cmp bx, [es:nameproc]    


Mr. Green
Post 24 Aug 2005, 08:21
View user's profile Send private message Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng 24 Aug 2005, 10:25
Hi,gunblade:
Code:
cmp bx, [es:nameproc]    
on FASM means that compares bx and the content of the es:nameporc, but the
Code:
cmp bx, offset es:nameproc 
    
on MASM means that complares bx and the offset distance es:nameproc.

Unfortunately, FASM don't support the syntax for example "cmp bx, es:namespace", we only use it on call and jmp instructions. for example: call segment:offset or jmp segment:offset.

Do you think it?

Thanks.

Kevin Zheng
Post 24 Aug 2005, 10:25
View user's profile Send private message MSN Messenger Reply with quote
gunblade



Joined: 19 Feb 2004
Posts: 209
gunblade 24 Aug 2005, 11:12
Whoop, read a mov instead of a lea there..
sorry, your right, there goes my attempt to optimizze 2 lines into 1 Laughing
Post 24 Aug 2005, 11:12
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 24 Aug 2005, 13:32
Kevin_Zheng wrote:
Code:
cmp bx, offset es:nameproc 
    
on MASM means that complares bx and the offset distance es:nameproc.

what?!? what should that code do? what is it in binary code. processor has no such instruction as "cmp bx,es:nameproc". Question
Post 24 Aug 2005, 13:32
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 203
Location: Madrid - Spain
avcaballero 24 Aug 2005, 14:30
Thank you Kevin_Zheng, I will test it as sortly as i can. It's a pitty that "cmp bx, offset es:nameproc" doesn't work (similar in nasm).
Quote:

what should that code do?

I used it recentely in TSRs.
Quote:

what is it in binary code

OFFSET gives the number position

Cheers
Post 24 Aug 2005, 14:30
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 24 Aug 2005, 23:12
ehhz...
,
what should cmp word register, segment:offset do?

bug in masm?
Post 24 Aug 2005, 23:12
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Aug 2005, 08:24
someone assemble it and send me it's opcode, i'm very curious. because there just ISN'T any such instruction (maybe "cmp reg,imm" with semgent prefix but if i am right this is invalid opcode)
Post 25 Aug 2005, 08:24
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 203
Location: Madrid - Spain
avcaballero 25 Aug 2005, 10:02
Too fast typing I really want to say that "cmp bx, es:procname" doesn't work in fasm, the same in nasm.

Now I haven't got my code. But if I don't remember wrong, for deinstall a tsr we need to know that no one has change interrupt vector that we have change first, so because of "procname" is resident in ES segment and bx has the interrupt vector value for now, if both aren't equal, we can't remove our tsr.

OFFSET belong to preprocessor and gives the offset number. What we can see in a debuger is this number.

I'm sorry for my english
Post 25 Aug 2005, 10:02
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Aug 2005, 13:01
ah, now i understand, if you have more same names in different segment then segment name should choose one. this wouldn't be possible in FASM because "es" is segment register and during compilation it isn't clear which program segment (if any) it points to. in MASM this is ?solved? by ASSUME, but i don't like this. i think you can't have same names in different segments in FASM. But at least we stay clear.
Post 25 Aug 2005, 13:01
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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.