This question is inspired by a question asked by someone on another forum. In the following code what does the extended inline assembly constraint Rah
and Ral
mean. I haven't seen these before:
#include<stdint.h>void tty_write_char(uint8_t inchar, uint8_t page_num, uint8_t fg_color){ asm ("int $0x10" : : "b" ((uint16_t)page_num<<8 | fg_color),"Rah"((uint8_t)0x0e), "Ral"(inchar));}void tty_write_string(const char *string, uint8_t page_num, uint8_t fg_color){ while (*string) tty_write_char(*string++, page_num, fg_color);}/* Use the BIOS to print the first command line argument to the console */int main(int argc, char *argv[]){ if (argc > 1) tty_write_string(argv[1], 0, 0); return 0;}
In particular are the use of Rah
and Ral
as constraints in this code:
asm ("int $0x10" : : "b" ((uint16_t)page_num<<8 | fg_color),"Rah"((uint8_t)0x0e), "Ral"(inchar));
The GCC Documentation doesn't have an l
or h
constraint for either simple constraints or x86/x86 machine constraints. R
is any legacy register and a
is the AX/EAX/RAX register.
What am I not understanding?