Jump to content
IGNORED

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


Recommended Posts

OK, here it is ...

 

This tune demonstrates the strengths of the SKCTLS 2-tone mode.  You can reach the high notes easily without tuning errors, and by varying the pulse width, still play the normal range available in the $Ax pure tone settings.

 

The tune is, of course, the famous opening intro music from the SNES game Super Mario World.

 

Here is the setup:

 

AUDCTL=$00 (no special settings)

 

Channel 0: $Ax square wave, modulated from Channel 1 using SKCTLS=$8B 2-tone mode

Channel 1: Silent - frequency setting modulates Channel 0

Channel 2: $Ax square wave, no modulation

Channel 3: $Ax square wave, no modulation

 

The 2-tone SKCTLS=$8B mode is quite similar to the SYNC function on the C=64 SID chip.  The frequency on channel 1 must always be higher than 0, and when the modulation frequency gets beyond 12 semitones from channel 0, channel 0 then jumps up an octave.  So basically, channel 1 mimics the melody on channel 0, but transposed up an octave plus some semitones.  The counterpoint melody has channel 1 transposed lower, so as to vary the pulse width.

 

Executables below, but a warning:  This will not work correctly in the current emulation.  On Prosystem and A7800 the lead will sound horribly out of tune.  Real hardware only.

 

Trebor:  I have included a Pokey @$450 executable as well.  Please test this on your real hardware and record it. :)

 

Also included:  A recording made from the Altirra emulator which demonstrates how this should sound on real hardware, assuming I ported everything correctly.

 

 

marioworld.A78 marioworld.asm marioworld.bin marioworld-pokey450.A78 marioworld-pokey450.asm marioworld-pokey450.bin marioworld.mp3

  • Like 2
Link to comment
Share on other sites

Found the mistake:

 

PLAYTUNE 
	LDA #00; normal mode
	STA AUDCTL
	LDA #139
	STA $D20F

$D20F should be replaced with SKCTLS.

 

It seems I broke the #1 rule of assembly programming:  NEVER reference memory locations directly, always by their label.  I used $D20F because that's where SKCTLS is on an 8-bit XL/XE.  On the 7800 ... nahh.  ?

 

I will post a fixed version tonight after work.

 

Link to comment
Share on other sites

Another note table.  This time we are using the SKCTLS=$8B mode, combined with AUDCTL=$40 to clock the first channel at 1.79 mhz.  This is the "Save to cassette" sound setting which the old Atari XL used when saving or loading from cassette.  It's a very sonorous bell type timbre.  You can also get a saw wave out of this setting by varying the pulse width.  Here is a rudimentary table:

 

Bell sound

AUDCTL=$40 SKCTLS=$8B AUDC0=$Ax AUDC1=$00

Note	AUDF0		AUDF1

B2	253		255
C3	241		243
C#	245		230
D	251		217
D#	236		204
E	244		193
F	253		182
F#	239		172
G	250		162
G#	236		153
A	250		144
A#	236		136		
B	255		128
C4	241		121
c#	227		114
D	251		108
D#	237		102
E	223		96
F	254		91
F#	238		85
G	226		81
G#	212		76
A	252		72
A#	238		68
B	224		64
C5	210		60
C#	200		57
D	249		53
D#	235		50
E	221		47
F	212		45
f#	198		42
G	188		40

The frequencies in channel 1 correspond to the standard 8-bit note table for $Ax square wave, as found in my POKEY note table.

 

The $4x distortion also allows for some electric guitar sounds using the AUDCTL=$40 setting.  This will take a lot more work to map out, but they sound terrific!

Also showing promise is the $8x noise combined with AUDCTL=$C0 (1.79 mhz plus the 9-bit polycounter) for more guitar distortions.

 

  • Like 2
Link to comment
Share on other sites

This is proving to be real donkey work:

 

