diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 54 |
1 files changed, 54 insertions, 0 deletions
@@ -25,6 +25,7 @@ static const char id[]="$Id$"; #include <stdlib.h> #include <stdio.h> +#include <string.h> #include "SDL.h" @@ -63,6 +64,8 @@ static Uint32 grey; */ int main(int argc, char *argv[]) { + char tape_in[FILENAME_MAX]; + char tape_out[FILENAME_MAX]; Z80 *z80; SDL_Event *e; int quit; @@ -72,6 +75,9 @@ int main(int argc, char *argv[]) trace=IConfig(CONF_TRACE); + strcpy(tape_in,SConfig(CONF_TAPEDIR)); + strcpy(tape_out,SConfig(CONF_TAPEDIR)); + z80=Z80Init(SPECWriteMem, SPECReadMem, SPECWritePort, @@ -89,6 +95,12 @@ int main(int argc, char *argv[]) quit=FALSE; + /* Check for initial memory menu usage + TODO: Proper switch handling + */ + if (argc>1 && strcmp(argv[1],"-m")==0) + MemoryMenu(z80); + while(!quit) { Z80State s1,s2; @@ -118,6 +130,48 @@ int main(int argc, char *argv[]) quit=TRUE; break; + case SDLK_F1: + if (e->key.state==SDL_PRESSED) + GUIMessage("HELP", + "ESC - Quit \n" + "F1 - Help \n" + "F8 - Select tape file for loading\n" + "F9 - Select tape file for saving \n" + "F10 - Close all open tape files \n" + "F11 - Memory Menu \n" + "F12 - Toggle onscreen trace "); + break; + + case SDLK_F8: + if (e->key.state==SDL_PRESSED) + { + if (GUIFileSelect("TAPE TO LOAD",TRUE, + tape_in,tape_in)) + { + SPECMount(SPEC_TAPE_IN,tape_in); + } + } + break; + + case SDLK_F9: + if (e->key.state==SDL_PRESSED) + { + if (GUIFileSelect("TAPE TO SAVE",FALSE, + tape_out,tape_out)) + { + SPECMount(SPEC_TAPE_OUT,tape_out); + } + } + break; + + case SDLK_F10: + if (e->key.state==SDL_PRESSED) + { + SPECUnmount(SPEC_TAPE_IN); + SPECUnmount(SPEC_TAPE_OUT); + } + break; + case SDLK_F11: if (e->key.state==SDL_PRESSED) MemoryMenu(z80); |