adjust erroneous register count and initialization
This commit is contained in:
parent
548fbd14d0
commit
4731e932cc
|
@ -73,7 +73,7 @@ struct Bus {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Cpu {
|
pub struct Cpu {
|
||||||
pub reg: [u32; 31],
|
pub reg: [u32; 32],
|
||||||
pub pc: u32,
|
pub pc: u32,
|
||||||
bus: Bus,
|
bus: Bus,
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ impl Memory for Bus {
|
||||||
|
|
||||||
impl Cpu {
|
impl Cpu {
|
||||||
pub fn new(mem: Vec<u8>) -> Result<Self, elf::Error> {
|
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();
|
let mut ram = Ram::new();
|
||||||
|
|
||||||
// set sp to point to top of ram
|
// set sp to point to top of ram
|
||||||
|
@ -388,7 +388,7 @@ impl Cpu {
|
||||||
panic!("invalid register write");
|
panic!("invalid register write");
|
||||||
}
|
}
|
||||||
self.reg[reg] = val;
|
self.reg[reg] = val;
|
||||||
self.reg[0] = 0
|
self.reg[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn gpu_queue(&self) -> &Vec<Primitive> {
|
pub fn gpu_queue(&self) -> &Vec<Primitive> {
|
||||||
|
|
Loading…
Reference in New Issue