Go to the documentation of this file.
49 [[nodiscard]]
static std::shared_ptr<SRAM> getSram(
const DeviceConfig& config)
51 return config.getMotherBoard().getSharedStuff<
SRAM>(
53 config.getAttribute(
"id") +
" SRAM", 0x2000, config);
60 :
MSXRom(config, std::move(rom_))
61 , fsSram(getSram(config))
62 , firmwareSwitch(config)
66 "Rom for FSA1FM mapper must be 1MB in size "
67 "(some dumps are 2MB, those can be used as well).");
78 if ((0x4000 <= address) && (address < 0x6000)) {
80 return rom[(0x2000 * ((*fsSram)[0x1FC4] & 0x0F)) +
82 }
else if ((0x7FC0 <= address) && (address < 0x7FD0)) {
83 switch (address & 0x0F) {
85 return (*fsSram)[address & 0x1FFF];
87 return firmwareSwitch.
getStatus() ? 0xFB : 0xFF;
91 }
else if ((0x6000 <= address) && (address < 0x8000)) {
94 return (*fsSram)[address & 0x1FFF];
110 }
else if ((0x4000 <= address) && (address < 0x6000)) {
112 return &
rom[(0x2000 * ((*fsSram)[0x1FC4] & 0x0F)) +
114 }
else if ((0x6000 <= address) && (address < 0x8000)) {
116 return &(*fsSram)[address & 0x1FFF];
126 if ((0x6000 <= address) && (address < 0x8000)) {
127 if (address == 0x7FC4) {
131 fsSram->write(address & 0x1FFF, value);
140 }
else if ((0x6000 <= address) && (address < 0x8000)) {
148 template<
typename Archive>
152 ar.template serializeBase<MSXDevice>(*
this);
163 , fsSram(getSram(config))
165 reset(EmuTime::dummy());
171 for (
auto region :
xrange(6)) {
172 changeBank(region, 0xA8);
182 if (0xC000 <= address) {
184 }
else if ((control & 0x04) && (0x7FF0 <= address) && (address < 0x7FF8)) {
186 return bankSelect[address & 7];
187 }
else if (isRam[address >> 13]) {
188 return (*fsSram)[address & 0x1FFF];
189 }
else if (isEmpty[address >> 13]) {
203 if (0xC000 <= address) {
207 }
else if (isRam[address >> 13]) {
208 return &(*fsSram)[address & 0x1FFF];
209 }
else if (isEmpty[address >> 13]) {
219 if ((0x6000 <= address) && (address < 0x7FF0)) {
221 switch (address & 0x1C00) {
223 changeBank(2, value);
226 changeBank(0, value);
229 changeBank(3, value);
232 changeBank(1, value);
235 changeBank(4, value);
241 changeBank(5, value);
247 }
else if (address == 0x7FF9) {
250 }
else if (isRam[address >> 13]) {
251 fsSram->write(address & 0x1FFF, value);
257 if ((0x6000 <= address) && (address < 0x8000)) {
259 }
else if (isRam[address >> 13]) {
266 void RomFSA1FM2::changeBank(
byte region,
byte bank)
268 bankSelect[region] = bank;
269 if ((0x80 <= bank) && (bank < 0x90)) {
271 isRam[region] =
true;
272 isEmpty[region] =
false;
274 isRam[region] =
false;
275 isEmpty[region] =
true;
279 isRam[region] =
false;
280 isEmpty[region] =
false;
281 setRom(region, bank & 0x7F);
288 template<
typename Archive>
291 ar.template serializeBase<Rom8kBBlocks>(*
this);
294 ar.serialize(
"SRAM", *fsSram,
295 "bankSelect", bankSelect,
299 for (
auto region :
xrange(8)) {
300 changeBank(region, bankSelect[region]);
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
constexpr auto xrange(T e)
static byte unmappedWrite[0x10000]
void serialize(Archive &ar, unsigned version)
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
RomFSA1FM2(const DeviceConfig &config, Rom &&rom)
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
void setRom(byte region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
void setUnmapped(byte region)
Select 'unmapped' memory for this region.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
RomFSA1FM1(const DeviceConfig &config, Rom &&rom)
void invalidateDeviceRCache()
void invalidateDeviceRWCache()
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is lo...
void serialize(Archive &ar, unsigned version)
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
static byte unmappedRead[0x10000]
uint16_t word
16 bit unsigned integer
void reset(EmuTime::param time) override
This method is called on reset.
void reset(EmuTime::param time) override
This method is called on reset.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
This file implemented 3 utility functions: