Talk:X86 assembly language

Examples
Some small and working examples of how to use assembly language. Usually examples makes people leap forward in knowledge and learning.

Thanks 193.28.147.12 08:40, 20 January 2007 (UTC)

Proposals
I think this article : Ericd 20:54 Apr 23, 2003 (UTC)
 * should have an introduction,
 * should link to some free software assembler.

isn't NASM a free assembler?

smaffy

Move to Wikibooks?
Perhaps this should be moved to Wikibooks? Dysprosia 12:12, 23 Oct 2003 (UTC)

This doesn't look like anything about assembly language
This article doesn't look like anything it has anything to do with assembly language, it looks more like a general overview of x86. Those articles already exist in the form of the x86 and IA-32 articles.

--ykhan 17:25, 2004 May 3 (UTC)

I agree. In fact, its not even a fair or correct description of x86 CPUs -- in particular AMD's processors do not have a "rename register" stage. (Rename registers are implicit, and don't require an additional stage to be assigned like they do in other processors.) A corrected version of this description could probably be added to an x86 CPU page.

I think this article should contrast x86 assembly versus, say, DSP, RISC assemblies. Talk about complex addressing, independence from alignment restrictions, atomic instructions, SIMD instructions, implicit flags, partially implicit and partially general registers.

(Paul Hsieh July 6, 2005)

 To answer the question of merging IA32 and IA64 article's. A catalog separate's, and only usage binds. A catalog can hold separate usage bindings.  Niels Krook 

Yeah, I agree too guys. - Alex

LazyASM 0.52 NASM 0.98.39 FASM 1.64 NBASM32 00.25.97 YASM 0.40

List of x86 assembly language instructions
maybe such a list should be created?


 * Initial 8086/8088 instructions and "real mode"
 * Initial 8087 (x87) instructions
 * 80186/80188 additions (few)
 * 80187 additions (few if any)
 * 80286 additions, "protected mode"
 * 80287 additions (few if any)
 * 80386 additions, "virtual 8086 mode", 32bit
 * 80387 additions
 * 80486 additions (few), including x87 (few if any)
 * 80586 (Pentium) additions (few)
 * 80686 (Pentium Pro) additions (few)
 * 80786 (Athlon, P4) - none?
 * 80886 (Athlon64) additions (few), "long mode", 64bit


 * Intel MMX
 * Cyrix MMX extensions (supported by Athlon64)
 * AMD 3DNow!
 * AMD 3DNow! extensions
 * Intel SSE
 * Intel SSE2
 * Intel SSE3
 * SSE3 HyperThreading instructions (2)
 * Intel VMX - 10 instruction about Virtualisation Technology


 * x86-64 (AMD64) undocumented instructions and behaivour not supported in EM64T (Intel)


 * NexGen Nx586, Nx587 irregulars?
 * Other irregualrs - NEC, UMC, Cyrix, IDT, Rise, VIA, SiS, etc.


 * If you mean a complete list of instructions, that might better belong in a reference manual; we could link to Intel and AMD's reference documentation online.


 * Perhaps summarizing the instruction set, including various additions done at various times, would be useful. Guy Harris 20:34, 7 February 2006 (UTC)


 * It seems that there is already such list here: X86 instruction listings. But it is still incomplete 212.36.8.100 11:42, 25 February 2006 (UTC)

To answer the question of merging IA32 and IA64 article's. A catalog seperate's, and only usage binds. A catalog can hold seperate usage bindings. Niels Krook.

Framebuffer UI
How is Framebuffer UI in the External Links related to Assembly? This proves the above point that this article is not its own purpose, but rather an ad or a comparison. —The preceding unsigned comment was added by 24.185.112.164 (talk) 02:03, 28 December 2006 (UTC).

Processor modes
The section on processor modes is just plain wrong. The *only* difference between 16- and 32-bit modes is the *default* data and address sizes, however, one can override the default address and data sizes with prefixes (67 and 66 hex, respectively.)

The difference between real and protected modes lies in the meaning of segment register values -- in real mode, the segment base is directly computed from the segment register value by shifting right by four and the limit value is left unmodified (it defaults to 64K at boot time), whereas in protected mode it is an index (selector) into one of the Descriptor Tables (Global Descriptor Table or Local Descriptor Table) from which the base and limit are obtained. One normally assumes 16 bits when one is discussing real mode, but it is possible to force the processor into 32-bit real mode. (This, incidentally, is not the so-called "unreal mode", that is simply 16-bit real mode with the segment limits set to 4 GB.)

