28 July 2014, 21:46 | #1 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
Under which circumstances is an extra-read required?
...before relying on the value.
Specifically: The extra read before relying on the result of blitter busy flag. You know, this one. Code:
tst.w DMACONR .l: btst #6,DMACONR+1 bne.s .l 2) Is it required if the code is running in chipmem? (Such code works fine without extra read on A1200-060, with FMODE=0.) 3) Why isn't it required for VHPOS, INTREQ, etc? (also pollable regs set by custom chips) |
28 July 2014, 21:48 | #2 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,017
|
Its a bug in some German A1000's isn't it?
|
28 July 2014, 21:48 | #3 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
That's the original reason, at least, from the HRM.
|
28 July 2014, 23:15 | #4 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,545
|
IIRC the A1000 Agnus sets the BBUSY bit only when the first Blitter DMA slot after a Blitter start is reached. There might be situations where the CPU is fast enough to check BBUSY before that happens (Fast RAM?).
Later Agnus versions (Fat Agnus?) set the BBUSY bit at the same time the BLTSIZE is written. Toni Wilen knows the details for sure... |
29 July 2014, 01:37 | #5 |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
|
29 July 2014, 02:01 | #6 | |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
Quote:
I've tipped off Toni in the hope that his probe will reveal the truth. |
|
29 July 2014, 08:33 | #7 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,573
|
I think it was simply much easier to document it as "read DMACONR" twice than some long and boring explanation which everyone would ignore or misunderstand anyway
|
29 July 2014, 09:49 | #8 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
I'm more interested in how it works than how it was documented, unless the documentation is perfect and complete of course, and we're done here?
The goal is of course to remove as many unnecessary extra reads as possible (since blits are often in inner loops) but stay compatible under the right circumstances. F.ex., it doesn't seem required due to CPU speed or required due to prefetch. |
29 July 2014, 11:11 | #9 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,545
|
In fact you can access any custom chip register to generate the required delay. For example in my WAITBLIT I'm setting the blitter priority bit before checking BBUSY, which has the same effect. So it comes for free.
Code:
macro WAITBLIT move.w #$8400,DMACON(a6) .\@: btst #6,DMACONR(a6) bne.b .\@ move.w #$0400,DMACON(a6) endm |
29 July 2014, 13:14 | #10 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
phx: never heard of. Tested on such A1000s?
It's not about generating delay. A1000 accelerator=no blit works? Don't think so! Plus it's slower so it's not a very good replacement |
29 July 2014, 20:02 | #11 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
It is about generating delay. Everything suggests it's exactly what it looks like, that BBUSY is not set until the Blitter performs its first memory access.
Adding an accelerator to the system doesn't change the delay introduced by touching the hardware registers, it doesn't work that way. The bus where the hardware sits can't serve requests at infinite speed, and there's always a minimum delay introduced, regardless of whether you are running on a 7 MHz 68000 or a 100 MHz 68060. Also, when you say phx's method of waiting for the Blitter would be slower, is that because of those extra move instructions before and after, and because you always keep Blitter priority disabled anyway? |
29 July 2014, 20:11 | #12 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
I have wondered if one could just do this:
Code:
macro WAITBLIT move.w #$8400,DMACON(a6) move.w #$0400,DMACON(a6) endm |
29 July 2014, 20:56 | #13 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
The blitter doesn't stall the CPU, it takes cycle slots on the chipmem bus. BLTPRI=1 with a clear-blit only takes half of them. There are also gaps in the slot sequence at the beginning and end of a blit, as the blitter waits for the source/dest channel's assigned slot to come up for loading/unloading a word.
This would make phx's macro fail on these A1000s if it's not as he claims but as it's written in HRM - the btst will have been reached a few words into the clear-blit without triggering the desired effect inside the old Agnus. Your macro is not a waitblit macro. For both macros, if BLTPRI=0 when called, BLTPRI will be changed after the blit is started. I don't know if the blitter reads BLTPRI in the middle of a blit. |
29 July 2014, 21:14 | #14 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,545
|
Quote:
Quote:
Would be interesting to test that. Solid Gold uses my macro. Does anybody own an A1000 with at least 1MB RAM? Mine has only 512K. Quote:
|
|||
29 July 2014, 21:22 | #15 | |||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,573
|
Quote:
Quote:
Quote:
|
|||
29 July 2014, 21:28 | #16 | |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
Mrs. Beanbag's macro doesn't check BBUSY. If the very next instruction writes to a blitter register, I'm sure it would mess the blit up, because of the gaps in the slot sequence when assigned channel slots are reading their first input words, even for four-channel blits.
Quote:
|
|
29 July 2014, 21:44 | #17 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,545
|
Quote:
Quote:
I will always use that macro before a Blit, to ensure that the Blitter is available. In the time before I execute the macro I want the Blitter to run in parallel to the CPU. But when I do nothing else than waiting for BBUSY the Blitter should finish as fast as possible. So I set its priority flag. |
||
29 July 2014, 22:25 | #18 | |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
Quote:
There is no point in the CPU stealing cycles from the Blitter to do nothing but check if the Blitter is finished. |
|
29 July 2014, 22:28 | #19 |
Registered User
Join Date: Jan 2012
Location: USA
Posts: 373
|
Are there any drawbacks to simply polling bit 6 in INTREQR?
The only thing I can think of is that it might be slightly slower because of the write to INTREQ to clear the bit before starting the blit. And isn't there an issue with the BBUSY bit possibly being reset before the last write by the blitter? If bit 6 in INTREQR is set after the last blitter write then that would further argue for its use especially in code that mixes blitter and CPU writes to the same area of memory. |
29 July 2014, 22:48 | #20 | ||
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
Quote:
A tight loop, in which the blit wait would follow directly after the write to BLITSIZE, is just the worst case and that's what we need to test to know anything. Quote:
Basically it's a question about whether "extra read before blitwait on some A1000s" and "clear INTREQ twice to work on A4000(T?)" are the ONLY compatibility patches. Me, I just want to remove that pesky extra read of blitwait and find the circumstances under which it's safe to do so (and under which circumstances it's safe to omit the blitwait completely, which I think I know already). |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Benefactor Extra Levels | hextreme | Nostalgia & memories | 16 | 30 August 2021 15:10 |
Why extra branches? (Which compiler?) | crabman | Coders. Asm / Hardware | 31 | 01 May 2014 08:24 |
Strange pause issues under certain circumstances | Bloodwych | support.WinUAE | 3 | 21 December 2009 11:25 |
Looking for extra RAM for A1200 | Vollldo | support.Hardware | 10 | 07 November 2009 21:53 |
Extra Material | Haystack | HOL suggestions and feedback | 0 | 08 October 2003 16:05 |
|
|