Ok, one more. This will be the last one for now. I've got some more ideas, but my motivation batteries are a bit exhausted for the time being. Also I do want to work on some other projects in the coming weeks.
Anyway, tftone is basically Tritone (Digi) without transition noise. No special tricks here, just plain and boring loop unrolling. Runs a bit slower than the original Tritone (216t loop), but row length can be controlled up to ¼ tick precision. So yep, it can go really fast.
Due to the big spaghetti mess there may be some bugs hiding here and there. Ultimately I would also like to get the synth loop a bit faster, 216t is still pretty noisy. I think at least 208t should be doable.
I did discover one neat trick. Probably nothing new to some of you, but. I normally like stack-based loaders, not just because they're fast, but also because you can do POP AF and have individually set Z,C,S and P flags for a quick&dirty compression scheme. With this engine however, stack-based loading wasn't feasible. So I found that actually, something functionally equivalent to POP AF can be achived with
ld a,(hl) ; or whatever the data pointer is
or a ; check for Z
jr z,... ; end of pattern or whatever
sla a
Now the last one is where the magic happens. If bit 7 was set, Carry is now flagged. If bit 6 was set, Sign is flagged. SLA also flags Parity, which means we can turn that on or off individually as well, just need to pay attention to bit 6 and possibly flip another bit so the initial value is not 0 when we don't intend it to be.
Anyway. so much for that. Code's on my github repo as usual. Sorry for the crappy demo tune. Just wanted something fast to demonstrate that it does sound (relatively) clean, but of course that's really tedious to type up in asm. And this is actually speed 4, so it can go even faster.