o add custom chip for mmio
This commit is contained in:
parent
c66828729f
commit
1075795ef4
@ -1,9 +1,9 @@
|
||||
# SDK Config
|
||||
|
||||
|
||||
PLATFORM=mac
|
||||
PLATFORM=$(shell uname)
|
||||
|
||||
ifeq ($(PLATFORM),linux)
|
||||
ifeq ($(PLATFORM),Linux)
|
||||
# Linux Wine
|
||||
SDK=/home/david/.wine/drive_c/65xx_FreeSDK
|
||||
WINE=wine
|
||||
|
||||
@ -29,10 +29,8 @@ void main(void) {
|
||||
word crc01;
|
||||
word crc02;
|
||||
padStatus pad1;
|
||||
char line_header[32] = "BANK CRC ADDR 123456789ABCDEF";
|
||||
char line[32] = " ";
|
||||
char test_buffer[] = "da";
|
||||
unsigned long addr;
|
||||
char line_header[32] = "OK";
|
||||
char packet[4] = "TEST";
|
||||
initInternalRegisters();
|
||||
|
||||
*(byte*) 0x2105 = 0x01; // MODE 1 value
|
||||
@ -41,9 +39,14 @@ void main(void) {
|
||||
*(byte*) 0x2100 = 0x0f; // enable background
|
||||
|
||||
enableDebugScreen();
|
||||
|
||||
writeln(line_header,0);
|
||||
|
||||
for (i=0;i<4;i++){
|
||||
*(byte*) 0x3000=packet[i];
|
||||
*(byte*) 0x700010=packet[i];
|
||||
}
|
||||
//writeln(line_header,1);
|
||||
|
||||
while(1){
|
||||
while(!pad1.start) {
|
||||
waitForVBlank();
|
||||
|
||||
222
snesram.tmproj
222
snesram.tmproj
@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>currentDocument</key>
|
||||
<string>tools/bsnes/memory/memory.cpp</string>
|
||||
<string>tools/bsnes/ppu/bppu/bppu_mmio.cpp</string>
|
||||
<key>documents</key>
|
||||
<array>
|
||||
<dict>
|
||||
@ -18,7 +18,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>fileHierarchyDrawerWidth</key>
|
||||
<integer>200</integer>
|
||||
<integer>271</integer>
|
||||
<key>metaData</key>
|
||||
<dict>
|
||||
<key>poc/avr_sdcard/fat.h</key>
|
||||
@ -105,6 +105,62 @@
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>43</integer>
|
||||
</dict>
|
||||
<key>snes/mmio/data.h</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>snes/mmio/debug.c</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>snes/mmio/debug.h</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>10</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>snes/mmio/main.c</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>7</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>5</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/cart/cart.cpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
@ -133,12 +189,40 @@
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>24</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/cc.sh</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/memory/memory.cpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>22</integer>
|
||||
<integer>4</integer>
|
||||
<key>line</key>
|
||||
<integer>37</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/memory/memory.hpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
@ -203,10 +287,107 @@
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/ppu/bppu/bppu.cpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>67</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/ppu/bppu/bppu.hpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>13</integer>
|
||||
<key>line</key>
|
||||
<integer>166</integer>
|
||||
</dict>
|
||||
<key>columnSelection</key>
|
||||
<false/>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>134</integer>
|
||||
<key>selectFrom</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>9</integer>
|
||||
<key>line</key>
|
||||
<integer>166</integer>
|
||||
</dict>
|
||||
<key>selectTo</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>13</integer>
|
||||
<key>line</key>
|
||||
<integer>166</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>tools/bsnes/ppu/bppu/bppu_mmio.cpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>220</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/ppu/bppu/bppu_render_mode7.cpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>32</integer>
|
||||
<key>line</key>
|
||||
<integer>33</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/ppu/ppu.cpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>openDocuments</key>
|
||||
<array>
|
||||
<string>tools/bsnes/memory/memory.cpp</string>
|
||||
<string>tools/bsnes/ppu/ppu.cpp</string>
|
||||
<string>tools/bsnes/ppu/bppu/bppu.cpp</string>
|
||||
<string>tools/bsnes/ppu/bppu/bppu_mmio.cpp</string>
|
||||
<string>tools/bsnes/ppu/bppu/bppu.hpp</string>
|
||||
<string>tools/bsnes/ppu/bppu/bppu_render_mode7.cpp</string>
|
||||
<string>tools/bsnes/cc.sh</string>
|
||||
<string>snes/mmio/main.c</string>
|
||||
<string>snes/mmio/data.h</string>
|
||||
<string>snes/mmio/debug.h</string>
|
||||
<string>snes/mmio/debug.c</string>
|
||||
<string>tools/bsnes/memory/memory.hpp</string>
|
||||
</array>
|
||||
<key>showFileHierarchyDrawer</key>
|
||||
<false/>
|
||||
@ -220,7 +401,7 @@
|
||||
<true/>
|
||||
<key>subItems</key>
|
||||
<dict>
|
||||
<key>scripts</key>
|
||||
<key>snes</key>
|
||||
<dict>
|
||||
<key>isExpanded</key>
|
||||
<true/>
|
||||
@ -240,28 +421,12 @@
|
||||
<key>subItems</key>
|
||||
<dict>
|
||||
<key>lib</key>
|
||||
<dict>
|
||||
<key>isExpanded</key>
|
||||
<true/>
|
||||
<key>subItems</key>
|
||||
<dict>
|
||||
<key>ruby</key>
|
||||
<dict>
|
||||
<key>isExpanded</key>
|
||||
<true/>
|
||||
<key>subItems</key>
|
||||
<dict>
|
||||
<key>video</key>
|
||||
<dict>
|
||||
<key>isExpanded</key>
|
||||
<true/>
|
||||
<key>subItems</key>
|
||||
<dict/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>memory</key>
|
||||
<dict>
|
||||
<key>isExpanded</key>
|
||||
@ -269,6 +434,21 @@
|
||||
<key>subItems</key>
|
||||
<dict/>
|
||||
</dict>
|
||||
<key>ppu</key>
|
||||
<dict>
|
||||
<key>isExpanded</key>
|
||||
<true/>
|
||||
<key>subItems</key>
|
||||
<dict>
|
||||
<key>bppu</key>
|
||||
<dict>
|
||||
<key>isExpanded</key>
|
||||
<true/>
|
||||
<key>subItems</key>
|
||||
<dict/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>ui_qt</key>
|
||||
<dict>
|
||||
<key>isExpanded</key>
|
||||
@ -284,6 +464,6 @@
|
||||
</dict>
|
||||
</dict>
|
||||
<key>windowFrame</key>
|
||||
<string>{{0, 60}, {720, 818}}</string>
|
||||
<string>{{0, 58}, {720, 820}}</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@ -126,7 +126,7 @@ link += $(if $(findstring input.rawinput,$(ruby)),$(call mklib,xinput) $(call mk
|
||||
objects = libco ruby libfilter string \
|
||||
reader cart cheat \
|
||||
memory smemory cpu scpu smp ssmp sdsp ppu bppu snes \
|
||||
bsx srtc sdd1 spc7110 cx4 dsp1 dsp2 dsp3 dsp4 obc1 st010
|
||||
bsx srtc sdd1 spc7110 cx4 dsp1 dsp2 dsp3 dsp4 obc1 st010 cmmio
|
||||
|
||||
ifeq ($(enable_gzip),true)
|
||||
#objects += adler32 compress crc32 deflate gzio inffast inflate inftrees ioapi trees unzip zip zutil
|
||||
@ -236,6 +236,8 @@ obj/dsp3.$(obj) : chip/dsp3/dsp3.cpp chip/dsp3/*
|
||||
obj/dsp4.$(obj) : chip/dsp4/dsp4.cpp chip/dsp4/*
|
||||
obj/obc1.$(obj) : chip/obc1/obc1.cpp chip/obc1/*
|
||||
obj/st010.$(obj) : chip/st010/st010.cpp chip/st010/*
|
||||
obj/cmmio.$(obj) : chip/cmmio/cmmio.cpp chip/cmmio/*
|
||||
|
||||
|
||||
############
|
||||
### zlib ###
|
||||
|
||||
@ -9,3 +9,4 @@
|
||||
#include "dsp4/dsp4.hpp"
|
||||
#include "obc1/obc1.hpp"
|
||||
#include "st010/st010.hpp"
|
||||
#include "cmmio/cmmio.hpp"
|
||||
|
||||
35
tools/bsnes/chip/cmmio/cmmio.cpp
Normal file
35
tools/bsnes/chip/cmmio/cmmio.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <../base.hpp>
|
||||
#include <../cart/cart.hpp>
|
||||
#include "cmmio.hpp"
|
||||
|
||||
|
||||
void CMMIO::init() {
|
||||
}
|
||||
|
||||
void CMMIO::enable() {
|
||||
memory::mmio.map(0x3000, *this);
|
||||
memory::mmio.map(0x3001, *this);
|
||||
memory::mmio.map(0x3002, *this);
|
||||
memory::mmio.map(0x3004, *this);
|
||||
}
|
||||
|
||||
void CMMIO::power() {
|
||||
reset();
|
||||
}
|
||||
|
||||
void CMMIO::reset() {
|
||||
}
|
||||
|
||||
uint8 CMMIO::mmio_read(unsigned addr) {
|
||||
addr &= 0xffff;
|
||||
printf("CMMIO::mmio_read 0x%x",addr);
|
||||
return cpu.regs.mdr;
|
||||
}
|
||||
|
||||
void CMMIO::mmio_write(unsigned addr, uint8 data) {
|
||||
addr &= 0xffff;
|
||||
printf("CMMIO::mmio_write 0x%x 0x%x",addr,data);
|
||||
}
|
||||
|
||||
CMMIO::CMMIO() {
|
||||
}
|
||||
16
tools/bsnes/chip/cmmio/cmmio.hpp
Normal file
16
tools/bsnes/chip/cmmio/cmmio.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
class CMMIO : public MMIO {
|
||||
public:
|
||||
|
||||
void init();
|
||||
void enable();
|
||||
void power();
|
||||
void reset();
|
||||
|
||||
uint8 mmio_read (unsigned addr);
|
||||
void mmio_write(unsigned addr, uint8 data);
|
||||
|
||||
CMMIO();
|
||||
|
||||
};
|
||||
|
||||
extern CMMIO cmmio;
|
||||
@ -483,6 +483,14 @@ void sCPU::mmio_write(unsigned addr, uint8 data) {
|
||||
port_write(addr & 3, data);
|
||||
return;
|
||||
}
|
||||
printf("sCPU::mmio_write 0x%x 0x%x",addr,data);
|
||||
|
||||
/*custom area*/
|
||||
if((addr & 0xff00) == 0x3000) { //$3000-$30ff
|
||||
printf("sCPU::mmio_write 0x%x 0x%x",addr,data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//DMA
|
||||
if((addr & 0xff80) == 0x4300) { //$4300-$437f
|
||||
|
||||
@ -14,12 +14,18 @@ namespace memory {
|
||||
};
|
||||
|
||||
uint8 UnmappedMemory::read(unsigned) { return cpu.regs.mdr; }
|
||||
void UnmappedMemory::write(unsigned, uint8) {}
|
||||
void UnmappedMemory::write(unsigned addr, uint8 val) {
|
||||
printf("UnmappedMemory::write 0x%x 0x%x\n",addr,val);
|
||||
}
|
||||
|
||||
uint8 UnmappedMMIO::mmio_read(unsigned) { return cpu.regs.mdr; }
|
||||
void UnmappedMMIO::mmio_write(unsigned, uint8) {}
|
||||
void UnmappedMMIO::mmio_write(unsigned addr, uint8 val) {
|
||||
printf("UnmappedMemory::write 0x%x 0x%x\n",addr,val);
|
||||
|
||||
}
|
||||
|
||||
void MMIOAccess::map(unsigned addr, MMIO &access) {
|
||||
//printf("MMIOAccess::map 0x%x\n",addr);
|
||||
//MMIO: $[00-3f]:[2000-5fff]
|
||||
mmio[(addr - 0x2000) & 0x3fff] = &access;
|
||||
}
|
||||
@ -34,7 +40,8 @@ uint8 MMIOAccess::read(unsigned addr) {
|
||||
}
|
||||
|
||||
void MMIOAccess::write(unsigned addr, uint8 data) {
|
||||
//printf("MMIOAccess::write 0x%x %x\n",addr,data);
|
||||
|
||||
printf("MMIOAccess::write 0x%x %x\n",addr,data);
|
||||
mmio[(addr - 0x2000) & 0x3fff]->mmio_write(addr, data);
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,10 @@ void sBus::map_system() {
|
||||
map(MapDirect, 0x00, 0x3f, 0x2000, 0x5fff, memory::mmio);
|
||||
map(MapDirect, 0x80, 0xbf, 0x2000, 0x5fff, memory::mmio);
|
||||
|
||||
map(MapDirect, 0x80, 0xbf, 0x2000, 0x5fff, memory::mmio);
|
||||
/* custom memmap */
|
||||
map(MapDirect, 0x70, 0x7f, 0x0000, 0x01ff, memory::mmio);
|
||||
|
||||
map(MapLinear, 0x00, 0x3f, 0x0000, 0x1fff, memory::wram, 0x000000, 0x002000);
|
||||
map(MapLinear, 0x80, 0xbf, 0x0000, 0x1fff, memory::wram, 0x000000, 0x002000);
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ DSP3 dsp3;
|
||||
DSP4 dsp4;
|
||||
OBC1 obc1;
|
||||
ST010 st010;
|
||||
|
||||
CMMIO cmmio;
|
||||
#include "scheduler/scheduler.cpp"
|
||||
#include "tracer/tracer.cpp"
|
||||
|
||||
@ -56,6 +56,7 @@ void SNES::init() {
|
||||
video.init();
|
||||
audio.init();
|
||||
input.init();
|
||||
cmmio.init();
|
||||
snesinterface.init();
|
||||
}
|
||||
|
||||
@ -95,6 +96,8 @@ void SNES::power() {
|
||||
if(cartridge.has_obc1()) obc1.power();
|
||||
if(cartridge.has_st010()) st010.power();
|
||||
|
||||
cmmio.power();
|
||||
|
||||
for(unsigned i = 0x2100; i <= 0x213f; i++) memory::mmio.map(i, ppu);
|
||||
for(unsigned i = 0x2140; i <= 0x217f; i++) memory::mmio.map(i, cpu);
|
||||
for(unsigned i = 0x2180; i <= 0x2183; i++) memory::mmio.map(i, cpu);
|
||||
@ -117,6 +120,8 @@ void SNES::power() {
|
||||
if(cartridge.has_obc1()) obc1.enable();
|
||||
if(cartridge.has_st010()) st010.enable();
|
||||
|
||||
cmmio.enable();
|
||||
|
||||
input.port_set_device(0, snes.config.controller_port1);
|
||||
input.port_set_device(1, snes.config.controller_port2);
|
||||
input.update();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user