Use the CODEC

From F256 Foenix
Jump to navigationJump to search

How to use the CODEC

The Codec chip is a way to mix and match audio signals together for their single audio output (headphones, RCA jacks).

Its datasheet can be found in the goodies github repo: https://github.com/Mu0n/F256MiscGoodies/blob/main/datasheets/WM8776_v4.1-532420.pdf

Codec Registers

Address R/W B7 B6 B5 B4 B3 B2 B1 B0 Purpose
0xD620 W D7 D6 D5 D4 D3 D2 D1 D0 Command Low
0xD621 W R6 R5 R4 R3 R2 R1 R0 D8 Command High
0xD622 R X X X X X X X Busy Status
0xD622 W X X X X X X X Start Control

How to enable (unmute) every sound device

  • Loop-read 0xD622 and wait until bit0 is set to 1
  • Send 0x1F to Command Low at 0xD620
  • Send 0x2A to Command High at 0xD621
  • Loop-read 0xD622 and wait until bit0 is set to 1

Audio input devices on the various machines

CODEC inputs F256Jr F256K F256K2 F256Jr2
AIN1 SID SID SAM2695 MIDI SAM2695 MIDI
AIN2 Line in onboard header OPL3 MIDI wavetable
AIN3 PWM PWM
AIN4 VS1053b VS1053b
AIN5 Line in onboard header Line in onboard header Line in onboard header

Here's a precise pinout diagram of the F256K as an example

Pinout diagram for the Codec chip