use beneater::parts::backplane::Backplane;
use core::constants::constants_isa_op::*;
use core::constants::constants_system::*;
use std::fs;
use std::ops::Index;
fn main() {
    println!("Taxation is Theft");

    let mut backplane = Backplane::new();

    for i in 0..12 {
        backplane.tick();
    }

    //backplane.load_rom();
    println!("Backplane is live.");

    let mut new_program = [0x00u8; SIZE_32KB];
    new_program[(OFFSET_RESET_VECTOR - SIZE_32KB as u16) as usize] = 0x00;
    new_program[(OFFSET_RESET_VECTOR + 1 - SIZE_32KB as u16) as usize] = 0x60;
    println!("Set offset in rom...");
    println!(
        "VALUE AT OFFSET_RESET_VECTOR = 0x{:04x} ",
        new_program[(OFFSET_RESET_VECTOR - SIZE_32KB as u16) as usize]
    );
    // println!("{:?}", new_program);

    // backplane.rom.program(&new_program);
    // backplane.cpu.pc = 0x6000;
    // backplane.memory[0x6000] = ISA_OP_LDA_I;
    // backplane.memory[0x6001] = 0xab;
    // backplane.tick();
}
