#include #include #include #include #include #include "keyb.h" #include "vga.h" #include "data.h" /* disable paging because our int handlers are written in C */ int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY; int main(int argc, char *argv[]) { keyb_init(); atexit(keyb_free); /* set VGA 320x200, 256 col */ set_mode(0x13); set_palette(binary_palette_start); if (!open_framebuffer()) { set_mode(3); fprintf(stderr, "ERROR: failed to open the framebuffer\n"); return 1; } blit_erase(0); uint8_t bg[24 * 24] = { 0 }; uint16_t x = 10, y = 10; int8_t ix = 1, iy = 1; uint8_t c = 0; while (!keys[KEY_ESC]) { // erase blit(bg, x, y, 24, 24); x += ix; y += iy; if (x >= 320 - 24 || x == 0) { ix *= -1; c = (c + 1) % 15; blit_erase(c); memset(bg, c, 24 * 24); } if (y >= 200 - 24 || y == 0) { iy *= -1; c = (c + 1) % 15; blit_erase(c); memset(bg, c, 24 * 24); } // draw blit(binary_sprites_start, x, y, 24, 24); wait_vsync(); blit_update(); } set_mode(3); close_framebuffer(); return 0; }