Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %define     BPE     4   ; Byte Per Element
  2.  
  3.  
  4. ; dword array_2D[3][4] <=> tableau 2D à 4 lignes et 5 colonne (zero compte)
  5.    
  6.     ; array_2D[2][2]
  7.         mov     eax, 2                      ; y
  8.         mul     dword [max_x]               ; eax *= [max_x] <=> (y * max_x) <=> Select line of array
  9.         add     eax, 2 * BPE                ; (y * max_x) + x <=> (2 * 20) + 8 <=> 48
  10.  
  11.         mov     [array_2D + eax], dword 23  ; Target array_2D[2][2] <=> array_2D[48]
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement