1#ifndef ROMBLOCKDEBUGGABLE_HH
2#define ROMBLOCKDEBUGGABLE_HH
17 device.
getName() +
" romblocks",
18 "Shows for each byte of the mapper which memory block is selected.",
30 unsigned startAddress_,
unsigned mappedSize_,
31 unsigned bankSizeShift_,
unsigned debugShift_ = 0)
33 , blockNr(blockNr_.data()), startAddress(startAddress_)
34 , mappedSize(mappedSize_), bankSizeShift(bankSizeShift_)
35 , debugShift(debugShift_), debugMask(~((1 << debugShift) - 1))
37 assert((mappedSize >> bankSizeShift) == blockNr_.size());
40 unsigned startAddress_,
unsigned mappedSize_,
41 unsigned bankSizeShift_,
unsigned debugShift_,
44 , blockNr(blockNr_.data()), startAddress(startAddress_)
45 , mappedSize(mappedSize_), bankSizeShift(bankSizeShift_)
46 , debugShift(debugShift_), debugMask(debugMask_)
48 assert(((mappedSize >> bankSizeShift) & debugMask) < blockNr_.size());
51 [[nodiscard]]
byte read(
unsigned address)
override
53 unsigned addr = address - startAddress;
54 if (addr < mappedSize) {
55 byte tmp = blockNr[(addr >> bankSizeShift) & debugMask];
56 return (tmp != 255) ? (tmp >> debugShift) : tmp;
64 const unsigned startAddress;
65 const unsigned mappedSize;
66 const unsigned bankSizeShift;
67 const unsigned debugShift;
68 const unsigned debugMask;
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
RomBlockDebuggableBase(const MSXDevice &device)
~RomBlockDebuggableBase()=default
RomBlockDebuggable(const MSXDevice &device, std::span< const byte > blockNr_, unsigned startAddress_, unsigned mappedSize_, unsigned bankSizeShift_, unsigned debugShift_=0)
RomBlockDebuggable(const MSXDevice &device, std::span< const byte > blockNr_, unsigned startAddress_, unsigned mappedSize_, unsigned bankSizeShift_, unsigned debugShift_, unsigned debugMask_)
byte read(unsigned address) override
const std::string & getName() const
MSXMotherBoard & getMotherBoard() const
This file implemented 3 utility functions: