From 74fe4fda2a3059b97d1bfcc03e37be1a19ea82fe Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 26 Jun 2021 18:19:14 +0000 Subject: Fast mode working and partial text mode. Plan on attempting a ULA emulation. --- source/main.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 2 deletions(-) (limited to 'source/main.c') diff --git a/source/main.c b/source/main.c index b41efe6..8ea8e00 100644 --- a/source/main.c +++ b/source/main.c @@ -69,6 +69,7 @@ static const char *main_menu[]= "Load Memory Snapshot", "Save Joypad/Key State", "Load Joypad/Key State", + "Help", "Exit 3DS81", "Cancel", NULL @@ -84,6 +85,7 @@ typedef enum MenuLoadSnapshot, MenuSaveMappings, MenuLoadMappings, + MenuHelp, MenuExit } MenuOpt; @@ -179,6 +181,80 @@ static void Splash(void) } +/* ---------------------------------------- HELP +*/ +static void ShowHelp(void) +{ + struct + { + FB_Colour col; + const char *text; + } + help[] = + { + {COL_RED, "KEYBOARD"}, + {COL_BLACK, "Use the touchscreen to press keys on the computer."}, + {COL_BLACK, "The ZX81 had a keyword entry system, so when the"}, + {COL_BLACK, "cursor is an inverse K then the keyword printed"}, + {COL_BLACK, "at the top of the key is displayed. Therefore"}, + {COL_BLACK, "to load a tape press the J key, then the SHIFT"}, + {COL_BLACK, "key (which by default stays pressed until you"}, + {COL_BLACK, "click it again) and press the P key to enter a"}, + {COL_BLACK, "quote, press the SHIFT key to stop pressing it,"}, + {COL_BLACK, "type the name of the .P file and close it with"}, + {COL_BLACK, "another quote, then press ENTER"}, + {COL_TRANSPARENT, ""}, + {COL_RED, "LOADING TAPES"}, + {COL_BLACK, "There are two ways of loading tapes in the"}, + {COL_BLACK, "simulator. The first is to put .P files in"}, + {COL_BLACK, "either the root directory of the SD card"}, + {COL_BLACK, "or a directory called ZX81SNAP. Files from"}, + {COL_BLACK, "either place can be loaded by typing"}, + {COL_BLACK, "LOAD \"GAME\" to load GAME.P. Alternatively"}, + {COL_BLACK, "you can type LOAD \"*\" to display a file"}, + {COL_BLACK, "selector that allows you to select the tape"}, + {COL_BLACK, "to load. LOAD \"\" can be used to load an"}, + {COL_BLACK, "internal tape image once it has been selected."}, + {COL_TRANSPARENT, NULL} + }; + + int done = FALSE; + u32 key; + Framebuffer upper; + Framebuffer lower; + + while(!done) + { + int f; + + FB_StartFrame(&upper, &lower); + + FB_Clear(&upper, COL_WHITE); + FB_Clear(&lower, COL_BLACK); + + for(f = 0; help[f].text; f++) + { + FB_Print(&upper, help[f].text, 0, upper.height - f * 8, + help[f].col,COL_TRANSPARENT); + } + + FB_Print(&lower, "Scroll around help by using the\n" + "control pad\n" + "Press A to finish.", + 0, lower.height - 40, COL_YELLOW,COL_TRANSPARENT); + + FB_EndFrame(); + + key = hidKeysDown(); + + if (key & KEY_A) + { + done = TRUE; + } + } +} + + /* ---------------------------------------- JOYPAD MAPPING */ static void MapJoypad(void) @@ -246,7 +322,6 @@ int main(int argc, char *argv[]) int quit = FALSE; gfxInit(GSP_RGB565_OES, GSP_RGB565_OES, false); - consoleInit(GFX_TOP, NULL); FB_Init(); @@ -289,7 +364,7 @@ int main(int argc, char *argv[]) Z80Exec(z80); - ZX81RenderDisplay(&upper); + ZX81RenderDisplay(&upper, z80); FB_EndFrame(); @@ -338,6 +413,10 @@ int main(int argc, char *argv[]) SNAP_Load(z80, NULL, SNAP_TYPE_KEYBOARD); break; + case MenuHelp: + ShowHelp(); + break; + case MenuExit: quit = TRUE; break; -- cgit v1.2.3