I want to get into the x86 instruction set a bit more, but I have to first explore some of the tools available to me. First, I want to see if I can provide a link to the ASM.HLP file I have zipped and attached to this post below. It's now in the download section as well if you need to find it easily in the future.
This file really does a lot to help you understand assembler and how to program the x86, but it can be daunting to look at, and I want to discuss one of the commands in some detail to help you understand the way to interpret the Help File.
Okay, that worked as expected. Unfortunately, I can't control where the ADC bitmap goes, this forum software insists on putting it at the bottom and made so small that you can't read it at first glance. But if you click on the image, it will expand, and if you click on it again, it will toggle back to small size.
The ADC instruction was selected because it works with several of the most important flags. It also is influenced by the current setting of the Carry Flag. Note that the mnemonic format is ADC dest,src. This means you use ADC, and you follow it with any valid destination, then a comma, and any valid source.
The rest of the bitmap page attempts to explain what those valid references
might be, the difference in the way the instruction worked on the different x86 platforms (that's what the 286, 386, and 486 columns are for), the number of
clock cycles needed for the instruction (a way of determining performance), and
then the portion of the code that determines the destination, and finally the portion of the code that determines the source.
The use of "reg" refers to one of the named registers. If it says reg8, then it is an 8-bit register. If it says reg16, then it is a 16-bit register.
The use of "mem" says that this reads from a memory address. The "imm" refers to a byte, word, or dword portion of the instruction itself. For instance, if you
wrote an instruction ADC al,3, which means to add with carry, a three to al, then the "3" would be a constant, and embedded in the instruction itself, actually taking up one of the 8-bit bytes that forms the instruction. We know it is just 8 bits (a byte), because al itself is just 8 bits, or one byte in size, and in all cases, we match the same size operands.
For brevity, you may also see something like "r/m8" which means that either a register or memory location of 8 bits may be specified. You should be able to understand r16, m8, or m32 at this point as well.
When you write or read assembly code, you will sometimes see something like MOV al,"a". This again would be a constant, and treated as an immediate part of the instruction, but the assembler would understand that the double quote would mean the character "a". which has an ASCII code of 97 in decimal.
Note that the vast majority of modern computers use binary (two state) circuitry for the greatest efficiency and reliability, into what we refer to as "bits".. Two states can be interpreted as any conditon where only one of two outcomes is possible, such as true/false, yes/no. go/nogo, 1/0, on/off, plus/minus, set/clear, up/down and so on. By grouping multiple bits together into groups of four (nybbles), 8 (bytes), 16 (words), 32 (double-words or dwords), and 64 (quads), we can represent quantities as well. The most common grouping for presentation purposes is in nybbles of 4 bits, which we see
as the digits 0 to 9, followed by the letters A to F. These correspond to a count range from 0 to 15 decimal, and represents a binary number shown in Base 16.
The x86 assembler probably expects most numbers to be entered in decimal form, rather than hexidecimal, octal, binary, or other representation. That is
because we humans are usually taught to work with base 10 numbers first, and many of the things we do involve base 10 values. So if you just enter a number like 100, that is one hundred in decimal. If you want it to represent 100 in hex,
you would trail it with an "h" character, so 100h = 256 decimal. Now there is an area of possible confusion, where you might have a number like ab, which since this is hexidecimal (base 16), we would represent as abh. Now how is abh to be understood to be a number, and not the name of some variable? The answer is, that all numbers must start with a digit 0 to 9 which tells the assembler that this is clearly a number. So to the assembler, abh would be the name of something, and 0abh would be a hexidecimal number.