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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
global _start
segment .code
;{
_start:
;{
jmp push_chaine
fin_push_chaine:
jmp pop_chaine
fin_pop_chaine:
mov ecx, msg
mov eax, 4 ; syscall 4 = stdout(ecx)
mov ebx, 1
mov edx, size
int 80h ; stdout msg
mov eax,1 ; Interruption linux
mov ebx,0 ; Pour quitter
int 80h ; Le programme
;}
push_chaine:
;{
xor ecx, ecx
loop1:
;{
dec esp
mov al, [msg + ecx]
mov [esp], al
inc ecx
;}
cmp al, 0 ; Quand fin chaine on arrete de boucler
jne loop1
dec ecx ; Si le zéro n'est pas pris en compte, alors mettre sub ecx, 2 pour voir
;}
jmp fin_push_chaine
pop_chaine:
;{
xor ebx, ebx
loop2:
;{
mov al, [esp]
mov [msg + ebx], al
inc esp
inc ebx
;}
loop loop2 ; While (ecx)
;}
jmp fin_pop_chaine
;}
section .data
msg: db "Salut les potes", 0 |
Partager