SHOW:
|
|
- or go back to the newest paste.
| 1 | - | mov eax, 2 ; y |
| 1 | + | %define BPE 4 ; Byte Per Element |
| 2 | - | mul dword [max_x] ; eax *= [max_x] <=> (y * max_x) <=> Select line of array |
| 2 | + | |
| 3 | - | add eax, 5 ; (y * max_x) + x |
| 3 | + | |
| 4 | ; dword array_2D[3][4] <=> tableau 2D à 4 lignes et 5 colonne (zero compte) | |
| 5 | - | mov [array_2D + eax], dword 23 |
| 5 | + | |
| 6 | ; array_2D[2][2] | |
| 7 | - | max_x dd 5 |
| 7 | + | mov eax, 2 ; y |
| 8 | mul dword [max_x] ; eax *= [max_x] <=> (y * max_x) <=> Select line of array | |
| 9 | - | array_2D: dd 0, 0, 0, 0, 0 |
| 9 | + | add eax, 2 * BPE ; (y * max_x) + x <=> (2 * 20) + 8 <=> 48 |
| 10 | - | dd 0, 0, 0, 0, 0 |
| 10 | + | |
| 11 | - | dd 0, 0, 0, 0, 0 |
| 11 | + | mov [array_2D + eax], dword 23 ; Target array_2D[2][2] <=> array_2D[48] |
| 12 | - | dd 0, 0, 0, 0, 0 |
| 12 | + | |
| 13 | ||
| 14 | ||
| 15 | max_x dd 5 * BPE ; <=> 20 | |
| 16 | ||
| 17 | ; 0 1 2 3 4 | |
| 18 | ; | |
| 19 | array_2D: dd 0, 0, 0, 0, 0 ; 0 0( 0), 1( 4), 2( 8), 3(12), 4(16) | |
| 20 | dd 0, 0, 0, 0, 0 ; 1 5(20), 6(24), 7(28), 8(32), 9(36) | |
| 21 | dd 0, 0, 0, 0, 0 ; 2 10(40), 11(44), 12(48), 13(52), 14(56) | |
| 22 | dd 0, 0, 0, 0, 0 ; 3 15(60), 16(64), 17(68), 18(62), 19(66) |