From 72c1116a89a249a9a5541fc57ecb3993523d7d5b Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 6 Mar 2022 22:11:01 -0500 Subject: [PATCH 1/3] PC speaker: correct frequency in real mode damn it --- src/engine/platform/pcspkr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/engine/platform/pcspkr.cpp b/src/engine/platform/pcspkr.cpp index 5f57f31a..f485bca8 100644 --- a/src/engine/platform/pcspkr.cpp +++ b/src/engine/platform/pcspkr.cpp @@ -122,7 +122,11 @@ void DivPlatformPCSpeaker::beepFreq(int freq) { gettimeofday(&ie.time,NULL); ie.type=EV_SND; ie.code=SND_TONE; - ie.value=freq; + if (freq>0) { + ie.value=chipClock/freq; + } else { + ie.value=0; + } if (write(beepFD,&ie,sizeof(struct input_event))<0) { perror("error while writing frequency!"); } else { From 9333b5bd515320795cae7ba496e1a51d9b98d22d Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 6 Mar 2022 22:36:13 -0500 Subject: [PATCH 2/3] prepare for X1-010 --- papers/format.md | 1 + 1 file changed, 1 insertion(+) diff --git a/papers/format.md b/papers/format.md index 4df49ed0..ff068d83 100644 --- a/papers/format.md +++ b/papers/format.md @@ -174,6 +174,7 @@ size | description | - 0xaa: MSM6295 - 4 channels | - 0xab: MSM6258 - 1 channel | - 0xac: Commander X16 (VERA) - 17 channels + | - 0xb0: Seta/Allumer X1-010 - 16 channels | - 0xde: YM2610B extended - 19 channels | - 0xe0: QSound - 19 channels | - (compound!) means that the system is composed of two or more chips, From 177c409e19c902c99567e76b07d16677ca0f5b37 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 6 Mar 2022 22:36:32 -0500 Subject: [PATCH 3/3] add more notes when working with new systems --- src/engine/dispatch.h | 6 ++++++ src/engine/instrument.h | 3 +++ src/engine/playback.cpp | 1 + 3 files changed, 10 insertions(+) diff --git a/src/engine/dispatch.h b/src/engine/dispatch.h index 300b0033..e697cccb 100644 --- a/src/engine/dispatch.h +++ b/src/engine/dispatch.h @@ -29,6 +29,12 @@ #define addWrite(a,v) regWrites.push_back(DivRegWrite(a,v)); +// HOW TO ADD A NEW COMMAND: +// add it to this enum. then see playback.cpp. +// there is a const char* cmdName[] array, which contains the command +// names as strings for the commands (and other debug stuff). +// +// if you miss it, the program will crash or misbehave at some point. enum DivDispatchCmds { DIV_CMD_NOTE_ON=0, DIV_CMD_NOTE_OFF, diff --git a/src/engine/instrument.h b/src/engine/instrument.h index 27ce2a4c..a0d37523 100644 --- a/src/engine/instrument.h +++ b/src/engine/instrument.h @@ -23,6 +23,9 @@ #include "dataErrors.h" #include "../ta-utils.h" +// NOTICE! +// before adding new instrument types to this struct, please ask me first. +// absolutely zero support granted to conflicting formats. enum DivInstrumentType { DIV_INS_STD=0, DIV_INS_FM=1, diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index f0f43dc1..7114a7c2 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -42,6 +42,7 @@ const char* notes[12]={ "C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-" }; +// update this when adding new commands. const char* cmdName[DIV_CMD_MAX]={ "NOTE_ON", "NOTE_OFF",