- [NEW] Càrrega "instantànea" de TAPs

This commit is contained in:
2025-07-29 12:51:40 +02:00
parent 2a0febc6b7
commit 2775da3d53
4 changed files with 33 additions and 4 deletions

View File

@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
ui::menu::addoption(menu, "SAVE STATE", nullptr);
menu = ui::menu::addsubmenu("TAPE");
ui::menu::addbooloption(menu, "BERSERK MODE", zx_tape::getOption(ZXTAPE_OPTION_FAST_LOAD), actions::fastload);
ui::menu::addbooloption(menu, "FAST LOAD", zx_tape::getOption(ZXTAPE_OPTION_FAST_LOAD), actions::fastload);
ui::menu::addbooloption(menu, "STOP AT END", zx_tape::getOption(ZXTAPE_OPTION_STOP_AT_END), actions::stopatend);
menu = ui::menu::addsubmenu("SCREEN");

10
z80.cpp
View File

@@ -1,7 +1,7 @@
#include "z80.h"
#include "z80debug.h"
#include "zx_mem.h"
//#include "zx_tape.h"
#include "zx_tape.h"
#include <stdio.h>
#include <vector>
@@ -191,7 +191,13 @@ namespace z80
t+=1;
reading_m1 = true;
if (rPC==0x056A) {
z80debug::stop();
//z80debug::stop();
if (zx_tape::getOption(ZXTAPE_OPTION_FAST_LOAD)) {
rIX = zx_tape::fastLoad(rA2, rIX, rDE);
rDE = 0;
rA = 0;
rPC = 0x05E0;
}
//zx_tape::rewind();
//zx_tape::play();
}

View File

@@ -1,6 +1,7 @@
#include "zx_tape.h"
#include "zx_ula.h"
#include "zx_screen.h"
#include "zx_mem.h"
#include "z80debug.h"
#include "z80.h"
#include <vector>
@@ -36,7 +37,7 @@ namespace zx_tape
bool playing = false;
bool loaded = false;
bool options[ZXTAPE_NUM_OPTIONS] = { false, true };
bool options[ZXTAPE_NUM_OPTIONS] = { true, true };
std::vector<block_t> blocks;
uint8_t current_block = 0;
@@ -244,6 +245,27 @@ namespace zx_tape
printf("tape loading: %i%\n", percent);
}
uint16_t fastLoad(const uint8_t block_type, const uint16_t address, const uint16_t length)
{
block_pos=0;
current_bit=0;
current_section = PULSE_PILOT;
current_pulse = 0;
pulse_pos = 0;
pulse_level = 0;
if (blocks[current_block].data[0] != block_type ||
blocks[current_block].length != length+2) {
printf("ERROR: Tape data not consistent with expectation\n");
z80debug::stop();
}
for (int i=0;i<length;++i) {
mem::writeMem(address+i, blocks[current_block].data[i+1]);
}
current_block++;
return address + length;
}
const bool getOption(const int option)
{
return options[option];

View File

@@ -14,6 +14,7 @@ namespace zx_tape
void update(const uint8_t dt);
const bool getplaying();
void report();
uint16_t fastLoad(const uint8_t block_type, const uint16_t address, const uint16_t length);
const bool getOption(const int option);
void setOption(const int option, const bool value);