memory_card: fixed off by one in card numbering

This commit is contained in:
Jakub Czekański 2021-11-18 15:31:57 +01:00
parent b568e6712f
commit dd517d8843
2 changed files with 2 additions and 2 deletions

View file

@ -5,7 +5,7 @@ namespace peripherals {
enum class Type { None, Digital, Analog, Mouse, MemoryCard };
struct AbstractDevice {
Type type;
int port; // Physical port number
int port; // Physical port number (numbered from 1..n)
int state = 0;
AbstractDevice(Type type, int port);

View file

@ -150,7 +150,7 @@ uint8_t MemoryCard::handleWrite(uint8_t byte) {
state = 0;
command = Command::None;
bus.notify(Event::Controller::MemoryCardContentsChanged{port});
bus.notify(Event::Controller::MemoryCardContentsChanged{port - 1});
return static_cast<uint8_t>(writeStatus);