more chips

more docs
This commit is contained in:
2025-08-02 11:17:23 -04:00
parent 7ac8bd86ba
commit c4e1f233ae
98 changed files with 2908 additions and 2270 deletions
-30
View File
@@ -1,30 +0,0 @@
use std::fs;
use core::computers::ram_rom::RamRomComputer;
use core::traits::backplane::Backplane;
fn main() {
let bytes = include_bytes!("/home/tmerritt/Projects/mos6502/resources/test/periph/at28c256/checksum.bin");
println!("Taxation is theft");
let mut ramrom_computer = RamRomComputer::program_rom((&bytes[..]).to_vec());
ramrom_computer.tick2(0x05, 0b0000_0000, 0x05);
println!("COMPUTER: Read {:02x} from ROM / {:04x} from Address bus",
ramrom_computer.data_bus(),
ramrom_computer.address_bus()
);
println!("--TICK--");
ramrom_computer.tick2(0x4005, 0b0000_0001, ramrom_computer.data_bus());
println!("COMPUTER: Read {:02x} from ROM / {:04x} from Address bus",
ramrom_computer.data_bus(),
ramrom_computer.address_bus()
);
println!("--TICK--");
ramrom_computer.tick2(0x4005, 0b0000_0000, ramrom_computer.data_bus());
println!("COMPUTER: Read {:02x} from ROM / {:04x} from Address bus",
ramrom_computer.data_bus(),
ramrom_computer.address_bus()
);
println!("--TICK--");
}
-37
View File
@@ -1,37 +0,0 @@
use std::fs;
use core::computers::rom_only::RomOnlyComputer;
use core::traits::backplane::Backplane;
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!("Read {} bytes.", bytes.len());
bytes
},
Err(e) => {
eprintln!("FAIL to read rom.");
panic!("No rom no run.");
vec![]
}
};
let mut rom_only = RomOnlyComputer::program((&bytes[..]).to_vec());
rom_only.set_read_mode(true);
rom_only.set_address_bus(0x05);
rom_only.tick();
println!("COMPUTER: Read {:02x} from ROM", rom_only.data_bus()) ;
println!("COMPUTER: Read {:04x} from Address Bus", rom_only.address_bus());
println!("----");
rom_only.set_read_mode(true);
rom_only.set_address_bus(0x07);
rom_only.tick();
println!("COMPUTER: Read {:02x} from ROM", rom_only.data_bus()) ;
println!("COMPUTER: Read {:04x} from Address Bus", rom_only.address_bus());
println!("----");
}
-20
View File
@@ -1,20 +0,0 @@
use std::fs;
use core::computers::rom_only::RomOnlyComputer;
use core::traits::backplane::Backplane;
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 / {:04x} from Address bus", rom_only.data_bus(), rom_only.address_bus()) ;
}
+6
View File
@@ -0,0 +1,6 @@
use core::computers::single_breadboard::SingleBreadboard;
fn main() {
let sb = SingleBreadboard::new();
}
+2
View File
@@ -0,0 +1,2 @@
mod ram_rom_tests;
mod rom_only_test;
+16
View File
@@ -0,0 +1,16 @@
use core::computers::ram_rom::RamRomComputer;
use core::traits::backplane::Backplane;
const RAM_START: u16 = 0x4000;
const ROM_START: u16 = 0x0000;
#[test]
fn ram_rom_thintick() {
let mut ramrom = RamRomComputer::new();
ramrom.tick2(0x0001, 1, 0x00);
println!("DataBus: {}", ramrom.data_bus());
ramrom.tick2(0x4001, 1,0xab);
println!("DataBus: {}", ramrom.data_bus());
ramrom.tick2(0x4001, 1,0x00);
println!("DataBus: {}", ramrom.data_bus());
}
+42
View File
@@ -0,0 +1,42 @@
use core::computers::rom_only::RomOnlyComputer;
use core::traits::backplane::Backplane;
#[test]
fn rom_only_widetick_test() {
let bytes = include_bytes!("/home/tmerritt/Projects/mos6502/resources/test/periph/at28c256/checksum.bin");
let mut rom_only = RomOnlyComputer::program((&bytes[..]).to_vec());
rom_only.tick2(0x05, 0x00, 0x00);
assert_eq!(rom_only.data_bus(), 0x05);
assert_eq!(rom_only.address_bus(), 0x05);
rom_only.tick2(0x07, 0x00, 0x00);
assert_eq!(rom_only.data_bus(), 0x07);
assert_eq!(rom_only.address_bus(), 0x07);
rom_only.tick2(0x09, 0x00, 0x00);
assert_eq!(rom_only.data_bus(), 0x09);
assert_eq!(rom_only.address_bus(), 0x09);
}
#[test]
fn rom_only_thintick_test() {
let bytes = include_bytes!("/home/tmerritt/Projects/mos6502/resources/test/periph/at28c256/checksum.bin");
let mut rom_only = RomOnlyComputer::program((&bytes[..]).to_vec());
rom_only.set_read_mode(true);
rom_only.set_address_bus(0x05);
rom_only.tick();
assert_eq!(rom_only.data_bus(), 0x05);
assert_eq!(rom_only.address_bus(), 0x05);
rom_only.set_read_mode(true);
rom_only.set_address_bus(0x07);
rom_only.tick();
assert_eq!(rom_only.data_bus(), 0x07);
assert_eq!(rom_only.address_bus(), 0x07);
}