* 32-bit assembler::how to initialize segment registers
@ 2004-10-19 5:12 san
2004-10-19 5:40 ` zebarbuc
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: san @ 2004-10-19 5:12 UTC (permalink / raw)
To: linux-assembly@vger.kernel.org
---------------------------- Original Message ----------------------------
Subject: 32-bit assembler::how to initialize segment registers
From: "shivam sharma" <shiurya@yahoo.co.in>
Date: Tue, October 19, 2004 12:07 am
To: San@cusat.ac.in
--------------------------------------------------------------------------
Hi
am making 32-bit
assembler as project in c under linux platform.
my problem is how my assembler should
initialize the segment registers.suppose,if user
program format is..........
.stack[64h]
.data
.........
.........
.........
.code
.........
.........
..........
then,on seeing the stack or data or
code how the assembler program should initialize the
segment registers.
thanks in advance
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32-bit assembler::how to initialize segment registers
2004-10-19 5:12 32-bit assembler::how to initialize segment registers san
@ 2004-10-19 5:40 ` zebarbuc
2004-10-19 14:47 ` Muthu
2004-10-20 1:57 ` Daniel R. Blair
2004-10-19 15:07 ` Brian Raiter
2004-10-19 20:09 ` HLA v1.71 is now available Randall Hyde
2 siblings, 2 replies; 8+ messages in thread
From: zebarbuc @ 2004-10-19 5:40 UTC (permalink / raw)
To: san; +Cc: linux-assembly@vger.kernel.org
I don't understand your question...
You want to create your own assembler (like 'as86' prog), but you don't know how
to make it? That's it?
If yes, you'd better buy a related book, i'm afraid that we cannot answer all
your futur requests.
If not, please, explain a little bit your problem...
Fred
Selon san@cusat.ac.in:
> ---------------------------- Original Message ----------------------------
> Subject: 32-bit assembler::how to initialize segment registers
> From: "shivam sharma" <shiurya@yahoo.co.in>
> Date: Tue, October 19, 2004 12:07 am
> To: San@cusat.ac.in
> --------------------------------------------------------------------------
> Hi
>
> am making 32-bit
> assembler as project in c under linux platform.
> my problem is how my assembler should
> initialize the segment registers.suppose,if user
> program format is..........
>
> .stack[64h]
>
> .data
> .........
> .........
> .........
> .code
> .........
> .........
> ..........
> then,on seeing the stack or data or
> code how the assembler program should initialize the
> segment registers.
>
> thanks in advance
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32-bit assembler::how to initialize segment registers
2004-10-19 5:40 ` zebarbuc
@ 2004-10-19 14:47 ` Muthu
2004-10-20 1:57 ` Daniel R. Blair
1 sibling, 0 replies; 8+ messages in thread
From: Muthu @ 2004-10-19 14:47 UTC (permalink / raw)
To: zebarbuc, linux-assembly
Hi !
I guess you have to refer to intel architecture
manual.
Generally you arent supposed to load the segment
registers directly. That is taken care of by the
loader program. eg: ld.so in GNU/Linux.
This [loading segment registers] is a problem only
if you are making straight binary code, that runs
[eg: Bootloader, Embedded code].
For this case do something like
/* in INTEL syntax */
mov ax,0xfff
mov ds,ax
mov fs,ax
Cheers
Muthu
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32-bit assembler::how to initialize segment registers
2004-10-19 5:12 32-bit assembler::how to initialize segment registers san
2004-10-19 5:40 ` zebarbuc
@ 2004-10-19 15:07 ` Brian Raiter
2004-10-19 20:09 ` HLA v1.71 is now available Randall Hyde
2 siblings, 0 replies; 8+ messages in thread
From: Brian Raiter @ 2004-10-19 15:07 UTC (permalink / raw)
To: linux-assembly
> am making 32-bit
> assembler as project in c under linux platform.
> my problem is how my assembler should
> initialize the segment registers.
Assuming the output of your assembler is a Linux object file, then the
segment registers are not your responsibility. Linux sets up the
segment registers before the user's code is called. If the programmer
wants to do something bizarre and/or clever with segments, then it's
their responsiblity.
b
^ permalink raw reply [flat|nested] 8+ messages in thread
* HLA v1.71 is now available
2004-10-19 5:12 32-bit assembler::how to initialize segment registers san
2004-10-19 5:40 ` zebarbuc
2004-10-19 15:07 ` Brian Raiter
@ 2004-10-19 20:09 ` Randall Hyde
2004-10-19 20:30 ` Claudio Fontana
2 siblings, 1 reply; 8+ messages in thread
From: Randall Hyde @ 2004-10-19 20:09 UTC (permalink / raw)
To: linux-assembly
Hi all,
HLA v1.71 is now available on Webster at the HLA download page:
http://webster.cs.ucr.edu/AsmTools/HLA/dnld.html
This is a maintenance release, containing the following minor
changes:
* Corrected a syntax error in the arrays.hhf header file
(extra parentheses occuring in the test for floating-point
types)
* Fixed a problem with the indexing into REAL80 arrays in
the arrays.hla module in the standard library.
* Fixed a problem with the mem.isInHeap function.
* Changed FASM output to use conditional assembly to
"protect" extrn symbols in case the symbols weren't
accessed in the file.
I also modified the HLA.DLL code in the "examples"
download to compile correctly when using FHLA.
----------------------------------------------------
HLA, the High-Level Assembler, is a powerful macro
assembly language development system that runs under
Windows and Linux operating systems. Carefully-written
applications are portable between both operating systems
with nothing more than a recompile of the source file.
From a features point of view, HLA is one of the most
powerful assemblers ever written. It's macro and
"compile-time language" facilities far exceed those found
in other assemblers.
HLA was specifically designed to make learning and writing
assembly language as easy as possible. HLA is fully supported
by tons of documentation, example code, and other things
that beginning and advanced programmers will find useful.
The 32-bit edition of "The Art of Assembly Language"
(No Starch Press) teaches introductory assembly language
programming using HLA and is one of the most often-cited
textbooks on the subject. You can read "The Art of Assembly"
on-line at http://webster.cs.ucr.edu/AoA/index.html.
The HLA system also includes the HLA Standard Library,
a collection of hundreds of ready to use library routines that
simplify assembly language programming and provide (among
other things) a usable interface to the underlying operating system.
Full source code to the Standard Library is available.
The HLA compiler and standard library are public domain and
can be used anyway you see fit.
Cheers,
Randy Hyde
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: HLA v1.71 is now available
2004-10-19 20:09 ` HLA v1.71 is now available Randall Hyde
@ 2004-10-19 20:30 ` Claudio Fontana
0 siblings, 0 replies; 8+ messages in thread
From: Claudio Fontana @ 2004-10-19 20:30 UTC (permalink / raw)
To: Randall Hyde; +Cc: linux-assembly
Hello,
I've found AoA for Linux html online version at
http://webster.cs.ucr.edu/AoA/Linux/HTML/AoATOC.html
to have problems with the numbering of the chapters.
After 4.7 comes 1.1 and the like.
Claudio
___________________________________
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica… Scaricalo ora!
http://it.messenger.yahoo.it
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32-bit assembler::how to initialize segment registers
2004-10-19 5:40 ` zebarbuc
2004-10-19 14:47 ` Muthu
@ 2004-10-20 1:57 ` Daniel R. Blair
2004-10-20 8:24 ` Fred Marmond
1 sibling, 1 reply; 8+ messages in thread
From: Daniel R. Blair @ 2004-10-20 1:57 UTC (permalink / raw)
To: zebarbuc; +Cc: san, linux-assembly@vger.kernel.org
On Tue, 19 Oct 2004 zebarbuc@free.fr wrote:
> I don't understand your question...
> You want to create your own assembler (like 'as86' prog), but you don't know how
> to make it? That's it?
> If yes, you'd better buy a related book, i'm afraid that we cannot answer all
> your futur requests.
> If not, please, explain a little bit your problem...
Selon,
Amen.. if you are not sure about something as elementary as that
(which isn't elementary, but it is in the context (relatively)), then you
really need to learn more about the x86 architecture, ELF binary format,
etc. There as stated above, this list is to help with specific things,
assembler related, not to help people write assemblers =] If you are
using an assembler, and say, have a piece of code that *SHOULD* work, but
doesn't, then post it and other eyes may see something/know something that
you don't and can tell you "Oh, under protected mode that cannot be
successfully completed, you must go through another register and access
it indirectly" or something like that..
I suggest getting the source to HLA, or NASM, etc. and checking it
out. I know it's a lot to go through (both lines of code wise, as well as
sheer technical data/routines), but, if you plan on writing your own
assembler, optimized or not.. I am talking about just getting one to work
and build an executable/binary that will run, based on either a sub-set of
the x86 instruction set, or the entire x86 instruction set (preferably the
later), then you need to know the "basics" about how an assembler works,
how a linker works, parsers, lexical analyzers, etc. This you need books,
time, and knowledge, reference tables, etc. Even to do a straight
assembly language to machine code translation program.. and that isn't
doing much.. but it still involves reading ahead, recognizing grammar(s),
etc. and then acting on them (i.e. loop constructs, etc.)
All of this should be something that you already know... if you
are attempting to write a working assembler in C. If not, just stop
writing your assembler now and either start reading, or write something
else. Again, NASM is a great, Open Source, x86 assembler that compiles
under Unix (I run FreeBSD and use NASM, but I know it works on Linux too),
and I think it even has a version and compiles under Windows as well..
HLA (High Level Assembler), which can be found by searching google
for "HLA High Level Assembly Webster" (the site is called "Webster", not
sure, but, it's something like www.webster.edu or webster.something.edu,
etc. it's not, to my knowledge, webster.com|net|org, so, you need to
search for it, but, it will be the first thing that comes up I am sure),
it not only has the HLA (High Level Assembly) language compiler, but, it
is written by the author of the book, which I own, now that you can
purchase it in print, rather than just read it online (although the Online
version gets updated more frequently than the printed version, for obvious
reasons) entitled "The Art of Assembly Language". This book is a great
reference for anyone learning assembly language, but also a great book to
teach you how things operate, etc. HLA is more of a cross between a
high[er] level language and assembler, with things like mutable variables,
procedures/functions/etc.
Check it out and recommend it to people who want to learn more
about how the actual architecture works.. what are it's quirks, etc. and
then also, to ease people into assembly language programming from standard
procedural languages as well. Once you have learned how to program in
HLA, you can take of the "training wheels" and write in pure assembler,
which HLA can compile.. so.. you can start mixing your old code that used
HLA constructs that aren't quite valid asm, or, shall I say, not "straight
assembly language", but, damn close, and a lot more close than C/C++,
etc., and then finally, you can be programming in pure assembly language
code by itself, again, using HLA, and you are now capable of programming
in ASM.
Now, even writing code using the HLA libraries and syntax, it is
compiled, or shall I say, pre-processed, to be pure assembly language,
before it's compiled, so, it's pretty close, and right on the money (in
some cases), to what you would code (or would like to have written) by
hand in a lot of places. Some places are a *LITTLE* less effecient simply
because you cannot interpret something dynamically (i.e. the syntax of a
high level language), and turn it into optimized assembler code in the
absolute best way, using the least amount of instructions, or cpu cycles
(as lower instruction count doesn't nessecarily equal lower cpu cycle
count.) The HLA libraries are written in pure assembler I think, which is
why it's so close to hand written assembler once it's been pre-processed,
but, you get the idea.
You can download and/or read the book, The Art of Assembly (AoA)
online, and it will show you from start to fnish how to write assembl
langage code, using HLA, and also the differences in HLA and normal x86
ASM. It will show you everything you need to know.. and, as I stated, you
can purchase this book by itself too (which comes with a CD-ROM and other
things in the book.. like the sample code, sample apps, the book in PDF
and HTML format, the RadHLA IDE for HLA, etc.) But, if you buy the book,
you will want to snag the newest version of the HLA distribution, and then
you can follow along with the book.. just read the CHANGELOG to see if
anything major has changed between versions (incompatibilities, etc.)
Hope this gets you started bro.. I applaud the effort in wanting to write
an assembler, as it's a monumental task.. whether for a project or for a
tool to be used by others, in place of the existing tools which are
already mature, used by many, and supported on lots of architectures. So,
if you aren't doing this "just to do it", and you want people to start
using it, etc. You are going to need a lot of knowledge on your side to
make yours better than what's already out there bro =] If you are doing
it as a C.S. project, than, go for it, and good luck. If you honestly
have the skills and the knowledge that it takes to write an assembler, and
you have the time (which obviously you do, or at least think you do, or
you wouldn't be attempting to write one), you might consider joining the
NASM Open Source development team, or some other Open Source assembler
team, and that way you can help aid in making an existing product perform
better, rather than re-inventing the wheel and most likely (no offense to
you meant at all) doing it worse than it already exists.. simply because
the other projects have had time for user feedback, etc. and have improved
because of knowledge gained during development, testing, and in other
areas.. starting from scratch will give you a good feeling when you can
compile your own "Hello, World!" program/binary and actually run it and
have it work, but, adding to a project like NASM will benefit the
community a lot more..
Hope some/any of this helped you, if not, at least I got it out in
the open and perhaps it will be archived somewhere and come up on a search
of older news group postings for some other pour soul seeking knowledge =]
Cheers,
Danny
= Daniel Blair =
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- dblair@realcoders.org - [http://www.realcoders.org]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32-bit assembler::how to initialize segment registers
2004-10-20 1:57 ` Daniel R. Blair
@ 2004-10-20 8:24 ` Fred Marmond
0 siblings, 0 replies; 8+ messages in thread
From: Fred Marmond @ 2004-10-20 8:24 UTC (permalink / raw)
To: Daniel R. Blair, Muthu; +Cc: san, linux-assembly@vger.kernel.org
Hey, guys, I WAS NOT THE MAN WHO ASKED THE ORIGINAL QUESTION!
I was only answering to "san@cusat.ac.in", telling him that I just didn't
understand what he wanted to know!
Look at this list archive, I don't feel I am a newbie in x86 assembly.
What I said, in other words:
"if you don't know anything about assembly in general, and basics of binary
formats as ELF, you'd better starting with buying a assembly-related book, we
(guys in the list) won't have time to make you a full course on this
subject."
Or perhapse my english is soo bad too, that I was not able to make you
understand my reply...
Fred
Le mercredi 20 Octobre 2004 03:57, Daniel R. Blair a écrit :
> On Tue, 19 Oct 2004 zebarbuc@free.fr wrote:
> > I don't understand your question...
> > You want to create your own assembler (like 'as86' prog), but you don't
> > know how to make it? That's it?
> > If yes, you'd better buy a related book, i'm afraid that we cannot answer
> > all your futur requests.
> > If not, please, explain a little bit your problem...
>
> Selon,
> Amen.. if you are not sure about something as elementary as that
> (which isn't elementary, but it is in the context (relatively)), then you
> really need to learn more about the x86 architecture, ELF binary format,
> etc. There as stated above, this list is to help with specific things,
> assembler related, not to help people write assemblers =] If you are
> using an assembler, and say, have a piece of code that *SHOULD* work, but
> doesn't, then post it and other eyes may see something/know something that
> you don't and can tell you "Oh, under protected mode that cannot be
> successfully completed, you must go through another register and access
> it indirectly" or something like that..
>
> I suggest getting the source to HLA, or NASM, etc. and checking it
> out. I know it's a lot to go through (both lines of code wise, as well as
> sheer technical data/routines), but, if you plan on writing your own
> assembler, optimized or not.. I am talking about just getting one to work
> and build an executable/binary that will run, based on either a sub-set of
> the x86 instruction set, or the entire x86 instruction set (preferably the
> later), then you need to know the "basics" about how an assembler works,
> how a linker works, parsers, lexical analyzers, etc. This you need books,
> time, and knowledge, reference tables, etc. Even to do a straight
> assembly language to machine code translation program.. and that isn't
> doing much.. but it still involves reading ahead, recognizing grammar(s),
> etc. and then acting on them (i.e. loop constructs, etc.)
>
> All of this should be something that you already know... if you
> are attempting to write a working assembler in C. If not, just stop
> writing your assembler now and either start reading, or write something
> else. Again, NASM is a great, Open Source, x86 assembler that compiles
> under Unix (I run FreeBSD and use NASM, but I know it works on Linux too),
> and I think it even has a version and compiles under Windows as well..
>
> HLA (High Level Assembler), which can be found by searching google
> for "HLA High Level Assembly Webster" (the site is called "Webster", not
> sure, but, it's something like www.webster.edu or webster.something.edu,
> etc. it's not, to my knowledge, webster.com|net|org, so, you need to
> search for it, but, it will be the first thing that comes up I am sure),
> it not only has the HLA (High Level Assembly) language compiler, but, it
> is written by the author of the book, which I own, now that you can
> purchase it in print, rather than just read it online (although the Online
> version gets updated more frequently than the printed version, for obvious
> reasons) entitled "The Art of Assembly Language". This book is a great
> reference for anyone learning assembly language, but also a great book to
> teach you how things operate, etc. HLA is more of a cross between a
> high[er] level language and assembler, with things like mutable variables,
> procedures/functions/etc.
> Check it out and recommend it to people who want to learn more
> about how the actual architecture works.. what are it's quirks, etc. and
> then also, to ease people into assembly language programming from standard
> procedural languages as well. Once you have learned how to program in
> HLA, you can take of the "training wheels" and write in pure assembler,
> which HLA can compile.. so.. you can start mixing your old code that used
> HLA constructs that aren't quite valid asm, or, shall I say, not "straight
> assembly language", but, damn close, and a lot more close than C/C++,
> etc., and then finally, you can be programming in pure assembly language
> code by itself, again, using HLA, and you are now capable of programming
> in ASM.
>
> Now, even writing code using the HLA libraries and syntax, it is
> compiled, or shall I say, pre-processed, to be pure assembly language,
> before it's compiled, so, it's pretty close, and right on the money (in
> some cases), to what you would code (or would like to have written) by
> hand in a lot of places. Some places are a *LITTLE* less effecient simply
> because you cannot interpret something dynamically (i.e. the syntax of a
> high level language), and turn it into optimized assembler code in the
> absolute best way, using the least amount of instructions, or cpu cycles
> (as lower instruction count doesn't nessecarily equal lower cpu cycle
> count.) The HLA libraries are written in pure assembler I think, which is
> why it's so close to hand written assembler once it's been pre-processed,
> but, you get the idea.
>
> You can download and/or read the book, The Art of Assembly (AoA)
> online, and it will show you from start to fnish how to write assembl
> langage code, using HLA, and also the differences in HLA and normal x86
> ASM. It will show you everything you need to know.. and, as I stated, you
> can purchase this book by itself too (which comes with a CD-ROM and other
> things in the book.. like the sample code, sample apps, the book in PDF
> and HTML format, the RadHLA IDE for HLA, etc.) But, if you buy the book,
> you will want to snag the newest version of the HLA distribution, and then
> you can follow along with the book.. just read the CHANGELOG to see if
> anything major has changed between versions (incompatibilities, etc.)
>
> Hope this gets you started bro.. I applaud the effort in wanting to write
> an assembler, as it's a monumental task.. whether for a project or for a
> tool to be used by others, in place of the existing tools which are
> already mature, used by many, and supported on lots of architectures. So,
> if you aren't doing this "just to do it", and you want people to start
> using it, etc. You are going to need a lot of knowledge on your side to
> make yours better than what's already out there bro =] If you are doing
> it as a C.S. project, than, go for it, and good luck. If you honestly
> have the skills and the knowledge that it takes to write an assembler, and
> you have the time (which obviously you do, or at least think you do, or
> you wouldn't be attempting to write one), you might consider joining the
> NASM Open Source development team, or some other Open Source assembler
> team, and that way you can help aid in making an existing product perform
> better, rather than re-inventing the wheel and most likely (no offense to
> you meant at all) doing it worse than it already exists.. simply because
> the other projects have had time for user feedback, etc. and have improved
> because of knowledge gained during development, testing, and in other
> areas.. starting from scratch will give you a good feeling when you can
> compile your own "Hello, World!" program/binary and actually run it and
> have it work, but, adding to a project like NASM will benefit the
> community a lot more..
>
> Hope some/any of this helped you, if not, at least I got it out in
> the open and perhaps it will be archived somewhere and come up on a search
> of older news group postings for some other pour soul seeking knowledge =]
>
> Cheers,
>
> Danny
> = Daniel Blair =
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - dblair@realcoders.org - [http://www.realcoders.org]
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly"
> in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-10-20 8:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-19 5:12 32-bit assembler::how to initialize segment registers san
2004-10-19 5:40 ` zebarbuc
2004-10-19 14:47 ` Muthu
2004-10-20 1:57 ` Daniel R. Blair
2004-10-20 8:24 ` Fred Marmond
2004-10-19 15:07 ` Brian Raiter
2004-10-19 20:09 ` HLA v1.71 is now available Randall Hyde
2004-10-19 20:30 ` Claudio Fontana
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).