22 March 2012, 19:12 | #1 |
Registered User
Join Date: Jan 2012
Location: USA
Posts: 372
|
Anyone have any luck with using CPU for manual mode sprites?
It's not too difficult to use manual mode for sprites with the copper. I'm wondering, though, about the feasibility of using the CPU and MOVEM to rapidly reload the sprite registers with new data after the sprites have displayed on a scanline.
The idea is to preload D0-D7 and A0-A7 with sprite data then halt the processor with a STOP instruction. Once stopped, the copper is used to interrupt the CPU mid-scanline and the int handler would use a MOVEM to dump the new sprite data into the sprite registers. It should be possible to get at least 16 sprites per line (with certain limitations, obviously). I'm wondering, though, about the timing of chip register accesses. Is it four cpu cycles no matter what other DMA is going on? Seems at least the copper should prevent the CPU from accessing chip registers. |
25 March 2012, 06:29 | #2 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
Nothing stops CPU from writing SPRxDAT etc, it's exactly the same as writing them with the copper. At any chosen time, your Amiga is displaying a copper list. If the CPU wasn't able to change chip registers then, well then playing a song while showing anything onscreen would be impossible
With less than (what is it again? 5?) bitplanes on, MOVEM is indeed twice as fast as the copper with 4 cycles per word, since it doesn't have to read the MOVE-word of the copperlist. Interrupt handling time varies between CPUs, on 68000 it's something like 70 cycles. Should be possible to time it for stock A500 and A1200, the rest is harder... No need to stop the CPU if you use interrupts. Writing 32 words will take between 1/3 to 1/2 scanline on A500, to that is added interrupt handling code and register-loading. I'd busy-wait for the raster with the CPU and save the interrupt handling code. I guess you're planning to write not only SPRxDAT but also -POS since you're using a MOVEM. SPRxDAT writing is already present in parallax scrolling games of yore, so nothing impossible about this idea. Only one way to find out |
25 March 2012, 20:03 | #3 | ||
Registered User
Join Date: Jan 2012
Location: USA
Posts: 372
|
Quote:
But my question was more about the timing of the write to the chip registers. If DMA is occurring, can the CPU still write to the registers? Let's suppose the CPU has completed a MOVE instruction fetch and is ready to execute its write to the CHIP registers. Is this write blocked during DMA? If it's just like the copper, then it should block, bit I'm not sure. The CPU isn't competing with the chipset for access to RAM, after all. Can a chip registers write happen while DMA is happening? I tend to believe that the CPU is blocked, otherwise you can get into situations where the copper and CPU are trying to both update the same register at the same time. Maybe Toni knows what happens here. Quote:
Yeah, I've seen examples where the copper modified SPRxDAT. Getting twice the write speed of MOVEM, though, is enticing. I'm also interested it what happens when the palette registers are written with MOVEM when more than 4 bit planes are active. In this case having the chipset block writes during DMA is actually a good thing since it lets you spread out palette changes over the length of a scanline. In ham mode, it should be possible to change the lower 16 palette registers twice over the length of the line. With the STOP instruction/copper interrupt method, this would allow you to time the palette changes precisely with one palette change every 8 pixels. There would be a couple of spots where you couldn't do this, of course, because the CPU would have to do another MOVEM instruction fetch. |
||
26 March 2012, 08:26 | #4 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Chip RAM, Slow RAM and custom chipset registers share same internal Agnus busses and also have exact same timing = CPU chipset register access or chip ram access stalls identically if DMA accesses Chip RAM at the same time.
I agree that STOP is probably the best way to do this. Another accurate but also quite stupid metho is to start big blit that steals all CPU cycles. Copper can stop the blit by writing to DMACON, "releasing" the CPU |
27 March 2012, 21:16 | #5 | |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
If blitter nasty is on this is a better alternative than stopping the CPU. When I visited this Stop the Cpu Land 20 years ago I found no fruit. Or something
It seems a terrible waste (well, on cycle-starved OCS at least) when what you really want the CPU to do is being kept as busy as possible, indeed, same for the whole chipset, and without any of them doing a single unnecessary thing. You know, like run the OS and $#|+. As Toni also says, writing chip regs with the CPU is exactly like writing them with the copper, except, as mentioned the copper wasting 4c reading the register word. Quote:
Between DMA and CPU, DMA has higher priority and CMA has lower priority. Highest is the DRAM refresh slots because they can't be disabled, but apart from that the highest priority MA hog is display DMA (when bitplanes are on of course). After all the other DMA slots on a line comes the blitter DMA, and last the CPU MA / CMA. With CPU spriteDMA, on OCS it seems the CPU will waste 1/3 of the slots on a line busy-waiting or being stopped. The rest of the time it will be MOVEMing, and no other odd DMA must disturb it (blitter or >4 bpls). As I said, don't ask, just try it. It's just an evening's work and it's your idea. My suggestion is to start with a busy-wait-for-HPOS (IIRC, diff hpos on odd/even lines) and a big MOVEM loaded before the wait. Just as you can build a copperlist, you can build a complete program for the whole screen. If you put it in chipmem, accelerators (except ACA630 with some options on) won't throw up. |
|
28 March 2012, 23:47 | #6 | |
Registered User
Join Date: Jan 2012
Location: USA
Posts: 372
|
Quote:
And while I agree with you that using the blitter to perform work while blocking the CPU can be a good use of cycles over just using STOP, you still have the problem of precisely timing chip register writes. The initiation of the blit must be done at the correct time so that the CPU performs its writes at the correct time. The only way I can see this being possible is by using the STOP instruction at least once. I suppose after that blits can be used, but you need at least one point where the CPU is perfectly in sync with the beam. |
|
20 October 2015, 01:13 | #7 | |||||
Code Kitten
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
|
My, just did a google search and look what an interesting thread I found.
The EAB is just a treasure trove of technical information. So, without further ado, let me invigorate these old bones with new life! (*) Quote:
Quote:
Also, now that I am thinking of it, Photon, are you using this technique in the Frazetta demo by any chance? Quote:
movem"reloading" but close enough. Obviously, only the vertical blanking area will be left for any real processing time but still quite cool. Did anyone ever do that on OCS? Quote:
Quote:
(*) |
|||||
20 October 2015, 08:51 | #8 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
|
20 October 2015, 23:26 | #9 | |
Code Kitten
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
|
Quote:
Makes it even more regrettable that they did not put the Chip registers in Chip RAM... This would have allowed the blitter to set them for super fast setups. |
|
21 October 2015, 10:56 | #10 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,162
|
that's why copperlists exist right?
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Manual CPU Frequency setting not working | Scyphe | support.WinUAE | 11 | 19 July 2013 12:00 |
Change CPU in Save State Mode | arti | support.WinUAE | 9 | 23 December 2010 19:27 |
Anyone had any luck with ADFView? | MethodGit | Amiga scene | 1 | 25 September 2010 23:27 |
Problems with Detect Idle CPU mode | bdoe | support.WinUAE | 6 | 27 September 2002 13:44 |
some luck - still no CD drives | Unregistered | support.WinUAE | 2 | 13 September 2002 23:16 |
|
|