use std::net::IpAddr::V4;
use log::debug;
use crate::computers::tim1::Tim1;
use crate::traits::backplane::Backplane;

impl Backplane for Tim1 {
    fn data_bus(&self) -> u8 { self.data_bus }
    fn address_bus(&self) -> u16 { self.address_bus }
    fn read_mode(&self) -> bool { self.read_mode }
    fn set_read_mode(&mut self, new_mode: bool) {
        self.read_mode = new_mode
    }
    fn set_data_bus(&mut self, new_value: u8) {
        self.data_bus = new_value
    }
    fn set_address_bus(&mut self, new_value: u16) {
        self.address_bus = new_value
    }

    fn tick(&mut self) {
        println!("Starting tick for TIM-1");
    }

    fn tick_ram(&mut self, address: u16, data: u8, cs: bool, oe: bool, we: bool) -> u8 {
        debug!("No dedicated RAM.  Its in the VIA");
        0x00
    }

    fn tick_rom(&mut self, address: u16, cs: bool, oe: bool) -> u8 {
        debug!("No dedicated ROM.  Its in the VIA");
        0x00
    }

    fn tick_via(&mut self, address: u16, data: u8, cs0: bool, cs1: bool, rw: bool, rs0: bool, rs1: bool) -> (u8, bool, bool) {
        debug!("Starting VIA Tick");
        self.pia.tick(address, data, false, self.read_mode);
        // is this for the ROM?

        // is this for the RAM?

        // is this for the Interrupts?

        // is this for the Timers?
        (0x00, false, false)
    }
}
