Skip to content
Snippets Groups Projects
Verified Commit 8823fa32 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: initial support for PC print

parent 7e184aec
No related branches found
No related tags found
1 merge request!2Support for diagnostics text
......@@ -329,15 +329,13 @@ fn main() {
font.set_hinting(Hinting::None);
let surface = font
.render(format!("{} Hz", state.logic_frequency).as_str())
.blended(Color::RGBA(255, 0, 0, 255))
.render(format!("PC: {:#0x?}", state.system.pc()).as_str())
.blended(Color::RGBA(80, 203, 147, 255))
.unwrap();
let texture = texture_creator
.create_texture_from_surface(&surface)
.unwrap();
canvas.set_draw_color(Color::RGBA(195, 217, 255, 255));
let TextureQuery { width, height, .. } = texture.query();
canvas
......
......@@ -116,6 +116,14 @@ impl Chip8 {
self.beep
}
pub fn pc(&self) -> u16 {
self.pc
}
pub fn sp(&self) -> u8 {
self.sp
}
pub fn load_rom(&mut self, rom: &[u8]) {
self.ram[ROM_START..ROM_START + rom.len()].clone_from_slice(rom);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment