> Any realistic alternative to C must understand interrupts, memory mapped registers etc..
In what way does C understand interrupts?
In what way does C understand interrupts?
And yeah, it's a given that it's going to be non-portable.
Given asm, implementing a Turbo C-style int86() function seems pretty trivial. It might even be doable as a macro.
asm {
mov ax, 0x0013
int 0x10
}
Can't really like the way clang and gcc asm work, even it it means giving more info to the optimizer. int foo(int c)
{
int r;
asm {
mov ax, 0x0b00
int 0x21 /* poll stdin for input */
mov ax, offset c /* get address of `c` */
call bar /* call other C function */
mov r, dx /* save the result in `r` */
}
return r;
}
Or something like that — it's been a while. Those were the days! GCC's (and I'm assuming clang's is much the same) inline assembly is a joke in comparison. I remember, when I first encountered it, flipping back-and-forth through the GCC docs looking for how people actually do inline asm with GCC...