Jump to content
IGNORED

Polycounter Reset on Pokey


analmux

Recommended Posts

http://www.mediamax.com/rybags/Hosted/Atari/Pokeytest1.zip (9 meg file)

 

I sampled about a minute, mono at 48 KHz from my 130XE.

 

Hopefully the recording level is OK - I did it at about 30% as it was topping out at 60%.

 

I tried that program in the emulator on turbo - looks like it would take about an hour to run at standard speed.

 

The program seemed to work, but it loaded and just returned to DOS. So, I just ran it manually USR(16384) from BASIC.

Edited by Rybags
Link to comment
Share on other sites

I looked at the .wav file in audacity and there was some clipping towards the end as it gets louder.

 

I made an new version that plays the loudest possible tone at the beginning for several seconds to enable calibrating the gain.

 

I think it runs around 5 tones/sec so it should be around

(((16 + 4 - 1) choose 4) / ~5) / 60 = ~12.92min.

 

I tested it with the emulator and it finished in ~15 min or so.

pokeyvol.zip

Link to comment
Share on other sites

I have now written a program in Perl to analyze the data.

The program will calculate a statistical value for the volume of every possible mixed Pokey signal produced by the test program.

I find that the result is accurate to within better than 1 part in 200 in most cases.

I have attached the program to this message although I suspect it will not be useful to anyone besides me.

 

[updated] If anyone can get the data I will put up an FTP server or make other arrangements upon request if you wish to upload it. I do need the whole data set to complete the analysis. Please use lossless data such as .wav or FLAC, because lossy compression might introduce artifacts. Please check that the data is not clipped using the loud test tone at the beginning.

 

Thanks to Rybags for the data that I have used to write this program.

pokeyvolperl.zip

Edited by perry_m
Link to comment
Share on other sites

Not necessarily.

 

Sometimes, POKEY will be left in an "indeterminate" state after cassette operations (especially outut).

 

That's likely just a measure to ensure that it's not left in 2-tone mode.

Yeah, but Squish 'Em is a cartridge, would POKEY be in an indeterminate state when you power up the computer?

 

Or is it one of those "just in case" things that you do even though it probably isn't necessary (like setting the interrupt flag at the beginning of 2600 code)?

Edited by vdub_bobby
Link to comment
Share on other sites

  • 8 months later...

(quotes mixed from two threads)

 

Last year I did some research with Piotr Fusik about Pokey and he made documentation about what we found:

http://asap.sourceforge.net/pokeydoc.zip

 

Wow!!! That is absolutely awesome. Hats off.

 

What if the sum operation is non-linear, as it is supposed to be in Pokey?

Suppose the sum is attenuated at higher values: sum(1,1)=1.5...

For all 4 voices there are: (16 + 4 - 1) choose 4 = 3 876 possibilities.

 

According to the schematics, Pokey mixing of voices is fully linear. Linear in the sense that the voltage level at the Pokey audio pin depends only on the sum of the binary voices, disregarding how this sum is composed.

 

As posted and explained earlier by Bryan, Pokey uses a simple DAC at each voice consisting on variable resistance to ground.

 

All voices are off: open current (infinite resistance).

Single voice on with volume 1: 80 Ohm.

Single voice on with volume 2: 40 Ohm.

Two voices each at volume 1: Two parallel 80 Ohm, which is equivalent to 40 Ohm.

...

 

As you see, mixing is linear. This would mean just 61 different possible voltage levels.

 

Now, this doesn't mean that the output scale of the computer is linear. It is possible that the external (to Pokey) analog circuit changes the scale produced by Pokey. And it is very likely that the scale distorsion is more significant on the upper range. This might make you think that a single voice is linear, but this could be just a consequence of a single voice using only the lower range of the full scale.

 

for 1.79/1.77 mhz timing, there is a delay in resetting the counters when they count down to 0

for the 8 bit counter the delay is 3 cycles and for the 16 bit counter it is 6 cycles. Thus "+4 (=3+1)" and "+7=(6+1)" in the frequency formulas

 

Something seems to be wrong in the schematics, or may be I miss something. In the counters.png schematics you show two flip-flops only. This would produce actually a delay/pipeline of only two cycles, not three?

 

Do Atari disk drives send bytes without any gaps (i.e. a stop bit is immediately followed by a start bit of the next byte) ?

