Fix page offset miscalculation in instruction fetch
This commit is contained in:
@@ -38,7 +38,7 @@ impl Core {
|
|||||||
pub fn run(&mut self) {
|
pub fn run(&mut self) {
|
||||||
loop {
|
loop {
|
||||||
let page = (self.pc / 4096) as usize;
|
let page = (self.pc / 4096) as usize;
|
||||||
let offset = (self.pc / 4) as u16;
|
let offset = (self.pc % 4096 / 4) as u16;
|
||||||
if !self.pc.is_multiple_of(4) {
|
if !self.pc.is_multiple_of(4) {
|
||||||
//replace eprint with logging, replace break with exception
|
//replace eprint with logging, replace break with exception
|
||||||
eprintln!("PC not aligned");
|
eprintln!("PC not aligned");
|
||||||
|
|||||||
Reference in New Issue
Block a user