Skip to content

Commit

Permalink
Merge pull request #71 from EremusOne/psram
Browse files Browse the repository at this point in the history
ESPectrum 1.3
  • Loading branch information
EremusOne authored Oct 7, 2024
2 parents c4a926b + 9b0345c commit 103b75b
Show file tree
Hide file tree
Showing 72 changed files with 42,906 additions and 4,990 deletions.
16 changes: 6 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
!.keep
.pio
.vscode
.vscode/**
.VSCodeCounter
.VSCodeCounter/**
data/s/**
!data/s/sppong.sna
!data/s/fantasy.sna
!data/s/Snake.sna
!data/s/Tetris.sna
data/t/**
!data/t/vccc2022.tap
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
/unpacked_fs
/unpacked_fs/**
downloaded_fs*.bin
/doc
/doc/**
/releases
/releases/**

dependencies.lock
build/*
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16.0)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
list(APPEND EXTRA_COMPONENT_DIRS components/fabgl components/pwm_audio)
project(ESP32003)
project(ESPectrum2)
5 changes: 0 additions & 5 deletions ESPecpart.csv

This file was deleted.

9 changes: 9 additions & 0 deletions ESPecpart2 1.2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x35000,
otadata, data, ota, 0x3e000, 0x2000,
esp0, app, ota_0, 0x40000, 0xF0000,
esp1, app, ota_1, 0x130000, 0xF0000,
esp2, app, ota_2, 0x220000, 0xF0000,
esp3, app, ota_3, 0x310000, 0xF0000,
# nvs, data, nvs, 0x3E0000, 0x20000,
# spiffs, data, spiffs, 0x3D0000,0x30000,
7 changes: 3 additions & 4 deletions ESPecpart2.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x35000,
otadata, data, ota, 0x3e000, 0x2000,
esp0, app, ota_0, 0x40000, 0xF0000,
esp1, app, ota_1, 0x130000, 0xF0000,
esp2, app, ota_2, 0x220000, 0xF0000,
esp3, app, ota_3, 0x310000, 0xF0000,
esp0, app, ota_0, 0x40000, 0x140000,
esp1, app, ota_1, 0x180000, 0x140000,
esp2, app, ota_2, 0x2C0000, 0x140000,
# nvs, data, nvs, 0x3E0000, 0x20000,
# spiffs, data, spiffs, 0x3D0000,0x30000,
16 changes: 15 additions & 1 deletion include/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ class Config
static string romSet;
static string romSet48;
static string romSet128;
static string romSetTK90X;
static string romSetTK95;
static string pref_arch;
static string pref_romSet_48;
static string pref_romSet_128;
static string pref_romSet_TK90X;
static string pref_romSet_TK95;
static string ram_file;
static string last_ram_file;
static uint8_t esp32rev;
Expand Down Expand Up @@ -121,7 +125,17 @@ class Config

static bool TABasfire1;

static bool StartMsg;
static bool StartMsg;

static uint8_t port254default; // For TK90X v1 ROM -> 0xbf: Spanish, 0x3f: Portuguese

static uint8_t ALUTK; // TK ALU -> 0 -> Ferranti, 1 -> Microdigital 50hz, 2 -> Microdigital 60hz

static uint8_t DiskCtrl; // 0 -> None, 1 -> Betadisk

static bool TimeMachine;

static int8_t volume;

};

Expand Down
52 changes: 49 additions & 3 deletions include/ESPectrum.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,62 @@ visit https://zxespectrum.speccy.org/contacto

using namespace std;

// For reference / calcs
// #define TSTATES_PER_FRAME_48 69888
// #define TSTATES_PER_FRAME_TK_50 71136
// #define TSTATES_PER_FRAME_TK_60 59736
// #define TSTATES_PER_FRAME_128 70908
// #define TSTATES_PER_FRAME_PENTAGON 71680
// #define MICROS_PER_FRAME_48 19968
// #define MICROS_PER_FRAME_TK_50 19895
// #define MICROS_PER_FRAME_TK_60 16707
// #define MICROS_PER_FRAME_128 19992
// #define MICROS_PER_FRAME_PENTAGON 20480

#define ESP_AUDIO_OVERSAMPLES_48 4368
#define ESP_AUDIO_FREQ_48 31250 // In 48K calcs are perfect :) -> ESP_AUDIO_SAMPLES_48 * 50,0801282 frames per second = 31250 Hz
#define ESP_AUDIO_FREQ_48_125SPEED 39063 // 125% speed
#define ESP_AUDIO_FREQ_48_150SPEED 46875 // 150% speed
#define ESP_AUDIO_SAMPLES_48 624
#define ESP_AUDIO_SAMPLES_DIV_48 7
#define ESP_AUDIO_AY_DIV_48 112
#define ESP_AUDIO_OVERSAMPLES_DIV_48 16

#define ESP_AUDIO_OVERSAMPLES_TK_50 3744
#define ESP_AUDIO_FREQ_TK_50 31365 // ESP_AUDIO_SAMPLES_TK_50 * 50,2638854 frames per second = 31364,6645 Hz
#define ESP_AUDIO_FREQ_TK_50_125SPEED 39206 // 125% speed
#define ESP_AUDIO_FREQ_TK_50_150SPEED 47048 // 150% speed
#define ESP_AUDIO_SAMPLES_TK_50 624
#define ESP_AUDIO_SAMPLES_DIV_TK_50 6
#define ESP_AUDIO_AY_DIV_TK_50 114
#define ESP_AUDIO_OVERSAMPLES_DIV_TK_50 19

#define ESP_AUDIO_OVERSAMPLES_TK_60 3144
#define ESP_AUDIO_FREQ_TK_60 31364 // ESP_AUDIO_SAMPLES_TK_60 * 59,8551505 frames per second = 31364,0989 Hz
#define ESP_AUDIO_FREQ_TK_60_125SPEED 39204 // 125% speed
#define ESP_AUDIO_FREQ_TK_60_150SPEED 47046 // 150% speed
#define ESP_AUDIO_SAMPLES_TK_60 524
#define ESP_AUDIO_SAMPLES_DIV_TK_60 6
#define ESP_AUDIO_AY_DIV_TK_60 114
#define ESP_AUDIO_OVERSAMPLES_DIV_TK_60 19

#define ESP_AUDIO_OVERSAMPLES_128 3732
#define ESP_AUDIO_FREQ_128 31112 // ESP_AUDIO_SAMPLES_128 * 50,020008 fps = 31112,445 Hz.
#define ESP_AUDIO_FREQ_128_125SPEED 38890 // 125% speed
#define ESP_AUDIO_FREQ_128_150SPEED 46669 // 150% speed
#define ESP_AUDIO_SAMPLES_128 622
#define ESP_AUDIO_SAMPLES_DIV_128 6
#define ESP_AUDIO_AY_DIV_128 114
#define ESP_AUDIO_OVERSAMPLES_DIV_128 19

#define ESP_AUDIO_OVERSAMPLES_PENTAGON 4480
#define ESP_AUDIO_FREQ_PENTAGON 31250 // ESP_AUDIO_SAMPLES_PENTAGON * 48,828125 frames per second = 31250 Hz
#define ESP_AUDIO_FREQ_PENTAGON_125SPEED 39062 // 125% speed
#define ESP_AUDIO_FREQ_PENTAGON_150SPEED 46876 // 150% speed
#define ESP_AUDIO_SAMPLES_PENTAGON 640
#define ESP_AUDIO_SAMPLES_DIV_PENTAGON 7
#define ESP_AUDIO_AY_DIV_PENTAGON 112
#define ESP_AUDIO_OVERSAMPLES_DIV_PENTAGON 16

#define ESP_VOLUME_DEFAULT -8
#define ESP_VOLUME_MAX 0
Expand Down Expand Up @@ -87,6 +129,8 @@ class ESPectrum
static uint8_t audioBuffer[ESP_AUDIO_SAMPLES_PENTAGON];
static uint32_t* overSamplebuf;
static unsigned char audioSampleDivider;
static unsigned char audioAYDivider;
static unsigned char audioOverSampleDivider;
static signed char aud_volume;
static uint32_t audbufcnt;
static uint32_t audbufcntover;
Expand All @@ -97,15 +141,15 @@ class ESPectrum
static int faudioBit;
static int samplesPerFrame;
static bool AY_emu;
static int Audio_freq;
static int Audio_freq[4];

static bool ESP_delay;
static uint8_t ESP_delay;
static int sync_cnt;

static int TapeNameScroller;

static int64_t ts_start;
static int64_t target;
static int64_t target[4];
static double totalseconds;
static double totalsecondsnodelay;
static int64_t elapsed;
Expand All @@ -127,6 +171,8 @@ class ESPectrum

// static uint32_t sessid;

static void showMemInfo(const char* caption = "ESPectrum");

private:

static void audioTask(void* unused);
Expand Down
Loading

0 comments on commit 103b75b

Please sign in to comment.