Jump to content
IGNORED

POKEY 16-bit mode and other AUDCTL settings - A7800 emulation


Recommended Posts

Confirmed, standard 16-bit on C distortion is 100%.  Gave it the ultimate benchmark:  The "Have You Played Atari Today" jingle which uses this setting.  On the older A7800 release it had a horrid banjo type sound.  It's now 100% to real hardware.

 

Posting up the pokeyplayer for EXO.  Everything is 100% to real hardware except as marked:

 

Area 2:  A minor issue, I don't think the fuzziness is being done on the $4x/$Cx two-tone bass.  It still sounds good though.  Keep in mind I am still in the middle of documenting all the settings in this mode (there are at least about 9 or 10!)

Area 3:  The two-tone $Ax distortion 1.79+64 notes at the beginning are missing on some notes.  This is actually the same issue that presented itself in the most recent releases of Altirra and PokeyMax.  Once it goes to the CSAVE bell sound in the middle everything is ok.

 

Area 5, and title music:  The two-tone $Ax distortion 1.79+15 note arpeggio is missing on some notes, same issues as above.  Also, $2x 1.79 bell is playing in the wrong octave and waveform

 

Launch bay:  The fuzzy $4x/$Cx two tone bass is working ok, $2x @1.79 bell lead is wrong waveform and octave again, same issues as above in Area 5.

 

Launch and credits:  Reverse 16 $4x guitar is good!  Again, wrong octave on $2x @1.79 mhz bell.

 

Game Over:  Has the same issue with the $2x @1.79.  Also, may have to check against real hardware on the Reverse 16 $Ax bass with $Ax playing on second channel.  Seems unstable, but this instability may also be present in real hardware.  This however is a minor issue.

 

 

 

exo-pokeyplayer.78b.a78 exo-pokeyplayer.78b.bin

  • Like 4
Link to comment
Share on other sites

  • 3 weeks later...

So, further testing and A7800 is about 98% to 99% good to real hardware.

 

I am putting efforts now (in addition to documenting new POKEY settings) to Dragonfly stereo POKEY.  I know actual emulation is a ways away for this, but I am going to work up actual examples anyway towards that eventuality.  It'll be a rendition of music from Metroid. 

 

I do need a reminder tho ... how do I edit the .128 file to make a binary addressable by the Dragonfly, for $440 and $450 POKEY?  I've got the music player code right, I'm certain ...

  • Like 3
Link to comment
Share on other sites

  • 3 months later...
On 7/17/2019 at 12:51 AM, Synthpopalooza said:

Another obscure function of POKEY ... is that there is a means of playing sampled audio.  What you have to do is set AUDC0 to $1x or some other odd value.  Normally this plays no sound, but it pops the speaker.  By varying the volume, you can play a 4-bit quality audio sample, with the disadvantage that it will of course take up the entire CPU time for the duration of the sound being played.  I will attempt to work up a test example to see if it will work in the emulator or not.

Butwait... if the POKEY is like the TIA, you can set all 4 channels to 1x and play 4 4 bit samples at once or 1 6 bit sample! Almost as good as NES.

Link to comment
Share on other sites

On 4/22/2022 at 2:04 PM, Synthpopalooza said:

So, further testing and A7800 is about 98% to 99% good to real hardware.

 

I am putting efforts now (in addition to documenting new POKEY settings) to Dragonfly stereo POKEY.  I know actual emulation is a ways away for this, but I am going to work up actual examples anyway towards that eventuality.  It'll be a rendition of music from Metroid. 

 

I do need a reminder tho ... how do I edit the .128 file to make a binary addressable by the Dragonfly, for $440 and $450 POKEY?  I've got the music player code right, I'm certain ...

You're breaking my mind..... Arrgh!

You can look at the old world .a78 header documentation if that helps.

Edited by Ecernosoft
Link to comment
Share on other sites

  • 6 months later...
2 minutes ago, Synthpopalooza said:

