RamRomComputer now reads from ROM and writes to RAM and reads back from RAM

This commit is contained in:
2025-07-18 16:09:41 -04:00
parent 2939e1cac5
commit 7498489b03
33 changed files with 3356 additions and 547 deletions
-2
View File
@@ -18,6 +18,4 @@ fn main() {
for (op, bytes) in instructions {
assert_eq!(Instruction::decode(bytes), Some(op));
}
// let instruction = Instruction::decode(&[0xea]);
// println!("NOP Decoded -> {:?}", instruction);
}
+1 -1
View File
@@ -12,7 +12,7 @@ fn main() {
kim.tick();
num_ticks += 1;
if num_ticks == 11 {
if num_ticks == MOS6502_RESET_CYCLE_COUNT {
println!("Got our 11 ticks. time to hotwire this pc.");
kim.running = true;
kim.dump();
+28 -1
View File
@@ -1,3 +1,5 @@
use core::computers::ram_rom::backplane::RamRomComputer;
use core::periph::backplane::Backplane;
use std::fs;
fn main() {
@@ -18,4 +20,29 @@ fn main() {
};
}
let mut computer = RamRomComputer::new();
// Read byte from ROM 0x4000
println!("-- ");
computer.set_read_mode(true);
computer.set_address_bus(0x4020);
computer.tick();
println!("-- ");
// Data Bus contains value from ROM
let read_from_rom = computer.data_bus();
// Write byte to RAM 0x0000
computer.set_read_mode(false);
computer.set_address_bus(0x0001);
computer.tick();
println!("-- ");
// Read byte from RAM
computer.set_read_mode(true);
computer.set_address_bus(0x0001);
computer.tick();
println!("-- ");
let read_from_ram = computer.data_bus();
assert_eq!(read_from_rom, read_from_ram);
println!("Test passed. We read the same from ROM as we did from RAM - {} == {}", read_from_rom, read_from_ram);
}
+1 -1
View File
@@ -1,6 +1,6 @@
use std::fs;
use clap::Parser;
use core::computers::rom_only::backplane::RomOnlyComputer;
use core::computers::rom_only::RomOnlyComputer;
use core::periph::backplane::Backplane;
#[derive(Parser)]