I'm try to print integer using Assembly Language. But program not terminating. Can Any one help

  • Lakshitha
    Likes 0

    Problem Description
    section .data
    usrMsg db 'Print a number in ax', 10
    usrMsgLen equ $ - usrMsg
     
    section .bss
        numdigit resb 1         
        
    section .text
        global _start
        
    _start:
        mov edx, usrMsgLen
        mov ecx, usrMsg
        mov ebx, 1
        mov eax, 4
        int 80h
      
        
        mov cx, 0
        mov ax, 43878
        
        
    lable1:
        
        
        
        mov si, 10
        mov dx, 0
        div si
        
        push dx
        inc cx
        
        cmp ax,0
        jz prntLoop
        
        jmp lable1
       
    prntLoop:
        cmp cx, 0
        jz exit
        
        pop dx
        add dx,48
        mov [numdigit], dx
     
    ;print character
    mov edx, 1
    mov ecx, numdigit
    mov ebx, 1
    mov eax, 4
    int 80h
     
    dec cx
    jmp prntLoop
      
    exit:
        mov eax, 1
        mov ebx, 0
        int 80h
  • Sonar Systems admin
    Likes 0

    Any errors?


    This reply has been verified.
  • Lakshitha
    Likes 0

    Can’t terminate the code.

  • Sonar Systems admin
    Likes 0

    What happens?

Login to reply