[Reverse-engineering] MMD ticks-per-quarter-note constant

And then, ZUN hardcodes all measure-related functions to 4/4…
This commit is contained in:
nmlgc 2019-12-08 01:01:32 +01:00
parent 5f4f5d87dc
commit a23dab3154
8 changed files with 13 additions and 7 deletions

View File

@ -20,3 +20,7 @@ typedef enum {
#define PMD 0x60
#define MMD 0x61
// MMDFUNC.DOC and https://gist.github.com/devinacker/bdc58cfdba6a1ee80449
// both imply that this is a hardcoded property of the MMD format
#define MMD_TICKS_PER_QUARTER_NOTE 48

View File

@ -16,3 +16,5 @@ PMD_GET_WORKAREA_ADDRESS equ 10h
kajacall macro func, param := <0>
call snd_kaja_interrupt pascal, (func shl 8) or (param and 0ffh)
endm
MMD_TICKS_PER_QUARTER_NOTE = 48

View File

@ -10,7 +10,7 @@ void snd_delay_until_measure(int measure)
if(snd_midi_active != 1) {
geninterrupt(PMD);
} else {
_DX = 192;
_DX = MMD_TICKS_PER_QUARTER_NOTE * 4; // yes, hardcoded to 4/4
geninterrupt(MMD);
}
} while(_AX < measure);

View File

@ -5987,7 +5987,7 @@ loc_D412:
; ---------------------------------------------------------------------------
loc_D41F:
mov dx, 0C0h
mov dx, MMD_TICKS_PER_QUARTER_NOTE * 4 ; yes, hardcoded to 4/4
int 61h ; reserved for user interrupt
loc_D424:
@ -6029,7 +6029,7 @@ loc_D443:
; ---------------------------------------------------------------------------
loc_D450:
mov dx, 0C0h
mov dx, MMD_TICKS_PER_QUARTER_NOTE * 4 ; yes, hardcoded to 4/4
int 61h ; reserved for user interrupt
loc_D455:

View File

@ -5136,7 +5136,7 @@ loc_D05C:
; ---------------------------------------------------------------------------
loc_D069:
mov dx, 0C0h
mov dx, MMD_TICKS_PER_QUARTER_NOTE * 4 ; yes, hardcoded to 4/4
int 61h ; reserved for user interrupt
loc_D06E:

View File

@ -5409,7 +5409,7 @@ loc_DD96:
; ---------------------------------------------------------------------------
loc_DDA3:
mov dx, 0C0h
mov dx, MMD_TICKS_PER_QUARTER_NOTE * 4 ; yes, hardcoded to 4/4
int 61h ; reserved for user interrupt
loc_DDA8:

View File

@ -8707,7 +8707,7 @@ loc_F24B:
; ---------------------------------------------------------------------------
loc_F258:
mov dx, 0C0h
mov dx, MMD_TICKS_PER_QUARTER_NOTE * 4 ; yes, hardcoded to 4/4
int 61h ; reserved for user interrupt
loc_F25D:

View File

@ -5971,7 +5971,7 @@ loc_E0DD:
; ---------------------------------------------------------------------------
loc_E0EA:
mov dx, 0C0h
mov dx, MMD_TICKS_PER_QUARTER_NOTE * 4 ; yes, hardcoded to 4/4
int 61h ; reserved for user interrupt
loc_E0EF: