-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PC Engine: various improvements * PC Engine CD: started on emulation
- Loading branch information
byuu
committed
Mar 18, 2020
1 parent
1ba817c
commit c45c82e
Showing
36 changed files
with
413 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
components += huc6280 | ||
|
||
objects += pce-interface | ||
objects += pce-cpu pce-vdp pce-psg | ||
objects += pce-cpu pce-vdp pce-psg pce-pcd | ||
objects += pce-system pce-cartridge | ||
objects += pce-controller | ||
|
||
obj/pce-interface.o: pce/interface/interface.cpp | ||
obj/pce-cpu.o: pce/cpu/cpu.cpp | ||
obj/pce-vdp.o: pce/vdp/vdp.cpp | ||
obj/pce-psg.o: pce/psg/psg.cpp | ||
obj/pce-pcd.o: pce/pcd/pcd.cpp | ||
obj/pce-system.o: pce/system/system.cpp | ||
obj/pce-cartridge.o: pce/cartridge/cartridge.cpp | ||
obj/pce-controller.o: pce/controller/controller.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
auto RAM::load(Markup::Node document) -> void { | ||
if(auto memory = document["game/board/memory(type=ROM,content=Program)"]) { | ||
rom.allocate(memory["size"].natural()); | ||
if(auto fp = platform->open(cartridge.node, "program.rom", File::Read, File::Required)) { | ||
rom.load(fp); | ||
} | ||
} | ||
|
||
if(auto memory = document["game/board/memory(type=RAM,content=Save)"]) { | ||
ram.allocate(memory["size"].natural()); | ||
if(auto fp = platform->open(cartridge.node, "save.ram", File::Read)) { | ||
ram.load(fp); | ||
} | ||
} | ||
} | ||
|
||
auto RAM::save(Markup::Node document) -> void { | ||
if(auto memory = document["game/board/memory(type=RAM,content=Save)"]) { | ||
if(auto fp = platform->open(cartridge.node, "save.ram", File::Write)) { | ||
ram.save(fp); | ||
} | ||
} | ||
} | ||
|
||
auto RAM::read(uint8 bank, uint13 address) -> uint8 { | ||
return rom.read(bank << 13 | address); | ||
} | ||
|
||
auto RAM::write(uint8 bank, uint13 address, uint8 data) -> void { | ||
} | ||
|
||
auto RAM::power() -> void { | ||
} | ||
|
||
auto RAM::serialize(serializer& s) -> void { | ||
if(ram) ram.serialize(s); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
struct RAM : Interface { | ||
auto load(Markup::Node) -> void override; | ||
auto save(Markup::Node) -> void override; | ||
auto read(uint8 bank, uint13 address) -> uint8 override; | ||
auto write(uint8 bank, uint13 address, uint8 data) -> void override; | ||
auto power() -> void override; | ||
auto serialize(serializer&) -> void; | ||
|
||
Memory::Readable<uint8> rom; | ||
Memory::Writable<uint8> ram; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
auto SystemCard::load(Markup::Node document) -> void { | ||
if(auto memory = document["game/board/memory(type=ROM,content=Program)"]) { | ||
rom.allocate(memory["size"].natural()); | ||
if(auto fp = platform->open(cartridge.node, "program.rom", File::Read, File::Required)) { | ||
rom.load(fp); | ||
} | ||
} | ||
|
||
if(auto memory = document["game/board/memory(type=RAM,content=Work)"]) { | ||
ram.allocate(memory["size"].natural()); | ||
} | ||
} | ||
|
||
auto SystemCard::save(Markup::Node document) -> void { | ||
} | ||
|
||
auto SystemCard::read(uint8 bank, uint13 address) -> uint8 { | ||
uint8 data = 0xff; | ||
|
||
if(bank >= 0x00 && bank <= 0x3f) { | ||
return rom.read((uint6)bank << 13 | address); | ||
} | ||
|
||
if(bank >= 0x68 && bank <= 0x7f) { | ||
if(!ram) return data; | ||
return ram.read((bank - 0x68) << 13 | address); | ||
} | ||
|
||
return data; | ||
} | ||
|
||
auto SystemCard::write(uint8 bank, uint13 address, uint8 data) -> void { | ||
if(bank >= 0x68 && bank <= 0x7f) { | ||
if(!ram) return; | ||
return ram.write((bank - 0x68) << 13 | address, data); | ||
} | ||
} | ||
|
||
auto SystemCard::power() -> void { | ||
} | ||
|
||
auto SystemCard::serialize(serializer& s) -> void { | ||
if(ram) ram.serialize(s); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
struct SystemCard : Interface { | ||
auto load(Markup::Node) -> void override; | ||
auto save(Markup::Node) -> void override; | ||
auto read(uint8 bank, uint13 address) -> uint8 override; | ||
auto write(uint8 bank, uint13 address, uint8 data) -> void override; | ||
auto power() -> void override; | ||
auto serialize(serializer&) -> void override; | ||
|
||
Memory::Readable<uint8> rom; | ||
Memory::Writable<uint8> ram; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
auto PCD::read(uint4 address) -> uint8 { | ||
//print("* ff:180", hex(address, 1L), "\n"); | ||
|
||
uint8 data = 0xff; | ||
return data; | ||
} | ||
|
||
auto PCD::write(uint4 address, uint8 data) -> void { | ||
//print("* ff:180", hex(address, 1L), " = ", hex(data, 2L), "\n"); | ||
} | ||
|
||
auto PCD::readWRAM(uint16 address) -> uint8 { | ||
return wram.read(address); | ||
} | ||
|
||
auto PCD::writeWRAM(uint16 address, uint8 data) -> void { | ||
return wram.write(address, data); | ||
} | ||
|
||
auto PCD::readBRAM(uint11 address) -> uint8 { | ||
return bram.read(address); | ||
} | ||
|
||
auto PCD::writeBRAM(uint11 address, uint8 data) -> void { | ||
return bram.write(address, data); | ||
} |
Oops, something went wrong.