mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-18 16:30:29 +00:00
Made the rote changes necessary to attempt to open and to supply a G64 to the Vic.
This commit is contained in:
parent
ff49857f5c
commit
6cfc514c2d
@ -212,6 +212,19 @@ void Machine::tape_did_change_input(Tape *tape)
|
||||
_keyboardVIA->set_control_line_input(KeyboardVIA::Port::A, KeyboardVIA::Line::One, tape->get_input());
|
||||
}
|
||||
|
||||
#pragma mark - Disc
|
||||
|
||||
void Machine::set_disk(std::shared_ptr<Storage::Disk> disk)
|
||||
{
|
||||
// construct the 1540
|
||||
_c1540.reset(new ::Commodore::C1540::Machine);
|
||||
|
||||
// attach it to the serial bus
|
||||
_c1540->set_serial_bus(_serialBus);
|
||||
|
||||
// TODO: push the disk to the C1540
|
||||
}
|
||||
|
||||
#pragma mark - Typer
|
||||
|
||||
int Machine::get_typer_delay()
|
||||
@ -344,13 +357,3 @@ void Tape::process_input_pulse(Storage::Tape::Pulse pulse)
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Disc
|
||||
|
||||
void Machine::set_disc()
|
||||
{
|
||||
// construct the 1540
|
||||
_c1540.reset(new ::Commodore::C1540::Machine);
|
||||
|
||||
// attach it to the serial bus
|
||||
_c1540->set_serial_bus(_serialBus);
|
||||
}
|
||||
|
@ -9,16 +9,19 @@
|
||||
#ifndef Vic20_hpp
|
||||
#define Vic20_hpp
|
||||
|
||||
#include "../../../Processors/6502/CPU6502.hpp"
|
||||
#include "../../../Storage/Tape/Tape.hpp"
|
||||
#include "../../../Components/6560/6560.hpp"
|
||||
#include "../../../Components/6522/6522.hpp"
|
||||
#include "../1540/C1540.hpp"
|
||||
#include "../SerialBus.hpp"
|
||||
|
||||
#include "../../CRTMachine.hpp"
|
||||
#include "../../Typer.hpp"
|
||||
|
||||
#include "../../../Processors/6502/CPU6502.hpp"
|
||||
#include "../../../Components/6560/6560.hpp"
|
||||
#include "../../../Components/6522/6522.hpp"
|
||||
|
||||
#include "../SerialBus.hpp"
|
||||
#include "../1540/C1540.hpp"
|
||||
|
||||
#include "../../../Storage/Tape/Tape.hpp"
|
||||
#include "../../../Storage/Disk/Disk.hpp"
|
||||
|
||||
namespace Commodore {
|
||||
namespace Vic20 {
|
||||
|
||||
@ -237,7 +240,7 @@ class Machine:
|
||||
void set_rom(ROMSlot slot, 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_disc();
|
||||
void set_disk(std::shared_ptr<Storage::Disk> disk);
|
||||
|
||||
void set_key_state(Key key, bool isPressed) { _keyboardVIA->set_key_state(key, isPressed); }
|
||||
void clear_all_keys() { _keyboardVIA->clear_all_keys(); }
|
||||
|
@ -48,15 +48,13 @@ class Vic20Document: MachineDocument {
|
||||
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;
|
||||
case "tap": vic20.openTAPAtURL(url)
|
||||
case "g64": vic20.openG64AtURL(url)
|
||||
default:
|
||||
let fileWrapper = try NSFileWrapper(URL: url, options: NSFileWrapperReadingOptions(rawValue: 0))
|
||||
try self.readFromFileWrapper(fileWrapper, ofType: typeName)
|
||||
}
|
||||
}
|
||||
|
||||
let fileWrapper = try NSFileWrapper(URL: url, options: NSFileWrapperReadingOptions(rawValue: 0))
|
||||
try self.readFromFileWrapper(fileWrapper, ofType: typeName)
|
||||
}
|
||||
|
||||
// MARK: machine setup
|
||||
|
@ -80,7 +80,7 @@
|
||||
<string>prg</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Vic-20 Cartridge</string>
|
||||
<string>Commodore Program</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSTypeIsPackage</key>
|
||||
@ -94,9 +94,25 @@
|
||||
<string>tap</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Vic-20 Tape Image</string>
|
||||
<string>Commodore Tape Image</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSTypeIsPackage</key>
|
||||
<integer>0</integer>
|
||||
<key>NSDocumentClass</key>
|
||||
<string>$(PRODUCT_MODULE_NAME).Vic20Document</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>g64</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Commodore Disk</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSTypeIsPackage</key>
|
||||
<integer>0</integer>
|
||||
<key>NSDocumentClass</key>
|
||||
<string>$(PRODUCT_MODULE_NAME).Vic20Document</string>
|
||||
</dict>
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
- (void)setPRG:(nonnull NSData *)prg;
|
||||
- (BOOL)openTAPAtURL:(nonnull NSURL *)URL;
|
||||
- (BOOL)openG64AtURL:(nonnull NSURL *)URL;
|
||||
|
||||
@property (nonatomic, assign) BOOL useFastLoadingHack;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "Vic20.hpp"
|
||||
#include "CommodoreTAP.hpp"
|
||||
#include "G64.hpp"
|
||||
|
||||
using namespace Commodore::Vic20;
|
||||
|
||||
@ -56,6 +57,17 @@ using namespace Commodore::Vic20;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)openG64AtURL:(NSURL *)URL {
|
||||
@synchronized(self) {
|
||||
try {
|
||||
std::shared_ptr<Storage::G64> disk(new Storage::G64([URL fileSystemRepresentation]));
|
||||
_vic20.set_disk(disk);
|
||||
return YES;
|
||||
} catch(int exception) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setPRG:(nonnull NSData *)prg {
|
||||
@synchronized(self) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user