aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-05-29 23:32:41 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-05-29 23:32:41 +0100
commit2941ac6b8ecc1fd96b886219795f5d7e55bb85d8 (patch)
tree9786ef28b990199e353bea285d6d5ecdb0a45e31 /src/main.c
downloadgold-mine-run-2941ac6b8ecc1fd96b886219795f5d7e55bb85d8.tar.gz
gold-mine-run-2941ac6b8ecc1fd96b886219795f5d7e55bb85d8.zip
Initial import
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..5b315df
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,33 @@
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <conio.h>
+
+#include "vga.h"
+
+int main(int argc, char *argv[])
+{
+ /* set VGA 320x200, 256 col */
+ set_mode(0x13);
+
+ uint8_t *screen = open_framebuffer();
+ if (!screen)
+ {
+ fprintf(stderr, "ERROR: failed to open the framebuffer\n");
+ return 1;
+ }
+
+ for (int i = 0; i < 320 * 200 * 10; i++)
+ screen[rand() % (320 * 200)] = rand() % 255;
+
+ printf("Hello DOS!\n");
+
+ getch();
+
+ set_mode(3);
+ close_framebuffer();
+
+ return 0;
+}