Bonjour,

Je débute avec le langage Assembleur, j'aimerais faire une boucle qui affiche 5 fois "hello world!".

Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
global  my_strlen                                                                                                                                                                     
 
        section .data                                                                                                                                                                        
 
        msg db      "hello, world!", 10                                                                                                                                                      
 
        section .text                                                                                                                                                                        
 
my_strlen:                                                                                                                                                                                   
        enter 0,0                                                                                                                                                                            
        mov rcx, 0                                                                                                                                                                           
        jmp loop                                                                                                                                                                             
 
loop:                                                                                                                                                                                        
        cmp rcx, 5                                                                                                                                                                           
        jne _increment                                                                                                                                                                       
        leave                                                                                                                                                                                
        ret                                                                                                                                                                                  
 
_increment:                                                                                                                                                                                  
        inc rcx                                                                                                                                                                              
        jmp hello                                                                                                                                                                            
 
 
hello:                                                                                                                                                                                       
    mov     rax, 1                                                                                                                                                                           
    mov     rdi, 1                                                                                                                                                                           
    mov     rsi, msg                                                                                                                                                                         
    mov     rdx, 14                                                                                                                                                                          
    syscall                                                                                                                                                                                  
        jmp loop
Cependant j'ai un problème, la boucle ne s'arrête jamais... Pourtant j'incrémente bien rcx, je ne trouve pas mon erreur.

Quelqu'un peut m'aider svp ?

Cordialement,