is +=1 thread safe

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat May 3 02:16:13 EDT 2008


On Fri, 02 May 2008 19:23:54 +0100, Arnaud Delobelle wrote:

> Marc 'BlackJack' Rintsch <bj_666 at gmx.net> 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.  :-)

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list