move gpu to mmio module

This commit is contained in:
Alex Janka 2023-02-22 09:37:31 +11:00
parent c622a2ae4a
commit 5dba0e039a
7 changed files with 15 additions and 11 deletions

View file

@ -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),

View file

@ -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;

View file

@ -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",

View file

@ -3,11 +3,13 @@ use minifb::Window;
use crate::{
processor::{
get_bit,
gpu::{
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,
};

View file

@ -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;

View file

@ -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;