Polycounter Reset on Pokey - Page 4 - Atari 8-Bit Computers - AtariAge Forums Jump to content Existing user? Sign In Sign In Remember me Not recommended on shared computers Sign In Forgot your password? Sign Up Atari 8-Bit Computers Have You Played Atari Today? 2600 | 5200 | 7800 | Lynx | Jaguar | Forums | Store Forums Clubs Apps Blogs Gallery Events More All Activity My Activity Streams Status Updates More Leaderboard Staff Online Users Guidelines More Subscriptions More More Everywhere This Forum This Topic Status Updates Topics Blog Entries Images Albums Events Pages Products Members All Activity Home Atari Systems Atari 8-Bit Computers Polycounter Reset on Pokey IGNORED Polycounter Reset on Pokey By analmux November 21, 2007 in Atari 8-Bit Computers Share More sharing options... Followers 2 Reply to this topic Start new topic Prev 1 2 3 4 5 Next Page 4 of 5 Recommended Posts Rybags Posted December 2, 2007 Rybags Members 18,991 posts Location: Australia Share Posted December 2, 2007 (edited) 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 December 2, 2007 by Rybags Quote Link to comment Share on other sites More sharing options... perry_m Posted December 2, 2007 perry_m Members 61 posts Share Posted December 2, 2007 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 Quote Link to comment Share on other sites More sharing options... Rybags Posted December 2, 2007 Rybags Members 18,991 posts Location: Australia Share Posted December 2, 2007 http://www.mediamax.com/rybags/Hosted/Atari/PokeyTest2.mp3 (6 meg) There's 3 minutes worth - no way to run the whole thing as that site has a 10 meg limit on hosting (plus it would take an eternity to upload). Hope you get some useful data - let us know your conclusions. Quote Link to comment Share on other sites More sharing options... analmux Posted December 2, 2007 analmux Members 2,363 posts Author Share Posted December 2, 2007 ...but, before focussing on the analogue behaviour of Pokey, I'd really like to see emulation of the 2-tone-filter, as I'd think it's easy to add to the existing pokey.dll as it's just a digital effect, and emulation of the triangle waveform. The sawtooth is already there. Quote Link to comment Share on other sites More sharing options... perry_m Posted December 3, 2007 perry_m Members 61 posts Share Posted December 3, 2007 (edited) 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 December 9, 2007 by perry_m Quote Link to comment Share on other sites More sharing options... vdub_bobby Posted December 5, 2007 vdub_bobby Members 6,829 posts Boom bam. Location: Seattle, WA Share Posted December 5, 2007 A little note: I was just going through the disassembly of Squish 'Em and I saw that the programmer writes #3 to SKCTL at startup and I wondered why. Now I know, it is to reset the poly counters (for the random number generator, I assume). So thanks. Quote Link to comment Share on other sites More sharing options... Rybags Posted December 5, 2007 Rybags Members 18,991 posts Location: Australia Share Posted December 5, 2007 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. Quote Link to comment Share on other sites More sharing options... vdub_bobby Posted December 5, 2007 vdub_bobby Members 6,829 posts Boom bam. Location: Seattle, WA Share Posted December 5, 2007 (edited) 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 December 5, 2007 by vdub_bobby Quote Link to comment Share on other sites More sharing options... Rybags Posted December 6, 2007 Rybags Members 18,991 posts Location: Australia Share Posted December 6, 2007 Depends on the type of cartridge. Many games (e.g. Star Raiders) identify as diagnostic carts and get immediate control, so the OS doesn't perform any hardware initialization. Quote Link to comment Share on other sites More sharing options... vdub_bobby Posted December 6, 2007 vdub_bobby Members 6,829 posts Boom bam. Location: Seattle, WA Share Posted December 6, 2007 Depends on the type of cartridge. Many games (e.g. Star Raiders) identify as diagnostic carts and get immediate control, so the OS doesn't perform any hardware initialization. Ah. That makes sense. Thanks. Quote Link to comment Share on other sites More sharing options... potatohead Posted December 9, 2007 potatohead Members 4,891 posts Location: Portland, Oregon Share Posted December 9, 2007 On one of my 8 bitters, Star Raiders is the only thing that runs. Something fails on init, and I never knew why that game would run, but nothing else would. Thanks! Quote Link to comment Share on other sites More sharing options... Rybags Posted December 10, 2007 Rybags Members 18,991 posts Location: Australia Share Posted December 10, 2007 Might be a failed RAM test. 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. Quote Link to comment Share on other sites More sharing options... 8 months later... ijor Posted August 22, 2008 ijor Members 3,016 posts Share Posted August 22, 2008 (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! Quote Link to comment Share on other sites More sharing options... Rybags Posted August 22, 2008 Rybags Members 18,991 posts Location: Australia Share Posted August 22, 2008 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. Quote Link to comment Share on other sites More sharing options... Nukey Shay Posted August 22, 2008 Nukey Shay Members 22,132 posts Same as the old boss Location: The land of Gorch Share Posted August 22, 2008 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. Quote Link to comment Share on other sites More sharing options... ijor Posted August 23, 2008 ijor Members 3,016 posts Share Posted August 23, 2008 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. Quote Link to comment Share on other sites More sharing options... 11 years later... pavros Posted September 3, 2019 pavros Members 61 posts Location: Poland Share Posted September 3, 2019 An explanation of instability of C distortion based on 4-bit polycounter can be found in this thread: Quote Link to comment Share on other sites More sharing options... Kyle22 Posted September 6, 2019 Kyle22 Banned 5,154 posts Share Posted September 6, 2019 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? Quote Link to comment Share on other sites More sharing options... Rybags Posted September 6, 2019 Rybags Members 18,991 posts Location: Australia Share Posted September 6, 2019 (edited) 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 September 6, 2019 by Rybags Quote Link to comment Share on other sites More sharing options... R0ger Posted September 6, 2019 R0ger Members 804 posts Location: Olomouc, Czech Republic Share Posted September 6, 2019 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 And these days you want your games to be able to run on emulators anyway. Quote Link to comment Share on other sites More sharing options... emkay Posted September 6, 2019 emkay Banned 12,078 posts Share Posted September 6, 2019 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 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... Quote Link to comment Share on other sites More sharing options... R0ger Posted September 6, 2019 R0ger Members 804 posts Location: Olomouc, Czech Republic Share Posted September 6, 2019 That was .. painful ? Can you share the XEX, so we can listen to the bass alone ? Quote Link to comment Share on other sites More sharing options... _The Doctor__ Posted September 6, 2019 _The Doctor__ Members 15,171 posts Flux Capacitor Master Craftsman Sometimes you WIN! Location: 10-0-11-00:02 Share Posted September 6, 2019 why? why? why?,    it's considered and original work because it's so detuned/out of tune it becomes unrecognizable. 1 Quote Link to comment Share on other sites More sharing options... + Stephen Posted September 6, 2019 Stephen + AtariAge Subscriber 13,321 posts A8 Gear Head Location: In a cornfield, Glosterville Share Posted September 6, 2019 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. 1 Quote Link to comment Share on other sites More sharing options... Mathy Posted September 6, 2019 Mathy Members 4,358 posts Location: Heerlen, NL Share Posted September 6, 2019 Hello guys Maybe Emkay should use auto-tune, just like Madonna... Sincerely Mathy 1 Quote Link to comment Share on other sites More sharing options... Prev 1 2 3 4 5 Next Page 4 of 5 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. 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... × Desktop Tablet Phone Submit Reply Share More sharing options... Followers 2 Go to topic listing Recently Browsing 0 members No registered users viewing this page. All Activity Home Atari Systems Atari 8-Bit Computers Polycounter Reset on Pokey Theme AtariAge (Default) Dimension Deflection (Dark) Privacy Policy Contact Us Cookies Powered by Invision Community AtariAge Home 2600 5200 7800 Lynx Jaguar Forums Forum Home Clubs Blogs Gallery Subscriptions Store Store Home New Products Bestsellers Gift Certificates General Contact Submit News Privacy Policy Legal Mailing List Follow AtariAge Like us on Facebook   AtariAge Facebook Group   Follow us on Twitter   AtariAge on Instagram   Watch us on YouTube   Chat on Discord Copyright ©1998-2023 AtariAge × Existing user? Sign In Sign Up Forums Clubs Apps Back Blogs Gallery Events All Activity My Activity Streams Back Status Updates More Back More Leaderboard Staff Online Users Guidelines Subscriptions × Create New...