English Amiga Board    


Go Back   English Amiga Board > » Coders > Coders. Asm / Hardware

Reply
 
Thread Tools
Old 09 September 2012, 12:38   #1
Codetapper
Moderator
 
Codetapper's Avatar
 
Join Date: May 2001
Location: Auckland / New Zealand
Age: 38
Posts: 2,461
Send a message via Skype™ to Codetapper
Question Lack of blitter waits on A500

I'm curious if some of the more techy coders can answer this one! On many A500 games, the coders simply did not put any blitter wait operations in. This was apparently because the CPU was so slow in comparison to the blitter that they weren't needed. Some games had incredibly small bits of code between each blit. eg. Menace source:

Code:
        move.w  d2,bltdmod(a6)
        move.w  #$09f0,bltcon0(a6)    ;use D = A for the blit
        move.l  (a0)+,bltdpt(a6)      ;and do all three planes.
        move.w  d3,bltsize(a6)
        move.l  (a0)+,bltdpt(a6)
        move.w  d3,bltsize(a6)
        move.l  (a0)+,bltdpt(a6)
        move.w  d3,bltsize(a6)
        bra     restoreloop
Even if the blit is something tiny like a perfectly aligned 16x16 pixel image, that would be 4 cycles for a D=A blit x 16 pixels high = 64 cycles.

I find it quite incredible that in the time the blitter is working, the CPU can't execute 2 lousy instructions before it's finished? If the CPU is slightly faster, the blitter will be copying to a different location and corrupt the screen.

Can anyone explain exactly how these timings work? What size blit could be performed on an A500 without any waits? And if you lookup the 68k instruction counts, it seems that the blitter should not beat the CPU at all, particularly when the game is altering blitter registers while the blitter should be operating!
Codetapper is offline   Reply With Quote
Old 09 September 2012, 12:55   #2
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 4,546
Most probably the game sets "blitter nasty" before performing the small blits.
__________________
Makes me sick when I hear all the shit that you say
So much crap coming out, it must take you all day
There's a space kept in hell with your name on the seat
With a spike in the chair just to make it complete
StingRay is offline   Reply With Quote
Old 09 September 2012, 13:06   #3
Codetapper
Moderator
 
Codetapper's Avatar
 
Join Date: May 2001
Location: Auckland / New Zealand
Age: 38
Posts: 2,461
Send a message via Skype™ to Codetapper
I just checked and indeed it's doing:

Code:
        move.w  #$87e0,dmacon(a6)
So blitter nasty is set for the entire game (not enabled and disabled as required!) and I guess that's why no blitter waits.

I would still think that would cause problems for certain times (during a vertical blank etc) where there isn't much DMA happening, or does that bit being set effectively kill the 68000 CPU completely? (But not 68020+)
Codetapper is offline   Reply With Quote
Old 09 September 2012, 13:45   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 38
Posts: 11,941
Blitter stops the CPU (steals all cycles) if nasty is set and blitter's enabled channel combination don't have any idle cycles.

For example D and A enabled: uses all cycles, but on the other hand D only clear uses only every other cycle, CPU won't stop. Line mode also uses only every other cycle. check HRM for cycle diagrams.

"Unfortunately" CPU won't stop immediately, there is 2 cycle delay between write to BLTSIZE and before blitter starts and first D write cycle is always idle (except linemode) and finally CPU prefetch has already fetched next word: there are total 4 "free" memory cycles available before CPU stops. (If anyone is interested in details)

68020+ can still stop because custom chipset register accesses are also blocked (shares same chip ram bus) but CPU can be fast enough to execute following blitter register write during above "blitter startup delay" time. Above code probably isn't 68020 compatible if a0 points to 32-bit ram. (need only single memory access)

68040+ is most likely always fast enough.
Toni Wilen is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Improving emulated performance from original speed (or lack of) Morbane support.Amiga Forever 14 18 December 2011 02:57
Lack of appreciation for hand drawn 2D graphics Bloodwych Retrogaming General Discussion 34 13 August 2011 00:00
A500: max blitter+cpu throughput zaz Coders. General 2 30 March 2010 18:52
Adding mouse waits into existing code Jim Coders. General 7 22 December 2004 16:16


All times are GMT +2. The time now is 04:54.

-->

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Page generated in 0.16112 seconds with 11 queries