I am trying to create my own gets and puts function using system calls in NASM assembly language. So far the puts function works in this code just fine but I can not get the terminal to wait for input from the keyboard in the gets function.
global start
SECTION .text
SECTION .data
prompt1: db "We will make you a box. How tall would you like it to be?", 0
length1: equ $-prompt1
prompt2: db "How wide would you like it to be?" , 0
length2: equ $-prompt2
input: dd 0
start:
mov edi, prompt1
mov esi, length1
call puts
mov edi, input
mov esi, 4
call gets
mov eax, 0
ret
puts:
mov dword [esp], 1
mov dword [esp+8], esi
mov dword [esp+4], edi
mov eax, 0x4
sub esp, 4
int 0x80
add esp, 16
ret
gets:
mov dword [esp], 0
mov dword [esp+4], esi
mov dword [esp+8], edi
mov eax, 3
sub esp, 4
int 0x80
add esp, 16
ret
This is the output: We will make you a box. How tall would you like it to be?
But it doesn't prompt for input... Help please!