#include /* read memory [es:bx] */ unsigned char read_memory_es_bx(unsigned short bx, unsigned short es) { #asm push bp mov bp, sp push es mov bx, [bp + 4] mov ax, [bp + 6] mov es, ax seg es mov al, [bx] pop es pop bp ret #endasm } /* read memory [es:ebx] */ unsigned char read_memory_es_ebx(unsigned long ebx, unsigned short es) { #asm push bp mov bp, sp push es mov ebx, [bp + 4] mov ax, [bp + 8] mov es, ax seg es mov al, [ebx] pop es pop bp ret #endasm } /* test driver */ int MikeMain(void *argument) { int i; static char str0[] = "[es:bx]: "; static char str1[] = "[es:ebx]: "; /* Video-BIOS at c000:0000 */ mikeos_print_string(str0); for (i = 0; i < 16; i++) { mikeos_print_2hex(read_memory_es_bx(i, 0xc000)); mikeos_print_space(); } mikeos_print_newline(); /* 0000:000c0000 points Video-BIOS? */ mikeos_print_string(str1); for (i = 0; i < 16; i++) { mikeos_print_2hex(read_memory_es_ebx(0x000c0000UL + i, 0)); mikeos_print_space(); } mikeos_print_newline(); return 0; }