1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Ensured tape position is unaffected if the attempt at loading quickly fails.

This commit is contained in:
Thomas Harte 2017-06-23 20:18:19 -04:00
parent 2d02c23574
commit 50375fb373

View File

@ -124,7 +124,8 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
case CPU::Z80::PartialMachineCycle::ReadOpcodeStart:
case CPU::Z80::PartialMachineCycle::ReadOpcodeWait:
// Check for use of the fast tape hack.
if(use_fast_tape_hack_ && address == tape_trap_address_) {
if(use_fast_tape_hack_ && address == tape_trap_address_ && tape_player_.has_tape()) {
Storage::Time time = tape_player_.get_tape()->get_current_time();
int next_byte = parser_.get_next_byte(tape_player_.get_tape());
if(next_byte != -1) {
uint16_t hl = get_value_of_register(CPU::Z80::Register::HL);
@ -132,6 +133,8 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
*cycle.value = 0x00;
set_value_of_register(CPU::Z80::Register::ProgramCounter, tape_return_address_ - 1);
return 0;
} else {
tape_player_.get_tape()->seek(time);
}
}
is_opcode_read = true;