mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Removed state mirroring in the machine-specific Mac UI classes.
This commit is contained in:
parent
ddf1bf3cbf
commit
7b420d56e3
@ -130,6 +130,18 @@ class ConcreteMachine:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get_switch_is_enabled(Atari2600Switch input) override {
|
||||||
|
uint8_t port_input = bus_->mos6532_.get_port_input(1);
|
||||||
|
switch(input) {
|
||||||
|
case Atari2600SwitchReset: return !!(port_input & 0x01);
|
||||||
|
case Atari2600SwitchSelect: return !!(port_input & 0x02);
|
||||||
|
case Atari2600SwitchColour: return !!(port_input & 0x08);
|
||||||
|
case Atari2600SwitchLeftPlayerDifficulty: return !!(port_input & 0x40);
|
||||||
|
case Atari2600SwitchRightPlayerDifficulty: return !!(port_input & 0x80);
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void set_reset_switch(bool state) override {
|
void set_reset_switch(bool state) override {
|
||||||
bus_->set_reset_line(state);
|
bus_->set_reset_line(state);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,9 @@ class Machine:
|
|||||||
/// Sets the switch @c input to @c state.
|
/// Sets the switch @c input to @c state.
|
||||||
virtual void set_switch_is_enabled(Atari2600Switch input, bool state) = 0;
|
virtual void set_switch_is_enabled(Atari2600Switch input, bool state) = 0;
|
||||||
|
|
||||||
|
/// Gets the state of switch @c input.
|
||||||
|
virtual bool get_switch_is_enabled(Atari2600Switch input) = 0;
|
||||||
|
|
||||||
// Presses or releases the reset button.
|
// Presses or releases the reset button.
|
||||||
virtual void set_reset_switch(bool state) = 0;
|
virtual void set_reset_switch(bool state) = 0;
|
||||||
};
|
};
|
||||||
|
@ -341,10 +341,15 @@ template<bool is_zx81> class ConcreteMachine:
|
|||||||
tape_player_.set_motor_control(false);
|
tape_player_.set_motor_control(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_tape_is_playing(bool is_playing) override final {
|
void set_tape_is_playing(bool is_playing) override final {
|
||||||
tape_player_.set_motor_control(is_playing);
|
tape_player_.set_motor_control(is_playing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get_tape_is_playing() override final {
|
||||||
|
return tape_player_.get_motor_control();
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Typer timing
|
// MARK: - Typer timing
|
||||||
HalfCycles get_typer_delay() override final { return Cycles(7000000); }
|
HalfCycles get_typer_delay() override final { return Cycles(7000000); }
|
||||||
HalfCycles get_typer_frequency() override final { return Cycles(390000); }
|
HalfCycles get_typer_frequency() override final { return Cycles(390000); }
|
||||||
|
@ -30,6 +30,7 @@ class Machine:
|
|||||||
static Machine *ZX8081(const Analyser::Static::Target &target_hint);
|
static Machine *ZX8081(const Analyser::Static::Target &target_hint);
|
||||||
|
|
||||||
virtual void set_tape_is_playing(bool is_playing) = 0;
|
virtual void set_tape_is_playing(bool is_playing) = 0;
|
||||||
|
virtual bool get_tape_is_playing() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,29 +25,41 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)setColourButton:(BOOL)colourButton {
|
- (void)setColourButton:(BOOL)colourButton {
|
||||||
_colourButton = colourButton;
|
|
||||||
|
|
||||||
@synchronized(_machine) {
|
@synchronized(_machine) {
|
||||||
_atari2600->set_switch_is_enabled(Atari2600SwitchColour, colourButton);
|
_atari2600->set_switch_is_enabled(Atari2600SwitchColour, colourButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setLeftPlayerDifficultyButton:(BOOL)leftPlayerDifficultyButton {
|
- (BOOL)colourButton {
|
||||||
_leftPlayerDifficultyButton = leftPlayerDifficultyButton;
|
@synchronized(_machine) {
|
||||||
|
return _atari2600->get_switch_is_enabled(Atari2600SwitchColour);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setLeftPlayerDifficultyButton:(BOOL)leftPlayerDifficultyButton {
|
||||||
@synchronized(_machine) {
|
@synchronized(_machine) {
|
||||||
_atari2600->set_switch_is_enabled(Atari2600SwitchLeftPlayerDifficulty, leftPlayerDifficultyButton);
|
_atari2600->set_switch_is_enabled(Atari2600SwitchLeftPlayerDifficulty, leftPlayerDifficultyButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setRightPlayerDifficultyButton:(BOOL)rightPlayerDifficultyButton {
|
- (BOOL)leftPlayerDifficultyButton {
|
||||||
_rightPlayerDifficultyButton = rightPlayerDifficultyButton;
|
@synchronized(_machine) {
|
||||||
|
return _atari2600->get_switch_is_enabled(Atari2600SwitchLeftPlayerDifficulty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setRightPlayerDifficultyButton:(BOOL)rightPlayerDifficultyButton {
|
||||||
@synchronized(_machine) {
|
@synchronized(_machine) {
|
||||||
_atari2600->set_switch_is_enabled(Atari2600SwitchRightPlayerDifficulty, rightPlayerDifficultyButton);
|
_atari2600->set_switch_is_enabled(Atari2600SwitchRightPlayerDifficulty, rightPlayerDifficultyButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)rightPlayerDifficultyButton {
|
||||||
|
@synchronized(_machine) {
|
||||||
|
return _atari2600->get_switch_is_enabled(Atari2600SwitchRightPlayerDifficulty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)toggleSwitch:(Atari2600Switch)toggleSwitch {
|
- (void)toggleSwitch:(Atari2600Switch)toggleSwitch {
|
||||||
@synchronized(_machine) {
|
@synchronized(_machine) {
|
||||||
_atari2600->set_switch_is_enabled(toggleSwitch, true);
|
_atari2600->set_switch_is_enabled(toggleSwitch, true);
|
||||||
|
@ -28,9 +28,14 @@
|
|||||||
|
|
||||||
- (void)setTapeIsPlaying:(BOOL)tapeIsPlaying {
|
- (void)setTapeIsPlaying:(BOOL)tapeIsPlaying {
|
||||||
@synchronized(_machine) {
|
@synchronized(_machine) {
|
||||||
_tapeIsPlaying = tapeIsPlaying;
|
|
||||||
_zx8081->set_tape_is_playing(tapeIsPlaying ? true : false);
|
_zx8081->set_tape_is_playing(tapeIsPlaying ? true : false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)tapeIsPlaying {
|
||||||
|
@synchronized(_machine) {
|
||||||
|
return _zx8081->get_tape_is_playing();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
Reference in New Issue
Block a user