initstabilise lda $d012 ldx #10 ; 2 - dex ; (10 * 5) + 4 bpl - ; 54 nop ; 2 eor $d012 - $ff,x; 5 = 63 bne initstabilise; 7 = 70 [...]; timer setup
why does the &hi disappear on a badline?
* = $xy00, where x=$0-$f and y=$0-$6 loop: ldy #$08 ldx #$0a shx loop,y jmp loop $xx0A:
What an awful thread.. fell down the rabbit hole, turned utterly insane, lost several days of sleep...
Quiss' original approach is short and elegant, but opcode rewriting confuses my old brain. Adding a single byte to it's size, the flexibility can be increased somewhat (from 64 to 112 possible pages) and no opcode rewrites, just operand rewrite. * = $xy00, where x=$0-$f and y=$0-$6 loop: ldy #$08 ldx #$0a shx loop,y jmp loop $xx0A: Loop times kept at either 10 or 12 cycles, depending on address choice.
As an added bonus, A is not touched - which may or may not matter in your overall timer setup. So, it's obvious my priority is not size, but readability - and I find this approach a tad more readable ;-)
Still, I think the sniplet presented in post#90 (and all variants thereof) is best regarding trade-off between readability and size. And it imposes almost no restriction on the highbyte that can be used;)
ldy #$01 loop: ldx #243 (or any other badline) cpx $d012 bne *-3 shy $ffff, x lda $ff, x beq loop