OxC0FFEE Posted December 19, 2021 Share Posted December 19, 2021 (edited) I've been looking at the De Re Atari chapter on the POKEY and I'm trying to figure out if the output of the noise generator is output to a register anywhere. From the diagram on this page showing the poly counters it appears not; the output seems to go directly to the speaker. Is this true though? PEEKing the sound registers while playing sound does not appear to achieve this — though it does return what appears to be waveform values: sound 0,121,10,8 while 1 pos. 2,0 for x=53760 to 53775 ? x,peek(x) next x wend I'd like a native, fast source of noise (note, not randomness) and thought that it would be convenient to use the noise generator's output directly, if possible. Edited December 19, 2021 by OxC0FFEE Quote Link to comment Share on other sites More sharing options...
ClausB Posted December 19, 2021 Share Posted December 19, 2021 Isn't it the same poly counter that goes to the RANDOM register? Just read that and isolate one bit. Quote Link to comment Share on other sites More sharing options...
popmilo Posted December 19, 2021 Share Posted December 19, 2021 38 minutes ago, OxC0FFEE said: I'd like a native, fast source of noise (note, not randomness) and thought that it would be convenient to use the noise generator's output directly, if possible. Can you elaborate on the difference between noise and randomness in this case ? Quote Link to comment Share on other sites More sharing options...
OxC0FFEE Posted December 19, 2021 Author Share Posted December 19, 2021 1 hour ago, popmilo said: Can you elaborate on the difference between noise and randomness in this case ? I'm working on a procgen asteroid/space tenline basic game. I've considered regular noise algorithms, diamond-square terrain gen, cellular automata like for dungeon generation, and other methods. I was hoping to find a native source of something non-"random", but closer to perlin noise or at least selectable (think octaves of noise). Math on the CPU is slow, constructing and consulting lookup tables seems a bit heavy in a short basic program. I'm looking for a cheap, native hack like HSW's Yar's Revenge trick of displaying the ROM data in a player to make interesting looking 2d outlines of planetoid surfaces. 1 Quote Link to comment Share on other sites More sharing options...
ClausB Posted December 19, 2021 Share Posted December 19, 2021 For terrain generation you could try something like Brownian motion: if RANDOM>$AA then increment the height, if it's <$55 then decrement the height. 1 Quote Link to comment Share on other sites More sharing options...
thorfdbg Posted December 19, 2021 Share Posted December 19, 2021 5 hours ago, OxC0FFEE said: I've been looking at the De Re Atari chapter on the POKEY and I'm trying to figure out if the output of the noise generator is output to a register anywhere. From the diagram on this page showing the poly counters it appears not; the output seems to go directly to the speaker. Is this true though? The output of the poly counters is not available for the CPU, no, except for the longest polycounter, whose value is available at $D20A. If you read the pokey frequency register, you read the values of the POT counters. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted December 19, 2021 Share Posted December 19, 2021 5 hours ago, OxC0FFEE said: PEEKing the sound registers while playing sound You do realise that h/w registers tend to have one purpose if written to, e.g. set Freq/Control values per channel, than when read, e.g. return POT value? Quote Link to comment Share on other sites More sharing options...
Rybags Posted December 19, 2021 Share Posted December 19, 2021 (edited) The RANDOM register returns a sample from the noise output which is used for AUDCn value $8x. The "noise" poly-counter output will either be 17 or 9 bits depending on the AUDCTL setting (9-bit is almost "regular") and only goes through a sequence 511 times where 17-bit is over 130,000. Note it's not truly random - totally deterministic - and in 9-bit mode even less random. But programatically it's usually sampled at non-regular intervals so is sufficient. Note also that the noise sampling by Pokey (in fact all audio generation except forced volume) generates a 0 or 1 value at the point in time which then has the voice's volume level applied. Edited December 19, 2021 by Rybags 1 Quote Link to comment Share on other sites More sharing options...
popmilo Posted December 20, 2021 Share Posted December 20, 2021 22 hours ago, OxC0FFEE said: I'm working on a procgen asteroid/space tenline basic game. I've considered regular noise algorithms, diamond-square terrain gen, cellular automata like for dungeon generation, and other methods. I was hoping to find a native source of something non-"random", but closer to perlin noise or at least selectable (think octaves of noise). Math on the CPU is slow, constructing and consulting lookup tables seems a bit heavy in a short basic program. I'm looking for a cheap, native hack like HSW's Yar's Revenge trick of displaying the ROM data in a player to make interesting looking 2d outlines of planetoid surfaces. Had to google "diamond square terrain gen" to realize that's exactly what I used in Monk game for terrain height map I did put additional filter (kind of circular height map function that depended on distance from center of map so I would get lowest height on edges of map, so in the terrain looked like an island. Please share if you find some cool, fast hack, as we all could use one Good luck ! 1 Quote Link to comment Share on other sites More sharing options...
OxC0FFEE Posted December 23, 2021 Author Share Posted December 23, 2021 On 12/20/2021 at 1:40 PM, popmilo said: Had to google "diamond square terrain gen" to realize that's exactly what I used in Monk game for terrain height map I did put additional filter (kind of circular height map function that depended on distance from center of map so I would get lowest height on edges of map, so in the terrain looked like an island. Please share if you find some cool, fast hack, as we all could use one Good luck ! @popmilo a link to your Monk game? I'm curious Quote Link to comment Share on other sites More sharing options...
popmilo Posted December 23, 2021 Share Posted December 23, 2021 3 hours ago, OxC0FFEE said: @popmilo a link to your Monk game? I'm curious Think this topic should have most of interesting info about it It's basically my take on a small game that Minecraft author Notch did for one of those 48h LudumDare compos called "minicraft". Player goes around 2d map, chopping wood, digging earth and stone and kills zombies. Plan was to make full crafting part of game, but didn't have enough time in the end. That's why now I have Monk2 in my project folder You can see terrain generator code working in phases when game starts. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.