Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Fri, 02 May 2008 19:23:54 +0100, Arnaud Delobelle wrote: > >> Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: >> >>> >>> There are no modern processors with an opcode for incrementing a memory >>> location!? At least my C64 can do that. ;-) >> >> Indeed! I remember a simple use was to make the border change colour >> very fast, a v. cool effect when you're 12! >> >> CLV >> LOOP: INC $D020 >> BVC LOOP >> >> (from memory, untested!) > > That works but I think > > LOOP: INC $D020 > JMP LOOP > > is a bit more straight forward. Shorter in opcodes, equal in bytes, the > loop is as fast but you save the two cycles of the CLV. :-)
Ah you're right! I thought I remembered that Bxx instructions took 2 cycles whereas a JMP takes 3. I've checked it on the wonderful wide web and Bxx takes 2 cycles if the branch fails, but 3 cycles if the branch succeeds :) (or even 5 if it branches to a new page). To bring this back on topic, I would qualify my code snippet as more "Pythonesque" than yours ;) -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list