Another 1-bit puzzle cracked: How to generate a triangle wave without wavetable lookup. There are some killer modulation effects that you can do with this as well, but I still need to find a few free t-states in order to implement those for 2 channels.
Edit: Ok, got it. Here's a shorter and faster version, 11 t-states free which will be enough to pull of the modulation effects.
sloop
add hl,de ;11
ld a,0 ;7 ;timing
nop ;4 ;timing
ld a,h ;4
rlca ;4
sbc a,a ;4
xor h ;4
rrca ;4
out (c),a ;12__64
rrca ;4
out (c),a ;12__16
ds 4 ;16
rrca ;4
out (c),a ;12__32
jp sloop ;10Edit2: Example with modulation effect attached.