1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| global _init_table
%define ARRAY_SIZE 256
SECTION CODE USE32 CLASS=CODE:
_init_table_PRM_array equ 512 ; words array 2 bytes*256
_init_table:
push ebp ; add ebp on the stack
mov ebp, esp ; move esp in ebp
sub esp, _init_table_PRM_array
db 0xcc ; TO REMOVE WARNING
lea ebx, [ebp - _init_table_PRM_array] ; ebp points to ebx
; initialize the array from '0' to '255'
mov cx, 0 ; initialize i to '0'
mov esi, 0 ; data offset
.for_loop:
cmp cx, ARRAY_SIZE
jge .end_for
mov [ebx+esi], cx
inc cx
add esi, byte 2
jmp short .for_loop
.end_for:
mov esp, ebp ; move ebp in esp
pop ebp ; pop ebp
ret |
Partager