prep to do big tick method
This commit is contained in:
parent
7498489b03
commit
d5efabdd36
@ -1,19 +1,9 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use clap::Parser;
|
|
||||||
use core::computers::rom_only::RomOnlyComputer;
|
use core::computers::rom_only::RomOnlyComputer;
|
||||||
use core::periph::backplane::Backplane;
|
use core::periph::backplane::Backplane;
|
||||||
|
|
||||||
#[derive(Parser)]
|
|
||||||
struct CliOptions {
|
|
||||||
offset: u16,
|
|
||||||
bytes: u16,
|
|
||||||
filename: String
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Taxation is theft");
|
println!("Taxation is theft");
|
||||||
|
|
||||||
// let opts = CliOptions::parse();
|
|
||||||
let path = "/home/tmerritt/Projects/mos6502/resources/test/periph/at28c256/checksum.bin";
|
let path = "/home/tmerritt/Projects/mos6502/resources/test/periph/at28c256/checksum.bin";
|
||||||
let bytes = match fs::read(path) {
|
let bytes = match fs::read(path) {
|
||||||
Ok(bytes) => {
|
Ok(bytes) => {
|
||||||
|
|||||||
20
cli/src/bin/rom_only_widetick.rs
Normal file
20
cli/src/bin/rom_only_widetick.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
use std::fs;
|
||||||
|
use core::computers::rom_only::RomOnlyComputer;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("Taxation is theft");
|
||||||
|
let path = "/home/tmerritt/Projects/mos6502/resources/test/periph/at28c256/checksum.bin";
|
||||||
|
let bytes = match fs::read(path) {
|
||||||
|
Ok(bytes) => {
|
||||||
|
println!("Loaded {} bytes", bytes.len());
|
||||||
|
bytes
|
||||||
|
},
|
||||||
|
Err(e) => vec![]
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut rom_only = RomOnlyComputer::program((&bytes[..]).to_vec());
|
||||||
|
|
||||||
|
rom_only.tick2(0x05, 0b0000_0001, 0x05);
|
||||||
|
println!("COMPUTER: Read {:02x} from ROM", rom_only.data_bus()) ;
|
||||||
|
println!("COMPUTER: Read {:04x} from Address Bus", rom_only.address_bus());
|
||||||
|
}
|
||||||
@ -47,6 +47,7 @@ impl Backplane for RamRomComputer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_read_mode(&mut self, new_mode: bool) {
|
fn set_read_mode(&mut self, new_mode: bool) {
|
||||||
self.read_mode = new_mode;
|
self.read_mode = new_mode;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,3 +12,12 @@ pub struct RomOnlyComputer {
|
|||||||
pub(crate) address_bus: u16,
|
pub(crate) address_bus: u16,
|
||||||
pub(crate) read_mode: bool,
|
pub(crate) read_mode: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl RomOnlyComputer {
|
||||||
|
pub fn tick2(&mut self, address: u16, control: u8, data: u8) -> (u8) {
|
||||||
|
// tick the parts...
|
||||||
|
|
||||||
|
let (_, new_data) = self.rom.tick(address, data, control == 0x01);
|
||||||
|
new_data
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user