mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-14 13:33:42 +00:00
Made the slightest possible effort to get TAPs opened and passed to the VIC.
This commit is contained in:
parent
ee19417ded
commit
8741be5c84
@ -135,6 +135,18 @@ void Machine::add_prg(size_t length, const uint8_t *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mar - Tape
|
||||||
|
|
||||||
|
void Machine::set_tape(std::shared_ptr<Storage::Tape> tape)
|
||||||
|
{
|
||||||
|
tape->get_next_pulse();
|
||||||
|
tape->get_next_pulse();
|
||||||
|
tape->get_next_pulse();
|
||||||
|
tape->get_next_pulse();
|
||||||
|
tape->get_next_pulse();
|
||||||
|
tape->get_next_pulse();
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Typer
|
#pragma mark - Typer
|
||||||
|
|
||||||
int Machine::get_typer_delay()
|
int Machine::get_typer_delay()
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#define Vic20_hpp
|
#define Vic20_hpp
|
||||||
|
|
||||||
#include "../../Processors/6502/CPU6502.hpp"
|
#include "../../Processors/6502/CPU6502.hpp"
|
||||||
|
#include "../../Storage/Tape/Tape.hpp"
|
||||||
#include "../../Components/6560/6560.hpp"
|
#include "../../Components/6560/6560.hpp"
|
||||||
#include "../../Components/6522/6522.hpp"
|
#include "../../Components/6522/6522.hpp"
|
||||||
|
|
||||||
@ -104,6 +105,8 @@ class Machine:
|
|||||||
|
|
||||||
void set_rom(ROMSlot slot, size_t length, const uint8_t *data);
|
void set_rom(ROMSlot slot, size_t length, const uint8_t *data);
|
||||||
void add_prg(size_t length, const uint8_t *data);
|
void add_prg(size_t length, const uint8_t *data);
|
||||||
|
void set_tape(std::shared_ptr<Storage::Tape> tape);
|
||||||
|
|
||||||
void set_key_state(Key key, bool isPressed) { _keyboardVIA.set_key_state(key, isPressed); }
|
void set_key_state(Key key, bool isPressed) { _keyboardVIA.set_key_state(key, isPressed); }
|
||||||
void clear_all_keys() { _keyboardVIA.clear_all_keys(); }
|
void clear_all_keys() { _keyboardVIA.clear_all_keys(); }
|
||||||
|
|
||||||
|
@ -42,9 +42,6 @@ class ElectronDocument: MachineDocument {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func readFromURL(url: NSURL, ofType typeName: String) throws {
|
override func readFromURL(url: NSURL, ofType typeName: String) throws {
|
||||||
print(url)
|
|
||||||
print(typeName)
|
|
||||||
|
|
||||||
if let pathExtension = url.pathExtension {
|
if let pathExtension = url.pathExtension {
|
||||||
switch pathExtension.lowercaseString {
|
switch pathExtension.lowercaseString {
|
||||||
case "uef":
|
case "uef":
|
||||||
|
@ -36,6 +36,20 @@ class Vic20Document: MachineDocument {
|
|||||||
return "Vic20Document"
|
return "Vic20Document"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func readFromURL(url: NSURL, ofType typeName: String) throws {
|
||||||
|
if let pathExtension = url.pathExtension {
|
||||||
|
switch pathExtension.lowercaseString {
|
||||||
|
case "tap":
|
||||||
|
vic20.openTAPAtURL(url)
|
||||||
|
return
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let fileWrapper = try NSFileWrapper(URL: url, options: NSFileWrapperReadingOptions(rawValue: 0))
|
||||||
|
try self.readFromFileWrapper(fileWrapper, ofType: typeName)
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: machine setup
|
// MARK: machine setup
|
||||||
private func rom(name: String) -> NSData? {
|
private func rom(name: String) -> NSData? {
|
||||||
return dataForResource(name, ofType: "bin", inDirectory: "ROMImages/Vic20")
|
return dataForResource(name, ofType: "bin", inDirectory: "ROMImages/Vic20")
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
<key>CFBundleTypeRole</key>
|
<key>CFBundleTypeRole</key>
|
||||||
<string>Viewer</string>
|
<string>Viewer</string>
|
||||||
<key>NSDocumentClass</key>
|
<key>NSDocumentClass</key>
|
||||||
<string>Vic20Document</string>
|
<string>$(PRODUCT_MODULE_NAME).Vic20Document</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
#import "CSElectron.h"
|
#import "CSElectron.h"
|
||||||
|
|
||||||
#import "Electron.hpp"
|
#include "Electron.hpp"
|
||||||
#import "CSMachine+Subclassing.h"
|
#import "CSMachine+Subclassing.h"
|
||||||
#import "TapeUEF.hpp"
|
#include "TapeUEF.hpp"
|
||||||
|
|
||||||
@implementation CSElectron {
|
@implementation CSElectron {
|
||||||
Electron::Machine _electron;
|
Electron::Machine _electron;
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
- (void)setKernelROM:(nonnull NSData *)rom;
|
- (void)setKernelROM:(nonnull NSData *)rom;
|
||||||
- (void)setBASICROM:(nonnull NSData *)rom;
|
- (void)setBASICROM:(nonnull NSData *)rom;
|
||||||
- (void)setCharactersROM:(nonnull NSData *)rom;
|
- (void)setCharactersROM:(nonnull NSData *)rom;
|
||||||
|
|
||||||
- (void)setPRG:(nonnull NSData *)prg;
|
- (void)setPRG:(nonnull NSData *)prg;
|
||||||
|
- (BOOL)openTAPAtURL:(nonnull NSURL *)URL;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
#import "CSVic20.h"
|
#import "CSVic20.h"
|
||||||
|
|
||||||
#import "Vic20.hpp"
|
#include "Vic20.hpp"
|
||||||
|
#include "CommodoreTAP.hpp"
|
||||||
|
|
||||||
@implementation CSVic20 {
|
@implementation CSVic20 {
|
||||||
Vic20::Machine _vic20;
|
Vic20::Machine _vic20;
|
||||||
@ -19,7 +20,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)setROM:(nonnull NSData *)rom slot:(Vic20::ROMSlot)slot {
|
- (void)setROM:(nonnull NSData *)rom slot:(Vic20::ROMSlot)slot {
|
||||||
_vic20.set_rom(slot, rom.length, (const uint8_t *)rom.bytes);
|
@synchronized(self) {
|
||||||
|
_vic20.set_rom(slot, rom.length, (const uint8_t *)rom.bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setKernelROM:(nonnull NSData *)rom {
|
- (void)setKernelROM:(nonnull NSData *)rom {
|
||||||
@ -34,8 +37,23 @@
|
|||||||
[self setROM:rom slot:Vic20::ROMSlotCharacters];
|
[self setROM:rom slot:Vic20::ROMSlotCharacters];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)openTAPAtURL:(NSURL *)URL {
|
||||||
|
@synchronized(self) {
|
||||||
|
try {
|
||||||
|
std::shared_ptr<Storage::CommodoreTAP> tape(new Storage::CommodoreTAP([URL fileSystemRepresentation]));
|
||||||
|
_vic20.set_tape(tape);
|
||||||
|
return YES;
|
||||||
|
} catch(int exception) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)setPRG:(nonnull NSData *)prg {
|
- (void)setPRG:(nonnull NSData *)prg {
|
||||||
_vic20.add_prg(prg.length, (const uint8_t *)prg.bytes);
|
@synchronized(self) {
|
||||||
|
_vic20.add_prg(prg.length, (const uint8_t *)prg.bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setKey:(uint16_t)key isPressed:(BOOL)isPressed {
|
- (void)setKey:(uint16_t)key isPressed:(BOOL)isPressed {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user