Skip to content

Commit fb07d24

Browse files
committed
MP fix
1 parent 2bec173 commit fb07d24

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mdx_compiler.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ void mdx_compiler_maof(struct mdx_compiler *compiler, int chan_mask) {
442442

443443
void mdx_compiler_mp(struct mdx_compiler *compiler, int chan_mask, int waveform, int freq, int amplitude) {
444444
mdx_compiler_write(compiler, chan_mask, 0xec, waveform & 0x03, -1);
445-
mdx_compiler_write16(compiler, chan_mask, freq * 2, amplitude * 128, -1);
445+
mdx_compiler_write16(compiler, chan_mask, freq * 2, (amplitude & 0xff) << 8, -1);
446446
}
447447

448448
void mdx_compiler_mpon(struct mdx_compiler *compiler, int chan_mask) {

mdx_decompiler.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ void mdx_decompiler_decompile(struct mdx_decompiler *d, struct mdx_file *f) {
303303
else if(b[1] == 0x81)
304304
MMLF("MPON")
305305
else
306-
MMLF("MP%d,%d,%d", b[1], b[2] << 8 | b[3], b[4] << 8 | b[5])
306+
MMLF("MP%d,%d,%d", b[1], b[2] << 8 | b[3], b[4] >= 128 ? b[4] - 256 : b[4])
307307
break;
308308
case 0xeb:
309309
if(b[1] == 0x80)

0 commit comments

Comments
 (0)