Linux程序集中的Interger打印

时间:2017-06-19 06:59:59

标签: linux assembly printing

section .text

global _start

_start:

        mov eax, 4
        mov ebx, 1
        mov edx, num
        int 0x80
        mov eax, 1
        mov ebx, 0
        int 0x80

section .data

        num db 5

它汇编得很好,但什么都不打印。谁能告诉我出了什么问题?

1 个答案:

答案 0 :(得分:0)

您未正确使用sys_write。字符串地址should go into ecx, and the number of bytes to write should go into edx

    mov eax, 4
    mov ebx, 1    ; fd (stdout)
    mov ecx, num  ; const char*
    mov edx, 1    ; count
    int 0x80