Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mega-CD quick fixes #166

Merged
merged 2 commits into from
Mar 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion higan/md/mcd/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ auto MCD::GPU::start() -> void {
if(mcd.io.wramMode) return; //must be in 2mbit WRAM mode

active = 1;
period = 4 * 5 * image.hdots;
period = 5 * image.hdots;
counter = 0;

image.address = (image.base << 1) + image.offset;
Expand Down
4 changes: 2 additions & 2 deletions higan/md/mcd/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ auto MCD::readIO(uint1 upper, uint1 lower, uint24 address, uint16 data) -> uint1
}

if(address == 0xff8030) {
data.bit(0, 7) = timer.counter;
data.bit(0, 7) = timer.setpoint;
data.bit(8,15) = Unmapped;
}

Expand Down Expand Up @@ -251,7 +251,7 @@ auto MCD::writeIO(uint1 upper, uint1 lower, uint24 address, uint16 data) -> void

if(address == 0xff8030) {
if(lower) {
timer.counter = data.byte(0);
timer.counter = timer.setpoint = data.byte(0);
}
}

Expand Down
1 change: 1 addition & 0 deletions higan/md/mcd/mcd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ struct MCD : M68K, Thread {

IRQ irq;
uint8 counter;
uint8 setpoint;
} timer;

struct GPU {
Expand Down
1 change: 1 addition & 0 deletions higan/md/mcd/serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ auto MCD::CDD::serialize(serializer& s) -> void {
auto MCD::Timer::serialize(serializer& s) -> void {
irq.serialize(s);
s.integer(counter);
s.integer(setpoint);
}

auto MCD::GPU::serialize(serializer& s) -> void {
Expand Down
5 changes: 3 additions & 2 deletions higan/md/mcd/timer.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
auto MCD::Timer::clock() -> void {
if(counter && !--counter) {
if(setpoint && !--counter) {
irq.raise();
counter = setpoint;
}
}

auto MCD::Timer::power(bool reset) -> void {
irq = {};
counter = 0;
counter = setpoint = 0;
}