简体   繁体   中英

How to pause after output in assembly using nasm

I have a problem when i trying to learn assembler, i copied som code from a book and after i installed nasm for 64bit processor and GoLink.

After some tries a was able to compile it to an exe file that should display "Hello world" in the comand promt.

The program "works" but i cant see "hello world" i guess its becouse it never stops, or the fact that the book i read is assembly for linux - but both use x86 if im not wrong.

This is the code:

section .data
    msg db      "Hello, World",0
section .bss
section .text
    global START
START:
        mov rax, 1
        mov rdi,1
        mov rsi, msg
        mov rdx, 12
        syscall
        mov rax, 60
        mov rdi ,0
syscall

I dont want to link to c i want to code raw assembly.

When I need to make a program pause i will add “pause:jmp short pause” before the end of the code segment.this is a silly method,but it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM