mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-27 06:35:04 +00:00
I need to get a bit more definitive on naming but this gets all the way to setting a configuration upon an Electron.
This commit is contained in:
commit
21e5f407d8
@ -458,9 +458,17 @@ void Machine::synchronise()
|
||||
update_audio();
|
||||
}
|
||||
|
||||
void Machine::set_tape(std::shared_ptr<Storage::Tape::Tape> tape)
|
||||
void Machine::configure_as_target(const StaticAnalyser::Target &target)
|
||||
{
|
||||
_tape.set_tape(tape);
|
||||
if(target.tapes.size())
|
||||
{
|
||||
_tape.set_tape(target.tapes.front());
|
||||
}
|
||||
|
||||
if(target.loadingCommand.length()) // TODO: and automatic loading option enabled
|
||||
{
|
||||
set_typer_for_string(target.loadingCommand.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Machine::set_rom(ROMSlot slot, size_t length, const uint8_t *data)
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "../../Processors/6502/CPU6502.hpp"
|
||||
#include "../../Storage/Tape/Tape.hpp"
|
||||
#include "../../StaticAnalyser/StaticAnalyser.hpp"
|
||||
|
||||
#include "../CRTMachine.hpp"
|
||||
#include "../Typer.hpp"
|
||||
@ -145,7 +146,8 @@ class Machine:
|
||||
Machine();
|
||||
|
||||
void set_rom(ROMSlot slot, size_t length, const uint8_t *data);
|
||||
void set_tape(std::shared_ptr<Storage::Tape::Tape> tape);
|
||||
void configure_as_target(const StaticAnalyser::Target &target);
|
||||
// void set_tape(std::shared_ptr<Storage::Tape::Tape> tape);
|
||||
|
||||
void set_key_state(Key key, bool isPressed);
|
||||
void clear_all_keys();
|
||||
|
@ -41,6 +41,7 @@
|
||||
4B55CE5D1C3B7D6F0093A61B /* CSOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55CE5C1C3B7D6F0093A61B /* CSOpenGLView.m */; };
|
||||
4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */; };
|
||||
4B643F3A1D77AD1900D431D6 /* CSStaticAnalyser.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B643F391D77AD1900D431D6 /* CSStaticAnalyser.mm */; };
|
||||
4B643F3F1D77B88000D431D6 /* DocumentController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B643F3E1D77B88000D431D6 /* DocumentController.swift */; };
|
||||
4B69FB3D1C4D908A00B5F0AA /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB3B1C4D908A00B5F0AA /* Tape.cpp */; };
|
||||
4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */; };
|
||||
4B69FB461C4D950F00B5F0AA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B69FB451C4D950F00B5F0AA /* libz.tbd */; };
|
||||
@ -438,6 +439,7 @@
|
||||
4B643F381D77AD1900D431D6 /* CSStaticAnalyser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSStaticAnalyser.h; path = StaticAnalyser/CSStaticAnalyser.h; sourceTree = "<group>"; };
|
||||
4B643F391D77AD1900D431D6 /* CSStaticAnalyser.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CSStaticAnalyser.mm; path = StaticAnalyser/CSStaticAnalyser.mm; sourceTree = "<group>"; };
|
||||
4B643F3C1D77AE5C00D431D6 /* CSMachine+Target.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CSMachine+Target.h"; sourceTree = "<group>"; };
|
||||
4B643F3E1D77B88000D431D6 /* DocumentController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DocumentController.swift; sourceTree = "<group>"; };
|
||||
4B69FB3B1C4D908A00B5F0AA /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tape.cpp; sourceTree = "<group>"; };
|
||||
4B69FB3C1C4D908A00B5F0AA /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Tape.hpp; sourceTree = "<group>"; };
|
||||
4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TapeUEF.cpp; sourceTree = "<group>"; };
|
||||
@ -880,13 +882,13 @@
|
||||
children = (
|
||||
4BBC34241D2208B100FFC9DF /* CSFastLoading.h */,
|
||||
4B2A53931D117D36003C6002 /* CSKeyboardMachine.h */,
|
||||
4B2A53941D117D36003C6002 /* CSMachine+Subclassing.h */,
|
||||
4B2A53951D117D36003C6002 /* CSMachine.h */,
|
||||
4B2A53961D117D36003C6002 /* CSMachine.mm */,
|
||||
4B2A53971D117D36003C6002 /* KeyCodes.h */,
|
||||
4B2A53981D117D36003C6002 /* Wrappers */,
|
||||
4B643F3B1D77AD6D00D431D6 /* StaticAnalyser */,
|
||||
4B2A53941D117D36003C6002 /* CSMachine+Subclassing.h */,
|
||||
4B643F3C1D77AE5C00D431D6 /* CSMachine+Target.h */,
|
||||
4B2A53971D117D36003C6002 /* KeyCodes.h */,
|
||||
4B2A53961D117D36003C6002 /* CSMachine.mm */,
|
||||
4B643F3B1D77AD6D00D431D6 /* StaticAnalyser */,
|
||||
4B2A53981D117D36003C6002 /* Wrappers */,
|
||||
);
|
||||
path = Machine;
|
||||
sourceTree = "<group>";
|
||||
@ -1012,6 +1014,14 @@
|
||||
name = StaticAnalyser;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4B643F3D1D77B88000D431D6 /* Document Controller */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4B643F3E1D77B88000D431D6 /* DocumentController.swift */,
|
||||
);
|
||||
path = "Document Controller";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4B69FB391C4D908A00B5F0AA /* Storage */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -1403,16 +1413,17 @@
|
||||
4BB73EA01B587A5100552FC2 /* Clock Signal */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4BE5F85A1C3E1C2500C43F01 /* Resources */,
|
||||
4BB73ECF1B587A6700552FC2 /* Clock Signal.entitlements */,
|
||||
4B1414501B58848C00E04248 /* ClockSignal-Bridging-Header.h */,
|
||||
4BB73EAA1B587A5100552FC2 /* MainMenu.xib */,
|
||||
4BB73EAD1B587A5100552FC2 /* Info.plist */,
|
||||
4BB73EA11B587A5100552FC2 /* AppDelegate.swift */,
|
||||
4BB73EA81B587A5100552FC2 /* Assets.xcassets */,
|
||||
4BB73EAA1B587A5100552FC2 /* MainMenu.xib */,
|
||||
4B2A538F1D117D36003C6002 /* Audio */,
|
||||
4B643F3D1D77B88000D431D6 /* Document Controller */,
|
||||
4B55CE551C3B7D360093A61B /* Documents */,
|
||||
4B2A53921D117D36003C6002 /* Machine */,
|
||||
4BE5F85A1C3E1C2500C43F01 /* Resources */,
|
||||
4BD5F1961D1352A000631CD1 /* Updater */,
|
||||
4B55CE5A1C3B7D6F0093A61B /* Views */,
|
||||
);
|
||||
@ -2010,6 +2021,7 @@
|
||||
4BD14B111D74627C0088EAD6 /* AcornAnalyser.cpp in Sources */,
|
||||
4BBF99151C8FBA6F0075DAFB /* CRTOpenGL.cpp in Sources */,
|
||||
4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */,
|
||||
4B643F3F1D77B88000D431D6 /* DocumentController.swift in Sources */,
|
||||
4BB697C71D4B558F00248BDF /* Factors.cpp in Sources */,
|
||||
4B55CE591C3B7D360093A61B /* ElectronDocument.swift in Sources */,
|
||||
4B4DC82B1D2C27A4003C5BF8 /* SerialBus.cpp in Sources */,
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
|
||||
</dependencies>
|
||||
@ -13,6 +13,7 @@
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Clock_Signal" customModuleProvider="target"/>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
<customObject id="SOe-RA-8of" customClass="DocumentController" customModule="Clock_Signal" customModuleProvider="target"/>
|
||||
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||
<items>
|
||||
<menuItem title="Clock Signal" id="1Xt-HY-uBw">
|
||||
|
@ -10,6 +10,8 @@
|
||||
#import "CSElectron.h"
|
||||
#import "CSVic20.h"
|
||||
|
||||
#import "CSStaticAnalyser.h"
|
||||
|
||||
#import "CSOpenGLView.h"
|
||||
#import "CSAudioQueue.h"
|
||||
#import "CSBestEffortUpdater.h"
|
||||
|
@ -0,0 +1,25 @@
|
||||
//
|
||||
// DocumentController.swift
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 18/06/2016.
|
||||
// Copyright © 2016 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class DocumentController: NSDocumentController {
|
||||
override func makeDocumentWithContentsOfURL(url: NSURL, ofType typeName: String) throws -> NSDocument {
|
||||
if let analyser = CSStaticAnalyser(fileAtURL: url) {
|
||||
if let documentClass = analyser.documentClass as? NSDocument.Type {
|
||||
let document = documentClass.init()
|
||||
if let machineDocument = document as? MachineDocument {
|
||||
machineDocument.configureAs(analyser)
|
||||
return machineDocument
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return try! super.makeDocumentWithContentsOfURL(url, ofType: typeName)
|
||||
}
|
||||
}
|
@ -44,9 +44,11 @@ class ElectronDocument: MachineDocument {
|
||||
return "ElectronDocument"
|
||||
}
|
||||
|
||||
override func readFromURL(url: NSURL, ofType typeName: String) throws {
|
||||
electron.analyse(url)
|
||||
override func configureAs(analysis: CSStaticAnalyser) {
|
||||
analysis.applyToMachine(electron)
|
||||
}
|
||||
|
||||
/* override func readFromURL(url: NSURL, ofType typeName: String) throws {
|
||||
if let pathExtension = url.pathExtension {
|
||||
switch pathExtension.lowercaseString {
|
||||
case "uef":
|
||||
@ -65,7 +67,7 @@ class ElectronDocument: MachineDocument {
|
||||
electron.setROM(plus1ROM, slot: 12)
|
||||
}
|
||||
electron.setROM(data, slot: 15)
|
||||
}
|
||||
}*/
|
||||
|
||||
// MARK: IBActions
|
||||
@IBOutlet var displayTypeButton: NSPopUpButton?
|
||||
|
@ -98,6 +98,10 @@ class MachineDocument:
|
||||
super.close()
|
||||
}
|
||||
|
||||
// MARK: configuring
|
||||
func configureAs(analysis: CSStaticAnalyser) {
|
||||
}
|
||||
|
||||
// MARK: the pasteboard
|
||||
func paste(sender: AnyObject!) {
|
||||
let pasteboard = NSPasteboard.generalPasteboard()
|
||||
|
@ -12,6 +12,7 @@
|
||||
#import "CSMachine+Target.h"
|
||||
#import "Clock_Signal-Swift.h"
|
||||
#include "StaticAnalyser.hpp"
|
||||
#import "CSMachine+Subclassing.h"
|
||||
|
||||
@implementation CSStaticAnalyser
|
||||
{
|
||||
|
@ -10,14 +10,13 @@
|
||||
#import "CSKeyboardMachine.h"
|
||||
#import "CSFastLoading.h"
|
||||
|
||||
@class CSStaticAnalyser;
|
||||
|
||||
@interface CSElectron : CSMachine <CSKeyboardMachine, CSFastLoading>
|
||||
|
||||
- (void)setOSROM:(nonnull NSData *)rom;
|
||||
- (void)setBASICROM:(nonnull NSData *)rom;
|
||||
- (void)setROM:(nonnull NSData *)rom slot:(int)slot;
|
||||
- (BOOL)openUEFAtURL:(nonnull NSURL *)URL;
|
||||
|
||||
- (void)analyse:(nonnull NSURL *)url;
|
||||
|
||||
@property (nonatomic, assign) BOOL useFastLoadingHack;
|
||||
@property (nonatomic, assign) BOOL useTelevisionOutput;
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "Electron.hpp"
|
||||
#import "CSMachine+Subclassing.h"
|
||||
#import "CSMachine+Target.h"
|
||||
#include "StaticAnalyser.hpp"
|
||||
#include "TapeUEF.hpp"
|
||||
|
||||
@ -37,13 +38,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applyTarget:(StaticAnalyser::Target)target {
|
||||
@synchronized(self) {
|
||||
_electron.configure_as_target(target);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setROM:(nonnull NSData *)rom slot:(int)slot {
|
||||
@synchronized(self) {
|
||||
_electron.set_rom((Electron::ROMSlot)slot, rom.length, (const uint8_t *)rom.bytes);
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)openUEFAtURL:(NSURL *)URL {
|
||||
/*- (BOOL)openUEFAtURL:(NSURL *)URL {
|
||||
@synchronized(self) {
|
||||
try {
|
||||
std::shared_ptr<Storage::Tape::UEF> tape(new Storage::Tape::UEF([URL fileSystemRepresentation]));
|
||||
@ -53,7 +60,7 @@
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
- (void)clearAllKeys {
|
||||
@synchronized(self) {
|
||||
|
@ -75,9 +75,10 @@ void StaticAnalyser::Acorn::AddTargets(
|
||||
{
|
||||
std::shared_ptr<Storage::Tape::Tape> tape = tapes.front();
|
||||
tape->reset();
|
||||
std::list<File> files = GetFiles(tape);
|
||||
tape->reset();
|
||||
|
||||
// continue if there are any files
|
||||
std::list<File> files = GetFiles(tape);
|
||||
if(files.size())
|
||||
{
|
||||
bool is_basic = true;
|
||||
|
@ -79,6 +79,8 @@ void UEF::reset()
|
||||
{
|
||||
gzseek(_file, 12, SEEK_SET);
|
||||
_is_at_end = false;
|
||||
_start_of_next_chunk = gztell(_file);
|
||||
find_next_tape_chunk();
|
||||
}
|
||||
|
||||
bool UEF::is_at_end()
|
||||
|
Loading…
x
Reference in New Issue
Block a user