writes bins better now

This commit is contained in:
2025-07-07 16:28:13 -04:00
parent 9c672741ed
commit 8c08555003
29 changed files with 1381 additions and 108 deletions
+2 -8
View File
@@ -1,6 +1,8 @@
pub mod default;
pub mod rom_chip;
pub mod tick;
mod new;
mod program;
use crate::constants::constants_system::SIZE_32KB;
use crate::periph::rom_chip::RomChip;
@@ -16,14 +18,6 @@ pub struct At28C256 {
data: Box<[u8; SIZE_32KB]>,
}
impl At28C256 {
pub fn program(&mut self, new_program: &[u8; SIZE_32KB]) {
// panic!("FAIL. Cant program the chip.");
// println!("PROGRAMMING {:?}", new_program);
self.data = Box::new(*new_program);
}
}
#[cfg(test)]
mod test {
use super::*;
+10
View File
@@ -0,0 +1,10 @@
use crate::constants::constants_system::SIZE_32KB;
use crate::periph::at28c256::At28C256;
impl At28C256 {
pub fn new(data: &[u8; SIZE_32KB]) -> Self {
At28C256 {
data: (*data).into()
}
}
}
+10
View File
@@ -0,0 +1,10 @@
use crate::constants::constants_system::SIZE_32KB;
use crate::periph::at28c256::At28C256;
impl At28C256 {
pub fn program(&mut self, new_program: &[u8; SIZE_32KB]) {
// panic!("FAIL. Cant program the chip.");
// println!("PROGRAMMING {:?}", new_program);
self.data = Box::new(*new_program);
}
}
+4 -2
View File
@@ -3,8 +3,10 @@ use crate::periph::hm62256::Hm62256;
impl At28C256 {
fn tick(&mut self, address_bus: u16, data_bus: u8, read_mode: bool) -> (u16, u8) {
if !read_mode {
// has to be read mode. its a rom.
if read_mode {
panic!("UNABLE TO WRITE TO ROM");
} else {
// has to be read mode. its a rom.
return (address_bus, data_bus)
}
(address_bus, self.data[address_bus as usize])