Files
VGMPLAY.WMF/src_sdcc/inc/variant_cfg.h
T
alex 54112347f5 Add large-file (>1MB) OPL4 loading and fix track-end hang
- One-shot cold loader (asm/opl4_loader.asm, overlaid into plugin
  page 5) uploads embedded PCM sample blocks into ZXM-MoonSound SRAM
  and compacts the VGM stream in place, letting files over the normal
  64-page megabuffer budget play back through the existing pipeline.
- instant_abort() was filling only one of the two ISR command buffers
  with the shutdown chain; the chain (SILENCE_OPL + WAVE_OFF/TL +
  CMD_ISR_DONE) doesn't fit in one buffer, so after the first
  CMD_END_BUF the ISR swapped into stale data and never reached
  CMD_ISR_DONE, hanging at the end of long tracks instead of
  advancing to the next one. Now fills both buffers while frozen and
  syncs update_buffer()'s own ready-tracking state.
- Switch to 14MHz before the SRAM upload (previously ran at whatever
  speed WC's file I/O left active) and show "Loading..." for .vgz and
  files >= 1MB, since the busy-waited upload takes several seconds.
- Confirmed on real hardware: long OPL4 tracks (previously stuck
  looping at the end) now finish and advance normally, ESC exits
  cleanly.
2026-09-16 20:14:06 +03:00

52 lines
2.9 KiB
C

/**
* @file variant_cfg.h
* @brief Единственный файл конфигурации варианта сборки.
*
* build_variants.ps1 перегенерирует этот файл целиком для каждого
* варианта. Никакие другие исходники НЕ патчатся.
*
* build.bat читает VARIANT_POS_ENTRIES / VARIANT_POS_STEP /
* VARIANT_DATA_LOC из этого файла (парсинг через for /f).
*/
#ifndef VARIANT_CFG_H
#define VARIANT_CFG_H
/* ── Частота ISR (тиков/сек) ─────────────────────────────────────── */
/* ISR_FREQ = 3 500 000 / VARIANT_POS_STEP */
#define ISR_FREQ 683
/* Тиков ISR на TV-кадр (= 71680 / STEP) */
/* 14@683, 28@1367, 56@2734 */
#define ISR_TICKS_PER_FRAME 14
/* ── Маппинг VGM 44100→ISR тиков ─────────────────────────────────── */
/* SHIFT = log2(44100/ISR_FREQ): 6@683, 5@1367, 4@2734 */
#define VGM_SAMPLE_SHIFT 6
#define VGM_SAMPLE_MASK 0x3F
/* ── Лимит команд между принудительными yield ──────────────────────── */
#define VGM_FILL_CMD_BUDGET 16
/* ── Параметры pos_table (для build.bat → gen_pos_table.js) ──────── */
#define VARIANT_POS_ENTRIES 14
#define VARIANT_POS_STEP 5120
/* ── Адрес начала сегмента данных (для линковщика) ────────────────── */
/* Плотная раскладка: полная версия spectrum.s + загрузчик OPL4.
* Проверяется build.bat: _CODE должен закончиться раньше _DATA,
* а последняя секция — раньше 0xC000. */
#define VARIANT_DATA_LOC 0xB8DC
/* ── Спектроанализатор: скорости затухания (в TV-кадрах) ────────── */
/* Меньше = быстрее затухание. 1 = каждый кадр (~20 мс). */
/* Синхронизировать с EQU в spectrum.s! */
#define DECAY_FRAMES_FAST 1 /* уровни >= 6 */
#define DECAY_FRAMES_MED 2 /* уровни 3-5 */
#define DECAY_FRAMES_SLOW 4 /* уровни 1-2 */
/* ── Отключение обработки коротких пауз 0x70-0x7F ────────────────── */
/* Раскомментировать для «no short waits» варианта: */
/* #define VGM_NO_SHORT_WAITS */
#endif /* VARIANT_CFG_H */