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.
This commit is contained in:
2026-09-16 20:14:06 +03:00
parent ffee082140
commit 54112347f5
10 changed files with 1240 additions and 165 deletions
+1 -1
View File
@@ -35,7 +35,7 @@
/* Плотная раскладка: полная версия spectrum.s + загрузчик OPL4.
* Проверяется build.bat: _CODE должен закончиться раньше _DATA,
* а последняя секция — раньше 0xC000. */
#define VARIANT_DATA_LOC 0xB8D0
#define VARIANT_DATA_LOC 0xB8DC
/* ── Спектроанализатор: скорости затухания (в TV-кадрах) ────────── */
/* Меньше = быстрее затухание. 1 = каждый кадр (~20 мс). */
+1
View File
@@ -188,6 +188,7 @@ extern uint8_t vgm_chip_type;
/** Массив обнаруженных чипов (для вывода информации о файле) */
extern uint8_t vgm_chip_count;
extern uint8_t vgm_opl4_preloaded_rom;
extern vgm_chip_entry_t vgm_chip_list[VGM_MAX_CHIPS];
/** Адрес точки петли (#C000–#FFFF); 0 = нет петли */