Each channel would resemble an APU channel, but without hardware envelope, length counter, or sweep. Each channel has an 11-bit divider, an 8-step PWM sequencer, and a volume control.
Code: Select all
7654 3210 $4020/$4024
TT VVVV
|| ++++- Volume
++-------- Timbre (12.5%, 25%, 37.5%, or 50% duty)
7654 3210 $4022/$4026
PPPPPPPPP
+++++++++- Period (bits 7-0)
7654 3210 $4023/$4024
PPP
+++- Period (bits 10-8)
Every time a channel's waveform rises or falls, the sequencer pulls /IRQ low.
When $4011 is read, the channels are summed and put on the data bus, and /IRQ goes high impedance.
So if you have two channels playing notes at about 300 Hz, you get about 1200 IRQs per second: 300 rises and 300 falls for each channel. Each IRQ takes 19 cycles to service:
Code: Select all
brk $00 ; 7
irq:
dec $4011 ; 6
rti ; 6
A CPLD needs a macrocell for each flip-flop, but it also needs a few spare macrocells for complex combinational logic. I count 64 flip-flops, meaning it might fit in a 72 macrocell CPLD, but it might not.
- Divider reset values: 11 bits per channel
- Volume: 4 bits per channel
- Timbre:2 bits per channel:
- Divider position: 11 bits per channel
- Sequencer position: 3 bits per channel
- Pre-scaler: 1 bit
- IRQ flag: 1 bit
Inputs: R/W, /ROMSEL, A14-A0, M2, D7
Input/output: D6-D0
So would this be feasible?