There are a handful of instructions related to descriptor tables that are unavailable in real mode. Also, the processor will not allow paging to be enabled in real mode. Tere is no obvious technical reason for that restriction, but it is enforced by the processor.

V86 mode is formally a submode of protected mode, and all the memory protections of protected mode are active, however, segments are handled the same way as in (16-bit) real mode. There is no way to force the processor into any kind of "32-bit V86 mode" (that works on all processors, that is.)

32-bit and SIMD instructions are available in all these modes!

x86-64 adds a new top-level mode, long mode, with the submodes compatibility mode (which in turn can be 16 or 32 bit) and 64-bit mode, which makes considerable changes to the instruction encoding, which allows a bigger register set. 64-bit instructions and the extended register set are only available in 64-bit mode.

Thus, you have a mode chart looking like this:


 * Real Mode
 * 16-bit Real Mode
 * Unreal Mode (4 GB segment limits)
 * 32-bit Real Mode (undocumented)
 * Protected Mode
 * 16-bit Protected Mode
 * 32-bit Protected Mode
 * V86 mode
 * Long Mode
 * Compatibility Mode
 * 16-bit Compatibility Mode
 * 32-bit Compatibility Mode
 * 64-bit Mode

There is also System Management Mode. This is actually not an ISA-level processor mode at all; rather, it is a special high-priority interrupt level (higher than even Non-Maskable Interrupt.) By default, SMM is entered in 16-bit Real Mode with 4 GB limits ("Unreal mode"), but it is possible and legal to switch processor modes while in SMM. The only instruction-level difference between SMM and ordinary execution is that the RSM (return from system management interrupt) instruction is only available after an SMM.

Hpa 00:45, 25 August 2007 (UTC)

Issues solved
I have fixed the issues that people have been concerned about with this article.


 * The article is now a basic summary of the features of x86 language
 * There is a new intro which is more specific and less technical
 * There is now a link to a list of assemblers
 * Information about the x86 in general and not the language has been moved to x86 architecture
 * Info on processor modes summarized and some of it merged as above.

Hopefully this article is much better now. Da rulz07 08:16, 14 November 2007 (UTC)

Young, Holla —Preceding unsigned comment added by 75.161.178.31 (talk) 06:00, 2 December 2007 (UTC)

NOT "lowest level possible"...
Correction: Microcode is *the* lowest level possible. It's made up for every processor model by electronic engineer s. Assembly language is assembled to binary, which is sent to the controller as electrical pulses. The controller "compiles" this to microcode which literally controls how electricity flows through the processor. Assembly is one rung above this, and how you interface with the complex electrical currents inside electrical devices (which represent higher level things). Some companies refer to their microcode and micro-software implementations as "firmware". :)

Don't call this "original research". (Ed. note: Taken to mean something like "I'm not a racist, but", combined with it being a directive, I guess it's correct) There are articles about it here on Wikipedia and plenty of info about it can be found on the web. I just happened to know this because I'm currently a mediocre systems programmer in "training". ;) If you really want hard links to sources, let me know. But the statement is erroneous and should be removed. Maybe it could be changed to say that ASM is the lowest-level language possible outside the electronic circuit manufacturing industry? It's not limited to computers either; there are microcode implementations in your remote control, alarm clock, etc. And it should be noted, microcode implementations are RARELY cross-compatible:

For example, a company makes a CPU series called "X": X-1 model will have a distinct implementation X-2 will be binary compatible with X-1, but have different microcode/aka firmware

To extend that, imagine series "Y" comes out with wider addressing: 1) It can still run X-series instructions 2) X-series can NOT run Y-series instructions 3) Internal microcode is TOTALLY different ...a contrived example, but generally how it works... —Preceding unsigned comment added by 67.142.163.36 (talk) 11:40, 27 January 2010 (UTC)
 * I'm going to take your advice: "If you really want hard links to sources, let me know. But the statement is erroneous and should be removed." and remove all of the erroneous parts of your statement.
 * Somebody will revert that and probably bitch at me but I'm hopefully going to have hopefully figured out how to delete my account and if I'm lucky be diagnosed with terminal cancer and be given a day to live by then. --A Shortfall Of Gravitas (talk) 15:53, 28 April 2021 (UTC)
 * In a more general sense, all computer code is eventually interpreted. Sometimes the source code is interpreted, and no copilation takes place (e.g. Pearl). But even if the source code is compiled, the object code must eventually be interpreted by the machine. It is a matter of implementation whether that is pure hardware of microcode-controlled logic. I guess it is (only) appropriate to say that the code produced by an assembler is the lowest level that is kept in a stored form (file). Well, that applies to any "binary" (.EXE file). The specific characteristic of Assembler language is that there is a one to one relatiionship between statements and the code that is kept. Rbakels (talk) 10:02, 9 December 2011 (UTC)

