1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-29 12:50:28 +00:00

Treading water some more, ensured the DFS and ADFS ROMs get to the Electron. It now even inserts the DFS ROM if it has a DFS disk image. Might need to make it a sideways RAM though? Regardless, the next job surely — surely! — has to be to stop avoiding the 1770?

This commit is contained in:
Thomas Harte 2016-09-20 07:36:57 -04:00
parent a9e65e9b7a
commit cd5939501f
9 changed files with 89 additions and 22 deletions

View File

@ -485,22 +485,37 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target)
_tape.set_tape(target.tapes.front());
}
if(target.disks.size())
{
_wd1770.reset(new WD::WD1770);
if(target.acorn.has_dfs)
{
set_rom(ROMSlot0, _dfs);
}
// TODO: actually insert the disk, why not?
}
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)
void Machine::set_rom(ROMSlot slot, std::vector<uint8_t> data)
{
uint8_t *target = nullptr;
switch(slot)
{
case ROMSlotDFS: _dfs = data; return;
case ROMSlotADFS: _adfs = data; return;
case ROMSlotOS: target = _os; break;
default: target = _roms[slot]; break;
}
memcpy(target, data, std::min((size_t)16384, length));
memcpy(target, &data[0], std::min((size_t)16384, data.size()));
}
inline void Machine::signal_interrupt(Electron::Interrupt interrupt)

View File

@ -18,6 +18,7 @@
#include "../Typer.hpp"
#include <cstdint>
#include <vector>
namespace Electron {
@ -31,7 +32,7 @@ enum ROMSlot: uint8_t {
ROMSlot12, ROMSlot13, ROMSlot14, ROMSlot15,
ROMSlotOS
ROMSlotOS, ROMSlotDFS, ROMSlotADFS
};
enum Interrupt: uint8_t {
@ -147,7 +148,7 @@ class Machine:
public:
Machine();
void set_rom(ROMSlot slot, size_t length, const uint8_t *data);
void set_rom(ROMSlot slot, std::vector<uint8_t> data);
void configure_as_target(const StaticAnalyser::Target &target);
void set_key_state(Key key, bool isPressed);
@ -189,6 +190,7 @@ class Machine:
// Things that directly constitute the memory map.
uint8_t _roms[16][16384];
uint8_t _os[16384], _ram[32768];
std::vector<uint8_t> _dfs, _adfs;
// Things affected by registers, explicitly or otherwise.
uint8_t _interrupt_status, _interrupt_control;

View File

@ -51,6 +51,7 @@
4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B92EAC91B7C112B00246143 /* 6502TimingTests.swift */; };
4B96F7221D75119A0058BB2D /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B96F7201D75119A0058BB2D /* Tape.cpp */; };
4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA22B051D8817CE0008C640 /* Disk.cpp */; };
4BA61EB01D91515900B3C876 /* NSData+StdVector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BA61EAF1D91515900B3C876 /* NSData+StdVector.mm */; };
4BA799951D8B656E0045123D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA799931D8B656E0045123D /* StaticAnalyser.cpp */; };
4BAB62AD1D3272D200DF5BA0 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB62AB1D3272D200DF5BA0 /* Disk.cpp */; };
4BAB62B51D327F7E00DF5BA0 /* G64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB62B31D327F7E00DF5BA0 /* G64.cpp */; };
@ -464,6 +465,8 @@
4B96F7211D75119A0058BB2D /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Tape.hpp; path = ../../StaticAnalyser/Acorn/Tape.hpp; sourceTree = "<group>"; };
4BA22B051D8817CE0008C640 /* Disk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disk.cpp; path = ../../StaticAnalyser/Commodore/Disk.cpp; sourceTree = "<group>"; };
4BA22B061D8817CE0008C640 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Disk.hpp; path = ../../StaticAnalyser/Commodore/Disk.hpp; sourceTree = "<group>"; };
4BA61EAE1D91515900B3C876 /* NSData+StdVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+StdVector.h"; sourceTree = "<group>"; };
4BA61EAF1D91515900B3C876 /* NSData+StdVector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSData+StdVector.mm"; sourceTree = "<group>"; };
4BA799931D8B656E0045123D /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/Atari/StaticAnalyser.cpp; sourceTree = "<group>"; };
4BA799941D8B656E0045123D /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/Atari/StaticAnalyser.hpp; sourceTree = "<group>"; };
4BA9C3CF1D8164A9002DDB61 /* ConfigurationTarget.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ConfigurationTarget.hpp; sourceTree = "<group>"; };
@ -922,6 +925,8 @@
4B2A53961D117D36003C6002 /* CSMachine.mm */,
4B643F3B1D77AD6D00D431D6 /* StaticAnalyser */,
4B2A53981D117D36003C6002 /* Wrappers */,
4BA61EAE1D91515900B3C876 /* NSData+StdVector.h */,
4BA61EAF1D91515900B3C876 /* NSData+StdVector.mm */,
);
path = Machine;
sourceTree = "<group>";
@ -2118,6 +2123,7 @@
4BC830D11D6E7C690000A26F /* Tape.cpp in Sources */,
4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */,
4BF829691D8F7361001BAE39 /* File.cpp in Sources */,
4BA61EB01D91515900B3C876 /* NSData+StdVector.mm in Sources */,
4B4DC8211D2C2425003C5BF8 /* Vic20.cpp in Sources */,
4BF8295D1D8F048B001BAE39 /* MFM.cpp in Sources */,
4BE77A2E1D84ADFB00BC3827 /* File.cpp in Sources */,

