diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-06-06 21:44:44 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-06-06 21:44:44 +0100 |
commit | 269c766ec54edd0bc06d1df7385e2d5ed718b02b (patch) | |
tree | f7dc709bceadb047aba69fe757264100c29f1d82 /src/main.c | |
parent | 09ec8beb92da65231961e0de7e08b0f3183a738d (diff) | |
download | gold-mine-run-269c766ec54edd0bc06d1df7385e2d5ed718b02b.tar.gz gold-mine-run-269c766ec54edd0bc06d1df7385e2d5ed718b02b.zip |
Test timer and keyboard
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -4,8 +4,7 @@ #include <stdlib.h> #include <crt0.h> -#include <conio.h> - +#include "keyb.h" #include "timer.h" #include "vga.h" #include "data.h" @@ -13,10 +12,17 @@ /* disable paging because our int handlers are written in C */ int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY; +void free_all() +{ + timer_free(); + keyb_free(); +} + int main(int argc, char *argv[]) { timer_init(); - atexit(timer_free); + keyb_init(); + atexit(free_all); /* set VGA 320x200, 256 col */ set_mode(0x13); @@ -30,21 +36,21 @@ int main(int argc, char *argv[]) return 1; } - for (int i = 0; i < 16; i++) + int i = 0; + while (!keys[KEY_ESC]) { wait_vsync(); - memset(screen, i, 320 * 200); - getch(); - } - printf("Hello DOS!\n"); + memset(screen, i, 320 * 200); + i++; + if (i > 15) + i = 0; - getch(); + timer_wait(1); + } set_mode(3); close_framebuffer(); - printf("tick is %li\n", ticks); - return 0; } |