more stuff i worked on

This commit is contained in:
2025-07-03 16:32:55 -04:00
parent e4405cc225
commit 2cfd570789
13 changed files with 564 additions and 292 deletions
+6
View File
@@ -14,6 +14,12 @@ pub struct At28C256 {
data: Box<[u8; SIZE_32KB]>,
}
impl At28C256 {
pub fn program(&mut self, new_program: &[u8; 32768]) {
self.data= new_program.into();
}
}
#[cfg(test)]
mod test {
use crate::constants::constants_system::SIZE_1KB;
+1 -1
View File
@@ -8,7 +8,7 @@ impl RomChip for At28C256 {
self.data[*offset as usize]
}
fn program(new_data: Box<[u8; SIZE_32KB]>) -> Box<At28C256> {
fn program(new_data: &[u8; SIZE_32KB]) -> Box<At28C256> {
println!("Writing new chip.");
let mut working = At28C256::default();
working.data = Box::new(*new_data);
+1 -1
View File
@@ -29,7 +29,7 @@ impl RomChip for Hm62256 {
self.data[effective as usize]
}
fn program(_: Box<[u8; SIZE_32KB]>) -> Box<Self> {
fn program(_: &[u8; SIZE_32KB]) -> Box<Self> {
debug!("Dont program ram.");
Hm62256::default().into()
}
+1 -1
View File
@@ -8,5 +8,5 @@ pub trait RomChip {
/// Program
///
/// Replaces all data in the ROM chip
fn program(new_data: Box<[u8; SIZE_32KB]>) -> Box<Self>;
fn program(new_data: &[u8; SIZE_32KB]) -> Box<Self>;
}