- [NEW] Càrrega "instantànea" de TAPs
This commit is contained in:
2
main.cpp
2
main.cpp
@@ -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
10
z80.cpp
@@ -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();
|
||||
}
|
||||
|
||||
24
zx_tape.cpp
24
zx_tape.cpp
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user