45 lines
880 B
Rust
45 lines
880 B
Rust
pub enum Via6522Port {
|
|
A(u8),
|
|
B(u8)
|
|
}
|
|
|
|
#[derive(Default)]
|
|
pub struct Via6522 {
|
|
data_bus: u8,
|
|
address_bus: u16,
|
|
port_a_state: u8,
|
|
port_b_data: u8,
|
|
port_a_direction: u8,
|
|
port_b_direction: u8,
|
|
memory_offset: u16,
|
|
}
|
|
|
|
impl Via6522 {
|
|
pub fn new(offset: u16) -> Self {
|
|
Via6522 {
|
|
memory_offset: offset,
|
|
..Default::default()
|
|
}
|
|
}
|
|
|
|
pub fn set_port_direction(&mut self, port: Via6522Port) {
|
|
match port {
|
|
Via6522Port::A(x) => {
|
|
self.port_a_direction = x;
|
|
},
|
|
Via6522Port::B(x) => {
|
|
self.port_b_direction = x;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// check for output pins and see what they say
|
|
pub fn update_pins(&mut self) {
|
|
|
|
}
|
|
|
|
/// check for input mode pins and see what they say
|
|
pub fn read_pins(&self) {
|
|
|
|
}
|
|
} |