Category:8086 Assembly: Difference between revisions

m
→‎Data Registers: Fixed inaccurate info and added example of multiplication
m (→‎Data Registers: Clarification)
m (→‎Data Registers: Fixed inaccurate info and added example of multiplication)
Line 28:
* <code>AX</code> is the "Accumulator" and is used for advanced mathematics routines, as well as the source/destination for the <code>STOSW</code> and <code>LODSW</code> commands when loading/storing bytes from consecutive regions of memory.
* <code>BX</code> can be used as a variable offset on the Source Index/Destination Index registers (more on those later).
* <code>CX</code> is used as a loop counter. The <code>JCXZ</code> command jumps to the specified address, but only if <code>CX = 0</code>. In addition, <code>CL</code> is used to specify a shift amount when performing bit shifts and rotates. On later x86 CPUs, this can be any constant value, but on the original 8086 you can only specify 1 or <code>CL</code>.
* <code>DX</code> contains the "high word" of a 32-bit product when multiplying <code>AX</code> with another 16-bit register. For example, if <code>AX</code> contains 0x2000 and <code>BX</code> contains 0x10, the command <code>MUL BX</code> will create the product 0x20000, with <code>DX</code> containing 0x0002 and <code>AX</code> containing 0x0000. In addition, DX is also used with the <code>IN</code> and <code>OUT</code> commands when selecting which ports to read from/write to external hardware.
* <code>DX</code> can be used to specify a shift amount when bit shifting. Later versions of the x86 family allow this to be an arbitrary immediate value, but on the original 8086 you can only specify 1 or <code>DX</code>.
 
===Other Registers===
1,489

edits