summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile215
-rw-r--r--src/config.c8
-rw-r--r--src/exit.c5
-rw-r--r--src/expr.c2
-rw-r--r--src/gfx.c184
-rw-r--r--src/gfx.h21
-rw-r--r--src/gui.c10
-rw-r--r--src/kbbmp.c4
-rw-r--r--src/main.c10
-rw-r--r--src/memmenu.c8
-rw-r--r--src/snap.c4
-rw-r--r--src/spec.c19
-rw-r--r--src/util.c4
-rw-r--r--src/z80.c4
-rw-r--r--src/z80_decode.c2
-rw-r--r--src/z80_dis.c2
-rw-r--r--src/z80_private.h9
17 files changed, 64 insertions, 447 deletions
diff --git a/src/Makefile b/src/Makefile
index 4dfec79..f8a0a14 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -26,8 +26,7 @@
# Simply comment out if not, and replace as needed.
# Other CFLAGS lines *are* required.
#
-CFLAGS = -g -Wall -Werror -pedantic -ansi -O2
-#CFLAGS = -g -Wall -Werror -pedantic -ansi -O2 -pg
+CFLAGS = -g -O2
TARGET = espec
@@ -61,9 +60,9 @@ OBJECTS = main.o \
z80_decode.o \
z80_dis.o
-CFLAGS += `sdl-config --cflags` -DENABLE_DISASSEM
+CFLAGS += `sdl2-config --cflags` -DENABLE_DISASSEM
-LIBS = `sdl-config --libs`
+LIBS = `sdl2-config --libs`
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
@@ -71,211 +70,3 @@ $(TARGET): $(OBJECTS)
clean:
rm -f $(TARGET) $(TARGET).exe $(OBJECTS) core
-depend:
- makedepend -- $(CFLAGS) -- $(SOURCE)
- if test -e Makefile ; then rm -f Makefile.bak ; fi
-
-# DO NOT DELETE THIS LINE -- make depend depends on it
-
-main.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h
-main.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-main.o: /usr/include/machine/_types.h /usr/include/stdio.h
-main.o: /usr/include/string.h /usr/include/strings.h
-main.o: /usr/local/include/SDL11/SDL.h /usr/local/include/SDL11/SDL_main.h
-main.o: /usr/local/include/SDL11/SDL_types.h
-main.o: /usr/local/include/SDL11/SDL_getenv.h
-main.o: /usr/local/include/SDL11/SDL_error.h
-main.o: /usr/local/include/SDL11/begin_code.h
-main.o: /usr/local/include/SDL11/close_code.h
-main.o: /usr/local/include/SDL11/SDL_rwops.h
-main.o: /usr/local/include/SDL11/SDL_timer.h
-main.o: /usr/local/include/SDL11/SDL_audio.h
-main.o: /usr/local/include/SDL11/SDL_byteorder.h
-main.o: /usr/local/include/SDL11/SDL_cdrom.h
-main.o: /usr/local/include/SDL11/SDL_joystick.h
-main.o: /usr/local/include/SDL11/SDL_events.h
-main.o: /usr/local/include/SDL11/SDL_active.h
-main.o: /usr/local/include/SDL11/SDL_keyboard.h
-main.o: /usr/local/include/SDL11/SDL_keysym.h
-main.o: /usr/local/include/SDL11/SDL_mouse.h
-main.o: /usr/local/include/SDL11/SDL_video.h
-main.o: /usr/local/include/SDL11/SDL_mutex.h
-main.o: /usr/local/include/SDL11/SDL_quit.h
-main.o: /usr/local/include/SDL11/SDL_version.h z80.h spec.h gfx.h gui.h
-main.o: memmenu.h config.h kbbmp.h exit.h util.h
-spec.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h
-spec.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-spec.o: /usr/include/machine/_types.h /usr/include/stdio.h
-spec.o: /usr/include/string.h /usr/include/strings.h spec.h z80.h
-spec.o: /usr/local/include/SDL11/SDL.h /usr/local/include/SDL11/SDL_main.h
-spec.o: /usr/local/include/SDL11/SDL_types.h
-spec.o: /usr/local/include/SDL11/SDL_getenv.h
-spec.o: /usr/local/include/SDL11/SDL_error.h
-spec.o: /usr/local/include/SDL11/begin_code.h
-spec.o: /usr/local/include/SDL11/close_code.h
-spec.o: /usr/local/include/SDL11/SDL_rwops.h
-spec.o: /usr/local/include/SDL11/SDL_timer.h
-spec.o: /usr/local/include/SDL11/SDL_audio.h
-spec.o: /usr/local/include/SDL11/SDL_byteorder.h
-spec.o: /usr/local/include/SDL11/SDL_cdrom.h
-spec.o: /usr/local/include/SDL11/SDL_joystick.h
-spec.o: /usr/local/include/SDL11/SDL_events.h
-spec.o: /usr/local/include/SDL11/SDL_active.h
-spec.o: /usr/local/include/SDL11/SDL_keyboard.h
-spec.o: /usr/local/include/SDL11/SDL_keysym.h
-spec.o: /usr/local/include/SDL11/SDL_mouse.h
-spec.o: /usr/local/include/SDL11/SDL_video.h
-spec.o: /usr/local/include/SDL11/SDL_mutex.h
-spec.o: /usr/local/include/SDL11/SDL_quit.h
-spec.o: /usr/local/include/SDL11/SDL_version.h snap.h gfx.h gui.h config.h
-spec.o: exit.h util.h
-snap.o: snap.h /usr/include/stdlib.h /usr/include/sys/cdefs.h
-snap.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-snap.o: /usr/include/machine/_types.h /usr/include/stdio.h z80.h util.h
-config.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h
-config.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-config.o: /usr/include/machine/_types.h /usr/include/stdio.h
-config.o: /usr/include/string.h /usr/include/strings.h exit.h config.h
-gfx.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h
-gfx.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-gfx.o: /usr/include/machine/_types.h /usr/include/stdio.h
-gfx.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdarg.h
-gfx.o: gfx.h /usr/local/include/SDL11/SDL.h
-gfx.o: /usr/local/include/SDL11/SDL_main.h
-gfx.o: /usr/local/include/SDL11/SDL_types.h
-gfx.o: /usr/local/include/SDL11/SDL_getenv.h
-gfx.o: /usr/local/include/SDL11/SDL_error.h
-gfx.o: /usr/local/include/SDL11/begin_code.h
-gfx.o: /usr/local/include/SDL11/close_code.h
-gfx.o: /usr/local/include/SDL11/SDL_rwops.h
-gfx.o: /usr/local/include/SDL11/SDL_timer.h
-gfx.o: /usr/local/include/SDL11/SDL_audio.h
-gfx.o: /usr/local/include/SDL11/SDL_byteorder.h
-gfx.o: /usr/local/include/SDL11/SDL_cdrom.h
-gfx.o: /usr/local/include/SDL11/SDL_joystick.h
-gfx.o: /usr/local/include/SDL11/SDL_events.h
-gfx.o: /usr/local/include/SDL11/SDL_active.h
-gfx.o: /usr/local/include/SDL11/SDL_keyboard.h
-gfx.o: /usr/local/include/SDL11/SDL_keysym.h
-gfx.o: /usr/local/include/SDL11/SDL_mouse.h
-gfx.o: /usr/local/include/SDL11/SDL_video.h
-gfx.o: /usr/local/include/SDL11/SDL_mutex.h
-gfx.o: /usr/local/include/SDL11/SDL_quit.h
-gfx.o: /usr/local/include/SDL11/SDL_version.h exit.h config.h font.h
-gui.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h
-gui.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-gui.o: /usr/include/machine/_types.h /usr/include/stdio.h
-gui.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdarg.h
-gui.o: /usr/include/ctype.h /usr/include/_ctype.h /usr/include/runetype.h
-gui.o: /usr/include/unistd.h /usr/include/sys/types.h
-gui.o: /usr/include/machine/endian.h /usr/include/sys/_pthreadtypes.h
-gui.o: /usr/include/sys/select.h /usr/include/sys/_sigset.h
-gui.o: /usr/include/sys/_timeval.h /usr/include/sys/timespec.h
-gui.o: /usr/include/sys/unistd.h /usr/include/dirent.h
-gui.o: /usr/include/sys/dirent.h /usr/include/sys/stat.h
-gui.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/param.h
-gui.o: /usr/include/sys/syslimits.h /usr/include/sys/signal.h
-gui.o: /usr/include/machine/signal.h /usr/include/machine/trap.h
-gui.o: /usr/include/machine/param.h /usr/include/sys/limits.h
-gui.o: /usr/include/machine/_limits.h gui.h gfx.h
-gui.o: /usr/local/include/SDL11/SDL.h /usr/local/include/SDL11/SDL_main.h
-gui.o: /usr/local/include/SDL11/SDL_types.h
-gui.o: /usr/local/include/SDL11/SDL_getenv.h
-gui.o: /usr/local/include/SDL11/SDL_error.h
-gui.o: /usr/local/include/SDL11/begin_code.h
-gui.o: /usr/local/include/SDL11/close_code.h
-gui.o: /usr/local/include/SDL11/SDL_rwops.h
-gui.o: /usr/local/include/SDL11/SDL_timer.h
-gui.o: /usr/local/include/SDL11/SDL_audio.h
-gui.o: /usr/local/include/SDL11/SDL_byteorder.h
-gui.o: /usr/local/include/SDL11/SDL_cdrom.h
-gui.o: /usr/local/include/SDL11/SDL_joystick.h
-gui.o: /usr/local/include/SDL11/SDL_events.h
-gui.o: /usr/local/include/SDL11/SDL_active.h
-gui.o: /usr/local/include/SDL11/SDL_keyboard.h
-gui.o: /usr/local/include/SDL11/SDL_keysym.h
-gui.o: /usr/local/include/SDL11/SDL_mouse.h
-gui.o: /usr/local/include/SDL11/SDL_video.h
-gui.o: /usr/local/include/SDL11/SDL_mutex.h
-gui.o: /usr/local/include/SDL11/SDL_quit.h
-gui.o: /usr/local/include/SDL11/SDL_version.h exit.h util.h
-memmenu.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h
-memmenu.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-memmenu.o: /usr/include/machine/_types.h /usr/include/stdio.h
-memmenu.o: /usr/include/string.h /usr/include/strings.h /usr/include/ctype.h
-memmenu.o: /usr/include/_ctype.h /usr/include/runetype.h memmenu.h z80.h
-memmenu.o: spec.h /usr/local/include/SDL11/SDL.h
-memmenu.o: /usr/local/include/SDL11/SDL_main.h
-memmenu.o: /usr/local/include/SDL11/SDL_types.h
-memmenu.o: /usr/local/include/SDL11/SDL_getenv.h
-memmenu.o: /usr/local/include/SDL11/SDL_error.h
-memmenu.o: /usr/local/include/SDL11/begin_code.h
-memmenu.o: /usr/local/include/SDL11/close_code.h
-memmenu.o: /usr/local/include/SDL11/SDL_rwops.h
-memmenu.o: /usr/local/include/SDL11/SDL_timer.h
-memmenu.o: /usr/local/include/SDL11/SDL_audio.h
-memmenu.o: /usr/local/include/SDL11/SDL_byteorder.h
-memmenu.o: /usr/local/include/SDL11/SDL_cdrom.h
-memmenu.o: /usr/local/include/SDL11/SDL_joystick.h
-memmenu.o: /usr/local/include/SDL11/SDL_events.h
-memmenu.o: /usr/local/include/SDL11/SDL_active.h
-memmenu.o: /usr/local/include/SDL11/SDL_keyboard.h
-memmenu.o: /usr/local/include/SDL11/SDL_keysym.h
-memmenu.o: /usr/local/include/SDL11/SDL_mouse.h
-memmenu.o: /usr/local/include/SDL11/SDL_video.h
-memmenu.o: /usr/local/include/SDL11/SDL_mutex.h
-memmenu.o: /usr/local/include/SDL11/SDL_quit.h
-memmenu.o: /usr/local/include/SDL11/SDL_version.h gfx.h gui.h util.h
-util.o: /usr/include/stdio.h /usr/include/sys/cdefs.h
-util.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-util.o: /usr/include/machine/_types.h /usr/include/string.h
-util.o: /usr/include/strings.h /usr/include/stdarg.h /usr/include/sys/param.h
-util.o: /usr/include/sys/types.h /usr/include/machine/endian.h
-util.o: /usr/include/sys/_pthreadtypes.h /usr/include/sys/select.h
-util.o: /usr/include/sys/_sigset.h /usr/include/sys/_timeval.h
-util.o: /usr/include/sys/timespec.h /usr/include/sys/syslimits.h
-util.o: /usr/include/sys/signal.h /usr/include/machine/signal.h
-util.o: /usr/include/machine/trap.h /usr/include/machine/param.h
-util.o: /usr/include/sys/limits.h /usr/include/machine/_limits.h util.h
-util.o: /usr/include/stdlib.h exit.h
-kbbmp.o: kbbmp.h
-exit.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h
-exit.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-exit.o: /usr/include/machine/_types.h /usr/include/stdarg.h exit.h
-exit.o: /usr/local/include/SDL11/SDL.h /usr/local/include/SDL11/SDL_main.h
-exit.o: /usr/local/include/SDL11/SDL_types.h
-exit.o: /usr/local/include/SDL11/SDL_getenv.h
-exit.o: /usr/local/include/SDL11/SDL_error.h
-exit.o: /usr/local/include/SDL11/begin_code.h
-exit.o: /usr/local/include/SDL11/close_code.h
-exit.o: /usr/local/include/SDL11/SDL_rwops.h /usr/include/stdio.h
-exit.o: /usr/local/include/SDL11/SDL_timer.h
-exit.o: /usr/local/include/SDL11/SDL_audio.h
-exit.o: /usr/local/include/SDL11/SDL_byteorder.h
-exit.o: /usr/local/include/SDL11/SDL_cdrom.h
-exit.o: /usr/local/include/SDL11/SDL_joystick.h
-exit.o: /usr/local/include/SDL11/SDL_events.h
-exit.o: /usr/local/include/SDL11/SDL_active.h
-exit.o: /usr/local/include/SDL11/SDL_keyboard.h
-exit.o: /usr/local/include/SDL11/SDL_keysym.h
-exit.o: /usr/local/include/SDL11/SDL_mouse.h
-exit.o: /usr/local/include/SDL11/SDL_video.h
-exit.o: /usr/local/include/SDL11/SDL_mutex.h
-exit.o: /usr/local/include/SDL11/SDL_quit.h
-exit.o: /usr/local/include/SDL11/SDL_version.h
-expr.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h
-expr.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-expr.o: /usr/include/machine/_types.h /usr/include/stdio.h
-expr.o: /usr/include/string.h /usr/include/strings.h /usr/include/ctype.h
-expr.o: /usr/include/_ctype.h /usr/include/runetype.h
-z80.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h
-z80.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-z80.o: /usr/include/machine/_types.h /usr/include/string.h
-z80.o: /usr/include/strings.h z80.h z80_private.h
-z80_decode.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h
-z80_decode.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-z80_decode.o: /usr/include/machine/_types.h z80.h z80_private.h
-z80_dis.o: /usr/include/stdio.h /usr/include/sys/cdefs.h
-z80_dis.o: /usr/include/sys/_null.h /usr/include/sys/_types.h
-z80_dis.o: /usr/include/machine/_types.h /usr/include/string.h
-z80_dis.o: /usr/include/strings.h /usr/include/stdarg.h z80.h z80_private.h
diff --git a/src/config.c b/src/config.c
index ba3db5b..4d92d70 100644
--- a/src/config.c
+++ b/src/config.c
@@ -23,16 +23,12 @@
Config file
*/
-static const char ident[]="$Id$";
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "exit.h"
#include "config.h"
-static const char ident_h[]=ESPEC_CONFIG_H;
-
#ifndef TRUE
#define TRUE 1
#endif
@@ -90,8 +86,8 @@ static void Parse(FILE *fp)
char *t1=NULL;
char *t2=NULL;
- t1=strtok(buff,"\t");
- t2=strtok(NULL,"\t");
+ t1=strtok(buff,"\t ");
+ t2=strtok(NULL,"\t ");
if (t2)
{
diff --git a/src/exit.c b/src/exit.c
index 254acc3..84cdc04 100644
--- a/src/exit.c
+++ b/src/exit.c
@@ -23,17 +23,12 @@
Provides a common error exit point
*/
-static const char ident[]="$Id$";
-
#include <stdlib.h>
#include <stdarg.h>
#include "exit.h"
#include <SDL.h>
-static const char ident_h[]=ESPEC_EXIT_H;
-
-
/* ---------------------------------------- EXPORTED INTERFACES
*/
void Exit(const char *format,...)
diff --git a/src/expr.c b/src/expr.c
index 9369e1d..c4c223a 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -22,8 +22,6 @@
Expands an expression.
*/
-static const char id[]="$Id$";
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/gfx.c b/src/gfx.c
index 4a79b70..cf343d8 100644
--- a/src/gfx.c
+++ b/src/gfx.c
@@ -23,8 +23,6 @@
Wrapper to SDL
*/
-static const char ident[]="$Id$";
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -33,12 +31,10 @@ static const char ident[]="$Id$";
#include "gfx.h"
#include "exit.h"
#include "config.h"
+#include "util.h"
#include "font.h"
-static const char ident_h[]=ESPEC_GFX_H;
-static const char ident_fh[]=ESPEC_FONT_H;
-
/* ---------------------------------------- MACROS
*/
@@ -50,24 +46,12 @@ static const char ident_fh[]=ESPEC_FONT_H;
#define FALSE 0
#endif
-#define LOCK do \
- { \
- if (SDL_MUSTLOCK(surface)) \
- if (SDL_LockSurface(surface)<0) \
- Exit("Failed to lock surface: %s\n", \
- SDL_GetError()); \
- } while(0)
-
-#define UNLOCK do \
- { \
- if (SDL_MUSTLOCK(surface)) \
- SDL_UnlockSurface(surface); \
- } while(0)
-
-
/* ---------------------------------------- STATICS
*/
-static SDL_Surface *surface;
+static SDL_Window *window;
+static SDL_Renderer *renderer;
+static SDL_Texture *texture;
+static Uint32 *pixels;
static Uint32 ticks;
static Uint32 frame;
static int scale;
@@ -98,44 +82,9 @@ static struct
/* ---------------------------------------- PRIVATE FUNCTIONS
*/
-/* Taken from SDL documentation
-*/
static void normal_putpixel(int x, int y, Uint32 pixel)
{
- int bpp;
- Uint8 *p;
-
- bpp=surface->format->BytesPerPixel;
- p=(Uint8 *)surface->pixels+y*surface->pitch+x*bpp;
-
- switch(bpp)
- {
- case 1:
- *p=pixel;
- break;
-
- case 2:
- *(Uint16 *)p=pixel;
- break;
-
- case 3:
- if(SDL_BYTEORDER==SDL_BIG_ENDIAN)
- {
- p[0]=(pixel>>16)&0xff;
- p[1]=(pixel>>8)&0xff;
- p[2]=pixel&0xff;
- } else
- {
- p[0]=pixel&0xff;
- p[1]=(pixel>>8)&0xff;
- p[2]=(pixel>>16)&0xff;
- }
- break;
-
- case 4:
- *(Uint32 *)p=pixel;
- break;
- }
+ pixels[x + y * GFX_WIDTH] = pixel;
}
@@ -148,7 +97,7 @@ static void scale_putpixel(int x, int y, Uint32 pixel)
for(sx=0;sx<scale;sx++)
for(sy=0;sy<scale;sy++)
- normal_putpixel(x+sx,y+sy,pixel);
+ pixels[x+sx + (y+sy) * GFX_WIDTH * scale] = pixel;
}
@@ -215,17 +164,35 @@ void GFXInit(void)
Exit("Failed to init SDL: %s\n",SDL_GetError());
}
- if (!(surface=SDL_SetVideoMode(GFX_WIDTH*scale,
- GFX_HEIGHT*scale,
- 0,
- IConfig(CONF_FULLSCREEN) ?
- SDL_FULLSCREEN : 0)))
+
+ if (!(window=SDL_CreateWindow("eSPEC",
+ SDL_WINDOWPOS_UNDEFINED,
+ SDL_WINDOWPOS_UNDEFINED,
+ GFX_WIDTH*scale,
+ GFX_HEIGHT*scale,
+ IConfig(CONF_FULLSCREEN) ?
+ SDL_WINDOW_FULLSCREEN : 0)))
+ {
+ Exit("Failed to open window: %s\n",SDL_GetError());
+ }
+
+ if (!(renderer = SDL_CreateRenderer(window, -1, 0)))
{
- Exit("Failed to open video: %s\n",SDL_GetError());
+ Exit("Failed to create renderer: %s\n",SDL_GetError());
}
+ if (!(texture = SDL_CreateTexture(renderer,
+ SDL_PIXELFORMAT_ARGB8888,
+ SDL_TEXTUREACCESS_STREAMING,
+ GFX_WIDTH*scale,
+ GFX_HEIGHT*scale)))
+ {
+ Exit("Failed to create texture: %s\n",SDL_GetError());
+ }
+
+ pixels = Malloc(sizeof(Uint32) * GFX_WIDTH*scale * GFX_HEIGHT*scale);
+
SDL_ShowCursor(SDL_DISABLE);
- SDL_WM_SetCaption("eSPEC","eSPEC");
for(f=0;f<NO_BMPIX;f++)
bmpix[f].col=GFXRGB(bmpix[f].r,bmpix[f].g,bmpix[f].b);
@@ -234,21 +201,20 @@ void GFXInit(void)
}
-SDL_Surface *GFXGetSurface(void)
-{
- return surface;
-}
-
-
Uint32 GFXRGB(Uint8 r, Uint8 g, Uint8 b)
{
- return SDL_MapRGB(surface->format,r,g,b);
+ return 0xff << 24 | (Uint32)r << 16 | (Uint32)g << 8 | b;
}
void GFXClear(Uint32 col)
{
- SDL_FillRect(surface,NULL,col);
+ int f;
+
+ for(f = 0; f < GFX_WIDTH * scale * GFX_HEIGHT * scale; f++)
+ {
+ pixels[f] = col;
+ }
}
@@ -260,7 +226,12 @@ void GFXStartFrame(void)
void GFXEndFrame(int delay)
{
- SDL_UpdateRect(surface,0,0,0,0);
+ SDL_UpdateTexture(texture, NULL,
+ pixels, GFX_WIDTH * scale * sizeof(Uint32));
+
+ SDL_RenderClear(renderer);
+ SDL_RenderCopy(renderer, texture, NULL, NULL);
+ SDL_RenderPresent(renderer);
if (delay)
{
@@ -274,16 +245,6 @@ void GFXEndFrame(int delay)
}
-void GFXKeyRepeat(int repeat)
-{
- if (repeat)
- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,
- SDL_DEFAULT_REPEAT_INTERVAL);
- else
- SDL_EnableKeyRepeat(0,0);
-}
-
-
SDL_Event *GFXGetKey(void)
{
static SDL_Event e;
@@ -311,48 +272,21 @@ SDL_Event *GFXWaitKey(void)
}
-void GFXLock(void)
-{
- LOCK;
-}
-
-
-void GFXUnlock(void)
-{
- UNLOCK;
-}
-
-
void GFXPlot(int x, int y, Uint32 col)
{
- LOCK;
-
- putpixel(x,y,col);
-
- UNLOCK;
-}
-
-
-void GFXFastPlot(int x, int y, Uint32 col)
-{
putpixel(x,y,col);
}
void GFXRect(int x, int y, int w, int h, Uint32 col, int solid)
{
- LOCK;
-
if (solid)
{
- SDL_Rect r;
-
- r.x=x*scale;
- r.y=y*scale;
- r.w=w*scale;
- r.h=h*scale;
-
- SDL_FillRect(surface,&r,col);
+ while(h--)
+ {
+ DoHLine(x,x+w-1,y,col);
+ y++;
+ }
}
else
{
@@ -361,24 +295,18 @@ void GFXRect(int x, int y, int w, int h, Uint32 col, int solid)
DoVLine(x,y,y+h-1,col);
DoVLine(x+w-1,y,y+h-1,col);
}
-
- UNLOCK;
}
void GFXHLine(int x1, int x2, int y, Uint32 col)
{
- LOCK;
DoHLine(x1,x2,y,col);
- UNLOCK;
}
void GFXVLine(int x, int y1, int y2, Uint32 col)
{
- LOCK;
DoVLine(x,y1,y2,col);
- UNLOCK;
}
@@ -395,8 +323,6 @@ void GFXPrint(int x, int y, Uint32 col, const char *format, ...)
p=buff;
- LOCK;
-
while(*p)
{
for(sy=0;sy<8;sy++)
@@ -414,8 +340,6 @@ void GFXPrint(int x, int y, Uint32 col, const char *format, ...)
p++;
x+=8;
}
-
- UNLOCK;
}
@@ -433,8 +357,6 @@ void GFXPrintPaper(int x, int y, Uint32 col, Uint32 paper,
p=buff;
- LOCK;
-
while(*p)
{
for(sy=0;sy<8;sy++)
@@ -454,8 +376,6 @@ void GFXPrintPaper(int x, int y, Uint32 col, Uint32 paper,
p++;
x+=8;
}
-
- UNLOCK;
}
@@ -464,8 +384,6 @@ void GFXBitmap(int x, int y, int w, int h, const unsigned char *data)
int pix;
int px,py;
- LOCK;
-
pix=0;
px=0;
py=0;
@@ -496,8 +414,6 @@ void GFXBitmap(int x, int y, int w, int h, const unsigned char *data)
break;
}
}
-
- UNLOCK;
}
diff --git a/src/gfx.h b/src/gfx.h
index d89edee..8166b2c 100644
--- a/src/gfx.h
+++ b/src/gfx.h
@@ -55,11 +55,6 @@
void GFXInit(void);
-/* Get the SDL_Surface for the screen
-*/
-SDL_Surface *GFXGetSurface(void);
-
-
/* Get the pixel value for a colour
*/
Uint32 GFXRGB(Uint8 r, Uint8 g, Uint8 b);
@@ -97,27 +92,11 @@ SDL_Event *GFXGetKey(void);
SDL_Event *GFXWaitKey(void);
-/* Lock the screen for updates
-*/
-void GFXLock(void);
-
-
-/* Unlock the screen following updates
-*/
-void GFXUnlock(void);
-
-
/*
Note that no bound checking (except for GFXPrint()) is done - it is the
callers responsibility to plot onscreen.
*/
-/* Plot a point without locking. GFXLock() and GFXUnlock() MUST surround
- calls to this
-*/
-void GFXFastPlot(int x, int y, Uint32 col);
-
-
/* Plot a point
*/
void GFXPlot(int x, int y, Uint32 col);
diff --git a/src/gui.c b/src/gui.c
index 37a48ec..6904d33 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -23,8 +23,6 @@
Basic GUI routines
*/
-static const char ident[]="$Id$";
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -41,8 +39,6 @@ static const char ident[]="$Id$";
#include "exit.h"
#include "util.h"
-static const char ident_h[]=ESPEC_GUI_H;
-
/* ---------------------------------------- MACROS
*/
@@ -400,8 +396,6 @@ const char *GUIInputString(const char *prompt, const char *orig)
strncat(buff,orig,40);
len=strlen(buff);
- SDL_EnableUNICODE(1);
-
while(!done)
{
GFXRect(0,y_pos,GFX_WIDTH,8,BLACK,TRUE);
@@ -430,7 +424,7 @@ const char *GUIInputString(const char *prompt, const char *orig)
break;
default:
- c=(unsigned char)e->key.keysym.unicode;
+ c=(unsigned char)e->key.keysym.sym;
if (len<40 && isprint(c))
{
@@ -441,8 +435,6 @@ const char *GUIInputString(const char *prompt, const char *orig)
}
}
- SDL_EnableUNICODE(0);
-
return buff;
}
diff --git a/src/kbbmp.c b/src/kbbmp.c
index 406ba72..b329ef0 100644
--- a/src/kbbmp.c
+++ b/src/kbbmp.c
@@ -23,12 +23,8 @@
The bitmap data for the spectrum keyboard
*/
-static const char ident[]="$Id$";
-
#include "kbbmp.h"
-static const char ident_h[]=ESPEC_KBBMP_H;
-
const unsigned char keyboard_bitmap[]=
{
0x00,0xff,0xff,0xff,0xff,0xd5,0x07,0x83,
diff --git a/src/main.c b/src/main.c
index a951097..d3aa0be 100644
--- a/src/main.c
+++ b/src/main.c
@@ -21,8 +21,6 @@
-------------------------------------------------------------------------
*/
-static const char id[]="$Id$";
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -247,8 +245,6 @@ int main(int argc, char *argv[])
case SDLK_F8:
if (e->key.state==SDL_PRESSED)
{
- GFXKeyRepeat(TRUE);
-
if (GUIFileSelect("TAPE TO LOAD",TRUE,
tape_in[0] ?
Dirname(tape_in) :
@@ -257,16 +253,12 @@ int main(int argc, char *argv[])
{
SPECMount(SPEC_TAPE_IN,tape_in);
}
-
- GFXKeyRepeat(FALSE);
}
break;
case SDLK_F9:
if (e->key.state==SDL_PRESSED)
{
- GFXKeyRepeat(TRUE);
-
if (GUIFileSelect("TAPE TO SAVE",FALSE,
tape_out[0] ?
Dirname(tape_out) :
@@ -275,8 +267,6 @@ int main(int argc, char *argv[])
{
SPECMount(SPEC_TAPE_OUT,tape_out);
}
-
- GFXKeyRepeat(FALSE);
}
break;
diff --git a/src/memmenu.c b/src/memmenu.c
index 9e470d1..6a6d3d3 100644
--- a/src/memmenu.c
+++ b/src/memmenu.c
@@ -23,8 +23,6 @@
Provides the memory menu
*/
-static const char ident[]="$Id$";
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -39,8 +37,6 @@ static const char ident[]="$Id$";
#include <SDL.h>
-static const char ident_h[]=ESPEC_MEMMENU_H;
-
#ifndef TRUE
#define TRUE 1
#endif
@@ -1197,8 +1193,6 @@ int MemoryMenu(Z80 *z80)
Z80GetState(z80,&s);
- GFXKeyRepeat(TRUE);
-
while(!done)
{
DisplayMenu();
@@ -1271,8 +1265,6 @@ int MemoryMenu(Z80 *z80)
}
}
- GFXKeyRepeat(FALSE);
-
return quit;
}
diff --git a/src/snap.c b/src/snap.c
index 91680e8..69c1f4b 100644
--- a/src/snap.c
+++ b/src/snap.c
@@ -23,13 +23,9 @@
Utilities for handling snapshots
*/
-static const char ident[]="$Id$";
-
#include "snap.h"
#include "util.h"
-static const char ident_h[]=ESPEC_SNAP_H;
-
/* ---------------------------------------- MACROS
*/
diff --git a/src/spec.c b/src/spec.c
index 3a9b295..7066292 100644
--- a/src/spec.c
+++ b/src/spec.c
@@ -23,8 +23,6 @@
Provides the emulation for the Spectrum
*/
-static const char ident[]="$Id$";
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -36,8 +34,6 @@ static const char ident[]="$Id$";
#include "exit.h"
#include "util.h"
-static const char ident_h[]=ESPEC_SPECH;
-
#ifndef TRUE
#define TRUE 1
#endif
@@ -138,7 +134,7 @@ static Z80Byte matrix[8];
typedef struct
{
- SDLKey key;
+ SDL_Keycode key;
int m1,b1,m2,b2;
} MatrixMap;
@@ -259,8 +255,6 @@ static void DrawScanlineAt(int y, int sline)
if (aline>=0 && aline<SCRL)
{
- GFXLock();
-
scr=line[aline];
for(f=0;f<TXT_W;f++)
@@ -285,12 +279,10 @@ static void DrawScanlineAt(int y, int sline)
for(r=0,b=*scr++;r<8;r++)
if (b&(1<<(7-r)))
- GFXFastPlot(f*8+r+OFF_X,y,coltable[ink].col);
+ GFXPlot(f*8+r+OFF_X,y,coltable[ink].col);
else
- GFXFastPlot(f*8+r+OFF_X,y,coltable[paper].col);
+ GFXPlot(f*8+r+OFF_X,y,coltable[paper].col);
}
-
- GFXUnlock();
}
}
@@ -505,6 +497,11 @@ void SPECKeyEvent(SDL_Event *e)
{
const MatrixMap *m;
+ if (e->key.repeat)
+ {
+ return;
+ }
+
m=keymap;
while(m->key!=SDLK_UNKNOWN)
diff --git a/src/util.c b/src/util.c
index 8bca1b3..ee43a3c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -23,8 +23,6 @@
Usual library wrappers and utils
*/
-static const char ident[]="$Id$";
-
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
@@ -33,8 +31,6 @@ static const char ident[]="$Id$";
#include "util.h"
#include "exit.h"
-static const char ident_h[]=ESPEC_UTIL_H;
-
/* ---------------------------------------- MACROS
*/
diff --git a/src/z80.c b/src/z80.c
index 60dbca4..e4d68e5 100644
--- a/src/z80.c
+++ b/src/z80.c
@@ -31,10 +31,6 @@
#include "z80.h"
#include "z80_private.h"
-static const char ident[]="$Id$";
-static const char ident_z80_header[]=Z80_H;
-static const char ident_z80_private_header[]=Z80_PRIVATE_H;
-
Z80Label *z80_labels=NULL;
/* ---------------------------------------- PRIVATE FUNCTIONS
diff --git a/src/z80_decode.c b/src/z80_decode.c
index ced7fbd..23408da 100644
--- a/src/z80_decode.c
+++ b/src/z80_decode.c
@@ -29,8 +29,6 @@
#include "z80.h"
#include "z80_private.h"
-static const char ident[]="$Id$";
-
/* ---------------------------------------- TABLES AND INIT
*/
static Z80Byte PSZtable[512];
diff --git a/src/z80_dis.c b/src/z80_dis.c
index 9d42829..4bdb6fc 100644
--- a/src/z80_dis.c
+++ b/src/z80_dis.c
@@ -23,8 +23,6 @@
$Id$
*/
-static const char ident[]="$Id$";
-
#ifdef ENABLE_DISASSEM
#include <stdio.h>
diff --git a/src/z80_private.h b/src/z80_private.h
index 6675c12..a970eab 100644
--- a/src/z80_private.h
+++ b/src/z80_private.h
@@ -209,15 +209,6 @@ struct Z80
extern Z80Label *z80_labels;
-/* ---------------------------------------- FLAG TABLES
-*/
-extern Z80Byte PSZtable[512];
-extern Z80Byte SZtable[512];
-extern Z80Byte Ptable[512];
-extern Z80Byte Stable[512];
-extern Z80Byte Ztable[512];
-
-
/* ---------------------------------------- GLOBAL GENERAL OPCODES/ROUTINES
*/
void Z80_Decode(Z80 *cpu, Z80Byte opcode);