I think so.  The two POKEY have to be mapped at $440 and $450, and some jiggerypokery has to be done with the .a78 header 

To say nothing of the modifications needed on the DF to make it work since both Pokeys are combined just before going into the cartridge port. I know a 3.5mm jack could be added to break this out, but then you need an external mixer to mix your TIA + Pokey and then back to your receiver/TV to get the right balance with all the stereo channels in place right?

Link to comment
Share on other sites

  • 1 year later...

Hello!

 

I realize I am very late to the party.  I am trying to learn more about POKEY and found this amazing thread.  But, as I was working my way through it, I realized that something strange may have occurred over time.  Let me explain-- I think what happened was that over the 5 years this thread was active, the "a7800" emulator was improved quite a bit to more closely match real hardware.  However, on the older posts (page 1-3), a lot of demos were posted with notes saying that they would work on emulation, but not necessarily on real hardware (or at least, that is what it sounds like)?  And, it looks like over the last 5 years, a7800 was improved quite a bit to be closer to the real hardware.  This seems to lead to a situation where a bunch of the old demos don't work at all on modern versions of a7800.  It makes them a bit tough for a beginner to learn from.

 

For reference, I am using a7800 v5.2.

 

Maybe I'm doing something wrong, but:

 

The following demos seem to work on a7800:
 * arkanoid2-levelstart.A78
 * worldrunner.A78
 * zanac1.A78
 * zanac2.A78
 * marioworld1.A78

 

But, these just make quiet screens or have random popping noises in a7800:

 * atariage-jingle2.A78
 * bubbob7800.A78
 * bubblebobble-pokey450.A78
 * marioworld-pokey450.A78
 * marioworld.A78
 * megaman2-start.A78
 * megaman-pokey450.A78
 * rollingthunder-intro.A78
 * rollingthunder-intro-450.A78
 * test16k.A78
 * bubbob7800-bass.A78
 * zanac1-450.A78
 * zanac2-450.A78

 * marioworld-pokey450.A78
 * marioworld.A78
 * marioworld1-450.A78

 

I'm using a mac for emulation; I'm not sure if that's a contributing factor.

 

Am I understanding what happened correctly?  If so, it's kind of a shame that a lot of these files don't work as expected anymore.  Are there are newer versions of these older files that are compatible with the newer version of a7800?

 

Also, it sounds like a lot of this was done as a documentation exercise, which is fantastic.  Is there a great / updated resource for how AUDCTL works?  There's so much that POKEY can do, but I find some of it confusing.

 

Note: if it's just me (which it certainly could be), I would be open to any feedback to help figure out where things broke on my side.

 

Link to comment
Share on other sites

Just quick check.

I don't see in code JSR to RSTPOKEY (need to set SKCTL=3)

 

;	RESET POKEY CHIP
RSTPOKEY:
	LDX #$0F 
	LDA #$00
RSTLP:
	STA AUDF0,X									;CLEAR POKEY REGISTERS
	DEX 
	BPL RSTLP 
	LDA #$03
	STA SKCTLS									;TURN IT ON
	RTS

 

Also I don't see any writes to XM cntrl1 to switch Pokey on

 

Try JS7800 online emulator to check other files.

 

Also some my Pokey LZSS music

https://forums.atariage.com/topic/315966-my-experiments-with-atari-7800/page/13/#comment-5215809

 

BTW don't expect that Hokey will play music well. It's ok for A7800 world where it's no other option than TIA, but in A8 is not.

https://github.com/zoltraks/hokey-stereo-test

 

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

14 hours ago, Propane13 said:

Hello!

 

I realize I am very late to the party.  I am trying to learn more about POKEY and found this amazing thread.  But, as I was working my way through it, I realized that something strange may have occurred over time.  Let me explain-- I think what happened was that over the 5 years this thread was active, the "a7800" emulator was improved quite a bit to more closely match real hardware.  However, on the older posts (page 1-3), a lot of demos were posted with notes saying that they would work on emulation, but not necessarily on real hardware (or at least, that is what it sounds like)?  And, it looks like over the last 5 years, a7800 was improved quite a bit to be closer to the real hardware.  This seems to lead to a situation where a bunch of the old demos don't work at all on modern versions of a7800.  It makes them a bit tough for a beginner to learn from.

 

For reference, I am using a7800 v5.2.

 

Maybe I'm doing something wrong, but:

 

The following demos seem to work on a7800:
 * arkanoid2-levelstart.A78
 * worldrunner.A78
 * zanac1.A78
 * zanac2.A78
 * marioworld1.A78

 

But, these just make quiet screens or have random popping noises in a7800:

 * atariage-jingle2.A78
 * bubbob7800.A78
 * bubblebobble-pokey450.A78
 * marioworld-pokey450.A78
 * marioworld.A78
 * megaman2-start.A78
 * megaman-pokey450.A78
 * rollingthunder-intro.A78
 * rollingthunder-intro-450.A78
 * test16k.A78
 * bubbob7800-bass.A78
 * zanac1-450.A78
 * zanac2-450.A78

 * marioworld-pokey450.A78
 * marioworld.A78
 * marioworld1-450.A78

 

I'm using a mac for emulation; I'm not sure if that's a contributing factor.

 

Am I understanding what happened correctly?  If so, it's kind of a shame that a lot of these files don't work as expected anymore.  Are there are newer versions of these older files that are compatible with the newer version of a7800?

 

Also, it sounds like a lot of this was done as a documentation exercise, which is fantastic.  Is there a great / updated resource for how AUDCTL works?  There's so much that POKEY can do, but I find some of it confusing.

 

Note: if it's just me (which it certainly could be), I would be open to any feedback to help figure out where things broke on my side.

 

Some (Many) may have bad or incomplete headers.  Have you tried the demos from the PROPack?   

 

I just tried Rolling Thunder Intro, Mega Man, and Super Mario World POKEY demos and all sound perfect under A7800 v5.2 with the respective *.a78 files from the PROPack under the Demos folder, leveraging either the corresponding 4000 or 450 specified POKEY addressing.

  • Like 3
Link to comment
Share on other sites

To expand on what's been said, a good many of the demos were missing taking pokey out of reset (as Eagle said) and another good chunk had issues with headers (as Trebor said). For a while we had a7800 with pokey starting up out of reset, so the demos played. But then Trebor and I discovered that a good many of the demos didn't play on real hardware (except with flash carts that may have taken pokey out of reset) we decided to make this aspect of a7800 hardware accurate.

 

To address the demos in Trebor's pack, I wrote a patcher that updated the demos with a small routine to take pokey out of reset, and Trebor fixed up problems with the headers.

 

And now you know the rest of the story.

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Thank you so much @RevEng, @Trebor, and @Eagle.  You are 100% correct in your assessments and this has been very helpful for me.

 

@Trebor is correct, and I have confirmed that there are no issues with the latest PROPack.  However, I did find that one item is missing, though: metroid-brinstar-lead-harmony-dblpokey.asm requires that there be 2 POKEY chips available (at 440 and 450).  From what I gather in this thread, this still isn't a valid configuration on real hardware or in emulation.  And, as is not surprising, that .asm file doesn't compile for me due to missing definitions.  So, that one may still require a little effort in a few places if it is ever desired to be working and added to the PROPack.

 

As a person looking to learn how to develop for POKEY support, I went a small step further and put all of these items into a compilable github repo.  Unfortunately, it only compiles nicely on Mac for now (which is my development environment)-- I hope that is okay.  I would be happy to take pull requests if folks wanted to add the capabilities to be able to work on different platforms.  Note that if @Synthpopalooza has any problems with this repository being available, I am happy to take it down and/or make it private.  I completely recognize that this is not my code and I have no rights to it.  However, I thought that having a compilable repository somewhere would be helpful for developers as they would have the ability to tweak values, recompile, and learn from the changes in their outputs.  Since a lot of the .asm files in this thread have issues, I thought making an archive of "repaired" code available might be of value.  Again, if this is problematic for any reason, just let me know.

 

The demo repo can be found here:

 

 * https://github.com/johnkharvey/atari_7800_pokey_examples

 

I tried to credit the author as much as possible in the README, but if more info needs to be added, I would be happy to make edits.

 

And with that, I'm really looking forward to playing with these a bit to better understand how these work.  This is exciting stuff!

Link to comment
Share on other sites

 

2 hours ago, Propane13 said:

Thank you so much @RevEng, @Trebor, and @Eagle.  You are 100% correct in your assessments and this has been very helpful for me.

 

@Trebor is correct, and I have confirmed that there are no issues with the latest PROPack.  However, I did find that one item is missing, though: metroid-brinstar-lead-harmony-dblpokey.asm requires that there be 2 POKEY chips available (at 440 and 450).  From what I gather in this thread, this still isn't a valid configuration on real hardware or in emulation.  And, as is not surprising, that .asm file doesn't compile for me due to missing definitions.  So, that one may still require a little effort in a few places if it is ever desired to be working and added to the PROPack.

HOKEY supports dual POKEY, so I can try this demo in a bit and see how it works there.


HOKEY use a transparent form of bankswitching to support two POKEYs in the addressable space of 16 bytes, and responds equally to $440 or $450, so a properly-written program will work on either HOKEY or other dual-POKEY implementations with separate address space.
 

  • Thanks 1
Link to comment
Share on other sites

Just as a data point (even though it sounds like some code updates are imminent), here are the current compile failures on the dual-pokey demo metroid-brinstar-lead-harmony-dblpokey.asm:
 

--- Unresolved Symbol List
POKEY2_OFFSET            0000 ????         (R )
CHD.FREQCNT              0000 ????         (R )
CHD.TUNPRIOR             0000 ????         (R )
CHANNEL_COUNT            0000 ????         (R )
CHD.TUNON                0000 ????         (R )
SKCTL                    0000 ????         (R )
CHD.CTLVOL               0000 ????         (R )
CHD.DURNLO               0000 ????         (R )
CHD.NOTEHI               0000 ????         (R )
CHD.DCYSTOR              0000 ????         (R )
CHD.DURNHI               0000 ????         (R )
CHD.TUNFRM               0000 ????         (R )
CHD.CTLSAV               0000 ????         (R )
CHD.TUNINDEX             0000 ????         (R )
CHD.NOTELO               0000 ????         (R )
--- 15 Unresolved Symbols


src/440/metroid-brinstar-lead-harmony-dblpokey.asm (5): error: Unknown Mnemonic 'POKEY2_OFFSET'.
src/440/metroid-brinstar-lead-harmony-dblpokey.asm (6): error: Unknown Mnemonic 'CHANNEL_COUNT'.
src/440/metroid-brinstar-lead-harmony-dblpokey.asm (117): error: Unknown Mnemonic 'CHD'.
src/440/metroid-brinstar-lead-harmony-dblpokey.asm (970): error: Value in 'byte byte 2406' must be <$100.

 

These can be fixed fairly easily:

 

 * On lines 5 and 6, remove the `.def`and spacing before the definitions for `POKEY2_OFFSET` and `CHANNEL_COUNT`

 * On line 90, change `SKCTLS` to `SKCTL`

 * On line 117, remove `.LOCAL CHD` and stick `CHD.` in front of the variables underneath (e.g. CHD.TUNON).  There is probably a better way, but this is a quick answer.

 * On line 969, change `$966` to `$96`

 

I'm sure the upcoming source code will have similar patches.  But, I thought it may be helpful to document these, just in case.

 

Link to comment
Share on other sites

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...