I have this code:
section .bss
buff resb 1
readfromkeyboard:
mov eax,3 ;specify system read
mov ebx,0 ;specify standard in -> keyboard
mov ecx,buff ;where to store what is read
mov edx,1 ;read 1 byte
int 0x80 ;tell linux to do everything above
mov eax,4 ;sys_write
mov ebx,1 ;Standard output
mov ecx,buff ;what to print
mov edx,1 ;how long to print
int 0x80 ;tell linux to do everything above
which works fine.
When I start the process the cursor will start to blink in terminal and I am free to enter characters. At this point I am free to enter as many characters as I want, except when I hit "ENTER" 1 byte will be read and it will be printed in the terminal.
My question is, what is happening internally as I enter characters and as I hit Enter.. So I hit 'a' in my keyboard, and say 'c', where is this data stored at the moment? Are they already in the memory space addressed by 'buff' in my code? Why does Linux read when I hit Enter?