This commit is contained in:
mkwong98 2017-08-03 18:06:31 +08:00
parent a6e0131a22
commit fb069fdd69
12 changed files with 278 additions and 161 deletions

View file

@ -3458,7 +3458,7 @@
1478602519 source:c:\work\hdnesr\trunk\rewrite\emu\emupart.cpp
"emuPart.h"
1497602883 source:c:\work\hdnesr\trunk\rewrite\gamemanager.cpp
1499416367 source:c:\work\hdnesr\trunk\rewrite\gamemanager.cpp
"gameManager.h"
"core\memBus.h"
"core\cart.h"
@ -3709,24 +3709,24 @@
"../classList.h"
"emuPart.h"
1497585713 source:c:\work\hdnesr\trunk\rewrite\core\cart.cpp
1501733292 source:c:\work\hdnesr\trunk\rewrite\core\cart.cpp
"../common.h"
"cart.h"
"mapper000.h"
"mapper001.h"
"../emu/emuPart.h"
1497960223 c:\work\hdnesr\trunk\rewrite\core\cart.h
1501733117 c:\work\hdnesr\trunk\rewrite\core\cart.h
"corePart.h"
"../classList.h"
1497585507 c:\work\hdnesr\trunk\rewrite\core\mapper001.h
1501727968 c:\work\hdnesr\trunk\rewrite\core\mapper001.h
"cart.h"
1497585713 source:c:\work\hdnesr\trunk\rewrite\core\mapper001.cpp
1501727994 source:c:\work\hdnesr\trunk\rewrite\core\mapper001.cpp
"mapper001.h"
1498274558 source:c:\work\hdnesr\trunk\rewrite\core\membus.cpp
1501727538 source:c:\work\hdnesr\trunk\rewrite\core\membus.cpp
"memBus.h"
"../gameManager.h"
"cart.h"
@ -3735,7 +3735,7 @@
"apu.h"
"gamepad.h"
1498274600 c:\work\hdnesr\trunk\rewrite\core\membus.h
1501729135 c:\work\hdnesr\trunk\rewrite\core\membus.h
"../classList.h"
<corePart.h>
@ -3811,20 +3811,23 @@
1497585507 c:\work\hdnesr\trunk\rewrite\core\apu.h
<corePart.h>
1499400417 source:c:\work\hdnesr\trunk\rewrite\core\cpu.cpp
1499751690 source:c:\work\hdnesr\trunk\rewrite\core\cpu.cpp
"cpu.h"
"memBus.h"
"../gameManager.h"
1499418292 c:\work\hdnesr\trunk\rewrite\core\cpu.h
1499418348 c:\work\hdnesr\trunk\rewrite\core\cpu.h
"../classList.h"
<corePart.h>
1497585507 c:\work\hdnesr\trunk\rewrite\core\ppu.h
1501733745 c:\work\hdnesr\trunk\rewrite\core\ppu.h
"../classList.h"
<corePart.h>
1497585714 source:c:\work\hdnesr\trunk\rewrite\core\ppu.cpp
1501728762 source:c:\work\hdnesr\trunk\rewrite\core\ppu.cpp
"ppu.h"
"cpu.h"
"../gameManager.h"
1478948230 c:\work\hdnesr\trunk\rewrite\emu\input.h
"../classList.h"
@ -3873,10 +3876,10 @@
1497740739 c:\work\hdnes\trunk\rewrite\core\gamepad.h
<corePart.h>
1497585507 c:\work\hdnesr\trunk\rewrite\core\mapper000.h
1501727968 c:\work\hdnesr\trunk\rewrite\core\mapper000.h
<cart.h>
1497600113 source:c:\work\hdnesr\trunk\rewrite\core\mapper000.cpp
1501727994 source:c:\work\hdnesr\trunk\rewrite\core\mapper000.cpp
"mapper000.h"
1497740739 c:\work\hdnes\trunk\rewrite\core\mapper000.h

View file

