aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-06-06 21:44:44 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-06-06 21:44:44 +0100
commit269c766ec54edd0bc06d1df7385e2d5ed718b02b (patch)
treef7dc709bceadb047aba69fe757264100c29f1d82 /src
parent09ec8beb92da65231961e0de7e08b0f3183a738d (diff)
downloadgold-mine-run-269c766ec54edd0bc06d1df7385e2d5ed718b02b.tar.gz
gold-mine-run-269c766ec54edd0bc06d1df7385e2d5ed718b02b.zip
Test timer and keyboard
Diffstat (limited to 'src')
-rw-r--r--src/main.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/main.c b/src/main.c
index d83c18b..9d74efc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;
}