sketching, reading
This commit is contained in:
parent
ac416cc722
commit
d0896707bd
|
@ -1,7 +1,24 @@
|
||||||
impl super::DMC {
|
impl super::DMC {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
super::DMC {
|
super::DMC {
|
||||||
|
sample: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pub fn control(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn direct_load(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn sample_address(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn sample_length(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -46,7 +46,7 @@ struct Noise {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DMC {
|
struct DMC {
|
||||||
|
sample: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Apu {
|
impl Apu {
|
||||||
|
@ -91,16 +91,21 @@ impl Apu {
|
||||||
0x4015 => self.control(value),
|
0x4015 => self.control(value),
|
||||||
0x4016 => (),
|
0x4016 => (),
|
||||||
0x4017 => self.frame_counter(value),
|
0x4017 => self.frame_counter(value),
|
||||||
|
_ => panic!("bad address written: 0x{:X}", address),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mix(&self) -> f32 {
|
fn mix(&self) -> f32 {
|
||||||
let square_out = self.square_table[self.square1.sample + self.square2.sample as usize];
|
let square_out = self.square_table[(self.square1.sample + self.square2.sample) as usize];
|
||||||
let tnd_out = self.tnd_table[(3*self.triangle.sample)+(2*self.noise.sample)+self.dmc.sample as usize];
|
let tnd_out = self.tnd_table[((3*self.triangle.sample)+(2*self.noise.sample) + self.dmc.sample) as usize];
|
||||||
square_out + tnd_out
|
square_out + tnd_out
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame_counter(value: u8) {
|
fn frame_counter(&mut self, value: u8) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn control(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,17 @@ impl super::Noise {
|
||||||
self.linear_feedback_sr >>= 1;
|
self.linear_feedback_sr >>= 1;
|
||||||
self.linear_feedback_sr |= feedback << 14;
|
self.linear_feedback_sr |= feedback << 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn envelope(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn loop_noise(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
|
pub fn load_length_counter(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the timer clocks the shift register, the following actions occur in order:
|
// When the timer clocks the shift register, the following actions occur in order:
|
||||||
|
|
|
@ -8,6 +8,27 @@ impl super::Square {
|
||||||
length_counter: 0,
|
length_counter: 0,
|
||||||
envelope: 0,
|
envelope: 0,
|
||||||
sweep: 0,
|
sweep: 0,
|
||||||
|
sample: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn clock(&mut self) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn duty(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn sweep(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn timer_low(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn timer_high(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -6,4 +6,16 @@ impl super::Triangle {
|
||||||
linear_counter: 0,
|
linear_counter: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn timer_low(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn timer_high(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn counter(&mut self, value: u8) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue