Jump to content
IGNORED

Pole Position - now with speech (WIP)


Rybags

Recommended Posts

ppos20.zip

 

A work in progress at the moment. Only the "Prepare to qualify" speech at this stage.

 

I've found the best method of getting good samples from the arcade original is to just run the game and Record Audio from MAME, rather than ripping from the ROM image.

So, I've done that - only problem being that you get some music in the "Great driving, you've qualified to race".

 

So far as getting the samples to work on the A8 - I've converted them to 4 KHz, 4 bits. The originals are only 2 KHz 8 bit, so there's not a huge deal of difference.

 

But...

Pole Position on the Atari uses some rather large DLIs, and at the moment the samples don't sound so great. The solution here will likely be to enable IRQs within the DLI, which will need some hacking of the actual game code.

The samples are played back with a Pokey Timer 1 interrupt. I've found that stealing the Immediate IRQ vector temporarily is a more efficient way to do things... using the Timer vector itself was a bit too slow.

 

I've also had issues with lockups - this example is just an early test, so might lock up occasionally - just press Reset and it'll run again. It's an unmodified copy of the cracked RAM-based cart image I've had for 20+ years.

 

The game code itself isn't modified in any way ATM - I've used a VBlank Immediate routine (the game only uses deferred VBlanks).

The routine checks a few RAM locations which hit specific values at times when the speech is needed. Not the most elegant way, but it'll do for the moment.

I've also got it changing colours - that's just for debugging and to let you see when the samples are being played.

 

It doesn't sound to good at all in my emulator - might be best to try on real hardware. Load with BASIC disabled. It also loads from DOS on a real machine, and should work if you put it on a Bin-Load menu disk.

Edited by Rybags
Link to comment
Share on other sites

Don't worry about the colours - at the moment the Timer routine changes COLBK just as a debug kinda thing.

 

I've just tried one with an altered DLI - improves the sound, but corrupts the screen.

Just patching the DLI with some code that re-enables IRQs and does a couple of quick things is enough to throw the whole thing into chaos.

The painful bit is that there's multiple DLIs happening. The ones up top of screen are no real drama. It's the one that does the road and has a Kernal that uses 70 scanlines or so that causes the sound to break up.

 

But, I've tried different sample rates. At some speeds it sounds better, despite the DLIs messing with it (actually, sounds a lot like the voice on Amiga's Alien Breed).

 

Looks like enabling IRQs in the DLI mightn't be such a great idea - you'll get corruption of the road graphics no matter what.

 

The other alternative might be to modify that particular DLI... there might be sufficient cycles to embed some playback code in there.

 

 

Re - timing of the speech. The problem we have there is that the music messes with the Pokey Timers. I initially tried having the speech overlaying the last note of the music but it didn't work out.

Edited by Rybags
Link to comment
Share on other sites

So they are - there's a number of references to the PAL/NTSC register... the game seems to have colour sets for each region.

 

Just had a look at the big DLI - it's at $8860. Would be some work, but it could probably be redone to accomodate Digi speech embedded in the loop.

Might have to leave it for later - getting real late here.

Link to comment
Share on other sites

OK. I've disected the big DLI that runs for about 100 scanlines, and should have room to jam in the sample playback.

Tried last night the method of re-enabling IRQs, and as expected they just cause massive screen corruption.

 

The big DLI runs a loop that iterates about every 6 scanlines, which almost matches the sampling rate I want to use.

It'll be a tight fit (timewise) though, the existing routine uses from around 40-44 cycles per scanline not counting the STA WSYNC.

 

By my calculations, there are 49 cycles available to the CPU given that we lose:

48 cycles to screen DMA (possibly less each time dependant on HSCROL value)

5 to PMG DMA

3 to DList fetch (all are LMS instructions)

9 to Refresh

 

65 in total.

 

The method I'll be using will use a bit of self-modifying code. The VBlank routine will change the operand of a LDA $xxxx,X instruction. It will also need to modify the STA $xxxx address. When the routine isn't needed, it'll just do a store to an unused location.

The address will be "estimated" by checking the IRQ's pointer (which is also self-modified), then adding the relevant amount.

 

Due again to time constraints, only the lower nybble of the samples will able to be played by the DLI... meaning it'll go faster for those 100 scanlines. Might need to adjust the IRQ so it executes each 3rd scanline to compensate.

 

All up, some hurdles to get over. With some luck I might do a bit on this tonight. Hoping to have a near to final solution in the next couple of days.

Link to comment
Share on other sites

I'm doing it by altering the original code as little as possible. Just patch a bit here and there, and the DLI routine I mentioned before will be replaced by code that resides elsewhere. That way it hopefully should be easier to port across to the 5200 and other enhanced versions.

 

It'll probably need at least 24K - I'm guessing here that the 5200 version is 16K and the flash cart can do a 32K image?

