diff options
author | Ian C <ianc@noddybox.co.uk> | 2003-12-19 01:14:08 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2003-12-19 01:14:08 +0000 |
commit | 50f23c8c394338fc48f825e5b61303d4ac0360db (patch) | |
tree | 5ad022778212fc6b094b3e11dd1a73fe3df7f9c2 /src/zx81.c | |
parent | 3a80024643367a4514f0160a90583e00042382b2 (diff) |
Added basic GFX wrapper
Diffstat (limited to 'src/zx81.c')
-rw-r--r-- | src/zx81.c | 35 |
1 files changed, 21 insertions, 14 deletions
@@ -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]; } |