@ -2,99 +2,39 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="emu\gameFile.h" open="0" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="323" topLine="2" />
</Cursor>
</File>
<File name="core\mapper000.cpp" open="0" top="0" tabpos="27" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="392" topLine="3" />
</Cursor>
</File>
<File name="emu\input.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1949" topLine="0" />
</Cursor>
</File>
<File name="core\mapper001.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="514" topLine="17" />
</Cursor>
</File>
<File name="wx\frmWaitInputImp.cpp" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="core\apu.cpp" open="0" top="0" tabpos="36" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="465" topLine="0" />
</Cursor>
</File>
<File name="emu\emuPart.cpp" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="225" topLine="0" />
</Cursor>
</File>
<File name="core\mapper001.h" open="0" top="0" tabpos="28" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="312" topLine="6" />
</Cursor>
</File>
<File name="emu\gameFile.cpp" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1333" topLine="24" />
</Cursor>
</File>
<File name="core\apu.h" open="0" top="0" tabpos="25" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="emu\gameFile.h" open="0" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="340" topLine="9" />
<Cursor1 position="323" topLine="2" />
</Cursor>
</File>
<File name="core\ppu.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="core\cart.cpp" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="664" topLine="20" />
<Cursor1 position="633" topLine="27" />
</Cursor>
</File>
<File name="core\memBus.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="gameManager.cpp" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="192" topLine="26" />
<Cursor1 position="122" topLine="69" />
</Cursor>
</File>
<File name="emu\emuPart.h" open="0" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="core\corePart.cpp" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="40" topLine="0" />
<Cursor1 position="82" topLine="0" />
</Cursor>
</File>
<File name="core\cpu.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="wx\frmWaitInputImp.h" open="0" top="0" tabpos="17" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1465" topLine="57" />
</Cursor>
</File>
<File name="emu\input.cpp" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10799" topLine="0" />
</Cursor>
</File>
<File name="core\corePart.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="395" topLine="0" />
</Cursor>
</File>
<File name="gameManager.cpp" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1310" topLine="189" />
</Cursor>
</File>
<File name="emu\video.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2316" topLine="92" />
<Cursor1 position="418" topLine="0" />
</Cursor>
</File>
<File name="core\cpu.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="19835" topLine="493" />
<Cursor1 position="20083" topLine="496" />
</Cursor>
<Folding>
<Collapse line="119" />
@ -104,14 +44,9 @@
<Collapse line="298" />
</Folding>
</File>
<File name="emu\audio.h" open="0" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="emu\video.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="476" topLine="7" />
</Cursor>
</File>
<File name="wx\mainFrameImp.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1047" topLine="15" />
<Cursor1 position="595" topLine="13" />
</Cursor>
</File>
<File name="wx\mainFrameImp.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -119,14 +54,44 @@
<Cursor1 position="5515" topLine="159" />
</Cursor>
</File>
<File name="classList.h" open="0" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="wx\mainFrame.cpp" open="0" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="90" topLine="0" />
<Cursor1 position="26945" topLine="586" />
</Cursor>
</File>
<File name="core\gamepad.h" open="0" top="0" tabpos="34" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="wx\mainFrameImp.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="325" topLine="7" />
<Cursor1 position="1047" topLine="15" />
</Cursor>
</File>
<File name="core\memBus.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="699" topLine="18" />
</Cursor>
</File>
<File name="emu\emuPart.h" open="0" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="40" topLine="0" />
</Cursor>
</File>
<File name="emu\input.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1949" topLine="0" />
</Cursor>
</File>
<File name="mainApp.cpp" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="352" topLine="1" />
</Cursor>
</File>
<File name="core\memBus.cpp" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1123" topLine="0" />
</Cursor>
</File>
<File name="mainApp.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="158" topLine="0" />
</Cursor>
</File>
<File name="wx\mainGUI.fbp" open="0" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -134,34 +99,19 @@
<Cursor1 position="74" topLine="0" />
</Cursor>
</File>
<File name="core\mapper000.h" open="0" top="0" tabpos="26" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="emu\video.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="327" topLine="7" />
</Cursor>
</File>
<File name="wx\mainFrame.cpp" open="0" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="26945" topLine="586" />
</Cursor>
</File>
<File name="core\memBus.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="513" topLine="3" />
</Cursor>
</File>
<File name="core\cart.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2105" topLine="0" />
</Cursor>
</File>
<File name="wx\mainFrame.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5968" topLine="171" />
<Cursor1 position="2316" topLine="92" />
</Cursor>
</File>
<File name="core\ppu.cpp" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="753" topLine="27" />
<Cursor1 position="1003" topLine="30" />
</Cursor>
</File>
<File name="core\cpu.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1135" topLine="84" />
</Cursor>
</File>
<File name="gameManager.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -174,39 +124,54 @@
<Cursor1 position="155" topLine="0" />
</Cursor>
</File>
<File name="mainApp.cpp" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="wx\frmWaitInputImp.cpp" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="352" topLine="1" />
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="mainApp.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="core\mapper000.cpp" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="158" topLine="0" />
<Cursor1 position="561" topLine="0" />
</Cursor>
</File>
<File name="core\corePart.cpp" open="0" top="0" tabpos="30" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="core\gamepad.h" open="0" top="0" tabpos="34" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="82" topLine="0" />
<Cursor1 position="325" topLine="7" />
</Cursor>
</File>
<File name="emu\video.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="core\apu.cpp" open="0" top="0" tabpos="36" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="595" topLine="13" />
<Cursor1 position="465" topLine="0" />
</Cursor>
</File>
<File name="core\cart.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="core\apu.h" open="0" top="0" tabpos="25" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="205" topLine="0" />
<Cursor1 position="340" topLine="9" />
</Cursor>
</File>
<File name="wx\frmWaitInputImp.h" open="0" top="0" tabpos="17" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="core\ppu.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="418" topLine="0" />
<Cursor1 position="1180" topLine="40" />
</Cursor>
</File>
<File name="emu\audio.cpp" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="core\cart.h" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="795" topLine="28" />
<Cursor1 position="1278" topLine="39" />
</Cursor>
</File>
<File name="emu\emuPart.cpp" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="225" topLine="0" />
</Cursor>
</File>
<File name="core\corePart.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="395" topLine="0" />
</Cursor>
</File>
<File name="emu\input.cpp" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10799" topLine="0" />
</Cursor>
</File>
<File name="core\gamepad.cpp" open="0" top="0" tabpos="37" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -214,4 +179,39 @@
<Cursor1 position="414" topLine="16" />
</Cursor>
</File>
<File name="core\mapper001.h" open="0" top="0" tabpos="28" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="557" topLine="3" />
</Cursor>
</File>
<File name="core\mapper000.h" open="0" top="0" tabpos="26" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="516" topLine="2" />
</Cursor>
</File>
<File name="wx\mainFrame.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5968" topLine="171" />
</Cursor>
</File>
<File name="core\mapper001.cpp" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="329" topLine="0" />
</Cursor>
</File>
<File name="emu\audio.cpp" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="795" topLine="28" />
</Cursor>
</File>
<File name="classList.h" open="0" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="239" topLine="0" />
</Cursor>
</File>
<File name="emu\audio.h" open="0" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="476" topLine="7" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View file

