mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 19:26:43 +01:00
64 lines
1.5 KiB
Plaintext
64 lines
1.5 KiB
Plaintext
// Steady On Tim, It's Only A Budget Game
|
|
// original bytebeat by Gasman / Hooy-Program
|
|
// ported to MicroW8/GES by exoticorn/icebird
|
|
|
|
import "env.memory" memory(4);
|
|
|
|
fn melody(ch: i32, t: i32, T: i32) {
|
|
let lazy riff_pos = abs(((T&31) - 16) as f32) as i32;
|
|
let lazy shift = ((1-((T>>5)&3))%2-1) * 2;
|
|
|
|
let inline note_count = 5 - (T >= 512);
|
|
let inline octave = (riff_pos/5) * 12;
|
|
let inline riff_note = 5514 >> (riff_pos % note_count * 4) & 15;
|
|
let inline melody_note = shift + octave - riff_note;
|
|
|
|
ch?1 = 230 - riff_pos * 14;
|
|
ch?3 = melody_note + 64;
|
|
|
|
let inline arp_note = shift + ((0x85>>((t/2)%3*4)) & 15) - 1;
|
|
80?3 = arp_note + 64;
|
|
}
|
|
|
|
export fn upd() {
|
|
let lazy t = 32!32 / (1000/60);
|
|
let lazy T = t / 7;
|
|
melody(98, t, T - 3);
|
|
melody(92, t, T);
|
|
|
|
80?0 = ((T >= 256) & (T/12+(T-3)/12)) * 2 | 0x48; // arp trigger
|
|
|
|
if T >= 128 {
|
|
let inline bass_step = T % 8;
|
|
86?3 = if bass_step / 2 == 2 {
|
|
86?0 = 0xd6;
|
|
81
|
|
} else {
|
|
86?0 = ((197 >> bass_step) & 1) | 0x48;
|
|
((T & 4) * ((T & 7) - 1)) / 2 + 28
|
|
};
|
|
}
|
|
}
|
|
|
|
data 80 {
|
|
i8(
|
|
0, 0x90, 0, 0, 0, 0x90,
|
|
0, 0x4c, 0, 0, 0, 0x4c,
|
|
0x19, 0, 0, 0, 0, 0x4c,
|
|
0x19, 0, 0, 0, 0, 0x4c,
|
|
0xfa, 0x84,
|
|
0xc1, 0xc1, 0, 107, 0, 0x4c
|
|
)
|
|
}
|
|
|
|
/*
|
|
include "../../platform/src/ges.cwa"
|
|
|
|
import "env.pow" fn pow(f32, f32) -> f32;
|
|
import "env.exp" fn exp(f32) -> f32;
|
|
import "env.sin" fn sin(f32) -> f32;
|
|
|
|
export fn snd(t: i32) -> f32 {
|
|
gesSnd(t)
|
|
}
|
|
*/ |