flat assembler
Message board for the users of flat assembler.

Index > Linux > Segments in Assembler

Author
Thread Post new topic Reply to topic
flash



Joined: 11 Mar 2006
Posts: 55
Location: Cuba
flash
Hello:
in masm, you can write ES:[DI] to indicate the position DI inside the segment ES. Flat assembler accept [ES:DI] but there is no way I can well indicate values for ES.Embarassed My ask: how can I read ot get the segment value in fasm? Some thing like
mov ES, SEGMENT name
Thanks..!!! Wink

_________________
i don't hate goto
Post 14 Mar 2006, 20:37
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Code:
mov es, name    
FASM is FLAT assembler, segment name is just special kind of label
Post 14 Mar 2006, 21:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7752
Location: Kraków, Poland
Tomasz Grysztar
You perhaps forgot that there is no "mov segreg,imm" instruction, use "mov segreg,reg" instead. Like:
Code:
mov ax,name
mov es,ax    

Alternatively:
Code:
push name
pop es    


But why is this thread in Linux forum?
Post 14 Mar 2006, 22:47
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
oh...
Post 15 Mar 2006, 00:04
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
flash



Joined: 11 Mar 2006
Posts: 55
Location: Cuba
flash
Thanks, Grysztar. I create this thread because need it for Linux AND DOS. Thanks again
Post 15 Mar 2006, 04:31
View user's profile Send private message Reply with quote
viki



Joined: 03 Jan 2006
Posts: 40
Location: Czestochowa, Poland
viki
But still it is not clear for me. Please look at this code

Code:
 
   org 100h
    push ala
    pop  ds
    mov  ax,word ptr ala
    ret

ala dw 5  
    


the result is wrong because in this (mov ax,word ptr ala) instruction this ds ser register is used. And I and probably flash want to know how to get the correct ds if we loose it. It should be equal to cs? Sorry about my ignorance.
Post 14 Jul 2006, 08:12
View user's profile Send private message Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM
Since you are creating a COM file, CS should be equal to DS, so:
Code:
org 100h
push cs
pop ds
mov ax,word ptr ala

ala dw 5
    

should be what you want.
Post 14 Jul 2006, 15:37
View user's profile Send private message Reply with quote
viki



Joined: 03 Jan 2006
Posts: 40
Location: Czestochowa, Poland
viki
thanks ucm
Post 15 Jul 2006, 06:52
View user's profile Send private message 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. Also on YouTube, Twitter.

Website powered by rwasa.