Category:8086 Assembly: Difference between revisions
m
→Data Registers: Typo and formatting fixes
Puppydrum64 (talk | contribs) m (→Other Registers: Clarification) |
Puppydrum64 (talk | contribs) m (→Data Registers: Typo and formatting fixes) |
||
Line 18:
Each data register is 16-bit, but has two eight bit halves ending in H or L, e.g. <code>AH, AL</code>. Instructions can be executed using the whole register or just half of it.
<lang asm>mov ax, 1000h ;move 1000h into AX, or equivalently, move 10h into AH and 00h into AL.</lang>
Moving a value smaller than 16 bits into <code>?X</code> is the same as moving it into <code>?L
<lang asm>mov ax,0030h
Line 25:
Generally speaking, the 8086's registers serve the following purposes:
* <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>.
* <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===
|