Как читать из stdin и писать в stdout во встроенной сборке gcc, как и в NASM:
_start:
mov ecx, buffer ;buffer is a data word initialised 0h in section .data
mov edx, 03
mov eax, 03 ;read
mov ebx, 00 ;stdin
int 0x80
;Output the number entered
mov eax, 04 ;write
mov ebx, 01 ;stdout
int 0x80
Я пробовал читать из stdin в встроенной сборке, а затем назначил вход x:
#include<stdio.h>
int x;
int main()
{
asm(" movl $5, %%edx \n\t" "
movl $0, %%ebx \n\t" "
movl $3, %%eax \n\t" "
int $0x80 \n\t "
mov %%ecx,x"
::: "%eax", "%ebx", "%ecx", "%edx");
printf("%d",x);
return 0;
}
Однако он этого не делает.
syscall из встроенной сборки GCC
Эта ссылка содержит код, который может печатать только один символ в stdout.