mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-17 17:29:58 +00:00
Merge pull request #1080 from TomHarte/AtariSTRAM
Provide 1mb and 4mb options for Atari ST memory size.
This commit is contained in:
commit
fb83603133
@ -17,7 +17,18 @@ namespace Static {
|
||||
namespace AtariST {
|
||||
|
||||
struct Target: public Analyser::Static::Target, public Reflection::StructImpl<Target> {
|
||||
Target() : Analyser::Static::Target(Machine::AtariST) {}
|
||||
ReflectableEnum(MemorySize,
|
||||
FiveHundredAndTwelveKilobytes,
|
||||
OneMegabyte,
|
||||
FourMegabytes);
|
||||
MemorySize memory_size = MemorySize::OneMegabyte;
|
||||
|
||||
Target() : Analyser::Static::Target(Machine::AtariST) {
|
||||
if(needs_declare()) {
|
||||
DeclareField(memory_size);
|
||||
AnnounceEnum(MemorySize);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -595,10 +595,10 @@ Instruction Decoder<model, validate_reserved_bits>::decode(uint32_t opcode) {
|
||||
return Instruction(opcode);
|
||||
}
|
||||
|
||||
template class InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC601, true>;
|
||||
template class InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC603, true>;
|
||||
template class InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC620, true>;
|
||||
template struct InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC601, true>;
|
||||
template struct InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC603, true>;
|
||||
template struct InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC620, true>;
|
||||
|
||||
template class InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC601, false>;
|
||||
template class InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC603, false>;
|
||||
template class InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC620, false>;
|
||||
template struct InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC601, false>;
|
||||
template struct InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC603, false>;
|
||||
template struct InstructionSet::PowerPC::Decoder<InstructionSet::PowerPC::Model::MPC620, false>;
|
||||
|
@ -35,12 +35,14 @@
|
||||
#include "../../Utility/MemoryPacker.hpp"
|
||||
#include "../../Utility/MemoryFuzzer.hpp"
|
||||
|
||||
#include "../../../Analyser/Static/AtariST/Target.hpp"
|
||||
|
||||
namespace Atari {
|
||||
namespace ST {
|
||||
|
||||
constexpr int CLOCK_RATE = 8021247;
|
||||
|
||||
using Target = Analyser::Static::Target;
|
||||
using Target = Analyser::Static::AtariST::Target;
|
||||
class ConcreteMachine:
|
||||
public Atari::ST::Machine,
|
||||
public CPU::MC68000Mk2::BusHandler,
|
||||
@ -70,10 +72,25 @@ class ConcreteMachine:
|
||||
set_clock_rate(CLOCK_RATE);
|
||||
speaker_.set_input_rate(float(CLOCK_RATE) / 4.0f);
|
||||
|
||||
ram_.resize(512 * 1024); // i.e. 512kb
|
||||
video_->set_ram(reinterpret_cast<uint16_t *>(ram_.data()), ram_.size());
|
||||
switch(target.memory_size) {
|
||||
default:
|
||||
case Target::MemorySize::FiveHundredAndTwelveKilobytes:
|
||||
ram_.resize(512 * 1024);
|
||||
break;
|
||||
case Target::MemorySize::OneMegabyte:
|
||||
ram_.resize(1024 * 1024);
|
||||
break;
|
||||
case Target::MemorySize::FourMegabytes:
|
||||
ram_.resize(4 * 1024 * 1024);
|
||||
break;
|
||||
}
|
||||
Memory::Fuzz(ram_);
|
||||
|
||||
video_->set_ram(
|
||||
reinterpret_cast<uint16_t *>(ram_.data()),
|
||||
ram_.size() >> 1
|
||||
);
|
||||
|
||||
constexpr ROM::Name rom_name = ROM::Name::AtariSTTOS100;
|
||||
ROM::Request request(rom_name);
|
||||
auto roms = rom_fetcher(request);
|
||||
@ -685,7 +702,12 @@ class ConcreteMachine:
|
||||
using namespace Atari::ST;
|
||||
|
||||
Machine *Machine::AtariST(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) {
|
||||
return new ConcreteMachine(*target, rom_fetcher);
|
||||
auto *const atari_target = dynamic_cast<const Analyser::Static::AtariST::Target *>(target);
|
||||
if(!atari_target) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new ConcreteMachine(*atari_target, rom_fetcher);
|
||||
}
|
||||
|
||||
Machine::~Machine() {}
|
||||
|
@ -130,8 +130,9 @@ Video::Video() :
|
||||
crt_.set_visible_area(crt_.get_rect_for_area(33, 260, 440, 1700, 4.0f / 3.0f));
|
||||
}
|
||||
|
||||
void Video::set_ram(uint16_t *ram, size_t) {
|
||||
void Video::set_ram(uint16_t *ram, size_t size) {
|
||||
ram_ = ram;
|
||||
ram_mask_ = int(size - 1);
|
||||
}
|
||||
|
||||
void Video::set_scan_target(Outputs::Display::ScanTarget *scan_target) {
|
||||
@ -202,7 +203,7 @@ void Video::run_for(HalfCycles duration) {
|
||||
const int end_column = (since_load + run_length - 1) >> 3;
|
||||
|
||||
while(start_column != end_column) {
|
||||
data_latch_[data_latch_position_] = ram_[current_address_ & 262143];
|
||||
data_latch_[data_latch_position_] = ram_[current_address_ & ram_mask_];
|
||||
data_latch_position_ = (data_latch_position_ + 1) & 127;
|
||||
++current_address_;
|
||||
++start_column;
|
||||
|
@ -37,7 +37,7 @@ class Video {
|
||||
Video();
|
||||
|
||||
/*!
|
||||
Sets the memory pool that provides video, and its size.
|
||||
Sets the memory pool that provides video, and its size in words.
|
||||
*/
|
||||
void set_ram(uint16_t *, size_t size);
|
||||
|
||||
@ -138,6 +138,7 @@ class Video {
|
||||
int current_address_ = 0;
|
||||
|
||||
uint16_t *ram_ = nullptr;
|
||||
int ram_mask_ = 0;
|
||||
|
||||
int x_ = 0, y_ = 0, next_y_ = 0;
|
||||
bool load_ = false;
|
||||
|
@ -128,7 +128,7 @@ typedef int Kilobytes;
|
||||
- (instancetype)initWithAmstradCPCModel:(CSMachineCPCModel)model;
|
||||
- (instancetype)initWithAppleIIModel:(CSMachineAppleIIModel)model diskController:(CSMachineAppleIIDiskController)diskController;
|
||||
- (instancetype)initWithAppleIIgsModel:(CSMachineAppleIIgsModel)model memorySize:(Kilobytes)memorySize;
|
||||
- (instancetype)initWithAtariSTModel:(CSMachineAtariSTModel)model;
|
||||
- (instancetype)initWithAtariSTModel:(CSMachineAtariSTModel)model memorySize:(Kilobytes)memorySize;
|
||||
- (instancetype)initWithElectronDFS:(BOOL)dfs adfs:(BOOL)adfs ap6:(BOOL)ap6 sidewaysRAM:(BOOL)sidewaysRAM;
|
||||
- (instancetype)initWithEnterpriseModel:(CSMachineEnterpriseModel)model speed:(CSMachineEnterpriseSpeed)speed exosVersion:(CSMachineEnterpriseEXOS)exosVersion basicVersion:(CSMachineEnterpriseBASIC)basicVersion dos:(CSMachineEnterpriseDOS)dos;
|
||||
- (instancetype)initWithMacintoshModel:(CSMachineMacintoshModel)model;
|
||||
|
@ -135,11 +135,16 @@
|
||||
}
|
||||
|
||||
|
||||
- (instancetype)initWithAtariSTModel:(CSMachineAtariSTModel)model {
|
||||
- (instancetype)initWithAtariSTModel:(CSMachineAtariSTModel)model memorySize:(Kilobytes)memorySize {
|
||||
self = [super init];
|
||||
if(self) {
|
||||
using Target = Analyser::Static::AtariST::Target;
|
||||
auto target = std::make_unique<Target>();
|
||||
switch(memorySize) {
|
||||
default: target->memory_size = Target::MemorySize::FiveHundredAndTwelveKilobytes; break;
|
||||
case 1024: target->memory_size = Target::MemorySize::OneMegabyte; break;
|
||||
case 4096: target->memory_size = Target::MemorySize::FourMegabytes; break;
|
||||
}
|
||||
_targets.push_back(std::move(target));
|
||||
}
|
||||
return self;
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19529"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@ -300,22 +300,39 @@ Gw
|
||||
</tabViewItem>
|
||||
<tabViewItem label="Atari ST" identifier="atarist" id="a6Y-mx-yFn">
|
||||
<view key="view" id="nnv-Wi-7hc">
|
||||
<rect key="frame" x="10" y="7" width="400" height="223"/>
|
||||
<rect key="frame" x="10" y="7" width="400" height="222"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nLf-LI-nWO">
|
||||
<rect key="frame" x="18" y="187" width="364" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="At present only a 512k Atari ST is supported." id="gBA-ke-mur">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dKg-qC-BBF">
|
||||
<rect key="frame" x="18" y="184" width="58" height="16"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Memory:" id="ZBF-0r-RNK">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QD0-qk-qCa">
|
||||
<rect key="frame" x="79" y="178" width="80" height="25"/>
|
||||
<popUpButtonCell key="cell" type="push" title="512 kb" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" tag="512" imageScaling="axesIndependently" inset="2" selectedItem="LVX-CI-lo9" id="dSS-yv-CDV">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="jsD-9U-bwN">
|
||||
<items>
|
||||
<menuItem title="512 kb" tag="512" id="LVX-CI-lo9"/>
|
||||
<menuItem title="1 mb" state="on" tag="1024" id="jMF-5n-E33"/>
|
||||
<menuItem title="4 mb" tag="4096" id="Z77-x8-Hzh"/>
|
||||
</items>
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="nLf-LI-nWO" firstAttribute="leading" secondItem="nnv-Wi-7hc" secondAttribute="leading" constant="20" symbolic="YES" id="EIm-9Q-Rcj"/>
|
||||
<constraint firstItem="nLf-LI-nWO" firstAttribute="top" secondItem="nnv-Wi-7hc" secondAttribute="top" constant="20" symbolic="YES" id="f9w-Lj-5dn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="nLf-LI-nWO" secondAttribute="trailing" constant="20" symbolic="YES" id="m3L-Nx-Aqz"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="QD0-qk-qCa" secondAttribute="trailing" constant="20" symbolic="YES" id="2Ui-SB-1wY"/>
|
||||
<constraint firstItem="dKg-qC-BBF" firstAttribute="centerY" secondItem="QD0-qk-qCa" secondAttribute="centerY" id="8tu-sO-8Ob"/>
|
||||
<constraint firstItem="QD0-qk-qCa" firstAttribute="top" secondItem="nnv-Wi-7hc" secondAttribute="top" constant="20" symbolic="YES" id="AIX-7g-VAr"/>
|
||||
<constraint firstItem="QD0-qk-qCa" firstAttribute="leading" secondItem="dKg-qC-BBF" secondAttribute="trailing" constant="8" symbolic="YES" id="EW6-qd-vjy"/>
|
||||
<constraint firstItem="QD0-qk-qCa" firstAttribute="leading" secondItem="dKg-qC-BBF" secondAttribute="trailing" constant="8" symbolic="YES" id="bCB-i4-OhD"/>
|
||||
<constraint firstItem="dKg-qC-BBF" firstAttribute="leading" secondItem="nnv-Wi-7hc" secondAttribute="leading" constant="20" symbolic="YES" id="pDt-6K-6iz"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</tabViewItem>
|
||||
@ -959,6 +976,7 @@ Gw
|
||||
<outlet property="appleIIModelButton" destination="jli-ac-Sij" id="Jm3-f7-C17"/>
|
||||
<outlet property="appleIIgsMemorySizeButton" destination="nQa-YS-utT" id="pTV-XL-zX3"/>
|
||||
<outlet property="appleIIgsModelButton" destination="gcS-uy-mzl" id="Jcc-jC-cV1"/>
|
||||
<outlet property="atariSTMemorySizeButton" destination="QD0-qk-qCa" id="aKa-L6-2Te"/>
|
||||
<outlet property="cpcModelTypeButton" destination="2zv-Zo-rmO" id="F4C-b2-eS0"/>
|
||||
<outlet property="electronADFSButton" destination="945-wU-JOH" id="Fjm-W8-kvh"/>
|
||||
<outlet property="electronAP6Button" destination="cG2-Ph-S3Z" id="vkq-1J-KBG"/>
|
||||
|
@ -31,6 +31,9 @@ class MachinePicker: NSObject, NSTableViewDataSource, NSTableViewDelegate {
|
||||
@IBOutlet var appleIIgsModelButton: NSPopUpButton!
|
||||
@IBOutlet var appleIIgsMemorySizeButton: NSPopUpButton!
|
||||
|
||||
// MARK: - Atari ST properties
|
||||
@IBOutlet var atariSTMemorySizeButton: NSPopUpButton!
|
||||
|
||||
// MARK: - CPC properties
|
||||
@IBOutlet var cpcModelTypeButton: NSPopUpButton!
|
||||
|
||||
@ -108,6 +111,9 @@ class MachinePicker: NSObject, NSTableViewDataSource, NSTableViewDelegate {
|
||||
appleIIgsModelButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.appleIIgsModel"))
|
||||
appleIIgsMemorySizeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.appleIIgsMemorySize"))
|
||||
|
||||
// Atari ST settings
|
||||
atariSTMemorySizeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.atariSTMemorySize"))
|
||||
|
||||
// CPC settings
|
||||
cpcModelTypeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.cpcModel"))
|
||||
|
||||
@ -169,6 +175,9 @@ class MachinePicker: NSObject, NSTableViewDataSource, NSTableViewDelegate {
|
||||
standardUserDefaults.set(appleIIgsModelButton.selectedTag(), forKey: "new.appleIIgsModel")
|
||||
standardUserDefaults.set(appleIIgsMemorySizeButton.selectedTag(), forKey: "new.appleIIgsMemorySize")
|
||||
|
||||
// Atari ST settings
|
||||
standardUserDefaults.set(atariSTMemorySizeButton.selectedTag(), forKey: "new.atariSTMemorySize")
|
||||
|
||||
// CPC settings
|
||||
standardUserDefaults.set(cpcModelTypeButton.selectedTag(), forKey: "new.cpcModel")
|
||||
|
||||
@ -275,7 +284,8 @@ class MachinePicker: NSObject, NSTableViewDataSource, NSTableViewDelegate {
|
||||
return CSStaticAnalyser(appleIIgsModel: model, memorySize: memorySize)
|
||||
|
||||
case "atarist":
|
||||
return CSStaticAnalyser(atariSTModel: .model512k)
|
||||
let memorySize = Kilobytes(atariSTMemorySizeButton.selectedTag())
|
||||
return CSStaticAnalyser(atariSTModel: .model512k, memorySize: memorySize)
|
||||
|
||||
case "cpc":
|
||||
switch cpcModelTypeButton.selectedTag() {
|
||||
|
@ -1069,7 +1069,11 @@ void MainWindow::start_atariST() {
|
||||
using Target = Analyser::Static::AtariST::Target;
|
||||
auto target = std::make_unique<Target>();
|
||||
|
||||
/* There are no options yet for an Atari ST. */
|
||||
switch(ui->atariSTRAMComboBox->currentIndex()) {
|
||||
default: target->memory_size = Target::MemorySize::FiveHundredAndTwelveKilobytes; break;
|
||||
case 1: target->memory_size = Target::MemorySize::OneMegabyte; break;
|
||||
case 2: target->memory_size = Target::MemorySize::FourMegabytes; break;
|
||||
}
|
||||
|
||||
launchTarget(std::move(target));
|
||||
}
|
||||
@ -1274,7 +1278,8 @@ void MainWindow::launchTarget(std::unique_ptr<Analyser::Static::Target> &&target
|
||||
/* Amstrad CPC. */ \
|
||||
ComboBox(amstradCPCModelComboBox, "amstradcpc.model"); \
|
||||
\
|
||||
/* Atari ST: nothing */ \
|
||||
/* Atari ST. */ \
|
||||
ComboBox(atariSTRAMComboBox, "atarist.memorySize"); \
|
||||
\
|
||||
/* Electron. */ \
|
||||
CheckBox(electronDFSCheckBox, "electron.hasDFS"); \
|
||||
|
@ -343,12 +343,39 @@
|
||||
<string>Atari ST</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout">
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>At present only a 512k Atari ST is supported.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>RAM:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="atariSTRAMComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>512 kb</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1 mb</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4 mb</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user