[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 6502 trashing memory cycles...



On Mar 31, 8:42 pm, "biel...@terra.es" <biel...@terra.es> wrote:
>
> The code is:
>
> FD1B INC $4E (5 CYCLES, 1 BORROWABLE)
> FD1D BNE $FD21 (3 CYCLES NOT TAKEN, 4 CYCLES TAKEN, 0 BORROWABLE)
> FD1F INC $4F (5 CYCLES, 1 BORROWABLE)
> FD21 BIT $C000 (4 CYCLES, 0 BORROWABLE)
> FD24 BPL $FD1B (TAKEN, 4 CYCLES, 0 BORROWABLE)
>
> The loop takes
> (5+4+4+4)=17 cycles, (1 borrowable)
> 255 times, then
> (5+3+5+4+4)=21 cycles, (2 borrowable)
> the 256th time.
>
> Every (255*17)+21=4356 cycles, there are (255*1)+2=257 borrowable
> cycles.
>
> That is (257/43.56)=5.9 % of the time, @1Mhz translates to 59 KB/s.
>
> Jorge.

Aaargh !
These branches take 2,3 cycles (not taken, taken), the figures are
even better :

(5+3+4+3)*255+(5+2+4+3)=3844 cycles, 255*1+2=257 borrowable

@ 1MHz --> 1e4*(257/38.44)= ****  66.85 KB/s   ****

If lost cycles in taken branches are trapped too, then 255*3+3=768
borrowable

@ 1MHz --> 1e4*(768/38.44)= ****    199.79 KB/s    *****

Jorge.