pseudo instructions
I looked in this article for a summary or pointer to the pseudo instructions and meta language of intel's family of assemblers, but don't see it. Such a description would explain the features of this non-sensical medley of examples: name example %set (debug, 0) %*define (bit (b)) (%eval (1 shl (%b and 7))) %*define (set_bit (b)) (or    ds:byte ptr %byte(%b), %bit (%b)) %if(%debug)then(debug stuff here )else(non-debug stuff here )fi $genonly $eject txt    group   rom_text dgroup group   data assume cs:txt, ds:dgroup, es:dgroup Init_data      segment         public          'Init_data' extrn table_init :WORD Init_data      ends stack_frame    struc old_bp  dw      ? old_es  dw      ? old_ds  dw      ? ret_ip  dw      ? ret_seg dw      ? arg2    dd      ? arg1    dd      ? stack_frame    ends

Anybody know where I can find such a reference, whether on Wikipedia or online somewhere? 131.89.192.111 (talk) 23:53, 27 January 2010 (UTC)

Question
How linker assembly code 16B with the c language ?

This subject is unsavory
There should be no subject called "x86 assembly language" in wikipedia. An entry should cover one concept. Even if it is controversial what the concept should be named, the content should be one subject and cohesive. This entry invites a mishmash of miscellaneous comments, as it actually is. An interesting reference is Randall Hyde. He compares different assemblers, including his own. It comes out very well. I will not deny that this reference has value, but is this how Wikipedia is supposed to be?  Somewhere I had added a reference to the book of Morse, the designer of the 8086, what I consider the most seminal book of the architecture. I can't find it back in the tangle of x86 stuff, nor can I point out which of the wikipedia subjects would be the place where this reference is to be expected. 80.100.243.19 (talk) 14:23, 25 February 2011 (UTC)

Backward compatible?
In the very first sentence, backward compatibility is mentioned as a property. Yes, old programs may run unaltered on newer hardware. But that is a property of the x86 familiy of processors rather than its assembly language. Rbakels (talk) 10:07, 9 December 2011 (UTC)

External links modified
Hello fellow Wikipedians,

I have just modified 3 one external links on X86 assembly language. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
 * Added archive https://web.archive.org/20131003180256/http://www.ibm.com/developerworks/linux/library/l-gas-nasm/index.html to http://www.ibm.com/developerworks/linux/library/l-gas-nasm/index.html
 * Added archive https://web.archive.org/web/20140402192351/http://www.bell-labs.com/history/unix/ to http://www.bell-labs.com/history/unix/
 * Added archive http://web.archive.org/web/20050306034501/http://www.intel-assembler.it:80/ to http://www.intel-assembler.it

When you have finished reviewing my changes, please set the checked parameter below to true or failed to let others know (documentation at ).

Cheers.— InternetArchiveBot  (Report bug) 13:35, 21 July 2016 (UTC)

Regarding the Integer ALU instructions Section
It says "x86 assembly has the standard mathematical operations,  ,  , and  ", but should   and   be included in this list?

Thanks — Preceding unsigned comment added by IHeartHistory (talk • contribs) 02:27, 1 November 2017 (UTC)

AT&T syntax history
When and how did AT&T syntax come into being, and where is (was) it documented? The article should probably address this. If you, dear reader, know of any suitable sources (man pages for an assembler that AT&T shipped as part of some version of UNIX, maybe? Something else?), please tell. Zazpot (talk) 20:25, 30 December 2018 (UTC)


 * I'm pretty sure it's a GNU invention, and that the article's claim that "...AT&T syntax is dominant in the Unix world, since Unix was created at AT&T Bell Labs." is false. If you look at a Xenix programming manual from the 1980s you'll find that it used Intel syntax, and Xenix was an AT&T-licensed Unix. pburka (talk) 17:44, 6 April 2023 (UTC)

"Examples" section needs to be re-worked or removed.
x86 Assembly, DOS MASM, Windows MASM, etc are all different languages. They are heavily base on x86 assembly, but NOT the same thing at all as x86 assembly. Software written in x86 assembly does not need an OS to execute on an x86 machine, however all those other examples do, because they are built on the foundation of their respective OSs along with the libraries and whatnot that those bring with them.

This section is conflating concepts which, while they are similar in some respects, are functionally very different. Nabeel_co (talk) 20:11, 5 January 2023 (UTC)