From 16167bc599b40f6c3c203414c57c07381eb85055 Mon Sep 17 00:00:00 2001 From: Andy Sloane Date: Wed, 28 Oct 2015 16:21:12 -0700 Subject: [PATCH] implement pattern / song jumps --- index.html | 3 +-- xm.js | 25 ++++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index e895b92..ab59860 100644 --- a/index.html +++ b/index.html @@ -14,9 +14,8 @@ todo: - instrument fadeout - missing XM effects (in rough order of priority): - Rxy - retrigger - - Bxx / Dxx - position / pattern jumps - - 7xy - tremolo - E3x, E4x, E5x, E6x, E7x, E9x, EDx, EEx + - 7xy - tremolo - Gxx, Hxy, Kxx, Lxx, Pxy, Txy - oscilloscopes diff --git a/xm.js b/xm.js index 260cfe0..188bbe9 100644 --- a/xm.js +++ b/xm.js @@ -473,10 +473,25 @@ function eff_t0_a(ch, data) { // volume slide } } +function eff_t0_b(ch, data) { // song jump (untested) + if (data < songpats.length) { + cur_songpos = data + cur_pat = songpats[cur_songpos]; + } +} + function eff_t0_c(ch, data) { // set volume ch.vol = data & 0x3f; } +function eff_t0_d(ch, data) { // pattern jump + cur_songpos++; + if (cur_songpos >= songpats.length) + cur_songpos = song_looppos; + cur_pat = songpats[cur_songpos]; + cur_row = data; +} + function eff_t0_e(ch, data) { // extended effects! var eff = data >> 4; data = data & 0x0f; @@ -537,9 +552,9 @@ var effects_t0 = [ // effect functions on tick 0 eff_t0_8, // 8 eff_t0_9, // 9 eff_t0_a, // a - eff_unimplemented_t0, // b + eff_t0_b, // b eff_t0_c, // c - eff_unimplemented_t0, // d + eff_t0_d, // d eff_t0_e, // e eff_t0_f, // f ]; @@ -622,11 +637,11 @@ var effects_t1 = [ // effect functions on tick 1+ eff_nop, // 8 eff_nop, // 9 eff_t1_a, // a - eff_unimplemented, // b + eff_nop, // b eff_nop, // c - eff_unimplemented, // d + eff_nop, // d eff_t1_e, // e - eff_unimplemented, // f + eff_nop, // f ]; function ConvertSample(array, bits) {