View File

@ -31,15 +31,27 @@ class ElectronDocument: MachineDocument {
return dataForResource(name, ofType: "rom", inDirectory: "ROMImages/Electron")
}
override func windowControllerDidLoadNib(_ aController: NSWindowController) {
super.windowControllerDidLoadNib(aController)
override init() {
super.init();
if let os = rom("os"), let basic = rom("basic") {
self.electron.setOSROM(os)
self.electron.setBASICROM(basic)
}
if let dfs = rom("DFS-1770-2.20") {
self.electron.setDFSROM(dfs)
}
if let adfs1 = rom("ADFS-E00_1"), let adfs2 = rom("ADFS-E00_2") {
var fullADFS = adfs1
fullADFS.append(adfs2)
self.electron.setADFSROM(fullADFS as Data)
}
}
// override func windowControllerDidLoadNib(_ aController: NSWindowController) {
// super.windowControllerDidLoadNib(aController)
// }
override var windowNibName: String? {
return "ElectronDocument"
}

View File

@ -0,0 +1,18 @@
//
// NSData+StdVector.h
// Clock Signal
//
// Created by Thomas Harte on 20/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved.
//
#import <Foundation/Foundation.h>
#include <cstdint>
#include <vector>
@interface NSData (StdVector)
- (std::vector<uint8_t>)stdVector8;
@end

View File

@ -0,0 +1,19 @@
//
// NSData+StdVector.m
// Clock Signal
//
// Created by Thomas Harte on 20/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved.
//
#import "NSData+StdVector.h"
@implementation NSData (StdVector)
- (std::vector<uint8_t>)stdVector8
{
uint8_t *bytes8 = (uint8_t *)self.bytes;
return std::vector<uint8_t>(bytes8, bytes8 + self.length);
}
@end

View File

@ -16,7 +16,8 @@
- (void)setOSROM:(nonnull NSData *)rom;
- (void)setBASICROM:(nonnull NSData *)rom;
- (void)setROM:(nonnull NSData *)rom slot:(int)slot;
- (void)setDFSROM:(nonnull NSData *)rom;
- (void)setADFSROM:(nonnull NSData *)rom;
@property (nonatomic, assign) BOOL useFastLoadingHack;
@property (nonatomic, assign) BOOL useTelevisionOutput;

View File

@ -10,6 +10,7 @@
#include "Electron.hpp"
#import "CSMachine+Subclassing.h"
#import "NSData+StdVector.h"
#include "StaticAnalyser.hpp"
#include "TapeUEF.hpp"
@ -25,21 +26,14 @@
StaticAnalyser::GetTargets([url fileSystemRepresentation]);
}
- (void)setOSROM:(nonnull NSData *)rom {
@synchronized(self) {
_electron.set_rom(Electron::ROMSlotOS, rom.length, (const uint8_t *)rom.bytes);
}
}
- (void)setBASICROM:(nonnull NSData *)rom {
@synchronized(self) {
_electron.set_rom(Electron::ROMSlotBASIC, rom.length, (const uint8_t *)rom.bytes);
}
}
- (void)setOSROM:(nonnull NSData *)rom { [self setROM:rom slot:Electron::ROMSlotOS]; }
- (void)setBASICROM:(nonnull NSData *)rom { [self setROM:rom slot:Electron::ROMSlotBASIC]; }
- (void)setADFSROM:(nonnull NSData *)rom { [self setROM:rom slot:Electron::ROMSlotADFS]; }
- (void)setDFSROM:(nonnull NSData *)rom { [self setROM:rom slot:Electron::ROMSlotDFS]; }
- (void)setROM:(nonnull NSData *)rom slot:(int)slot {
@synchronized(self) {
_electron.set_rom((Electron::ROMSlot)slot, rom.length, (const uint8_t *)rom.bytes);
_electron.set_rom((Electron::ROMSlot)slot, rom.stdVector8);
}
}

View File

@ -5,12 +5,12 @@ Expected files:
basic.rom
os.rom
plus1.rom
DFS-1770-2.20.rom
ADFS-E00_1.rom
ADFS-E00_2.rom
Likely to be desired in the future:
adfs.rom
ADFS-E00_1.rom
ADFS-E00_2.rom
DFSE00r3.rom
ElectronExpansionRomPresAP2-v1.23.rom
os300.rom