diff --git a/src/main.rs b/src/main.rs index da06d81..f38a4ea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,8 +16,6 @@ use std::{ io::{self, stdout, Write}, }; -use crate::processor::gpu; - #[macro_export] macro_rules! verbose_println { ($($tts:tt)*) => { @@ -95,7 +93,7 @@ fn main() { 3 }) .unwrap(); - gpu::init_statics(); + crate::processor::memory::mmio::gpu::init_statics(); let rom: Rom = match fs::read(args.rom) { Ok(data) => Rom::load(data), diff --git a/src/processor/memory.rs b/src/processor/memory.rs index e76099b..3a022f3 100644 --- a/src/processor/memory.rs +++ b/src/processor/memory.rs @@ -5,7 +5,7 @@ use gilrs::ConnectedGamepadsIterator; use minifb::Key; // use std::io::{stdout, Write}; -mod mmio; +pub mod mmio; pub(crate) mod rom; pub(crate) type Address = u16; diff --git a/src/processor/gpu.rs b/src/processor/memory/mmio/gpu.rs similarity index 99% rename from src/processor/gpu.rs rename to src/processor/memory/mmio/gpu.rs index 7a66423..6ef5922 100644 --- a/src/processor/gpu.rs +++ b/src/processor/memory/mmio/gpu.rs @@ -41,7 +41,7 @@ pub struct Gpu { } impl Gpu { - pub(super) fn new(enable_tile_window: bool) -> Self { + pub fn new(enable_tile_window: bool) -> Self { let tile_window = if enable_tile_window { let mut window = Window::new( "Tiles", diff --git a/src/processor/gpu/tile_window.rs b/src/processor/memory/mmio/gpu/tile_window.rs similarity index 91% rename from src/processor/gpu/tile_window.rs rename to src/processor/memory/mmio/gpu/tile_window.rs index f60a2b1..636a396 100644 --- a/src/processor/gpu/tile_window.rs +++ b/src/processor/memory/mmio/gpu/tile_window.rs @@ -3,11 +3,13 @@ use minifb::Window; use crate::{ processor::{ get_bit, - gpu::{ - bits_to_mapped_colour, scale_buffer, Palette, TiledataArea, TILE_WINDOW_HEIGHT, - TILE_WINDOW_HEIGHT_SCALED, TILE_WINDOW_WIDTH, TILE_WINDOW_WIDTH_SCALED, + memory::{ + mmio::gpu::{ + bits_to_mapped_colour, scale_buffer, Palette, TiledataArea, TILE_WINDOW_HEIGHT, + TILE_WINDOW_HEIGHT_SCALED, TILE_WINDOW_WIDTH, TILE_WINDOW_WIDTH_SCALED, + }, + Memory, }, - memory::Memory, }, FACTOR, }; diff --git a/src/processor/gpu/types.rs b/src/processor/memory/mmio/gpu/types.rs similarity index 100% rename from src/processor/gpu/types.rs rename to src/processor/memory/mmio/gpu/types.rs diff --git a/src/processor/memory/mmio/mod.rs b/src/processor/memory/mmio/mod.rs index f14a15c..50b454a 100644 --- a/src/processor/memory/mmio/mod.rs +++ b/src/processor/memory/mmio/mod.rs @@ -1,6 +1,8 @@ mod apu; +pub(crate) mod gpu; mod joypad; mod serial; pub use apu::Apu; +pub use gpu::Gpu; pub use joypad::Joypad; pub use serial::Serial; diff --git a/src/processor/mod.rs b/src/processor/mod.rs index c28bc36..f7088c0 100644 --- a/src/processor/mod.rs +++ b/src/processor/mod.rs @@ -1,6 +1,9 @@ use std::time::Instant; -use self::{gpu::Gpu, memory::Memory, timer::Timers}; +use self::{ + memory::{mmio::Gpu, Memory}, + timer::Timers, +}; use crate::{ util::{clear_bit, get_bit}, verbose_println, @@ -8,7 +11,6 @@ use crate::{ use gilrs::Gilrs; use minifb::Window; -pub mod gpu; mod instructions; pub mod memory; mod opcodes;