mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-11 04:28:58 +00:00
Adds decoding of IWM accesses and respect for the ROM overlay bit.
This commit is contained in:
parent
bc9eb82e6f
commit
181b77c490
@ -30,7 +30,8 @@ class ConcreteMachine:
|
|||||||
ConcreteMachine(const ROMMachine::ROMFetcher &rom_fetcher) :
|
ConcreteMachine(const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||||
mc68000_(*this),
|
mc68000_(*this),
|
||||||
video_(ram_.data()),
|
video_(ram_.data()),
|
||||||
via_(via_port_handler_) {
|
via_(via_port_handler_),
|
||||||
|
via_port_handler_(*this) {
|
||||||
|
|
||||||
// Grab a copy of the ROM and convert it into big-endian data.
|
// Grab a copy of the ROM and convert it into big-endian data.
|
||||||
const auto roms = rom_fetcher("Macintosh", { "mac128k.rom" });
|
const auto roms = rom_fetcher("Macintosh", { "mac128k.rom" });
|
||||||
@ -76,18 +77,26 @@ class ConcreteMachine:
|
|||||||
if(cycle.data_select_active()) {
|
if(cycle.data_select_active()) {
|
||||||
printf("IO access to %06x: ", word_address << 1);
|
printf("IO access to %06x: ", word_address << 1);
|
||||||
|
|
||||||
// VIA accesses are via address 0xefe1fe + register*512,
|
switch(word_address & 0x7ff0ff) {
|
||||||
// which at word precision is 0x77f0ff + register*256.
|
case 0x77f0ff:
|
||||||
if((word_address & 0x77f0ff) == 0x77f0ff) {
|
// VIA accesses are via address 0xefe1fe + register*512,
|
||||||
printf("VIA access ");
|
// which at word precision is 0x77f0ff + register*256.
|
||||||
if(cycle.operation & Microcycle::Read) {
|
printf("VIA");
|
||||||
cycle.value->halves.low = via_.get_register(word_address >> 8);
|
if(cycle.operation & Microcycle::Read) {
|
||||||
if(cycle.operation & Microcycle::SelectWord) cycle.value->halves.high = 0xff;
|
cycle.value->halves.low = via_.get_register(word_address >> 8);
|
||||||
} else {
|
if(cycle.operation & Microcycle::SelectWord) cycle.value->halves.high = 0xff;
|
||||||
via_.set_register(word_address >> 8, cycle.value->halves.low);
|
} else {
|
||||||
}
|
via_.set_register(word_address >> 8, cycle.value->halves.low);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x6ff0ff:
|
||||||
|
// IWM
|
||||||
|
printf("IWM");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -163,32 +172,52 @@ class ConcreteMachine:
|
|||||||
synchronous bus.
|
synchronous bus.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void set_rom_is_overlay(bool rom_is_overlay) {
|
||||||
|
ROM_is_overlay_ = rom_is_overlay;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct VIAPortHandler: public MOS::MOS6522::PortHandler {
|
class VIAPortHandler: public MOS::MOS6522::PortHandler {
|
||||||
void set_port_output(MOS::MOS6522::Port port, uint8_t value, uint8_t direction_mask) {
|
public:
|
||||||
/*
|
VIAPortHandler(ConcreteMachine &machine) : machine_(machine) {}
|
||||||
Port A:
|
|
||||||
b7: [input] SCC wait/request (/W/REQA and /W/REQB wired together for a logical OR)
|
|
||||||
b6: 0 = alternate screen buffer, 1 = main screen buffer
|
|
||||||
b5: floppy disk SEL state control (upper/lower head "among other things")
|
|
||||||
b4: 1 = use ROM overlay memory map, 0 = use ordinary memory map
|
|
||||||
b3: 0 = use alternate sound buffer, 1 = use ordinary sound buffer
|
|
||||||
b2–b0: audio output volume
|
|
||||||
|
|
||||||
Port B:
|
void set_port_output(MOS::MOS6522::Port port, uint8_t value, uint8_t direction_mask) {
|
||||||
b7: 0 = sound enabled, 1 = sound disabled
|
/*
|
||||||
b6: [input] 0 = video beam in visible portion of line, 1 = outside
|
Peripheral lines: keyboard data, interrupt configuration.
|
||||||
b5: [input] mouse y2
|
(See p176 [/215])
|
||||||
b4: [input] mouse x2
|
*/
|
||||||
b3: [input] 0 = mouse button down, 1 = up
|
switch(port) {
|
||||||
b2: 0 = real-time clock enabled, 1 = disabled
|
case MOS::MOS6522::Port::A:
|
||||||
b1: clock's data-clock line
|
/*
|
||||||
b0: clock's serial data line
|
Port A:
|
||||||
|
b7: [input] SCC wait/request (/W/REQA and /W/REQB wired together for a logical OR)
|
||||||
|
b6: 0 = alternate screen buffer, 1 = main screen buffer
|
||||||
|
b5: floppy disk SEL state control (upper/lower head "among other things")
|
||||||
|
b4: 1 = use ROM overlay memory map, 0 = use ordinary memory map
|
||||||
|
b3: 0 = use alternate sound buffer, 1 = use ordinary sound buffer
|
||||||
|
b2–b0: audio output volume
|
||||||
|
*/
|
||||||
|
machine_.set_rom_is_overlay(!!(value & 0x10));
|
||||||
|
break;
|
||||||
|
|
||||||
Peripheral lines: keyboard data, interrupt configuration.
|
case MOS::MOS6522::Port::B:
|
||||||
(See p176 [/215])
|
/*
|
||||||
*/
|
Port B:
|
||||||
}
|
b7: 0 = sound enabled, 1 = sound disabled
|
||||||
|
b6: [input] 0 = video beam in visible portion of line, 1 = outside
|
||||||
|
b5: [input] mouse y2
|
||||||
|
b4: [input] mouse x2
|
||||||
|
b3: [input] 0 = mouse button down, 1 = up
|
||||||
|
b2: 0 = real-time clock enabled, 1 = disabled
|
||||||
|
b1: clock's data-clock line
|
||||||
|
b0: clock's serial data line
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ConcreteMachine &machine_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user