use crate::computers::kim1::Kim1;
use crate::periph::hm62256::Hm62256;
use crate::periph::kim1_keypad::Kim1Keypad;
use crate::periph::mos6530::mos6530::Mos6530;

impl Kim1 {
    pub fn dump(&self) {
        println!("DUMPING KIM-1 PC STATE");
        self.cpu.dump();
        self.rriot1.dump();
        self.rriot2.dump();
        self.keypad.dump();
    }

    pub fn new() -> Self {
        let rriot1_rom = include_bytes!("/home/tmerritt/Projects/mos6502/resources/kim1/6530-002_fillerbyte00-0x1c00.bin");
        let rriot2_rom = include_bytes!("/home/tmerritt/Projects/mos6502/resources/kim1/6530-003_fillerbyte00-0x1800.bin");

        Self {
            cpu: Default::default(),
            rriot1: Mos6530::new(0x1700, 0x1780, 0x1800, &rriot1_rom),
            rriot2: Mos6530::new(0x1740, 0x17C0, 0x1C00, &rriot2_rom),
            ram: Hm62256::new(0x0000),
            keypad: Kim1Keypad::new(),
            address_bus: 0,
            data_bus: 0,
            cpu_read: false,
            running: false
        }
    }
}