flat assembler
Message board for the users of flat assembler.

Index > Main > How set memery cells according to a segemt?

Author
Thread Post new topic Reply to topic
LiuJunfeng



Joined: 28 Nov 2003
Posts: 48
Location: China
LiuJunfeng 05 Mar 2004, 16:51
I'm new to assemly coding, how to translate this code to fasm?
Code:
seg es
mov [0],#0x41
    
Post 05 Mar 2004, 16:51
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 05 Mar 2004, 19:31
mov [es:0],0x41
or
mov [es:0],41h
or
mov [es:0],$41

#0x41 is nothing, i think you are moving from pascal that's why you used # am i right?

Keep learning, assembly is most powerful stuff about coding
Post 05 Mar 2004, 19:31
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 05 Mar 2004, 20:02
vid wrote:
#0x41 is nothing, i think you are moving from pascal that's why you used # am i right?


In some assemblers (for example 68000 and 6502) # mean immediate constant as opposite to address. For example:
Code:
; 6502 code
lda somelabel   ; loads accumulator with content of some address.
lda #somelabel ; loads the address of the label in the accumulator.
    


I don't know x86 assemblers to use this approach, but this means nothing - there are many assemblers out there. Smile

Regards
Post 05 Mar 2004, 20:02
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 06 Mar 2004, 11:00
yeah, didnt know about this.

anyway, i never seen assembler for non-IBMs
Post 06 Mar 2004, 11:00
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
LiuJunfeng



Joined: 28 Nov 2003
Posts: 48
Location: China
LiuJunfeng 06 Mar 2004, 15:03
Thank you!
I've known these number formats, I think "seg es" is also a good directive so that you don't have to preappend "es" for each cell index.
vid wrote:
mov [es:0],0x41
or
mov [es:0],41h
or
mov [es:0],$41

#0x41 is nothing, i think you are moving from pascal that's why you used # am i right?

Keep learning, assembly is most powerful stuff about coding
Post 06 Mar 2004, 15:03
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 06 Mar 2004, 19:56
as i know, fasm doesn't have such directive, but it can be made with macros. (too bad i'm too lazy to code it for you Sad )

i was thinking about something that will allow such maro very easily
privalov - end virtual restores code pointer. What if it would take argument which will tell how much of virtual data leave defined (eg how much to add to code generation pointer). Example:

macro seg segname
{
virtual
mov byte [segname:0],5
end virtual +1
;restore 1 byte behind virtual, thus leaving seg. prefix defined
}
Post 06 Mar 2004, 19:56
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.