Link to comment
Share on other sites

I've found the best method of getting good samples from the arcade original is to just run the game and Record Audio from MAME, rather than ripping from the ROM image.

So, I've done that - only problem being that you get some music in the "Great driving, you've qualified to race".

 

Get the samples from the Self-Test mode (F2). The speech is sound #19 and 20.

Link to comment
Share on other sites

Never knew that. Thanks.

 

Daylight Savings just came on here... an hour less sleep tonight.

 

Got the DLI code just about ready - just got to put all the bits together, so might have something going later on.

good job..

 

Next fix the cars so they dont look like they were made out of LEGOS by a 5 year old..

Link to comment
Share on other sites

Next fix the cars so they dont look like they were made out of LEGOS by a 5 year old..

Snap! Oh no you didn't!

 

I always thought the graphics were 'serviceable'. Then again I never really played the arcade game much so I didn't know what I was missing.

 

Tempest

Link to comment
Share on other sites

ppos20.zip

 

A work in progress at the moment. Only the "Prepare to qualify" speech at this stage.

 

...

It doesn't sound to good at all in my emulator - might be best to try on real hardware. Load with BASIC disabled. It also loads from DOS on a real machine, and should work if you put it on a Bin-Load menu disk.

 

I have some hacked version from the 80s that already speaks "Prepare to Qualify" and you have to press the trigger to give gas rather than press it for brakes. Perhaps, you can use some auto-reversing tape and trigger off the audio from the cassette player for background sound track and have it timed perfectly so you know which phrase will come next and when to trigger that off. That would give you high quality audio and use up only a few bytes of memory. I guess you could also add other cars crashing into each other once in a while like it can happen in real racing.

Link to comment
Share on other sites

Gotta admit, I didn't do anything on it over the last day... spent a good 4 hours watching the football games.

 

Actually, you get less sunlight hours closer to the equator in the warm months. DST coming in on the long weekend is a good idea though - gives that extra day to adjust.

Link to comment
Share on other sites

I think I've played a version that uses the fire button for acceleration.

 

Does yours really have the speech? Can you upload it - if it's as good as I'm anticipating mine can be, I may as well not bother.

 

I can't locate it-- I looked around yesterday. Disk seems to have gotten lost in latest relocation, but I do remember hearing that message "Prepare to Qualify" on the Atari polepos game.

Link to comment
Share on other sites

I think I've played a version that uses the fire button for acceleration.

 

Does yours really have the speech? Can you upload it - if it's as good as I'm anticipating mine can be, I may as well not bother.

 

I can't locate it-- I looked around yesterday. Disk seems to have gotten lost in latest relocation, but I do remember hearing that message "Prepare to Qualify" on the Atari polepos game.

 

I could swear I played that version as well. I'll see if I can find a copy this evening.

 

Stephen Anderson

Link to comment
Share on other sites

pptest6.zip

 

Here's a work in progress version with modified main DLI. Note that it occasionally hangs when playing the sample (only "Prepare to qualify" at this point) - just press Reset and it will re-initialize.

Also, the sample sometimes won't play. Press Select or Option, then Start and it should be fine. I know the problem there, it has to do with the way it detects when the sample should be played.

 

The sound is still kinda ordinary... I'm working more on getting it bug-free, then I'll get the sample redone and with proper speed, and it should then come somewhat closer to the original.

 

It uses Pokey Timers (noticable by the colour change bars when playing voice), and also embeds playback in the DLI which smoothly contours the road.

That's the hard part since it uses almost all the cycles as it is. At the moment, it only plays the low-nybble of each sample during that part of the display (2 packed per byte, as normal with most samples).

 

I'm going to try another DLI modification which plays the "missing" samples. Also, I believe the hanging problem it sometimes gets is related to the Timer routine executing and the VBlank interrupt then occurring, and skipping Stage 2 as a result.

I've got a couple of ideas for a workaround for that... I'm thinking the easiest way might just be to disable the Timer IRQ halfway down the screen, and just use another couple of DLIs in the bottom border area.

Edited by Rybags
  • Like 1
Link to comment
Share on other sites

Just a thought...

 

Is the main problem that the grass/road area blocks out IRQ's? It could be replaced with an identical bitmap image (no DLI's) until the speech ends. The bitmap would RLE really well.

Edited by Bryan
Link to comment
Share on other sites

Could do that, yes. But the sound does still play in that area, albeit at reduced quality at the moment.

 

The real issue I'm having with it is that it hangs occasionally. I'm almost certain it happnes if the IRQ is running when VBlank occurs.

The problem with the OS VBlank is that it will skip Stage 2 VBlank in that case.

 

Thinking some more, a possible workaround there might be to change the VBlank routine to detect if an IRQ was in progress (TSX, LDA $104,X then test the P Status). Then, if an IRQ was being serviced, jump through vector ($224) from the Immediate routine.

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...