linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fred Marmond <fmarmond@free.fr>
To: "Daniel R. Blair" <joecamel@realcoders.org>,
	Muthu <dearestchum@yahoo.co.in>
Cc: san@cusat.ac.in,
	"linux-assembly@vger.kernel.org" <linux-assembly@vger.kernel.org>
Subject: Re: 32-bit assembler::how to initialize segment registers
Date: Wed, 20 Oct 2004 10:24:10 +0200	[thread overview]
Message-ID: <200410201024.10655.fmarmond@free.fr> (raw)
In-Reply-To: <20041019211937.G1387@codepoet.unixcoders.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

  reply	other threads:[~2004-10-20  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200410201024.10655.fmarmond@free.fr \
    --to=fmarmond@free.fr \
    --cc=dearestchum@yahoo.co.in \
    --cc=joecamel@realcoders.org \
    --cc=linux-assembly@vger.kernel.org \
    --cc=san@cusat.ac.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).