mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 16:31:31 +00:00
Merge pull request #32 from TomHarte/FastVICLoading
Adds 'fast' tape loading for the Vic-20
This commit is contained in:
commit
15acec4889
@ -30,6 +30,18 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
{
|
||||
set_reset_line(false);
|
||||
|
||||
// test for PC at F92F
|
||||
if(_use_fast_tape_hack && address == 0xf92f && operation == CPU6502::BusOperation::ReadOpcode)
|
||||
{
|
||||
// advance time on the tape and the VIAs until an interrupt is signalled
|
||||
while(!_userPortVIA.get_interrupt_line() && !_keyboardVIA.get_interrupt_line())
|
||||
{
|
||||
_userPortVIA.run_for_half_cycles(2);
|
||||
_keyboardVIA.run_for_half_cycles(2);
|
||||
_tape.run_for_cycles(1);
|
||||
}
|
||||
}
|
||||
|
||||
// run the phase-1 part of this cycle, in which the VIC accesses memory
|
||||
uint16_t video_address = _mos6560->get_address();
|
||||
uint8_t video_value = 0xff; // TODO
|
||||
@ -92,7 +104,6 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
|
||||
void Machine::mos6522_did_change_interrupt_status(void *mos6522)
|
||||
{
|
||||
// bool irq = _userPortVIA.get_interrupt_line() || _keyboardVIA.get_interrupt_line();
|
||||
set_nmi_line(_userPortVIA.get_interrupt_line());
|
||||
set_irq_line(_keyboardVIA.get_interrupt_line());
|
||||
}
|
||||
|
@ -143,6 +143,8 @@ class Machine:
|
||||
void set_key_state(Key key, bool isPressed) { _keyboardVIA.set_key_state(key, isPressed); }
|
||||
void clear_all_keys() { _keyboardVIA.clear_all_keys(); }
|
||||
|
||||
inline void set_use_fast_tape_hack(bool activate) { _use_fast_tape_hack = activate; }
|
||||
|
||||
// to satisfy CPU6502::Processor
|
||||
unsigned int perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value);
|
||||
void synchronise() { _mos6560->synchronise(); }
|
||||
@ -199,7 +201,10 @@ class Machine:
|
||||
std::unique_ptr<MOS::MOS6560> _mos6560;
|
||||
UserPortVIA _userPortVIA;
|
||||
KeyboardVIA _keyboardVIA;
|
||||
|
||||
// Tape
|
||||
Tape _tape;
|
||||
bool _use_fast_tape_hack;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -683,6 +683,7 @@
|
||||
4BB73ECF1B587A6700552FC2 /* Clock Signal.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Clock Signal.entitlements"; sourceTree = "<group>"; };
|
||||
4BBB142F1CD2CECE00BDB55C /* IntermediateShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermediateShader.cpp; sourceTree = "<group>"; };
|
||||
4BBB14301CD2CECE00BDB55C /* IntermediateShader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = IntermediateShader.hpp; sourceTree = "<group>"; };
|
||||
4BBC34241D2208B100FFC9DF /* CSCommonOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSCommonOptions.h; sourceTree = "<group>"; };
|
||||
4BBF99081C8FBA6F0075DAFB /* CRTInputBufferBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CRTInputBufferBuilder.cpp; sourceTree = "<group>"; };
|
||||
4BBF99091C8FBA6F0075DAFB /* CRTInputBufferBuilder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CRTInputBufferBuilder.hpp; sourceTree = "<group>"; };
|
||||
4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CRTOpenGL.cpp; sourceTree = "<group>"; };
|
||||
@ -803,6 +804,7 @@
|
||||
4B2A53921D117D36003C6002 /* Machine */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4BBC34241D2208B100FFC9DF /* CSCommonOptions.h */,
|
||||
4B2A53931D117D36003C6002 /* CSKeyboardMachine.h */,
|
||||
4B2A53941D117D36003C6002 /* CSMachine+Subclassing.h */,
|
||||
4B2A53951D117D36003C6002 /* CSMachine.h */,
|
||||
|
@ -4,9 +4,11 @@
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="Atari2600Document" customModule="Clock_Signal" customModuleProvider="target">
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="Vic20Document" customModule="Clock_Signal" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="fastLoadingButton" destination="sBT-cU-h7s" id="gWf-9E-D7l"/>
|
||||
<outlet property="openGLView" destination="DEG-fq-cjd" id="Gxs-2u-n7B"/>
|
||||
<outlet property="optionsPanel" destination="ota-g7-hOL" id="zeO-di-9i3"/>
|
||||
<outlet property="window" destination="xOd-HO-29H" id="JIz-fz-R2o"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
@ -38,5 +40,54 @@
|
||||
<outlet property="delegate" destination="-2" id="0bl-1N-x8E"/>
|
||||
</connections>
|
||||
</window>
|
||||
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="ota-g7-hOL" customClass="NSPanel">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" HUD="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="83" y="102" width="200" height="83"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1366" height="768"/>
|
||||
<value key="minSize" type="size" width="200" height="83"/>
|
||||
<value key="maxSize" type="size" width="200" height="83"/>
|
||||
<view key="contentView" id="7Pv-WL-2Rq">
|
||||
<rect key="frame" x="0.0" y="0.0" width="200" height="83"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="sBT-cU-h7s">
|
||||
<rect key="frame" x="18" y="47" width="164" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Load Quickly" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="w0l-ha-esm">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFastLoading:" target="-2" id="ctR-h1-CYI"/>
|
||||
</connections>
|
||||
</button>
|
||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MlB-rE-TXV">
|
||||
<rect key="frame" x="18" y="17" width="165" height="26"/>
|
||||
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="UIu-uz-pTu">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="ajo-u0-WGk">
|
||||
<items>
|
||||
<menuItem title="Danish Machine" id="38Y-Wm-1uo"/>
|
||||
<menuItem title="European Machine" id="5ju-Z0-BDa"/>
|
||||
<menuItem title="Japanese Machine" id="YlT-9e-azY"/>
|
||||
<menuItem title="Swedish Machine" id="joU-Bt-XFb"/>
|
||||
<menuItem title="US Machine" state="on" id="FXe-ca-cTY"/>
|
||||
</items>
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="sBT-cU-h7s" secondAttribute="trailing" constant="20" id="79b-2A-2c7"/>
|
||||
<constraint firstItem="sBT-cU-h7s" firstAttribute="top" secondItem="7Pv-WL-2Rq" secondAttribute="top" constant="20" id="E5m-wo-X92"/>
|
||||
<constraint firstItem="MlB-rE-TXV" firstAttribute="top" secondItem="sBT-cU-h7s" secondAttribute="bottom" constant="8" id="fis-Fe-CkQ"/>
|
||||
<constraint firstItem="sBT-cU-h7s" firstAttribute="leading" secondItem="7Pv-WL-2Rq" secondAttribute="leading" constant="20" id="nDy-Xc-Ug9"/>
|
||||
<constraint firstItem="MlB-rE-TXV" firstAttribute="leading" secondItem="7Pv-WL-2Rq" secondAttribute="leading" constant="20" id="qb4-Lp-ZMc"/>
|
||||
<constraint firstAttribute="trailing" secondItem="MlB-rE-TXV" secondAttribute="trailing" constant="20" id="v18-62-uee"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<point key="canvasLocation" x="-2" y="6.5"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#import "CSMachine.h"
|
||||
#import "CSKeyboardMachine.h"
|
||||
#import "CSCommonOptions.h"
|
||||
|
||||
#import "CSAtari2600.h"
|
||||
#import "CSElectron.h"
|
||||
|
@ -16,6 +16,11 @@ class Atari2600Document: MachineDocument {
|
||||
return atari2600
|
||||
}
|
||||
}
|
||||
override var name: String! {
|
||||
get {
|
||||
return "atari2600"
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: NSDocument overrides
|
||||
override class func autosavesInPlace() -> Bool {
|
||||
|
@ -17,6 +17,11 @@ class ElectronDocument: MachineDocument {
|
||||
return electron
|
||||
}
|
||||
}
|
||||
override var name: String! {
|
||||
get {
|
||||
return "electron"
|
||||
}
|
||||
}
|
||||
|
||||
override func aspectRatio() -> NSSize {
|
||||
return NSSize(width: 11.0, height: 10.0)
|
||||
@ -33,8 +38,6 @@ class ElectronDocument: MachineDocument {
|
||||
self.electron.setOSROM(os)
|
||||
self.electron.setBASICROM(basic)
|
||||
}
|
||||
|
||||
establishStoredOptions()
|
||||
}
|
||||
|
||||
override var windowNibName: String? {
|
||||
@ -69,25 +72,14 @@ class ElectronDocument: MachineDocument {
|
||||
NSUserDefaults.standardUserDefaults().setInteger(sender.indexOfSelectedItem, forKey: self.displayTypeUserDefaultsKey)
|
||||
}
|
||||
|
||||
@IBOutlet var fastLoadingButton: NSButton!
|
||||
@IBAction func setFastLoading(sender: NSButton!) {
|
||||
electron.useFastLoadingHack = sender.state == NSOnState
|
||||
NSUserDefaults.standardUserDefaults().setBool(electron.useFastLoadingHack, forKey: self.fastLoadingUserDefaultsKey)
|
||||
}
|
||||
|
||||
private let displayTypeUserDefaultsKey = "electron.displayType"
|
||||
private let fastLoadingUserDefaultsKey = "electron.fastLoading"
|
||||
private func establishStoredOptions() {
|
||||
override func establishStoredOptions() {
|
||||
super.establishStoredOptions()
|
||||
let standardUserDefaults = NSUserDefaults.standardUserDefaults()
|
||||
standardUserDefaults.registerDefaults([
|
||||
displayTypeUserDefaultsKey: 0,
|
||||
fastLoadingUserDefaultsKey: true
|
||||
])
|
||||
|
||||
let useFastLoadingHack = standardUserDefaults.boolForKey(self.fastLoadingUserDefaultsKey)
|
||||
electron.useFastLoadingHack = useFastLoadingHack
|
||||
self.fastLoadingButton.state = useFastLoadingHack ? NSOnState : NSOffState
|
||||
|
||||
let displayType = standardUserDefaults.integerForKey(self.displayTypeUserDefaultsKey)
|
||||
electron.useTelevisionOutput = (displayType == 1)
|
||||
self.displayTypeButton.selectItemAtIndex(displayType)
|
||||
|
@ -25,6 +25,11 @@ class MachineDocument:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
var name: String! {
|
||||
get {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func aspectRatio() -> NSSize {
|
||||
return NSSize(width: 4.0, height: 3.0)
|
||||
@ -61,6 +66,7 @@ class MachineDocument:
|
||||
|
||||
setupClockRate()
|
||||
self.machine.delegate = self
|
||||
establishStoredOptions()
|
||||
}
|
||||
|
||||
func machineDidChangeClockRate(machine: CSMachine!) {
|
||||
@ -168,4 +174,33 @@ class MachineDocument:
|
||||
$0.setKey(VK_Option, isPressed: newModifiers.modifierFlags.contains(.AlternateKeyMask))
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: IBActions
|
||||
var fastLoadingUserDefaultsKey: String {
|
||||
get {
|
||||
return "\(self.name).fastLoading"
|
||||
}
|
||||
}
|
||||
|
||||
@IBOutlet var fastLoadingButton: NSButton!
|
||||
@IBAction func setFastLoading(sender: NSButton!) {
|
||||
if let commonOptionsMachine = machine as? CSCommonOptions {
|
||||
let useFastLoadingHack = sender.state == NSOnState
|
||||
commonOptionsMachine.useFastLoadingHack = useFastLoadingHack
|
||||
NSUserDefaults.standardUserDefaults().setBool(useFastLoadingHack, forKey: fastLoadingUserDefaultsKey)
|
||||
}
|
||||
}
|
||||
|
||||
func establishStoredOptions() {
|
||||
let standardUserDefaults = NSUserDefaults.standardUserDefaults()
|
||||
standardUserDefaults.registerDefaults([
|
||||
fastLoadingUserDefaultsKey: true
|
||||
])
|
||||
|
||||
if let commonOptionsMachine = machine as? CSCommonOptions {
|
||||
let useFastLoadingHack = standardUserDefaults.boolForKey(self.fastLoadingUserDefaultsKey)
|
||||
commonOptionsMachine.useFastLoadingHack = useFastLoadingHack
|
||||
self.fastLoadingButton.state = useFastLoadingHack ? NSOnState : NSOffState
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,11 @@ class Vic20Document: MachineDocument {
|
||||
return vic20
|
||||
}
|
||||
}
|
||||
override var name: String! {
|
||||
get {
|
||||
return "vic20"
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: NSDocument overrides
|
||||
override init() {
|
||||
|
@ -8,8 +8,9 @@
|
||||
|
||||
#import "CSMachine.h"
|
||||
#import "CSKeyboardMachine.h"
|
||||
#import "CSCommonOptions.h"
|
||||
|
||||
@interface CSElectron : CSMachine <CSKeyboardMachine>
|
||||
@interface CSElectron : CSMachine <CSKeyboardMachine, CSCommonOptions>
|
||||
|
||||
- (void)setOSROM:(nonnull NSData *)rom;
|
||||
- (void)setBASICROM:(nonnull NSData *)rom;
|
||||
|
@ -8,8 +8,9 @@
|
||||
|
||||
#import "CSMachine.h"
|
||||
#import "CSKeyboardMachine.h"
|
||||
#import "CSCommonOptions.h"
|
||||
|
||||
@interface CSVic20 : CSMachine <CSKeyboardMachine>
|
||||
@interface CSVic20 : CSMachine <CSKeyboardMachine, CSCommonOptions>
|
||||
|
||||
- (void)setKernelROM:(nonnull NSData *)rom;
|
||||
- (void)setBASICROM:(nonnull NSData *)rom;
|
||||
@ -18,4 +19,6 @@
|
||||
- (void)setPRG:(nonnull NSData *)prg;
|
||||
- (BOOL)openTAPAtURL:(nonnull NSURL *)URL;
|
||||
|
||||
@property (nonatomic, assign) BOOL useFastLoadingHack;
|
||||
|
||||
@end
|
||||
|
@ -137,4 +137,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack {
|
||||
@synchronized(self) {
|
||||
_useFastLoadingHack = useFastLoadingHack;
|
||||
_vic20.set_use_fast_tape_hack(useFastLoadingHack ? true : false);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user