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
*= page*$100 - 1 sta $d093,y brk
Yes, you're both right, the BRK can be used as some data and the step from the beginning of the page to the adress where to continue can be chosen almost arbitrarily... but it imposes more (and weirder!!) restrictions on the choices for a and x;)
Quoting CopyfaultYes, you're both right, the BRK can be used as some data and the step from the beginning of the page to the adress where to continue can be chosen almost arbitrarily... but it imposes more (and weirder!!) restrictions on the choices for a and x;) Not more restrictions, you just have more choice.
Quoting QuissNeat! Right, no reason to make those two address bytes go to waste. :) Another amusing thing to contemplate is how this code could be placed at, say, $08xx. Preferably without messing up the basic upstart. [...] Not necessarily the shortest piece of code, but it satisfies your requirement to have the sync routine at $08xx: 0843 A2 9E LDX #$9E 0845 A0 08 LDY #$08 0847 E0 00 CPX #$00 0849 D0 F9 BNE $0844 Branching to $0844 leads to SHX $08A0,Y, so the operand byte of the CPX is altered continuously. As long as the "&(hi+1)" plays in, the compare operand will be =$08. When "&(hi+1)" disappears, the full $9E is written to the operand byte and the loop will end. This happens iff the critical SHX-cycle happens on a badline.
Neat! Right, no reason to make those two address bytes go to waste. :) Another amusing thing to contemplate is how this code could be placed at, say, $08xx. Preferably without messing up the basic upstart. [...]
0843 A2 9E LDX #$9E 0845 A0 08 LDY #$08 0847 E0 00 CPX #$00 0849 D0 F9 BNE $0844