[fix] Get sensible y coordinates

This commit is contained in:
2024-02-19 12:37:53 +05:30
parent fbf38e4925
commit 2c8a61dcc8
2 changed files with 5 additions and 8 deletions

View File

@@ -44,10 +44,13 @@ impl <'a> Cpu<'a>{
for _i in 0..65536{
let address_to_execute = self.get_pc();
//fetch
//execute p1
self.copy_u24(address_to_execute)?;
//execute p2
let new_pc_location = address_to_execute+2*(Self::PC_LEN as u32) ;
let new_pc = self.memory.try_get_u24(new_pc_location)?;
self.set_pc(new_pc);
}
log::debug!("Finished internal loop");

View File

@@ -25,17 +25,11 @@ impl <'a> SDLGraphicsAdapter<'a> {
}
}
pub fn draw(&self, canvas:&mut WindowCanvas) -> EmulatorResult<()> {
let mut canvas_ref = &canvas;
let fb = self.graphics_processor.get_framebuffer();
for i in 0..fb.len() {
let i = i as u32;
let y_coord = i&0xff00;
let x_coord = i&0x00ff;
}
let xyc = fb.iter().enumerate().map(|(i,e)| {
let i = i as u32;
let y_coord = i&0xff00;
let y_coord = i&0xff00 >> 8;
let x_coord = i&0x00ff;
let color = Color::new(*e);
(x_coord,y_coord,color)