A partial test table for $4x distortion with AUDCTL=$40 (1.79 mhz clock) and SKCTLS=$8B (2-tone modulation) ... I have written a program that lets me step through each of the 65,536 possible settings ... and I am writing down by hand which ones produce musical notes.  There are several different timbres here, many of them suitable for distorted guitars.  Later, after I have gone through them all, I will have to tune them against the standard $Ax square wave settings to get a tuneable scale.  This is going to be a lot of work but the results will be worth it in the end.  The notes here are without octave modifiers, I will add those later.

 

This is the beginning ... a long way to go yet.  I also put in a few notes for the AUDCTL=$41 (1.79 mhz plus 15 khz, which changes the modulation frequency of channel 1).  A lot of these settings sound really terrific though, just like a real electric guitar.

 

Distorted guitar (partial frequency table without octave modifiers)

AUDCTL=$41 SKCTLS=$8B $AUDC1=$4x AUDC2=$00

AUDF2		AUDF1
255		254 (d#) 253 (g#) 247 (A#) 242 (C#) 233 (e) 232 (c) 230 (c) 229 (c#) 227 (b) 225 (c)
		224 (g#) 218 (b) 217 (F#) 215 (a#) 210 (c) 204 (e) 200 (a) 199 (a#) 197 (a) 194 (A#)
		190 (D) 188 (b) 183 (a#) 178 (c#) 175 (a) 173 (c) 172 (d#) 170 (a#) 163 (g) 160 (c#)
		155 (c#) 152 (f) 149 (a) 148 (g#) 140 (b) 139 (e) 135 (d#) 130 (g#) 127 (c#) 122 (f#)
		119 (c#) 114 (c) 113 (c) 112 (a#) 110 (a) 107 (c) 103 (c) 100 (e) 98 (a) 93 (D) 92 (b)
		88 (e) 87 (c) 85 (d) 84 (e) 82 (d#) 78 (c#) 77 (d#) 72 (g#) 69 (b) 68 (b) 60 (b) 55 (b)
		53 (g#) 49 (c#) 44 (b) 37 (c#) 34 (g#) 33 (c) 28 (b) 20 (b) 15 (g#) 12 (b) 8 (b) 4 (b) 
		2 (b) 0 (b)

254		251 (silence) 243 (b) 231 (c) 230 (c) 229 (d) 228 (A#) 227 (b) 226 (b) 216 (d) 

AUDCTL=$40 SKCTLS=$8B $AUDC1=$4x AUDC2=$00

255 		246 (a) 233 (f#) 232 (a#) 230 (f#) 227 (f#) 224 (f#) 211 (g#) 200 (e) 189 (c) 184 (c#) 
		179 (e) 175 (g#) 170 (f#) 154 (c) 145 (c) 139 (a) 132 (b) 126 (a) 121 (a) 113 (f)
		112 (f#) 110 (f) 98 (e) 96 (g#) 85 (c) 82 (g) 81 (g) 79 (c) 75 (c) 74 (f) 73 (f) 72 (f)
		67 (c) 64 (b) 63 (b) 60 (b) 59 (f) 53 (f) 52 (c#) 50 (f) 44(f) 43 (c#) 35 (f) 34 (f) 31 (g#)
		30 (b) 28 (b) 24 (c#) 23 (f) 15 (f) 13 (b) 12 (b) 10 (c#) 4 (b) 3 (c#) 0 (b)

254		254 (g#) 251 (silence) 203 (g) 200 (b) 188 (f#) 170 (f) 143 (b) 128 (c#) 118 (e) 102 (c#)
		98 (a#) 95 (f) 92 (f) 87 (e) 83 (e) 82 (a) 80 (c#) 64 (a#) 62 (c#) 60 (f#) 49 (c#) 47 (a#)
		45 (b) 40 (c) 38 (d) 34 (g#) 33 (b) 30 (a#) 29 (c) 25 (f) 24 (c#) 18 (c) 17 (c#) 16 (b)
		13 (a#) 10 (c#) 8 (b) 7 (c) 3 (c#) 2 (b) 0 (b)

253		243 (d) 242 (e) 241 (g) 231 (g) 226 (g#) 216 (g#) 215 (f#) 214 (d) 204 (a#) 203 (e)
		187 (c) 170 (e) 169 (f) 168 (c#) 163 (f) 162 (c) 160 (b) 157 (e) 145 (f#) 142 (f#) 
		139 (f#) 138 (g#) 133 (c) 119 (e) 117 (c) 115 (f#) 113 (f#) 111 (a) 106 (a) 105 (d)
		104 (f) 95 (f) 82 (c#) 79 (c) 78 (b) 73 (c) 69 (f) 67 (g#) 66 (g#) 57 (a#) 55 (b) 52 (c#)
		51 (g#) 50 (f) 47 (f) 45 (g#) 40 (g#) 37 (b) 32 (f) 31 (g#) 24 (d) 23 (f) 14 (f) 10 (c#)
		5 (f) 4 (b) 3 (c#) 0 (b)

 

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

I could do that a bit sooner.  That one uses a different kind of sound similar to one of my other settings.

 

On the $4x table, there are lots of sounds with the same tonal frequency but different vibrato pulse widths.  Still getting those all sorted.

Edited by Synthpopalooza
  • Like 2
Link to comment
Share on other sites

The other possibility is slapping a hi-pass filter on top of this setup to further modulate the sound as well.  The tradeoff is you are basically using 3 channels to generate one sound, which leaves one channel free.  But, for purposes of that wizball game over sound, it may be all that is needed.  The last channel can then play a standard $Ax square wave frequency to tie it together.

  • Like 2
Link to comment
Share on other sites

I have been tasked to do music for an NES game based on the TV show Stranger Things, and will be doing 7800 music for this as well.  One of these is going to use some of these experimental techniques ... in particular the above $4x SKCTLS setting coupled with 15khz mode. I will post this up when I have a test ready.

  • Like 3
Link to comment
Share on other sites

7 minutes ago, Synthpopalooza said:

I would be curious to know how well the PokeyOne handles all these special AUDCTL and SKCTLS settings.

Me too. 

Still too pricey at $40 a pop, but if it covers all audio features at least it is a possible, if not a financially sound, alternative for 7800 homebrews.

Link to comment
Share on other sites

Trebor:  I went and recompiled the earlier Bubble Bobble and Mega Man examples for POKEY@450 ... here they are.  They both fail on emulation but should work in real hardware.

 

Bubble Bobble actually works correctly in Prosystem but won't play notes above a certain frequency on the lead.

 

 

bubblebobble-pokey450.A78 bubblebobble-pokey450.asm bubblebobble-pokey450.bin megaman-pokey450.A78 megaman-pokey450.asm megaman-pokey450.bin

Edited by Synthpopalooza
Link to comment
Share on other sites

Good news ... means I have a workaround through Altirra for developing these on real hardware.

 

Next up:  A stranger things theme which uses 15khz mode.  This basically lets you transpose your $Ax square wave channels down 2 octaves and use the bass setting.  This can be combined with $2x and the 1.79 mhz clock on 1 or 3 to get your lead sounds.  The bass will work in emulation, I think.

 

There is also a reverse 16-bit filter using $Cx on channel 0, which makes for some strange sounding wood instrument timbres.  This will require a new note table.

 

 

Edited by Synthpopalooza
Link to comment
Share on other sites

Also:  going to rework the Rolling Thunder music for @450 tonight.  Very keen on hearing this one in real HW.

 

Also, this one:

 

 

It uses a very high G5 note at the start.  In 8 bit mode, this turns the POKEY to mush.  But in the SKCTLS 2-tone mode ... no problems.  I will work this up soon.

 

I'd love to see this on our 7800.

 

Edited by Synthpopalooza
  • Like 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...