Blitter support for VIDC1/20 and palette changes

Discuss development specific to the Pi version of ADFFS
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Blitter support for VIDC1/20 and palette changes

Post by JonAbbott »

Steve, it's occurred to me that we'll need to pre-stage the VIDC20 registers on the Pi on a MODE change, otherwise the blitter is going to fail once it's recoded to account for VIDC parameters.

There's a few ways of doing that off the top of my head:

1. A similar botch to what I did for the current VIDC20 module, where LCDgm writes VIDC20 registers when ADFFS is translating VIDC
2. Implement an SWI and have LCDgm pass the values to ADFFS
3. Issue Service_ModeExtension, although this will only work if we leave the Service_ModeExtension code in ADFFS
4. The VIDC type 0 MODE parameter table is still in ADFFS as I've not removed it yet. It could write the parameters to the VIDC table on a MODE change when running on a non-IOMD machine

What are your thoughts?
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Blitter support for VIDC1/20 and palette changes

Post by JonAbbott »

Whilst I recode the IOC emulation to get IRQ (&18) and IRQ1v (&100) to go through the JIT, extASM237c is the last version of ADFFS that will run James Pond. It's taking a bit longer than I thought to add support for these, mainly due to other changes having a knock on effect, but it's getting close.

I'm using the following games to check it's working:
Jahangir Khan World Championship Squash
James Pond
Lemmings
Lotus Turbo Challenge 2 - this times T1, so will be a good test for palette changes being in the right place
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Blitter support for VIDC1/20 and palette changes

Post by JonAbbott »

I've noticed Jet Fighter's palette is wrong since implementing mid-frame palette change support, although I'm not sure if it's directly related as I've not tested it for a few weeks.

Going by the odd things going on at the bottom of the screen with what look like raster bars, I'd say it's changing the palette just before VSync occurs. The game however doesn't use T1 or VSync pulse on IOC, so must be issuing palette changes on Event 4.

One thing that has changed whilst implementing palette changing is switching VIDC20 emulation from PaletteV to write directly to the palette table. That causes two differences:

1. PaletteV would not have taken effect until the next VSync, now the change is immediate
2. The OS palette isn't updated, so it will be writing its original palette on VSync

Pac-mania changes the palette on Event 4, but doesn't seem to be affected, I've only noticed it in Jet Fighter.
steve3000
Posts: 198
Joined: Thu May 02, 2013 9:25 pm

Re: Blitter support for VIDC1/20 and palette changes

Post by steve3000 »

Great progress! Unfortunately I have very limited internet access right now as away from home. Just managed to get on here - I can't see where to download 237c, is that available anywhere? Although I'm using emulation only at moment...

Have made some progress with LCDgm and thinking about your question re. pre-loading VIDC registers in ADFFS. More soon.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Blitter support for VIDC1/20 and palette changes

Post by JonAbbott »

JonAbbott wrote:I've noticed Jet Fighter's palette is wrong since implementing mid-frame palette change support, although I'm not sure if it's directly related as I've not tested it for a few weeks.
Jet Fighter is okay on 237f and breaks from 237g so it's not the palette code that's causing the problem. I'll investigate what changed between those builds to break it.

All builds are in: /development/32bit/CPU
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Blitter support for VIDC1/20 and palette changes

Post by JonAbbott »

JonAbbott wrote:Jet Fighter is okay on 237f and breaks from 237g so it's not the palette code that's causing the problem. I'll investigate what changed between those builds to break it.
Just to confirm, it's unrelated to the blitter changes. The cause is the code added to OS_FSControl / ADFFS_DiscOp which changes pages back to read/write when files are loaded. I'm at a loss as to how that will result in Jet Fighter going wrong as it only changes whole pages within the range the file was loaded into and any code that's subsequently touched in those pages will cause the page to change back to read-only. Will investigate later.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Blitter support for VIDC1/20 and palette changes

Post by JonAbbott »

237i now on the dev site. I've turned off subpage support on the Pi, which has fixed both Jet Fighter and James Pond, so all ready for the blitter changes.

StrongARM support is still broken, but I'll look into that next week.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Blitter support for VIDC1/20 and palette changes

Post by JonAbbott »

JonAbbott wrote:Either way, it needs to calculate the number of IOC clock ticks per pixel/raster based on the pixel clock. For the time being it's reducing T1 by 3 every four pixels which looks about right for 320x256 @ 50Hz.
I noticed today that James Pond is slightly out, so I started thinking about how to implement this.

The best place to calculate the ticks per pixel is probably on a mode change and in the code that applies the VIDC parameters on VSync. I just need to figure out the equation :?

Any ideas?

Are we going to leave it at 4 pixel accuracy or per raster? I guess that largely depends on your plans for the blitter. We certainly have enough spare CPU time to leave it at 4 pixels, but is that required considering the Arc isn't particularly accurate when T1 is latched on VSync.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Blitter support for VIDC1/20 and palette changes

Post by JonAbbott »

I now have Caverns working on the Pi, if you'd like another game besides James Pond to test the blitter changes.

Update to the latest Obey.zip in /development/obey and latest ADFFS500 in /development/32bit/cpu (extASM500239b or higher)
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Blitter support for VIDC1/20 and palette changes

Post by JonAbbott »

JonAbbott wrote:4. The VIDC type 0 MODE parameter table is still in ADFFS as I've not removed it yet. It could write the parameters to the VIDC table on a MODE change when running on a non-IOMD machine.
I've started implementing this method for non-IOMD using the RO3.1 TV modes table.

Rockfall gets past the title page, it might be useful to see what it's doing and see if we can fix it on IOMD / IOC under LCDgm, where the left third of the screen is missing. I added debug code to display the screen resolution and it goes to 640x256 so is in MODE 15.
Post Reply