@ -19,6 +19,35 @@ cart::~cart(){
}
}
Uint8 cart::readPRGData(Uint16 address){
}
void cart::writePRGData(Uint16 address, Uint8 value){
}
Uint8 cart::readCHRData(Uint16 address){
if(chrPageCount > 0){
return readMapperCHRData(address);
}
else{
return chrRAM[address];
}
}
void cart::writeCHRData(Uint16 address, Uint8 value){
}
Uint8 cart::readNameTable(Uint16 address){
return (mirrorPtr[(address & 0x0C00) >> 10])[address & 0x03FF];
}
void cart::writeNameTable(Uint16 address, Uint8 value){
}
cart* cart::getCartFromROMFile(const string& fileName){
fstream romfile;
Uint8 fileType[4];

View file

@ -6,7 +6,7 @@
#define CHR_PAGE_SIZE 0x2000
#define PRG_PAGE_SIZE 0x4000
#define CHR_RAM_SIZE 0x4000
#define CHR_RAM_SIZE 0x2000
#define BATTERY_SIZE 0x2000
@ -17,7 +17,8 @@ class cart : public corePart
Uint8 chrPageCount;
Uint8 prgPageCount;
bool mirrorV;
bool scr4x;
bool scr4x;
Uint8* mirrorPtr[4];
Uint8* prgROM;
Uint8* chrROM;
Uint8* chrRAM;
@ -40,10 +41,17 @@ class cart : public corePart
void loadBat();
void saveBat();
virtual Uint8 readPRGData(Uint16 address) = 0;
virtual void writePRGData(Uint16 address, Uint8 value) = 0;
virtual Uint8 readCHRData(Uint16 address) = 0;
virtual void writeCHRData(Uint16 address, Uint8 value) = 0;
Uint8 readPRGData(Uint16 address);
void writePRGData(Uint16 address, Uint8 value);
Uint8 readCHRData(Uint16 address);
void writeCHRData(Uint16 address, Uint8 value);
Uint8 readNameTable(Uint16 address);
void writeNameTable(Uint16 address, Uint8 value);
virtual Uint8 readMapperPRGData(Uint16 address) = 0;
virtual void writeMapperPRGData(Uint16 address, Uint8 value) = 0;
virtual Uint8 readMapperCHRData(Uint16 address) = 0;
virtual void writeMapperCHRData(Uint16 address, Uint8 value) = 0;
protected:

View file

@ -10,7 +10,7 @@ mapper000::~mapper000()
//dtor
}
Uint8 mapper000::readPRGData(Uint16 address){
Uint8 mapper000::readMapperPRGData(Uint16 address){
if(address & 0x8000){
if(prgPageCount == 1){
return prgROM[address & 0x3FFF];
@ -24,13 +24,13 @@ Uint8 mapper000::readPRGData(Uint16 address){
}
}
void mapper000::writePRGData(Uint16 address, Uint8 value){
void mapper000::writeMapperPRGData(Uint16 address, Uint8 value){
}
Uint8 mapper000::readCHRData(Uint16 address){
Uint8 mapper000::readMapperCHRData(Uint16 address){
}
void mapper000::writeCHRData(Uint16 address, Uint8 value){
void mapper000::writeMapperCHRData(Uint16 address, Uint8 value){
}

View file

@ -16,10 +16,10 @@ class mapper000 : public cart
void init();
void init2();
Uint8 readPRGData(Uint16 address);
void writePRGData(Uint16 address, Uint8 value);
Uint8 readCHRData(Uint16 address);
void writeCHRData(Uint16 address, Uint8 value);
Uint8 readMapperPRGData(Uint16 address);
void writeMapperPRGData(Uint16 address, Uint8 value);
Uint8 readMapperCHRData(Uint16 address);
void writeMapperCHRData(Uint16 address, Uint8 value);
protected:

View file

@ -10,16 +10,16 @@ mapper001::~mapper001()
//dtor
}
Uint8 mapper001::readPRGData(Uint16 address){
Uint8 mapper001::readMapperPRGData(Uint16 address){
}
void mapper001::writePRGData(Uint16 address, Uint8 value){
void mapper001::writeMapperPRGData(Uint16 address, Uint8 value){
}
Uint8 mapper001::readCHRData(Uint16 address){
Uint8 mapper001::readMapperCHRData(Uint16 address){
}
void mapper001::writeCHRData(Uint16 address, Uint8 value){
void mapper001::writeMapperCHRData(Uint16 address, Uint8 value){
}

View file

@ -16,10 +16,10 @@ class mapper001 : public cart
void init();
void init2();
Uint8 readPRGData(Uint16 address);
void writePRGData(Uint16 address, Uint8 value);
Uint8 readCHRData(Uint16 address);
void writeCHRData(Uint16 address, Uint8 value);
Uint8 readMapperPRGData(Uint16 address);
void writeMapperPRGData(Uint16 address, Uint8 value);
Uint8 readMapperCHRData(Uint16 address);
void writeMapperCHRData(Uint16 address, Uint8 value);
protected:

View file

@ -46,6 +46,22 @@ Uint8 memBus::memRead(Uint16 address){
void memBus::memWrite(Uint16 address, Uint8 value){
}
Uint8 memBus::ppuRead(Uint16 address){
if(address < 0x2000){
return rom->readCHRData(address);
}
else if(address < 0x3F00){
return rom->readNameTable(address);
}
else{
return pp->paletteTable[address & 0x001F];
}
}
void memBus::ppuWrite(Uint16 address, Uint8 value){
}
void memBus::reset(){
}

View file

@ -28,6 +28,8 @@ class memBus : public corePart
Uint8 memRead(Uint16 address);
void memWrite(Uint16 address, Uint8 value);
Uint8 ppuRead(Uint16 address);
void ppuWrite(Uint16 address, Uint8 value);
protected:

View file

@ -1,7 +1,11 @@
#include "ppu.h"
#include "cpu.h"
#include "../gameManager.h"
ppu::ppu(){
frameReady = false;
isRendering = false;
}
ppu::~ppu()
@ -10,14 +14,29 @@ ppu::~ppu()
}
Uint8 ppu::readReg(Uint8 idx){
return registers[idx];
if(idx == REG_PPUSTATUS){
//only read bit 5-7
busValue = (busValue & 0x1F) | (registers[idx] & 0xE0);
//clear flag 7
registers[idx] = registers[idx] & 0x7F;
}
else if(idx == REG_OAMDATA || idx == REG_PPUDATA){
busValue = registers[idx];
}
return busValue;
}
void ppu::writeReg(Uint8 idx, Uint8 value){
//skip for certain reg when not ready
if(bootUpCycles && idx == REG_PPUCTRL) return;
registers[idx] = value;
busValue = value;
if(idx == REG_PPUCTRL || idx == REG_PPUMASK || idx == REG_OAMADDR || idx == REG_PPUSCROLL || idx == REG_PPUADDR || idx == REG_PPUDATA){
registers[idx] = value;
}
else if(idx == REG_OAMDATA){
oam[registers[REG_OAMADDR]] = busValue;
++(registers[REG_OAMADDR]);
}
}
Uint8 ppu::read4014(){
@ -29,8 +48,23 @@ void ppu::write4014(Uint8 value){
void ppu::runCycle(){
if(bootUpCycles) --bootUpCycles;
if(renderingY == 241 && renderingX == 1 && (registers[REG_PPUCTRL] & 0x80){
cp->pullNMILow();
//rendering
if(renderingY < 240){
//pre render scan line
}
else if(renderingY == 241){
if(renderingX == 1 && (registers[REG_PPUCTRL] & 0x80)){
cp->pullNMILow();
}
}
else if(renderingY == 261){
if(renderingX == 1){
//clear top 3 bits
registers[REG_PPUSTATUS] = registers[REG_PPUSTATUS] & 0x1F;
}
}
//update x and y at the end of cycle

View file

@ -1,6 +1,7 @@
#ifndef PPU_H
#define PPU_H
#include "../classList.h"
#include <corePart.h>
#define REG_PPUCTRL 0
@ -12,20 +13,44 @@
#define REG_PPUADDR 6
#define REG_PPUDATA 7
#define FLAG_MASK_PPUCTRL_V 0x80
#define FLAG_MASK_PPUCTRL_P 0x40
#define FLAG_MASK_PPUCTRL_H 0x20
#define FLAG_MASK_PPUCTRL_B 0x10
#define FLAG_MASK_PPUCTRL_S 0x08
#define FLAG_MASK_PPUCTRL_I 0x04
#define FLAG_MASK_PPUCTRL_NN 0x03
#define FLAG_MASK_PPUMASK_B 0x80
#define FLAG_MASK_PPUMASK_G 0x40
#define FLAG_MASK_PPUMASK_R 0x20
#define FLAG_MASK_PPUMASK_s 0x10
#define FLAG_MASK_PPUMASK_b 0x08
#define FLAG_MASK_PPUMASK_M 0x04
#define FLAG_MASK_PPUMASK_m 0x02
#define FLAG_MASK_PPUMASK_g 0x02
#define FLAG_MASK_PPUSTATUS_V 0x80
#define FLAG_MASK_PPUSTATUS_S 0x40
#define FLAG_MASK_PPUSTATUS_O 0x20
class ppu : public corePart
{
public:
Uint8 registers[8];
Uint8 reg4014;
Uint8 busValue;
Uint8 busValue; //_io_db
Uint8 addressLatch;
bool frameReady;
bool oddFrame;
bool isRendering;
Uint16 bootUpCycles;
Uint16 renderingX;
Uint16 renderingY;
Uint8 tableValues[0x4000];
Uint8 nameTable1[0x400];
Uint8 nameTable2[0x400];
Uint8 paletteTable[0x20];
Uint8 oam[256];
memBus* mb;