How to calculate clock cycles for MOVEM?

All 680x0 related coding posts in this section please.

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Zamuel_a
Atari God
Atari God
Posts: 1234
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

How to calculate clock cycles for MOVEM?

Postby Zamuel_a » Thu Jan 30, 2014 12:57 pm

I tried to figure out how many cycles a movem would take, and by looking at some examples with the count written out and compare it with what I calculated it didn't match so something must be wrong.

For example, I saw this in a program example about color change each scanline and since that code is VERY critical I would assume this is corrent:
movem.l d7/a0-a5,(a7) ; 64

By looking at this document:
http://oldwww.nvg.ntnu.no/amiga/MC680x0_Sections/timjmpetc.HTML

I get that the calculation should be: 14+8n (R -> M), n = number of registers = 7 -> 14 + 8*7 = 70 cycles and NOT 64? So what is wrong?
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2978
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: How to calculate clock cycles for MOVEM?

Postby AtariZoll » Thu Jan 30, 2014 1:17 pm

Correct formula for movem from registers to RAM is: 8 + 8xn for long , where n is count of registers used
For mem to registers it is 12 + 8xn because overshot

In case of word-wise transfers it is 8 + 4xn and 12 + 4xn .

No way that movem cycle count is not divideable by 4. I used this a lot, and what wrote is accurate.
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.

User avatar
Nyh
Atari God
Atari God
Posts: 1496
Joined: Tue Oct 12, 2004 2:25 pm
Location: Netherlands

Re: How to calculate clock cycles for MOVEM?

Postby Nyh » Thu Jan 30, 2014 4:46 pm

Zamuel_a wrote:movem.l d7/a0-a5,(a7) ; 64

By looking at this document:
http://oldwww.nvg.ntnu.no/amiga/MC680x0_Sections/timjmpetc.HTML

I get that the calculation should be: 14+8n (R -> M), n = number of registers = 7 -> 14 + 8*7 = 70 cycles and NOT 64? So what is wrong?

You are using the time for movem.l d7/a0-a5,d16(An,ix): 14+8n
you want the time for movem.l d7/a0-a5,(An): 8+8n

Hans Wessels

Zamuel_a
Atari God
Atari God
Posts: 1234
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: How to calculate clock cycles for MOVEM?

Postby Zamuel_a » Thu Jan 30, 2014 5:12 pm

You are using the time for movem.l d7/a0-a5,d16(An,ix): 14+8n
you want the time for movem.l d7/a0-a5,(An): 8+8n


Ah ok! I was looking at the wrong line! ST.upid :wink:
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

wietze
Captain Atari
Captain Atari
Posts: 221
Joined: Fri Mar 01, 2013 10:52 pm

Re: How to calculate clock cycles for MOVEM?

Postby wietze » Thu Jan 30, 2014 5:38 pm

http://frummel.org/~weedz/atari/timings.txt is what I use to calc the cycles per instruction.

Im not sure how accurate it is; but it worked very well for me so far.

User avatar
galax
Captain Atari
Captain Atari
Posts: 208
Joined: Tue May 27, 2014 5:47 pm
Location: Toronto, Canada

Re: How to calculate clock cycles for MOVEM?

Postby galax » Tue May 27, 2014 8:14 pm

Is it cheating to step through the code on Steem SSE Boiler Room (Debug Build) and count how many cycles it takes? I've always meant to compare it against some of those tables, see if it matches up.


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 4 guests