mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-25 16:31:42 +00:00
Reinstated the 16 and 32 kb Atari pagers, and ensured the 6532 always starts in a valid state.
This commit is contained in:
parent
55ce851bb2
commit
e0bca1e37b
@ -130,7 +130,8 @@ template <class T> class MOS6532 {
|
||||
interrupt_status_(0),
|
||||
port_{{.output_mask = 0, .output = 0}, {.output_mask = 0, .output = 0}},
|
||||
a7_interrupt_({.last_port_value = 0, .enabled = false}),
|
||||
interrupt_line_(false)
|
||||
interrupt_line_(false),
|
||||
timer_{.value = 0, .activeShift = 0, .writtenShift = 0, .interrupt_enabled = false}
|
||||
{}
|
||||
|
||||
inline void set_port_did_change(int port)
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "CartridgeUnpaged.hpp"
|
||||
#include "CartridgeCommaVid.hpp"
|
||||
#include "CartridgeAtari8k.hpp"
|
||||
#include "CartridgeAtari16k.hpp"
|
||||
#include "CartridgeAtari32k.hpp"
|
||||
|
||||
using namespace Atari2600;
|
||||
namespace {
|
||||
@ -88,6 +90,20 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) {
|
||||
bus_.reset(new CartridgeAtari8k(target.cartridges.front()->get_segments().front().data));
|
||||
}
|
||||
break;
|
||||
case StaticAnalyser::Atari2600PagingModel::Atari16k:
|
||||
if(target.atari.uses_superchip) {
|
||||
bus_.reset(new CartridgeAtari16kSuperChip(target.cartridges.front()->get_segments().front().data));
|
||||
} else {
|
||||
bus_.reset(new CartridgeAtari16k(target.cartridges.front()->get_segments().front().data));
|
||||
}
|
||||
break;
|
||||
case StaticAnalyser::Atari2600PagingModel::Atari32k:
|
||||
if(target.atari.uses_superchip) {
|
||||
bus_.reset(new CartridgeAtari32kSuperChip(target.cartridges.front()->get_segments().front().data));
|
||||
} else {
|
||||
bus_.reset(new CartridgeAtari32k(target.cartridges.front()->get_segments().front().data));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* if(!target.cartridges.front()->get_segments().size()) return;
|
||||
|
66
Machines/Atari2600/CartridgeAtari16k.hpp
Normal file
66
Machines/Atari2600/CartridgeAtari16k.hpp
Normal file
@ -0,0 +1,66 @@
|
||||
//
|
||||
// CartridgeAtari8k.h
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 18/03/2017.
|
||||
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef Atari2600_CartridgeAtari16k_hpp
|
||||
#define Atari2600_CartridgeAtari16k_hpp
|
||||
|
||||
#include "Cartridge.hpp"
|
||||
|
||||
namespace Atari2600 {
|
||||
|
||||
class CartridgeAtari16k: public Cartridge<CartridgeAtari16k> {
|
||||
public:
|
||||
CartridgeAtari16k(const std::vector<uint8_t> &rom) :
|
||||
Cartridge(rom) {
|
||||
rom_ptr_ = rom_.data();
|
||||
}
|
||||
|
||||
void perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
if(address >= 0x1ff6 && address <= 0x1ff9) rom_ptr_ = rom_.data() + (address - 0x1ff6) * 4096;
|
||||
|
||||
if(isReadOperation(operation)) {
|
||||
*value = rom_ptr_[address & 4095];
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
};
|
||||
|
||||
class CartridgeAtari16kSuperChip: public Cartridge<CartridgeAtari16kSuperChip> {
|
||||
public:
|
||||
CartridgeAtari16kSuperChip(const std::vector<uint8_t> &rom) :
|
||||
Cartridge(rom) {
|
||||
rom_ptr_ = rom_.data();
|
||||
}
|
||||
|
||||
void perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
if(address >= 0x1ff6 && address <= 0x1ff9) rom_ptr_ = rom_.data() + (address - 0x1ff6) * 4096;
|
||||
|
||||
if(isReadOperation(operation)) {
|
||||
*value = rom_ptr_[address & 4095];
|
||||
}
|
||||
|
||||
if(address < 0x1080) ram_[address & 0x7f] = *value;
|
||||
else if(address < 0x1100 && isReadOperation(operation)) *value = ram_[address & 0x7f];
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
uint8_t ram_[128];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* Atari2600_CartridgeAtari16k_hpp */
|
66
Machines/Atari2600/CartridgeAtari32k.hpp
Normal file
66
Machines/Atari2600/CartridgeAtari32k.hpp
Normal file
@ -0,0 +1,66 @@
|
||||
//
|
||||
// CartridgeAtari8k.h
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 18/03/2017.
|
||||
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef Atari2600_CartridgeAtari32k_hpp
|
||||
#define Atari2600_CartridgeAtari32k_hpp
|
||||
|
||||
#include "Cartridge.hpp"
|
||||
|
||||
namespace Atari2600 {
|
||||
|
||||
class CartridgeAtari32k: public Cartridge<CartridgeAtari32k> {
|
||||
public:
|
||||
CartridgeAtari32k(const std::vector<uint8_t> &rom) :
|
||||
Cartridge(rom) {
|
||||
rom_ptr_ = rom_.data();
|
||||
}
|
||||
|
||||
void perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
if(address >= 0x1ff4 && address <= 0x1ffb) rom_ptr_ = rom_.data() + (address - 0x1ff4) * 4096;
|
||||
|
||||
if(isReadOperation(operation)) {
|
||||
*value = rom_ptr_[address & 4095];
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
};
|
||||
|
||||
class CartridgeAtari32kSuperChip: public Cartridge<CartridgeAtari32kSuperChip> {
|
||||
public:
|
||||
CartridgeAtari32kSuperChip(const std::vector<uint8_t> &rom) :
|
||||
Cartridge(rom) {
|
||||
rom_ptr_ = rom_.data();
|
||||
}
|
||||
|
||||
void perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
if(address >= 0x1ff4 && address <= 0x1ffb) rom_ptr_ = rom_.data() + (address - 0x1ff4) * 4096;
|
||||
|
||||
if(isReadOperation(operation)) {
|
||||
*value = rom_ptr_[address & 4095];
|
||||
}
|
||||
|
||||
if(address < 0x1080) ram_[address & 0x7f] = *value;
|
||||
else if(address < 0x1100 && isReadOperation(operation)) *value = ram_[address & 0x7f];
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
uint8_t ram_[128];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* Atari2600_CartridgeAtari32k_hpp */
|
@ -6,8 +6,8 @@
|
||||
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef CartridgeAtari8k_h
|
||||
#define CartridgeAtari8k_h
|
||||
#ifndef Atari2600_CartridgeAtari8k_hpp
|
||||
#define Atari2600_CartridgeAtari8k_hpp
|
||||
|
||||
#include "Cartridge.hpp"
|
||||
|
||||
@ -65,4 +65,4 @@ class CartridgeAtari8kSuperChip: public Cartridge<CartridgeAtari8kSuperChip> {
|
||||
|
||||
}
|
||||
|
||||
#endif /* CartridgeAtari8k_h */
|
||||
#endif /* Atari2600_CartridgeAtari8k_hpp */
|
||||
|
Loading…
Reference in New Issue
Block a user