- Llevats mòduls que ja no s'usaven i afegits DSKs del goldenaxe, normals i amb protecció
This commit is contained in:
BIN
goldenaxe1.dsk
Normal file
BIN
goldenaxe1.dsk
Normal file
Binary file not shown.
BIN
goldenaxe1_lock.dsk
Normal file
BIN
goldenaxe1_lock.dsk
Normal file
Binary file not shown.
BIN
goldenaxe2.dsk
Normal file
BIN
goldenaxe2.dsk
Normal file
Binary file not shown.
BIN
goldenaxe2_lock.dsk
Normal file
BIN
goldenaxe2_lock.dsk
Normal file
Binary file not shown.
@@ -1,5 +0,0 @@
|
|||||||
/*
|
|
||||||
#include "z80mem.h"
|
|
||||||
|
|
||||||
z80mem* z80mem::singleton= nullptr;
|
|
||||||
*/
|
|
||||||
46
z80mem.h
46
z80mem.h
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#define MEMTAG_NONE 0x00
|
|
||||||
#define MEMTAG_DATA 0x01
|
|
||||||
#define MEMTAG_INST 0x02
|
|
||||||
#define MEMTAG_CODE 0x04
|
|
||||||
#define MEMTAG_IGNORE 0x08
|
|
||||||
#define MEMTAG_TDATA 0x10
|
|
||||||
#define MEMTAG_TINST 0x20
|
|
||||||
#define MEMTAG_TREPEAT 0x40
|
|
||||||
#define MEMTAG_MODIFIED 0x80
|
|
||||||
|
|
||||||
#define MEMTAG_KNOWN 0x07
|
|
||||||
#define MEMTAG_TOUCHED 0x70
|
|
||||||
|
|
||||||
class z80mem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static z80mem *get() { return singleton; };
|
|
||||||
|
|
||||||
virtual uint8_t readMem(uint16_t address) = 0;
|
|
||||||
virtual void writeMem(uint16_t address, uint8_t value) = 0;
|
|
||||||
|
|
||||||
virtual void loadMem(uint16_t address, uint16_t len, uint8_t *buffer) = 0;
|
|
||||||
|
|
||||||
virtual uint8_t getTag(uint16_t address) = 0;
|
|
||||||
virtual void setTag(uint16_t address, uint8_t value) = 0;
|
|
||||||
virtual void reset() = 0;
|
|
||||||
|
|
||||||
virtual void saveState(FILE* f) = 0;
|
|
||||||
virtual void loadState(FILE* f) = 0;
|
|
||||||
|
|
||||||
virtual uint32_t getSize() = 0;
|
|
||||||
|
|
||||||
virtual uint8_t *rawPtr(uint32_t address) = 0;
|
|
||||||
virtual uint8_t *rawTagPtr(uint32_t address) = 0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
static z80mem *singleton;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
191
zx_128mem.cpp
191
zx_128mem.cpp
@@ -1,191 +0,0 @@
|
|||||||
/*
|
|
||||||
#include "zx_128mem.h"
|
|
||||||
#include "z80mem.h"
|
|
||||||
#include "z80.h"
|
|
||||||
#include "zx_screen.h"
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#define ZX_128MEM_PAGE 0x07
|
|
||||||
#define ZX_128MEM_SCREEN 0x08
|
|
||||||
#define ZX_128MEM_ROM 0x10
|
|
||||||
#define ZX_128MEM_DISPAG 0x20
|
|
||||||
|
|
||||||
void zx_128_port_out(int port, int val)
|
|
||||||
{
|
|
||||||
((zx_128mem*)z80mem::get())->port_out(port, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
zx_128mem::zx_128mem()
|
|
||||||
{
|
|
||||||
z80mem::singleton = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_128mem::port_out(int port, int val)
|
|
||||||
{
|
|
||||||
if (port != 0x7ffd) return;
|
|
||||||
if (config & ZX_128MEM_DISPAG) return;
|
|
||||||
const bool shadow = config & ZX_128MEM_SCREEN;
|
|
||||||
config = val;
|
|
||||||
if (config & ZX_128MEM_SCREEN) {
|
|
||||||
if (!shadow) zxscreen::setBaseAddresses(0x4000*7, 0x1800+0x4000*7);
|
|
||||||
} else {
|
|
||||||
if (shadow) zxscreen::setBaseAddresses(0x4000*5, 0x1800+0x4000*5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t zx_128mem::readMem(uint16_t address)
|
|
||||||
{
|
|
||||||
const uint8_t bank = address >> 14;
|
|
||||||
const uint16_t disp = address & 0x3fff;
|
|
||||||
|
|
||||||
switch (bank)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
return rom[disp | ((config & ZX_128MEM_ROM)<<10)];
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
return memory[disp | 0x14000];
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
return memory[address];
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
return memory[disp | (0x4000 * (config&ZX_128MEM_PAGE))];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_128mem::writeMem(uint16_t address, uint8_t value)
|
|
||||||
{
|
|
||||||
const uint8_t bank = address >> 14;
|
|
||||||
const uint16_t disp = address & 0x3fff;
|
|
||||||
|
|
||||||
switch (bank)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
memory[disp | 0x14000] = value;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
memory[address] = value;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
memory[disp | (0x4000 * (config&ZX_128MEM_PAGE))] = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_128mem::loadMem(uint16_t address, uint16_t len, uint8_t *buffer)
|
|
||||||
{
|
|
||||||
memcpy(&memory[address], buffer, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t zx_128mem::getTag(uint16_t address)
|
|
||||||
{
|
|
||||||
const uint8_t bank = address >> 14;
|
|
||||||
const uint16_t disp = address & 0x3fff;
|
|
||||||
|
|
||||||
switch (bank)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
return romtags[disp | ((config & ZX_128MEM_ROM)<<10)];
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
return tags[disp | 0x14000];
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
return tags[address];
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
return tags[disp | (0x4000 * (config&ZX_128MEM_PAGE))];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return tags[address];
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_128mem::setTag(uint16_t address, uint8_t value)
|
|
||||||
{
|
|
||||||
const uint8_t bank = address >> 14;
|
|
||||||
const uint16_t disp = address & 0x3fff;
|
|
||||||
|
|
||||||
switch (bank)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
romtags[disp | ((config & ZX_128MEM_ROM)<<10)] = value;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
tags[disp | 0x14000] = value;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
tags[address] = value;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
tags[disp | (0x4000 * (config&ZX_128MEM_PAGE))] = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_128mem::reset()
|
|
||||||
{
|
|
||||||
FILE* f = fopen("128k.rom", "rb");
|
|
||||||
fread(rom, 1024, 32, f);
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
for (int i=0x0000; i<=0x1FFFF; ++i) memory[i] = 0;
|
|
||||||
for (int i=0; i<131072; ++i) tags[i] = MEMTAG_NONE;
|
|
||||||
|
|
||||||
z80::connect_port(0x7ffd, nullptr, zx_128_port_out);
|
|
||||||
z80::connect_port(0xfd, nullptr, zx_128_port_out);
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_128mem::saveState(FILE *f)
|
|
||||||
{
|
|
||||||
fwrite(&memory[0x0000], 131072, 1, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_128mem::loadState(FILE *f)
|
|
||||||
{
|
|
||||||
fread(&memory[0x0000], 131072, 1, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t zx_128mem::getSize()
|
|
||||||
{
|
|
||||||
return 131072;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t *zx_128mem::rawPtr(uint32_t address)
|
|
||||||
{
|
|
||||||
return &memory[address];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t *zx_128mem::rawTagPtr(uint32_t address)
|
|
||||||
{
|
|
||||||
return &tags[address];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t zx_128mem::getPage(uint8_t bank)
|
|
||||||
{
|
|
||||||
switch(bank) {
|
|
||||||
case 0:
|
|
||||||
return (config & ZX_128MEM_ROM) ? 1 : 0;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
return 5;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
return 2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
return config & ZX_128MEM_PAGE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool zx_128mem::getShadowScreen()
|
|
||||||
{
|
|
||||||
return config & ZX_128MEM_SCREEN;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
44
zx_128mem.h
44
zx_128mem.h
@@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
#pragma once
|
|
||||||
#include "z80mem.h"
|
|
||||||
|
|
||||||
void zx_128_port_out(int port, int val);
|
|
||||||
|
|
||||||
class zx_128mem : public z80mem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
zx_128mem();
|
|
||||||
|
|
||||||
void port_out(int port, int val);
|
|
||||||
|
|
||||||
uint8_t readMem(uint16_t address);
|
|
||||||
void writeMem(uint16_t address, uint8_t value);
|
|
||||||
|
|
||||||
void loadMem(uint16_t address, uint16_t len, uint8_t *buffer);
|
|
||||||
|
|
||||||
uint8_t getTag(uint16_t address);
|
|
||||||
void setTag(uint16_t address, uint8_t value);
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
void saveState(FILE* f);
|
|
||||||
void loadState(FILE* f);
|
|
||||||
|
|
||||||
uint32_t getSize();
|
|
||||||
|
|
||||||
uint8_t *rawPtr(uint32_t address);
|
|
||||||
uint8_t *rawTagPtr(uint32_t address);
|
|
||||||
|
|
||||||
uint8_t getPage(uint8_t bank);
|
|
||||||
bool getShadowScreen();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
uint8_t config;
|
|
||||||
uint8_t memory[131072];
|
|
||||||
uint8_t tags[131072];
|
|
||||||
uint8_t rom[32768];
|
|
||||||
uint8_t romtags[32768];
|
|
||||||
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
72
zx_48mem.cpp
72
zx_48mem.cpp
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
#include "zx_48mem.h"
|
|
||||||
#include "z80mem.h"
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
|
|
||||||
zx_48mem::zx_48mem()
|
|
||||||
{
|
|
||||||
z80mem::singleton = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t zx_48mem::readMem(uint16_t address)
|
|
||||||
{
|
|
||||||
return memory[address];
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_48mem::writeMem(uint16_t address, uint8_t value)
|
|
||||||
{
|
|
||||||
memory[address] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_48mem::loadMem(uint16_t address, uint16_t len, uint8_t *buffer)
|
|
||||||
{
|
|
||||||
memcpy(&memory[address], buffer, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t zx_48mem::getTag(uint16_t address)
|
|
||||||
{
|
|
||||||
return tags[address];
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_48mem::setTag(uint16_t address, uint8_t value)
|
|
||||||
{
|
|
||||||
tags[address] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_48mem::reset()
|
|
||||||
{
|
|
||||||
FILE* f = fopen("48.rom", "rb");
|
|
||||||
fread(memory, 1024, 16, f);
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
for (int i=0x4000; i<=0xFFFF; ++i) memory[i] = 0;
|
|
||||||
for (int i=0; i<65536; ++i) tags[i] = MEMTAG_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_48mem::saveState(FILE *f)
|
|
||||||
{
|
|
||||||
fwrite(&memory[0x4000], 0xc000, 1, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void zx_48mem::loadState(FILE *f)
|
|
||||||
{
|
|
||||||
fread(&memory[0x4000], 0xc000, 1, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t zx_48mem::getSize()
|
|
||||||
{
|
|
||||||
return 65536;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t *zx_48mem::rawPtr(uint32_t address)
|
|
||||||
{
|
|
||||||
return &memory[address];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t *zx_48mem::rawTagPtr(uint32_t address)
|
|
||||||
{
|
|
||||||
return &tags[address];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
34
zx_48mem.h
34
zx_48mem.h
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
#pragma once
|
|
||||||
#include "z80mem.h"
|
|
||||||
|
|
||||||
class zx_48mem : public z80mem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
zx_48mem();
|
|
||||||
|
|
||||||
uint8_t readMem(uint16_t address);
|
|
||||||
void writeMem(uint16_t address, uint8_t value);
|
|
||||||
|
|
||||||
void loadMem(uint16_t address, uint16_t len, uint8_t *buffer);
|
|
||||||
|
|
||||||
uint8_t getTag(uint16_t address);
|
|
||||||
void setTag(uint16_t address, uint8_t value);
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
void saveState(FILE* f);
|
|
||||||
void loadState(FILE* f);
|
|
||||||
|
|
||||||
uint32_t getSize();
|
|
||||||
|
|
||||||
uint8_t *rawPtr(uint32_t address);
|
|
||||||
uint8_t *rawTagPtr(uint32_t address);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
uint8_t memory[65536];
|
|
||||||
uint8_t tags[65536];
|
|
||||||
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
Reference in New Issue
Block a user