style: format arrays

This commit is contained in:
lohhiiccc 2026-07-29 11:32:19 +02:00
parent 2fab257d1f
commit 79c6954559

View file

@ -39,7 +39,7 @@ All computation happens inside registers - RAM just holds the data until its
#### Special registers #### Special registers
| 64-bit | 32-bit | 16-bit | Name | Purpose | | 64-bit | 32-bit | 16-bit | Name | Purpose |
|--------|--------|--------|------|---------| |----------|----------|---------|---------------------|---------------------------------------------------------|
| `rsp` | `esp` | `sp` | Stack Pointer | Points to the top of the stack | | `rsp` | `esp` | `sp` | Stack Pointer | Points to the top of the stack |
| `rbp` | `ebp` | `bp` | Base Pointer | Marks the base of the current stack frame | | `rbp` | `ebp` | `bp` | Base Pointer | Marks the base of the current stack frame |
| `rip` | `eip` | `ip` | Instruction Pointer | Points to the next instruction to execute | | `rip` | `eip` | `ip` | Instruction Pointer | Points to the next instruction to execute |
@ -48,7 +48,7 @@ All computation happens inside registers - RAM just holds the data until its
#### General-purpose registers #### General-purpose registers
| 64-bit | 32-bit | 16-bit | 8-bit high | 8-bit low | Category | Conventional use | | 64-bit | 32-bit | 16-bit | 8-bit high | 8-bit low | Category | Conventional use |
|--------|--------|--------|------------|-----------|----------|-----------------| |-------------|---------------|---------------|------------|---------------|--------------|---------------------------|
| `rax` | `eax` | `ax` | `ah` | `al` | Caller-saved | Return value, accumulator | | `rax` | `eax` | `ax` | `ah` | `al` | Caller-saved | Return value, accumulator |
| `rbx` | `ebx` | `bx` | `bh` | `bl` | Callee-saved | General purpose | | `rbx` | `ebx` | `bx` | `bh` | `bl` | Callee-saved | General purpose |
| `rcx` | `ecx` | `cx` | `ch` | `cl` | Caller-saved | 4th argument | | `rcx` | `ecx` | `cx` | `ch` | `cl` | Caller-saved | 4th argument |
@ -68,7 +68,7 @@ All computation happens inside registers - RAM just holds the data until its
#### Base #### Base
| Instruction | Description | | Instruction | Description |
|-------------|-------------| |------------------|----------------------------------------|
| `mov dst, src` | Copy src into dst | | `mov dst, src` | Copy src into dst |
| `push src` | Push src onto the stack | | `push src` | Push src onto the stack |
| `pop dst` | Pop top of stack into dst | | `pop dst` | Pop top of stack into dst |
@ -79,14 +79,14 @@ All computation happens inside registers - RAM just holds the data until its
##### Flag-setting ##### Flag-setting
| Instruction | Flags set | Description | | Instruction | Flags set | Description |
|-------------|-----------|-------------| |-------------|----------------|-------------------------------------|
| `cmp a, b` | ZF, SF, OF, CF | Computes `a b`, discards result | | `cmp a, b` | ZF, SF, OF, CF | Computes `a b`, discards result |
| `test a, b` | ZF, SF, PF | Computes `a AND b`, discards result | | `test a, b` | ZF, SF, PF | Computes `a AND b`, discards result |
##### Conditional jumps ##### Conditional jumps
| Instruction | Flags | Condition | Description | | Instruction | Flags | Condition | Description |
|-------------|-------|-----------|-------------| |---------------|------------|--------------|---------------------------|
| `jmp` | - | always | Unconditional jump | | `jmp` | - | always | Unconditional jump |
| `je` / `jz` | ZF | ZF = 1 | Equal / Zero | | `je` / `jz` | ZF | ZF = 1 | Equal / Zero |
| `jne` / `jnz` | ZF | ZF = 0 | Not equal / Not zero | | `jne` / `jnz` | ZF | ZF = 0 | Not equal / Not zero |
@ -106,7 +106,7 @@ All computation happens inside registers - RAM just holds the data until its
#### Arithmetic #### Arithmetic
| Instruction | Description | | Instruction | Description |
|-------------|-------------| |-----------------|-------------------------------------------------------------|
| `add dst, src` | dst = dst + src | | `add dst, src` | dst = dst + src |
| `sub dst, src` | dst = dst - src | | `sub dst, src` | dst = dst - src |
| `inc dst` | dst = dst + 1 | | `inc dst` | dst = dst + 1 |
@ -159,7 +159,7 @@ Additional arguments are pushed onto the stack. The return value is stored in `r
**Register preservation:** **Register preservation:**
| Type | Registers | Who saves | Behavior | | Type | Registers | Who saves | Behavior |
|------|-----------|-----------|----------| |--------------|-----------------------------------------------|-----------|------------------------------------------------------------------------------------|
| Caller-saved | `rax`, `rcx`, `rdx`, `rsi`, `rdi`, `r8``r11` | Caller | **Will be overwritten** by the called function - save them before `call` if needed | | Caller-saved | `rax`, `rcx`, `rdx`, `rsi`, `rdi`, `r8``r11` | Caller | **Will be overwritten** by the called function - save them before `call` if needed |
| Callee-saved | `rbx`, `rbp`, `r12``r15` | Callee | Must be restored before returning | | Callee-saved | `rbx`, `rbp`, `r12``r15` | Callee | Must be restored before returning |