I may ask some stupid question, but please bear with me, I am just beginning.
Under Linux, when I have to deal with old assembly to wait for user input (which doesn't happen that much), I do :
Code: Select all
__asm__("loop:\n\t"
"movl $3, %%eax\n\t"
"movl $1, %%ebx\n\t"
"movl (%[buffer]), %%edx\n\t"
"int $0x80"
:
: [buffer]"g"(buffer)
: "rax","rbx","rcx","memory"
);
It starts correctly. Fine.
I tried to put some user interaction, but the screen keeps flickering with the bios inscriptions (booting from rom.. ).
I am doing it wrong.
I used the code I found in the keyboard interrupt wiki section, translated it to at&t syntax and put it in the kernel_main like so:
Code: Select all
void kernel_main( void ) {
printf( "Hello, kernel World!\n" );
printf( "prompt\n" );
__asm__("push %%eax\n\t"
"in $0x60 ,%%al\n\t"
"mov $0x20, %%al\n\t"
"out %%al, $0x20 \n\t"
"pop %%eax\n\t"
"iret"
:
:
: "al"
);
}
1) I am sure that at that point, I am still in real mode (I didn't set any gdt or family up yet). The Bios should catch the keyboard input.
2) If I take "iret" out (not returning from the interrupt properly), the code doesn't care and finish as if this section was non existent.
3) Maybe I set the wrong interrupts or cannot put that in kernel_main or worst, my asm code is nonsense in this context..
Could you please give me a hint ?