[hatari-devel] 68000 cycles, read and write cycles

Nicolas Pomarède npomarede at corp.free.fr
Fri Nov 18 00:11:08 CET 2011


On 17/11/2011 23:57, Laurent Sallafranque wrote:
> For my example with clr, I looked at the 8 bits table instead of the 16
> bits table.
>
> CLR cycles would be :
>
> CLR (byte) (register) : 4(1/0)
> CLR (word) (register) : 4(1/0)
> CLR (long) (register) : 6(1/0)
>
> CLR (byte) (memory) : 8(1/1) +
> CLR (word) (memory) : 8(1/1)+
> CLR (long) (memory) : 12(1/2)+
>
> Maybe some cycles values are different from the 68000 doc and the cycles
> of a real atari, but it's really easy to change this in a table that
> contains all the instructions.
> Correct values could be pick up in the old gencpu code.
>
> Regards
>
> Laurent

Hello

in fact this information wouldn't help to determine when the write 
really takes place. The number of read and write for each instruction is 
rather easy to "guess", as the 68000 in the ST does one access for 1 or 
2 bytes, you just have to divide the size of the operand to get the 
number of access (so a move.l is 2 write accesses).

But the problem to determine the precise write is more complex : it's 
more than knowing how many writes are made, but when these writes are 
made inside the operand, and there's no motorola documentation (that I 
know) that tells that.

This is the kind of work that has been made in WinUAE, based on research 
from Ijor and Toni, probably using some rare documentations and a lot of 
hand made testing.

Nicolas

>
> Le 17/11/2011 23:53, Laurent Sallafranque a écrit :
>> Hi Nicolas,
>>
>> I was watching your last patch in cycles.c
>>
>> The aim seems to compute precise cycles for the read and the write of
>> an instruction in the 2 following functions :
>>
>> int Cycles_GetCounterOnReadAccess(int nId)
>>
>> int Cycles_GetCounterOnWriteAccess(int nId)
>>
>>
>> Is this related to the cycles tables of the 68000 processor ?
>>
>> I mean when I look at the M68000UM doc, for CLR, I can read (maybe my
>> document is not the good one, but it gives the idea) :
>>
>> CLR (byte) (register) : 8(2/0)
>> CLR (word) (register) : 8(2/0)
>> CLR (long) (register) : 10(2/0)
>>
>> CLR (byte) (memory) : 12(2/1) +
>> CLR (word) (memory) : 16(2/2)+
>> CLR (long) (memory) : 24(2/4)+
>>
>>
>> In parenthesis are given the number of read and write access to the
>> memory.
>>
>> Would having these values for each instruction could let us compute
>> precise values for GetCounterOnReadAccess and GetCounterOnWriteAccess ?
>>
>> I'm currently filling a table for each 68030 instructions with all
>> these datas.
>> If having all these values for the 68000 is the good answear, I can
>> also fill a table for the Atari_St(e) processor with cycles + read +
>> write access.
>>
>> If yes, we could also speed up hatari a little by removing the return
>> in each instruction code and transform all instruction functions to
>> void and read the amount of cycles directly from the table.
>> (we can also leave the gencpu.c code unchanged, it's no problem)
>>
>> Are you interrested in such a table ?
>>
>> Regards
>>
>> Laurent
>>
>>
>




More information about the hatari-devel mailing list