0
section .data 
    tekst db "Unesite ime"
    ispis db "Uneseno "

section .bss
    name resb 16

section .text
    global _start

_start:
    call _ispisTekst
    call _unijetIme
    call _ispisIme

    mov rax, 60
    mov rdi, 0
    syscall

_ispisTekst:
    mov rax, 1
    mov rdi, 1
    mov rsi, tekst
    mov rdx, 11
    syscall
    ret

_unijetIme:
    mov rax, 0
    mov rdi, 0
    mov rsi, name
    mov rdx, 16
    syscall
    ret

_ispisIme:
    mov rax, 1
    mov rdi, 1
    mov rsi, name
    mov rdx, 16
    syscall
    ret

Since im new to asm programming can someone explain me and find mistake why program never exits. The program should output "enter the name" then user should enter and then program writes entered name, but after entering name it doesnt do anything. Using terminal it works but on sublime it doesnt, im using sublime 3.

Jester
  • 56,577
  • 4
  • 81
  • 125
  • What's the name of your file? How did you assemble and link it? What did you enter to execute it? Did you get an error message or truly nothing? – lurker Dec 03 '17 at 23:37
  • Works fine here. – Jester Dec 03 '17 at 23:44
  • i got nothing, after entering name it just stays no exit no error i can enter as much as i will no changes, im using sublime 3 – Zaim Busuladzic Dec 03 '17 at 23:53
  • yes using terminal works fine but same code in sublime 3 doesnt work – Zaim Busuladzic Dec 03 '17 at 23:54
  • 2
    Presumably it's not passing standard input to your program. Anyway, that's not a problem with your program. Maybe sublime pops up a separate terminal window that you haven't noticed or something like that? (I am not familiar with it.) – Jester Dec 03 '17 at 23:58
  • ok thank you btw is there good ide except sasm for ubuntu ofc, – Zaim Busuladzic Dec 04 '17 at 00:02
  • If you are looking for a development editor you could look at CodeBlocks – Michael Petch Dec 04 '17 at 00:11
  • Try running your program under `strace` to see what system calls it makes. See the bottom of the x86 tag wiki for debugging tips (with `strace` and `gdb`): https://stackoverflow.com/tags/x86/info – Peter Cordes Dec 04 '17 at 01:53
  • 2
    Programs executed by Sublime don't have their standard input connected to anything, so you can't interact with them. – OdatNurd Dec 04 '17 at 14:59
  • Possible duplicate of [Issue with Sublime Text 3's build system - can't get input from running program](https://stackoverflow.com/questions/19254765/issue-with-sublime-text-3s-build-system-cant-get-input-from-running-program) – Keith Hall Dec 05 '17 at 09:22

0 Answers0