diff options
author | Ian C <ianc@noddybox.co.uk> | 2007-02-21 01:12:50 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2007-02-21 01:12:50 +0000 |
commit | 1a07d880145ce350cea5bf6373901adf45dba4bd (patch) | |
tree | 53afa0cb99c50518ce180493a73ead20677d9e46 | |
parent | 72bba5ee6e4742bf27cfc09c5c41ca9646b419d6 (diff) |
Added support for RAM at 0x2000. Fixed 1K display.
-rw-r--r-- | source/zx81.c | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/source/zx81.c b/source/zx81.c index 81cfd55..4d1da51 100644 --- a/source/zx81.c +++ b/source/zx81.c @@ -31,6 +31,8 @@ #include "zx81.h" #include "gui.h" +#include "config.h" + #include "zx81_bin.h" #ifndef TRUE @@ -86,7 +88,6 @@ static Z80Byte scr_mirror[7000]; static Z80Word RAMBOT=0; static Z80Word RAMTOP=0; -static Z80Word RAMLEN=0; #define DFILE 0x400c @@ -258,7 +259,7 @@ static Z80Byte FromASCII(char c) /* Open a tape file the passed address */ -static FILE *OpenTapeFile(Z80Word addr) +static FILE *OpenTapeFile(Z80Word addr, int *cancelled) { static const char zx_chars[] = "\"#$:?()><=+-*/;,." "0123456789" @@ -271,6 +272,7 @@ static FILE *OpenTapeFile(Z80Word addr) fp = NULL; f = 0; done = FALSE; + *cancelled = FALSE; while(f<(FILENAME_MAX-3) && !done) { @@ -296,6 +298,10 @@ static FILE *OpenTapeFile(Z80Word addr) { fp = fopen(fn,"rb"); } + else + { + *cancelled = TRUE; + } SK_DisplayKeyboard(BG_GFX_SUB); } @@ -518,6 +524,12 @@ static void DrawScreen_TEXT(Z80 *z80) x++; } + while (x<TXT_W) + { + txt_screen[x+y*32]=0; + x++; + } + y++; } } @@ -749,16 +761,20 @@ static int EDCallback(Z80 *z80, Z80Val data) if (enable_filesystem && z80->DE.w<0x8000) { FILE *fp; + int cancel; - if ((fp=OpenTapeFile(z80->DE.w))) + if ((fp=OpenTapeFile(z80->DE.w,&cancel))) { LoadExternalTape(fp,z80); fclose(fp); } else { - GUI_Alert(FALSE,"Couldn't open tape"); - SK_DisplayKeyboard(BG_GFX_SUB); + if (!cancel) + { + GUI_Alert(FALSE,"Couldn't open tape"); + SK_DisplayKeyboard(BG_GFX_SUB); + } } } else @@ -847,8 +863,7 @@ void ZX81Init(uint16 *text_vram, uint16* bitmap_vram, Z80 *z80) /* Memory size (16K) */ RAMBOT=0x4000; - RAMLEN=0x4000; - RAMTOP=RAMBOT+RAMLEN; + RAMTOP=RAMBOT+0x4000; for(f=RAMBOT;f<=RAMTOP;f++) mem[f]=0; @@ -873,7 +888,7 @@ void ZX81HandleKey(SoftKey key, int is_pressed) } else { - /* TODO: Joysticks? */ + /* TODO: Joysticks? Were there any common ones for the 81? */ } } @@ -1044,4 +1059,18 @@ void ZX81DisplayString(const char *p) } +void ZX81Reconfigure(void) +{ + if (DS81_Config[DS81_STATIC_RAM_AT_0x2000]) + { + RAMBOT = 0x2000; + } + else + { + RAMBOT = 0x4000; + memcpy(mem+ROMLEN,mem,ROMLEN); + } +} + + /* END OF FILE */ |