//------------------------------------------------------------------- // romfonts.cpp // // This program uses the Linux Real Mode Interface to execute // a routine in the VIDEO ROM BIOS that returns the real-mode // memory address for each built-in character glyph table. // // compile using: root# g++ romfonts.cpp lrmi.o -o romfonts // execute using: root# ./romfonts // // NOTE: This program must be executed with root privileges. // // programmer: ALLAN CRUSE // written on: 09 SEP 2003 //------------------------------------------------------------------- #include // for printf(), perror() #include // for exit() #include // for iopl() // for C++ these function prototypes need to preceed the lrmi.h header extern "C" int LRMI_init( void ); extern "C" int LRMI_int( int, struct LRMI_regs * ); #include "lrmi.h" // for LRMI_init(), LRMI_int() void get_font_info( struct LRMI_regs *r, int which ) { r->eax = 0x1130; // character generator interface: find font r->ebx = which << 8; // the subfunction-ID goes into register BH if ( !LRMI_int( 0x10, r ) ) fprintf( stderr, "Cannot find font address\n" ); } char *legend[ 8 ] = { "", "", "8x14 font (0x00-0xFF)", "8x8 font (0x00-0x7F)", "8x8 font (0x80-0xFF)", "9x14 font (alternates)", "8x16 font (0x00-0xFF)", "9x16 font (alternates)" }; int main( void ) { if ( iopl( 3 ) ) { perror( "iopl" ); exit(1); } if ( !LRMI_init() ) { perror( "LRMI_init" ); exit(1); } printf( "\nReal-mode addresses for the built-in character-tables\n" ); struct LRMI_regs r = {0}; int i = 2; do { get_font_info( &r, i ); printf( "\n\t%04X:%04X ", r.es, r.ebp ); printf( " %s ", legend[ i ] ); } while ( ++i < 8 ); printf( "\n\n" ); }