x86 assembly on Linux info
Kragen Sitaker
kragen@pobox.com
Wed, 10 Apr 2002 08:11:47 -0400 (EDT)
I was trying to find information about x86 assembly programming on
Linux. Here are the resources I thought looked most worthwhile:
news:comp.lang.asm.x86 --- a moderated newsgroup on the subject.
http://nasm.2y.net/ --- NASM, the Netwide Assembler, is currently the
most popular assembler among x86 assembly programmers on Linux. Its
syntax is similar to that of MASM and TASM and very different from
gas.
http://linuxassembly.org/ --- information on programming in assembly
with Linux, including with gas.
http://www.gnu.org/manual/gas/html_chapter/as_16.html --- the "80386
Dependent Features" section of the gas manual, as.info (which was on
my machine already, in info file format, in the binutils-doc package)
that explains things like gas syntax for Intel addressing modes, which
was a major thing I was looking for.
http://www.drpaulcarter.com/pcasm/ --- a 150-page nicely-typeset
textbook on programming in x86 assembly on Linux with NASM.
ftp://download.intel.com/design/PentiumII/manuals/ --- programming
information for the P6 family, straight from the horse's mouth.
http://developer.intel.com/technology/itj/ --- Intel Technology
Journal, a quarterly journal on Intel's CPU tech. Back issues appear
to be unavailable, though.
http://webster.cs.ucr.edu/ --- Randall Hyde's web pages on assembly
language programming. He has his own assembler, "HLA" --- "high-level
assembler" --- and a 1500-page-or-so textbook on learning to program
with it.
http://www.agner.org/assem/ --- detailed-looking information on how to
optimize for Pentium-family CPUs, claiming to be the most
comprehensive, detailed, and accurate manual on the topic. It's a
couple of years out of date, but that's probably not much.
Here are the pages I visited. * is pages that might contain links I
should follow, - is pages all of whose interesting links I've
followed; x is dead links.
* http://X.webring.com/hub?ring=x86asm&id=59&hub is the "hub" of a
webring about x86 assembly language. It lists the following pages:
- http://loadall.planet-d.net/ --- English/French page of DirectX asm progs
by loadall@hotmail.com, ICQ#47747397. Suggests flipcode.com and
gamasutra.com for info on game dev. Lots of source and tools; no
text.
* http://home-4.tiscali.nl/~t821150/Welcome.html --- the Prophetic
Programming Homepage, by Wouter van Kleunen (aka The Prophet),
wkleunen@superweb.nl, ICQ#32398476. Some useful docs. Links to
* http://selenberg.just.nu/ --- asmlib
* http://www.cryogen.com/nasm --- nasm
* http://www.inglenook.co.uk/nasmide/ --- an IDE for NASM
x http://www.webster.cs.ucr.edu/asm/ArtOfAsm.html --- The Art of Assembly
Language Programming, "A very good book on programming assembly language
by Randel Hyde."
* asmjournal.freeservers.com --- Assembly Journal. Looks broken.
- http://home-4.tiscali.nl/~t821150/Tutorials/pentopt.html --- "How to
Optimize For the Pentium Family", updated 1998, by Agner Fog.
- http://home-4.tiscali.nl/~t821150/Tutorials/BranchPrediction.html ---
"Branch prediction in the Pentium Family", updated no later than Sept.
1999, by Agner Fog, including reverse-engineering results.
- http://home-4.tiscali.nl/~t821150/Tutorials/PentiumMSRs.html --- a 1995
article by Ralf Brown on Pentium MSRs, which mentions sandpile.org and
x86.org.
- http://www.x86.org/, previously Robert R. Collins's project, is now
a DDJ thingy; it doesn't seem to have been updated significantly since
early 1998. it includes
- http://www.x86.org/intel.doc/inteldocs.htm, last updated 1998, which
links to
* ftp://download.intel.com/design/PentiumII/manuals/ --- manuals for
Pentium II processors
* Christian Ludloff's "Programmer's Processor Power Package" of
undocumented information about Intel and compatible processors.
* http://webster.cs.ucr.edu/ --- Randall Hyde's very actively maintained
web page about Intel assembly, including 32-bit Linux information and
"The Art of Assembly". Also "HLA", "high-level assembly".
* http://webster.cs.ucr.edu/Page_TechDocs/0_techdocs.html --- tech docs
for the x86
- http://webster.cs.ucr.edu/Page_AoALinux/0_AoAHLA.html --- Art of
Assembly, 32-bit Linux edition. Unfortunately, while this includes
a 28-page instruction set manual, said manual seems to be written with
HLA in mind, and HLA seems to use Pascal syntax.
* suggests comp.lang.asm.x86 (moderated!) and alt.lang.asm
* http://webster.cs.ucr.edu/Page_hla/0_Page_hla.html --- HLA main page
* http://webster.cs.ucr.edu/Page_asm/0_RHUCRLib.html#Anchor-The-23240
--- the UCR Standard Library for x86 asm
* http://webster.cs.ucr.edu/links.htm --- links to other asm sites:
* www.sandpile.org, Christian Ludloff's site, which has some
detailed information online about opcodes and processor
models, but not as much expository info as I'd like; links to
lots of good stuff, though:
- http://www-2.cs.cmu.edu/afs/cs.cmu.edu/user/ralf/pub/WWW/ --- Ralf
Brown's very actively maintained home page, including the
famous Interrupt List. aka http://www.cs.cmu.edu/~ralf/.
* http://developer.intel.com/technology/itj/ --- Intel Technology
Journal
* http://www.agner.org/assem/, Agner Fog's assembly page, with
* http://www.agner.org/assem/pentopt.zip --- Pentium Optimization,
last updated 2000-07-03
x http://www.amd.com/products/cpg/athlon/techdocs/ --- Athlon info
* http://www.programmersheaven.com/zone5/index.htm
* http://www.amd.com/us-en/Corporate/VirtualPressRoom/0,,51_104_857_875%5e2371,00.html
AMD's x86-64 info.
- http://www.xs4all.nl/~smit/ --- ASSEMBLE IT! ---
"the coolest ASM oriented page on The Web." I disagree, but
it does seem to have decent 8086 (*not* 386) tutorials.
* http://linuxassembly.org/, an actively maintained site (mostly
by Konstantin Boldyshev and Francois-Rene Rideau) mirrored at
- http://reguly.net/alvaro/cic/linux-asm/
- http://www.lnxscene.org/assembly/
- http://mars.wiwi.uni-halle.de/asm/
- http://kernelkorea.org/la/
- http://nuieee.fe.up.pt/~ee97034/la/
- http://la.kmv.ru/
- http://linuxasm.gerf.org/
and it links to
x http://www2.dgsys.com/~raymoon/faq/ --- x86 assembly FAQ --- 403
- http://linuxassembly.org/list.html --- a mailing list,
linux-assembly@vger.kernel.org, with about 2-4 messages
per day (4 in 2000, 2 in 2001)
* http://linuxassembly.org/resources.html --- x86 assembly
resources
- http://www.gnu.org/manual/gas/ --- the gas manual, as.info ---
which was on my machine already, in info file format, in the
binutils-doc package. This *does* explain things like
gas syntax for Intel addressing modes, which was the one
thing I was looking for, in the "i386-Dependent" info node.
- http://linuxassembly.org/audio.html --- info on using /dev/dsp
under Linux by Karsten Scheibler, karsten.scheibler@bigfoot.de.
You use ioctls like SNDCTL_DSP_CHANNELS aka
SOUND_PCM_WRITE_CHANNELS and SNDCTL_DSP_GETBLKSIZE to get and
set info on the device.
* http://www2.dgsys.com/~raymoon/moonware.html --- Ray Moon's misc.
FAQs, including
* http://www2.dgsys.com/~raymoon/x86faqs.html
* http://www.drpaulcarter.com/pcasm/ --- a tutorial on PC assembly for C
programmers using NASM under Linux, written because its author needed a
textbook.
* http://nasm.2y.net/ --- NASM home page
--
/* By Kragen Sitaker, http://pobox.com/~kragen/puzzle4.html */
char b[2][10000],*s,*t=b,*d,*e=b+1,**p;main(int c,char**v){int n=atoi(v[1]);
strcpy(b,v[2]);while(n--){for(s=t,d=e;*s;s++){for(p=v+3;*p;p++)if(**p==*s){
strcpy(d,*p+2);d+=strlen(d);goto x;}*d++=*s;x:}s=t;t=e;e=s;*d++=0;}puts(t);}