I'm actually writing this code as inline ASM but I feel it is more relevant to ASM than it is to C...
Basically all I want to do for now is print the alphabet. However I'm having some trouble getting used to AT&T syntax (I would rather learn it than keep just using Intel syntax) and I'm also unsure as to how to solve this segfault I'm getting:
#include <stdio.h>
int main() {
// code
{
asm volatile("movb %ah, 0x4C\n" /* BIOS interrupt call for output */
"movb $'A', %AL\n" /* Place "A" in AL */
"jmp start\n"
"start:\n\t"
"add $1, %AL\n\t" /* Add 1 to 'A' to move on to 'B', etc. */
"print:\n\t\t"
"int $0x21\n\t" /* Print contents of AL */
#if 0
"hlt\n" /* Halt the machine (commented out because I think I need ring 0 access to use hlt) */
: " %ax", "%bx" /* List of registers used (commented out because GCC complained of the comma) */
#endif
);
}
// code
return 0;
}
I have tried without the "volatile" keyword. I did nothing, as I expected...
Thank you :)