adjust erroneous register count and initialization

This commit is contained in:
mos 2024-04-19 11:05:32 +02:00
parent 548fbd14d0
commit 4731e932cc
1 changed files with 3 additions and 3 deletions

View File

@ -73,7 +73,7 @@ struct Bus {
}
pub struct Cpu {
pub reg: [u32; 31],
pub reg: [u32; 32],
pub pc: u32,
bus: Bus,
}
@ -348,7 +348,7 @@ impl Memory for Bus {
impl Cpu {
pub fn new(mem: Vec<u8>) -> Result<Self, elf::Error> {
let mut reg: [u32; 31] = [0; 31];
let mut reg: [u32; 32] = [0; 32];
let mut ram = Ram::new();
// set sp to point to top of ram
@ -388,7 +388,7 @@ impl Cpu {
panic!("invalid register write");
}
self.reg[reg] = val;
self.reg[0] = 0
self.reg[0] = 0;
}
pub fn gpu_queue(&self) -> &Vec<Primitive> {