summaryrefslogtreecommitdiff
path: root/c/menu/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/menu/menu.c')
-rw-r--r--c/menu/menu.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/c/menu/menu.c b/c/menu/menu.c
new file mode 100644
index 0000000..4d3aa14
--- /dev/null
+++ b/c/menu/menu.c
@@ -0,0 +1,74 @@
+/* Menu Thing for RVController - Main Menu
+ * A product of Advanced Mesecons Devices, a Cheapie Systems company
+ * This is free and unencumbered software released into the public domain.
+ * See http://unlicense.org/ for more information */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "rvcontroller-ecalls.h"
+#include "calculator.h"
+#include "digilines.h"
+#include "games.h"
+#include "screensaver.h"
+
+uint_fast8_t menupage = 0;
+
+void main(void) {
+ char inputbuf[32] = {0}; // Overkill for now but it's not like I'm short on RAM
+ while (true) {
+ switch (menupage) {
+ case 0:
+ printstr("\nMAIN MENU Page 1\n");
+ printstr("< > to change page\n");
+ printstr("1: Calculator\n");
+ printstr("2: Calendar\n");
+ printstr("3: Digilines\n");
+ printstr("4: Games");
+ break;
+ case 1:
+ printstr("\nMAIN MENU Page 2\n");
+ printstr("< > to change page\n");
+ printstr("5: Screensaver\n");
+ printstr("6: Text Editor\n");
+ printstr("More coming soon\n");
+ printstr("(maybe)");
+ break;
+ default:
+ printstr("\nInvalid menu page\n\n\n\n\n\n");
+ }
+
+ readstr(inputbuf,32);
+
+ switch (inputbuf[0]) {
+ case '<':
+ if (menupage > 0) {
+ menupage--;
+ } else {
+ menupage = 1;
+ }
+ break;
+ case '>':
+ menupage = (menupage + 1) % 2;
+ break;
+ case '1':
+ runCalculator();
+ break;
+ case '3':
+ runDigilines();
+ break;
+ case '4':
+ runGames();
+ break;
+ case '5':
+ runScreensaver();
+ break;
+ default:
+ printstr("\nUnknown or\n");
+ printstr("unimplemented\n");
+ printstr("command\n");
+ printstr("\n");
+ printstr("Press any key\n");
+ readstr(inputbuf,32);
+ }
+ }
+}