qemu-util.c
#include "dryos.h"
#include "bmp.h"
#include "cache_hacks.h"
/** Some small engio API **/
#define REG_PRINT_CHAR 0xCF123000
#define REG_SHUTDOWN 0xCF123004
#define REG_DUMP_VRAM 0xCF123008
int qprintf(const char * fmt, ...) // prints in the QEMU console
{
va_list ap;
char buf[128];
va_start( ap, fmt );
vsnprintf( buf, sizeof(buf)-1, fmt, ap );
va_end( ap );
for (char* c = buf; *c; c++)
*(volatile uint32_t*)REG_PRINT_CHAR = *c;
return 0;
}
void qemu_hello()
{
bmp_printf(FONT_LARGE, 50, 50, "Hello from QEMU!");
for (int i = 1; i < 14; i++)
{
bfnt_draw_char(-i, i * 50, 100, COLOR_BLUE, COLOR_WHITE);
bmp_printf(FONT(FONT_MED, COLOR_BLUE, COLOR_WHITE), i * 50, 140, "%d", i);
}
qprintf("\nHello at QEMU console!\n\n");
call("dispcheck");
call("shutdown");
while(1); // that's all, folks!
}