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

feat: added ppu initial implementation

parent 94396676
No related branches found
No related tags found
No related merge requests found
use std::{cell::RefCell, rc::Rc};
use crate::{cpu::Cpu, mmu::Mmu, util::read_file};
use crate::{cpu::Cpu, mmu::Mmu, ppu::Ppu, util::read_file};
pub type SharedMut<T> = Rc<RefCell<T>>;
......@@ -10,7 +10,8 @@ pub struct GameBoy {
impl GameBoy {
pub fn new() -> GameBoy {
let mmu = Mmu::new();
let ppu = Ppu::new();
let mmu = Mmu::new(ppu);
let cpu = Cpu::new(mmu);
GameBoy { cpu: cpu }
}
......
use crate::ppu::Ppu;
pub const RAM_SIZE: usize = 8192;
pub const VRAM_SIZE: usize = 8192;
pub struct Mmu {
ppu: Ppu,
ram: [u8; RAM_SIZE],
vram: [u8; VRAM_SIZE],
}
impl Mmu {
pub fn new() -> Mmu {
pub fn new(ppu: Ppu) -> Mmu {
Mmu {
ppu: ppu,
ram: [0u8; RAM_SIZE],
vram: [0u8; VRAM_SIZE],
}
}
......
pub const VRAM_SIZE: usize = 8192;
pub struct Ppu {
vram: [u8; VRAM_SIZE],
}
impl Ppu {
pub fn new() -> Ppu {
Ppu {
vram: [0u8; VRAM_SIZE],
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment