Programming/Assembly: Difference between revisions
Jump to navigation
Jump to search
Brodriguez (talk | contribs) (Add link) |
Brodriguez (talk | contribs) (Add instruction size section) |
||
Line 1: | Line 1: | ||
== Instruction Sizes == | |||
In 64 bit assembly, some assembly instructions will have letters appended to the end of the instruction, indicating the size of data being referenced. The letters are the following: | |||
* '''Byte''' ('''b''') - A one-byte (8 bit) value. | |||
* '''Word''' ('''w''') - A two-byte (16 bit) value. | |||
* '''DoubleWord''' (l) - A four-byte (32 bit) value. | |||
* '''QuadWord''' (q) - A eight-byte (64 bit) value. | |||
== Registers == | |||
The following registers exist in 64 and 32 bit assembly. | The following registers exist in 64 and 32 bit assembly. | ||
Revision as of 13:14, 3 February 2020
Instruction Sizes
In 64 bit assembly, some assembly instructions will have letters appended to the end of the instruction, indicating the size of data being referenced. The letters are the following:
- Byte (b) - A one-byte (8 bit) value.
- Word (w) - A two-byte (16 bit) value.
- DoubleWord (l) - A four-byte (32 bit) value.
- QuadWord (q) - A eight-byte (64 bit) value.
Registers
The following registers exist in 64 and 32 bit assembly.
Stack Pointer | Stack Base Pointer | Accumulator | Base | Counter | Data | Source | Destination | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
64 Bit | RSP | RBP | RAX | RBX | RCX | RDX | RSI | RDI | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
32 Bit | ESP | EBP | EAX | EBX | ECX | EDX | ESI | EDI | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
16 Bit | SP | BP | AX | BX | CX | DX | SI | DI | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
8 Bit | SPL | BPL | AH | AL | BH | BL | CH | CL | DH | DL | SIL | DIL | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The following registers only exist in 64 bit assembly.
Temp 1 | Temp 2 | Temp 3 | Temp 4 | Temp 5 | Temp 6 | Temp 7 | Temp 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
64 Bit | R8 | R9 | R10 | R11 | R12 | R13 | R14 | R15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
32 Bit | R8D | R9D | R10D | R11D | R12D | R13D | R14D | R15D | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
16 Bit | R8W | R9W | R10W | R11W | R12W | R13W | R14W | R15W | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
8 Bit | R8B | R9B | R10B | R11B | R12B | R13B | R14B | R15B | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In-depth details of how assembly register and function calling should work: https://www.cs.princeton.edu/courses/archive/spring11/cos217/lectures/15AssemblyFunctions.pdf