diff options
author | Ian C <ianc@noddybox.co.uk> | 2004-01-22 02:38:13 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2004-01-22 02:38:13 +0000 |
commit | 2fc6cc22a29a53dc5127eafa2719d11e9bb38c42 (patch) | |
tree | d7e1c1ff902b2cb6469355c1750f1e93f42d1155 /src/main.c | |
parent | fc438b5afe5b6126d5cae3dd3586e608bc7a4925 (diff) |
Updated with various bits from espec (memory menu, GUI, etc)
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 69 |
1 files changed, 62 insertions, 7 deletions
@@ -25,6 +25,7 @@ static const char id[]="$Id$"; #include <stdlib.h> #include <stdio.h> +#include <string.h> #include "SDL.h" @@ -74,10 +75,11 @@ int main(int argc, char *argv[]) z80=Z80Init(ZX81WriteMem, ZX81ReadMem, + ZX81WriteWord, + ZX81ReadWord, ZX81WritePort, ZX81ReadPort, - ZX81ReadForDisassem, - NULL); + ZX81ReadForDisassem); GFXInit(); @@ -89,8 +91,16 @@ 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) + quit=MemoryMenu(z80); + while(!quit) { + const char *brk; + Z80SingleStep(z80); if (trace) @@ -99,22 +109,67 @@ int main(int argc, char *argv[]) GFXEndFrame(FALSE); } + if ((brk=Break())) + { + GUIMessage(eMessageBox,"BREAKPOINT","%s",brk); + quit=MemoryMenu(z80); + } + while((e=GFXGetKey())) { switch (e->key.keysym.sym) { + case SDLK_F1: + if (e->key.state==SDL_PRESSED) + GUIMessage(eMessageBox, + "HELP", + "ESC - Quit \n" + "F1 - Help \n" + "F2 - About \n" + "F3 - View ZX81 keyboad \n" + "F10 - Close all open tape files \n" + "F11 - Memory Menu \n" + "F12 - Toggle onscreen trace "); + break; + + case SDLK_F2: + if (e->key.state==SDL_PRESSED) + GUIMessage(eMessageBox, + "eZX81 - ZX81 Emulator", + "(c) 2004 Ian Cowburn\n" + " \n" + "This software comes with ABSOLUTELY \n" + "NO WARRANTY, and you are free to \n" + "to redistribute it under certain \n" + "conditions. See the supplied GNU \n" + "General Public License in LICENSE \n" + "for details. \n" + " \n" + "If you did not recieve a license, \n" + "vist www.gnu.org or wrote to: \n" + " \n" + "Free Software Foundation, Inc., \n" + "59 Temple Place, Suite 330, \n" + "Boston, MA 02111-1307 USA "); + break; + + case SDLK_F3: + if (e->key.state==SDL_PRESSED) + GUIMessage(eMessageBox,"TODO","Sorry, not done yet"); + break; + case SDLK_ESCAPE: - if (e->key.state==SDL_RELEASED) - quit=TRUE; + if (e->key.state==SDL_PRESSED) + quit=GUIMessage(eYesNoBox,"QUIT","Sure?"); break; case SDLK_F11: - if (e->key.state==SDL_RELEASED) - MemoryMenu(z80); + if (e->key.state==SDL_PRESSED) + quit=MemoryMenu(z80); break; case SDLK_F12: - if (e->key.state==SDL_RELEASED) + if (e->key.state==SDL_PRESSED) trace=!trace; break; |