I don't think there are any gaps.

 

Yes, there could be gaps. It depends on the drive, firmware, and sometimes even it depends on the speed. Most Atari drives don't have an UART and bit-bang the serial output. Sometimes they use a subroutine for transmitting a byte. Sometimes they even update the checksum after each byte. All this overhead creates a small gap between each byte.

 

P.S.: Once again. Amazing job in that schematics recreation!

Link to comment
Share on other sites

I think the SIO delay between bytes doesn't really matter due to the Start bit helping with sync.

 

When I did my 1050 emulator on the ST, I'm fairly sure I used no delay between stop bit and the next start bit.

 

IIRC, I also had delay values that could be set for all manner of things, and found that it worked fine with the shortest values as indicated in the OS/HW manuals.

 

 

Nice doc though - a lot of work to understand some of the innards of Pokey.

 

What I'd like to know is if we could ever play about with SKCTL Init, debounce, scan enable to be able to read multiple keypresses at once. I had a play with that a couple of months ago but didn't really get any positive results.

Link to comment
Share on other sites

Fairly sure that Star Raiders was written for 8K RAM, so as long as there's no major dramas with that block, it would run without showing up any problems of RAM higher up.

 

8K ram/8K rom. It was the intention that SR would be compatable w/all hardware setups...and 8K was the minimum in an 800. IIRC, Doug Neubauer had to do some optimizing prior to the game's release.

Link to comment
Share on other sites

I think the SIO delay between bytes doesn't really matter due to the Start bit helping with sync.

 

Well, it might matter or not depending on the purpose.

 

For the purpose of making it work, of course that it doesn't matter, it works either way. But it matters for the purpose of accurately emulating the drive timing, which is required for some copy protected software.

 

Anyway, I raised the issue because it is covered in that Pokey document (in that question and answer I quoted in the previous message). Not really too relevant for this whole Pokey discussion.

Link to comment
Share on other sites

  • 11 years later...

Best case scenario is that a 17 bit poly gives a sequence of around 131000 samples in a total predictable fashion.

 

With DMA, interrupts and an indeterminite starting time that makes things somewhat less predictable.  But in most cases doing a sequence of 32, 64, etc RANDOM samples would occur during active screen time, e.g. Graphics 0 where you have a mix of badline + DList DMA and character set only DMA (and of course Refresh everywhere).

In theory every possible start cycle on the scanline should give a different sequence.  Plus if you've not recently put Pokey into and out of the INIT state you don't know where you are in the poly sequence.

So, the number of possible sequences you could harvest would be pretty large but only a drop in the ocean compared to the number representable by however many bytes you use.

Edited by Rybags
Link to comment
Share on other sites

10 hours ago, Kyle22 said:

Could we reset the poly counter, then rapidly sample the bytes to use as an encryption key? A variable amount of time between the reset and the sampling would shift he key numbers.

Am I on to anything, or is it just BS?

 

What would it be good for ? What you asking is basically pseudo random number generator. Pokey's RNG is hard to predict, that's it's main feature. Predictable RNG can be easily made in software.

Or as anti-piracy measure ? That could work. But then Altirra can emulate even that, and if it can't at the moment, Phareon will eventually fix it :-D

And these days you want your games to be able to run on emulators anyway.

 

Link to comment
Share on other sites

5 hours ago, R0ger said:

What would it be good for ? What you asking is basically pseudo random number generator. Pokey's RNG is hard to predict, that's it's main feature. Predictable RNG can be easily made in software.

Or as anti-piracy measure ? That could work. But then Altirra can emulate even that, and if it can't at the moment, Phareon will eventually fix it :-D

And these days you want your games to be able to run on emulators anyway.

 

After all experimenting with POKEY, it is better to force the diversity of the 3 different Orbits. It will result in a modulation type bass sound. 

 

Youtube recognized 100% the original Tune. Multi "Orbit" Bass plus real Modulations...

Link to comment
Share on other sites

47 minutes ago, _The Doctor__ said:

why? why? why?,    it's considered and original work because it's so detuned/out of tune it becomes unrecognizable.

Emkay's ears work as well as his view on reality :)  He thinks that is perfectly in tune, and should be used in every new song created.  Don't dare tell him otherwise.

  • Haha 1
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...