Editing
Use the PSG
From F256 Foenix
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== The PSG is inside the FPGA of the F256Jr, F256K, F256Jr2 and F256K2 == The F256 machines have a dual PSG based on the SN76489 inside the Beatrix FPGA which generate 3 tones of square wave and one noise generator each.<br> {| class="wikitable" |+ !Register Name !Address !Description |- |PSG_LEFT |0xD600 |Send all formatted commands here to the left PSG |- |PSG_RIGHT |0xD610 |Send all formatted commands here to the right PSG |- |PSG_COMBINED_LEFT_RIGHT |0xD608 |Send all formatted commands here to both PSG |- |SYS1 |0xD6A1 |System Ctrl reg: bit2 sets PSG_ST = psg status. if 0, left and right are mixed to monaural output. if 1, left and right are normal stereo |} === Command Formats === Example: <p>To produce a 440 Hz A on Tone 1, send these bytes to address 0xD600 (left PSG) <p>0b1001 0100 (middle volume "attenuation" command)<br> 0b1000 1101 (low byte of the note)<br> 0b0000 1111 (high byte of the note). <p>to stop the sound, send to 0xD600: <p>0b1001 1111 (max attenuation closes off the sound) === Frequency bytes in C, meant for tone 1 === The high nybble of the low byte is set at 8 for tone 1, replace with A for tone 2, or with C for tone 3 uint8_t psgLow[] = { 0x86, 0x8d,0x87,0x84,0x84,0x87,0x8d,0x84,0x8e,0x8b,0x89,0x89, 0x8b, 0x8e,0x83,0x8a,0x82,0x8b,0x86,0x82,0x8f,0x8d,0x8c,0x8c, 0x8d, 0x8f,0x81,0x85,0x89,0x8d,0x83,0x89,0x8f,0x86,0x8e,0x86, 0x8e, 0x87,0x80,0x8a,0x84,0x8e,0x89,0x84,0x8f,0x8b,0x87,0x83, 0x8f, 0x8b,0x88,0x85,0x82,0x8f,0x8c,0x8a,0x87,0x85,0x83,0x81, 0x8f, 0x8d,0x8c,0x8a}; uint8_t psgHigh[] = { 0x3f, 0x3b,0x38,0x35,0x32,0x2f,0x2c,0x2a,0x27,0x25,0x23,0x21, 0x1f, 0x1d,0x1c,0x1a,0x19,0x17,0x16,0x15,0x13,0x12,0x11,0x10, 0xf, 0xe,0xe,0xd,0xc,0xb,0xb,0xa,0x9,0x9,0x8,0x8, 0x7, 0x7,0x7,0x6,0x6,0x5,0x5,0x5,0x4,0x4,0x4,0x4, 0x3, 0x3,0x3,0x3,0x3,0x2,0x2,0x2,0x2,0x2,0x2,0x2, 0x1, 0x1,0x1,0x1};
Summary:
Please note that all contributions to F256 Foenix are considered to be released under the Creative Commons Zero (Public Domain) (see
F256 Foenix:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
Edit source
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information