diff options
-rw-r--r-- | src/Makefile | 10 | ||||
-rw-r--r-- | src/config.c | 170 | ||||
-rw-r--r-- | src/config.h (renamed from src/ezx81.c) | 44 | ||||
-rw-r--r-- | src/emma.c | 39 | ||||
-rw-r--r-- | src/font.h | 1102 | ||||
-rw-r--r-- | src/gfx.c | 290 | ||||
-rw-r--r-- | src/gfx.h | 120 | ||||
-rw-r--r-- | src/main.c | 114 | ||||
-rw-r--r-- | src/zx81.c | 35 | ||||
-rw-r--r-- | src/zx81.h | 16 |
10 files changed, 1898 insertions, 42 deletions
diff --git a/src/Makefile b/src/Makefile index 5ebcd48..2d87ddc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,7 +18,7 @@ # # ------------------------------------------------------------------------- # -# $Id: Makefile,v 1.2 2003-12-17 16:55:42 ianc Exp $ +# $Id: Makefile,v 1.3 2003-12-19 01:14:08 ianc Exp $ # @@ -32,12 +32,16 @@ TARGET = ezx81 Z80LIB = z80/z80.a -SOURCE = ezx81.c \ +SOURCE = main.c \ zx81.c \ + config.c \ + gfx.c \ exit.c -OBJECTS = ezx81.o \ +OBJECTS = main.o \ zx81.o \ + config.o \ + gfx.o \ exit.o EMMA = emma diff --git a/src/config.c b/src/config.c new file mode 100644 index 0000000..edff062 --- /dev/null +++ b/src/config.c @@ -0,0 +1,170 @@ +/* + + ezx81 - X11 ZX81 emulator + + Copyright (C) 2003 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + + 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[]=EZX81_CONFIG_H; + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + + +/* ---------------------------------------- CONFIG +*/ +static char rompath[FILENAME_MAX]="zx81.rom"; +static int fullscreen=FALSE; +static int memsize=16; +static int frames=50; +static int scale=1; + +static const struct +{ + const char *name; + void *var; + int is_int; +} config[]= { + {"rompath", rompath, FALSE}, + {"fullscreen", &fullscreen, TRUE}, + {"memsize", &memsize, TRUE}, + {"frames", &frames, TRUE}, + {"scale", &scale, TRUE}, + {NULL, NULL, FALSE} + }; + + +/* ---------------------------------------- PRIVATE FUNCTIONS +*/ +static void Parse(FILE *fp) +{ + char buff[1024]; + + while(fgets(buff,sizeof buff,fp)) + { + size_t l; + + l=strlen(buff); + + if (buff[l-1]=='\n') + buff[--l]=0; + + if (l>0 && buff[0]!='#') + { + char *t1=NULL; + char *t2=NULL; + + t1=strtok(buff,"\t"); + t2=strtok(NULL,"\t"); + + if (t2) + { + int f; + + for(f=0;config[f].name;f++) + { + if (strcmp(config[f].name,t1)==0) + { + if (config[f].is_int) + { + int *i; + + i=config[f].var; + *i=atoi(t2); + } + else + { + char *p; + + p=config[f].var; + strcpy(p,t2); + } + } + } + } + else + { + fprintf(stderr,"Ignored bad config: %s %s\n",t1,t2 ? t2:""); + } + } + } +} + + +/* ---------------------------------------- EXPORTED INTERFACES +*/ +void ConfigRead(void) +{ + FILE *fp; + char path[FILENAME_MAX]={0}; + + if (getenv("HOME")) + strcpy(path,getenv("HOME")); + + strcat(path,"/.ezx81"); + + if ((fp=fopen(path,"r"))) + { + Parse(fp); + fclose(fp); + } +} + + +int IConfig(IConfigVar v) +{ + static const int *vars[]= + { + &fullscreen, + &memsize, + &frames, + &scale + }; + + return *vars[v]; +} + + +const char *SConfig(SConfigVar v) +{ + static const char *vars[]= + { + rompath + }; + + return vars[v]; +} + + +/* END OF FILE */ diff --git a/src/ezx81.c b/src/config.h index 0b09368..d655998 100644 --- a/src/ezx81.c +++ b/src/config.h @@ -20,29 +20,49 @@ ------------------------------------------------------------------------- -*/ -static const char id[]="$Id$"; + Config file -#include <stdlib.h> -#include <stdio.h> +*/ -#include "z80.h" +#ifndef EZX81_CONFIG_H +#define EZX81_CONFIG_H "$Id$" -/* ---------------------------------------- PROTOS +/* Integer settings */ +typedef enum +{ + CONF_FULLSCREEN, + CONF_MEMSIZE, + CONF_FRAMES_PER_SEC, + CONF_SCALE +} IConfigVar; -/* ---------------------------------------- MAIN +/* String settings */ -int main(int argc, char *argv[]) +typedef enum { - Z80 *z80; + CONF_ROMFILE +} SConfigVar; + + +/* Read config file +*/ +void ConfigRead(void); + + +/* Get integer setting +*/ +int IConfig(IConfigVar v); + + +/* Get string setting +*/ +const char *SConfig(SConfigVar v); - z80=Z80Init(NULL,NULL,NULL,NULL); - return EXIT_SUCCESS; -} +#endif /* END OF FILE */ @@ -36,10 +36,11 @@ static Z80Byte mem[0x10000]; /* ---------------------------------------- PROTOS */ -static Z80Byte ReadMem(Z80 *z80, Z80Word addr); -static void WriteMem(Z80 *z80, Z80Word addr, Z80Byte val); -static Z80Byte ReadPort(Z80 *z80, Z80Word addr); -static void WritePort(Z80 *z80, Z80Word addr, Z80Byte val); +static Z80Byte ReadMem(Z80 *z80, Z80Word addr); +static void WriteMem(Z80 *z80, Z80Word addr, Z80Byte val); +static Z80Byte ReadPort(Z80 *z80, Z80Word addr); +static void WritePort(Z80 *z80, Z80Word addr, Z80Byte val); +static const char *Label(Z80 *z80, Z80Word addr); /* ---------------------------------------- MAIN @@ -47,8 +48,10 @@ static void WritePort(Z80 *z80, Z80Word addr, Z80Byte val); int main(int argc, char *argv[]) { Z80 *z80; + FILE *fp; + Z80Word pc=0; - z80=Z80Init(WriteMem,ReadMem,WritePort,ReadPort); + z80=Z80Init(WriteMem,ReadMem,WritePort,ReadPort,ReadMem,Label); if (!z80) { @@ -56,6 +59,23 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } + if ((fp=fopen("/files/emu/ROM/zx81.rom","rb"))) + { + fread(mem,1,0x10000,fp); + fclose(fp); + } + + while(1) + { + Z80Word opc=pc; + + printf("%4.4x: ",pc); + printf("%s\n",Z80Disassemble(z80,&pc)); + + if (pc<opc) + break; + } + return EXIT_SUCCESS; } @@ -87,4 +107,13 @@ static void WritePort(Z80 *z80, Z80Word addr, Z80Byte val) } +static const char *Label(Z80 *z80, Z80Word addr) +{ + if (addr==0x0a2a) + return "CLS"; + + return NULL; +} + + /* END OF FILE */ diff --git a/src/font.h b/src/font.h new file mode 100644 index 0000000..440488b --- /dev/null +++ b/src/font.h @@ -0,0 +1,1102 @@ +/* + + ezx81 - X11 ZX81 emulator + + Copyright (C) 2003 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + + Internal font for gfx routines + +*/ + +#ifndef EZX81_FONT_H +#define EZX81_FONT_H "$Id$" + +typedef unsigned char FontChar[64]; + +#define NULLCHARDEF {0} + + +static const FontChar font[128]= +{ + NULLCHARDEF, /* 00 */ + + { /* 01 FONT_UP_ARROW */ + 0,0,0,1,1,0,0,0, + 0,0,1,1,1,1,0,0, + 0,1,1,1,1,1,1,0, + 1,1,0,1,1,0,1,1, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + }, + { /* 02 FONT_DOWN_ARROW */ + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 1,1,0,1,1,0,1,1, + 0,1,1,1,1,1,1,0, + 0,0,1,1,1,1,0,0, + 0,0,0,1,1,0,0,0, + }, + { /* 03 FONT_LEFT_ARROW */ + 0,0,0,1,0,0,0,0, + 0,0,1,1,0,0,0,0, + 0,1,1,0,0,0,0,0, + 1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1, + 0,1,1,0,0,0,0,0, + 0,0,1,1,0,0,0,0, + 0,0,0,1,0,0,0,0, + }, + { /* 04 FONT_RIGHT_ARROW */ + 0,0,0,0,1,0,0,0, + 0,0,0,0,1,1,0,0, + 0,0,0,0,0,1,1,0, + 1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1, + 0,0,0,0,0,1,1,0, + 0,0,0,0,1,1,0,0, + 0,0,0,0,1,0,0,0, + }, + { /* 05 FONT_TICK */ + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,1, + 0,0,0,0,0,0,1,1, + 0,0,0,0,0,1,1,0, + 1,1,0,0,1,1,0,0, + 0,1,1,1,1,0,0,0, + 0,0,1,1,0,0,0,0, + 0,0,0,0,0,0,0,0, + }, + { /* 06 FONT_CROSS */ + 0,0,0,0,0,0,0,0, + 0,1,1,0,0,0,1,1, + 0,0,1,1,0,1,1,0, + 0,0,0,1,1,1,0,0, + 0,0,0,1,1,1,0,0, + 0,0,1,1,0,1,1,0, + 0,1,1,0,0,0,1,1, + 0,0,0,0,0,0,0,0, + }, + { /* 07 FONT_CURSOR */ + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,1, + }, + { /* 08 FONT_COPYRIGHT */ + 0,0,1,1,1,0,0,0, + 0,1,0,0,0,1,0,0, + 1,0,0,1,1,0,1,0, + 1,0,1,0,0,0,1,0, + 1,0,0,1,1,0,1,0, + 0,1,0,0,0,1,0,0, + 0,0,1,1,1,0,0,0, + 0,0,0,0,0,0,0,0, + }, + + NULLCHARDEF, /* 09 */ + NULLCHARDEF, /* 0a */ + NULLCHARDEF, /* 0b */ + NULLCHARDEF, /* 0c */ + NULLCHARDEF, /* 0d */ + NULLCHARDEF, /* 0e */ + NULLCHARDEF, /* 0f */ + NULLCHARDEF, /* 10 */ + NULLCHARDEF, /* 11 */ + NULLCHARDEF, /* 12 */ + NULLCHARDEF, /* 13 */ + NULLCHARDEF, /* 14 */ + NULLCHARDEF, /* 15 */ + NULLCHARDEF, /* 16 */ + NULLCHARDEF, /* 17 */ + NULLCHARDEF, /* 18 */ + NULLCHARDEF, /* 19 */ + NULLCHARDEF, /* 1a */ + NULLCHARDEF, /* 1b */ + NULLCHARDEF, /* 1c */ + NULLCHARDEF, /* 1d */ + NULLCHARDEF, /* 1e */ + NULLCHARDEF, /* 1f */ + + { /* 20 ' ' */ + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + }, + { /* 21 '!' */ + 0,1,0,0,0,0,0,0, + 0,1,0,0,0,0,0,0, + 0,1,0,0,0,0,0,0, + 0,1,0,0,0,0,0,0, + 0,1,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,1,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + }, + { /* 22 '"' */ + 0,0,1,0,0,1,0,0, + 0,0,1,0,0,1,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + }, + { /* 23 '#' */ + 0,0,1,0,1,0,0,0, + 0,0,1,0,1,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,0,0,1,0,0,0, + 0,0,0,0,0,1,0,0, + 0,0,0,0,1,0,0,0, + 0,0,0,0,1,0,0,0, + 0,0,0,1,0,0,0,0, + 0,0,0,0,0,0,0,0, + }, + { /* 7d '~' */ + 0,1,1,0,0,0,0,0, + 1,0,0,1,0,0,0,1, + 0,0,0,0,1,1,1,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + }, + + NULLCHARDEF, /* 7f */ +}; + + +#endif + + +/* END OF FILE */ diff --git a/src/gfx.c b/src/gfx.c new file mode 100644 index 0000000..e37a211 --- /dev/null +++ b/src/gfx.c @@ -0,0 +1,290 @@ +/* + + ezx81 - X11 ZX81 emulator + + Copyright (C) 2003 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + + Config file + +*/ +static const char ident[]="$Id$"; + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <stdarg.h> + +#include "gfx.h" +#include "exit.h" +#include "config.h" + +#include "font.h" + +static const char ident_h[]=EZX81_GFX_H; +static const char ident_fh[]=EZX81_FONT_H; + + +/* ---------------------------------------- MACROS +*/ +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#define SCR_W 320 +#define SCR_H 200 + +#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 Uint32 ticks; +static Uint32 frame; +static int scale; + + +/* ---------------------------------------- PRIVATE FUNCTIONS +*/ + +/* Taken from SDL documentation +*/ +static void 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; + } +} + + +static void DoHLine(int x1, int x2, int y, Uint32 col) +{ + for(;x1<=x2;x1++) + putpixel(x1,y,col); +} + + +static void DoVLine(int x, int y1, int y2, Uint32 col) +{ + for(;y1<=y2;y1++) + putpixel(x,y1,col); +} + + +/* ---------------------------------------- EXPORTED INTERFACES +*/ +void GFXInit(void) +{ + scale=IConfig(CONF_SCALE); + + if (scale<0) + scale=1; + + frame=1000/IConfig(CONF_FRAMES_PER_SEC); + + if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO)) + Exit("Failed to init SDL: %s\n",SDL_GetError()); + + if (!(surface=SDL_SetVideoMode + (SCR_W,SCR_H,0,IConfig(CONF_FULLSCREEN) ? SDL_FULLSCREEN : 0))) + Exit("Failed to open video: %s\n",SDL_GetError()); + + SDL_ShowCursor(SDL_DISABLE); + SDL_WM_SetCaption("eZX81","eZX81"); +} + + +SDL_Surface *GFXGetSurface(void) +{ + return surface; +} + + +Uint32 GFXRGB(Uint8 r, Uint8 g, Uint8 b) +{ + return SDL_MapRGB(surface->format,r,g,b); +} + + +void GFXClear(Uint32 col) +{ + SDL_FillRect(surface,NULL,col); +} + + +void GFXStartFrame(void) +{ + ticks=SDL_GetTicks(); +} + + +void GFXEndFrame(int delay) +{ + SDL_UpdateRect(surface,0,0,0,0); + + if (delay) + { + Uint32 diff; + + diff=SDL_GetTicks()-ticks; + + if (diff<frame) + SDL_Delay(frame-diff); + } +} + + +void GFXPlot(int x, int y, Uint32 col) +{ + LOCK; + + putpixel(x,y,col); + + UNLOCK; +} + + +void GFXRect(int x, int y, int w, int h, Uint32 col, int solid) +{ + LOCK; + + if (solid) + { + SDL_Rect r; + + r.x=x; + r.y=y; + r.w=w; + r.h=h; + + SDL_FillRect(surface,&r,col); + } + else + { + DoHLine(x,x+w,y,col); + DoHLine(x,x+w,y+h,col); + DoVLine(x,y,y+h,col); + DoVLine(x+w,y,y+h,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; +} + + +void GFXPrint(int x, int y, Uint32 col, const char *format, ...) +{ + char buff[257]; + va_list va; + char *p; + int sx,sy; + + va_start(va,format); + vsprintf(buff,format,va); + va_end(va); + + p=buff; + + LOCK; + + while(*p) + { + for(sy=0;sy<8;sy++) + { + if (y+sy<SCR_H && x<SCR_W) + { + for(sx=0;sx<8;sx++) + { + if (font[(int)*p][sx+sy*8] && x+sx<SCR_W) + putpixel(x+sx,y+sy,col); + } + } + } + + p++; + x+=8; + } + + UNLOCK; +} + + +/* END OF FILE */ diff --git a/src/gfx.h b/src/gfx.h new file mode 100644 index 0000000..b9b353a --- /dev/null +++ b/src/gfx.h @@ -0,0 +1,120 @@ +/* + + ezx81 - X11 ZX81 emulator + + Copyright (C) 2003 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + + Wrapper to SDL + +*/ + +#ifndef EZX81_GFX_H +#define EZX81_GFX_H "$Id$" + +#include "SDL.h" + + +/* ---------------------------------------- CONSTANTS +*/ +#define FONT_UP_ARROW '\001' +#define FONT_DOWN_ARROW '\002' +#define FONT_LEFT_ARROW '\003' +#define FONT_RIGHT_ARROW '\004' +#define FONT_TICK '\005' +#define FONT_CROSS '\006' +#define FONT_CURSOR '\007' +#define FONT_COPYRIGHT '\010' + + +/* ---------------------------------------- INTERFACES +*/ + +/* Initialise +*/ +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); + + +/* Clear the screen +*/ +void GFXClear(Uint32 col); + + +/* Indicate a frame is starting +*/ +void GFXStartFrame(void); + + +/* Indicate a frame is done and refreshes the screen + If delay is TRUE, sleeps to implement the frames_per_sec config. +*/ +void GFXEndFrame(int delay); + + +/* + Note that no bound checking (except for GFXPrint()) is done - it is the + callers responsibility to plot onscreen. +*/ + +/* Plot a point +*/ +void GFXPlot(int x, int y, Uint32 col); + + +/* Draw a rectangle +*/ +void GFXRect(int x, int y, int w, int h, Uint32 col, int solid); + + +/* Draw an horizontal line +*/ +void GFXHLine(int x1, int x2, int y, Uint32 col); + + +/* Draw a vertical line +*/ +void GFXVLine(int x, int y1, int y2, Uint32 col); + + +/* Draws text using an internal 8x8 monspaced font. The only supported + characters are 32-126 and the special FONT_xxx characters defined + above. The routine assumes the environment operates with ASCII. + + The co-ord given is the top left of the first character, and characters + are drawn transparently. + + Causes undefined behaviour if the generated string from the printf + format is longer than 256 characters. +*/ +void GFXPrint(int x, int y, Uint32 col, const char *format, ...); + + +#endif + + +/* END OF FILE */ diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..edf772f --- /dev/null +++ b/src/main.c @@ -0,0 +1,114 @@ +/* + + ezx81 - X11 ZX81 emulator + + Copyright (C) 2003 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + +*/ +static const char id[]="$Id$"; + +#include <stdlib.h> +#include <stdio.h> + +#include "SDL.h" + +#include "z80.h" +#include "zx81.h" +#include "gfx.h" +#include "config.h" +#include "exit.h" + + +/* ---------------------------------------- MACROS +*/ +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + + +/* ---------------------------------------- STATICS +*/ +static Uint32 white; +static Uint32 black; +static Uint32 grey; + + +/* ---------------------------------------- PROTOS +*/ + + +/* ---------------------------------------- MAIN +*/ +int main(int argc, char *argv[]) +{ + Z80 *z80; + + ConfigRead(); + + ZX81Init(); + + z80=Z80Init(ZX81WriteMem, + ZX81ReadMem, + ZX81WritePort, + ZX81ReadPort, + ZX81ReadForDisassem, + NULL); + + GFXInit(); + + white=GFXRGB(255,255,255); + grey=GFXRGB(128,128,128); + black=GFXRGB(0,0,0); + + GFXClear(grey); + GFXPrint(1,1,black,"Quick SDL check"); + GFXPrint(2,2,white,"Quick SDL check"); + GFXRect(100,100,20,20,white,TRUE); + GFXRect(99,99,22,22,white,FALSE); + + GFXHLine(0,319,0,white); + GFXVLine(0,1,199,black); + + { + SDL_Event e; + int f; + + for(f=0;f<1000;f++) + { + GFXPlot(rand()%320,rand()%200,white); + GFXEndFrame(FALSE); + } + + do + { + SDL_WaitEvent(&e); + } while(e.type!=SDL_KEYUP); + } + + SDL_Quit(); + + return EXIT_SUCCESS; +} + + +/* END OF FILE */ @@ -29,9 +29,10 @@ static const char ident[]="$Id$"; #include <stdio.h> #include <string.h> #include "zx81.h" +#include "config.h" #include "exit.h" -static const char ident_h[]=EZX81_ZX81_H; +static const char ident_h[]=EZX81ZX81H; /* ---------------------------------------- STATICS @@ -40,6 +41,11 @@ static const int ROMLEN=0x2000; static const int ROM_SAVE=0x2fc; static const int ROM_LOAD=0x347; +/* These assume a 320x200 screen +*/ +static const int OFF_X=(320-256)/2; +static const int OFF_Y=(200-192)/2; + static Z80Byte mem[0x10000]; static Z80Word RAMBOT=0; @@ -56,16 +62,13 @@ void ULA_Video_Shifter(Z80 *z80, Z80Byte val) /* ---------------------------------------- EXPORTED INTERFACES */ -void ZX81_Init(void) +void ZX81Init(void) { - /* TODO: Config for ROM - */ - const char rom[]="/files/emu/ROM/zx81.rom"; FILE *fp; Z80Word f; - if (!(fp=fopen(rom,"rb"))) - Exit("Failed to open ZX81 ROM - %s\n",rom); + if (!(fp=fopen(SConfig(CONF_ROMFILE),"rb"))) + Exit("Failed to open ZX81 ROM - %s\n",SConfig(CONF_ROMFILE)); if (fread(mem,1,ROMLEN,fp)!=ROMLEN) { @@ -79,9 +82,13 @@ void ZX81_Init(void) RAMBOT=0x4000; - /* TODO: Memory size (1 or 16K) + /* Memory size (1 or 16K) */ - RAMLEN=0x2000; + if (IConfig(CONF_MEMSIZE)==16) + RAMLEN=0x2000; + else + RAMLEN=0x400; + RAMTOP=RAMBOT+RAMLEN; for(f=RAMBOT;f<=RAMTOP;f++) @@ -89,7 +96,7 @@ void ZX81_Init(void) } -Z80Byte ZX81_ReadMem(Z80 *z80, Z80Word addr) +Z80Byte ZX81ReadMem(Z80 *z80, Z80Word addr) { /* Memory reads above 32K invoke the ULA */ @@ -125,25 +132,25 @@ Z80Byte ZX81_ReadMem(Z80 *z80, Z80Word addr) } -void ZX81_WriteMem(Z80 *z80, Z80Word addr, Z80Byte val) +void ZX81WriteMem(Z80 *z80, Z80Word addr, Z80Byte val) { if (addr>=RAMBOT && addr<=RAMTOP) mem[addr&0x7fff]=val; } -Z80Byte ZX81_ReadPort(Z80 *z80, Z80Word port) +Z80Byte ZX81ReadPort(Z80 *z80, Z80Word port) { return 0; } -void ZX81_WritePort(Z80 *z80, Z80Word port, Z80Byte val) +void ZX81WritePort(Z80 *z80, Z80Word port, Z80Byte val) { } -Z80Byte ZX81_ReadForDisassem(Z80 *z80, Z80Word addr) +Z80Byte ZX81ReadForDisassem(Z80 *z80, Z80Word addr) { return mem[addr&0x7fff]; } @@ -24,23 +24,23 @@ */ -#ifndef EZX81_ZX81_H -#define EZX81_ZX81_H "$Id$" +#ifndef EZX81ZX81H +#define EZX81ZX81H "$Id$" #include "z80.h" /* Initialise the ZX81 */ -void ZX81_Init(void); +void ZX81Init(void); /* Interfaces for the Z80 */ -Z80Byte ZX81_ReadMem(Z80 *z80, Z80Word addr); -void ZX81_WriteMem(Z80 *z80, Z80Word addr, Z80Byte val); -Z80Byte ZX81_ReadPort(Z80 *z80, Z80Word port); -void ZX81_WritePort(Z80 *z80, Z80Word port, Z80Byte val); -Z80Byte ZX81_ReadForDisassem(Z80 *z80, Z80Word addr); +Z80Byte ZX81ReadMem(Z80 *z80, Z80Word addr); +void ZX81WriteMem(Z80 *z80, Z80Word addr, Z80Byte val); +Z80Byte ZX81ReadPort(Z80 *z80, Z80Word port); +void ZX81WritePort(Z80 *z80, Z80Word port, Z80Byte val); +Z80Byte ZX81ReadForDisassem(Z80 *z80, Z80Word addr); #endif |