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}, io::{self, stdout, Write},
}; };
use crate::processor::gpu;
#[macro_export] #[macro_export]
macro_rules! verbose_println { macro_rules! verbose_println {
($($tts:tt)*) => { ($($tts:tt)*) => {
@ -95,7 +93,7 @@ fn main() {
3 3
}) })
.unwrap(); .unwrap();
gpu::init_statics(); crate::processor::memory::mmio::gpu::init_statics();
let rom: Rom = match fs::read(args.rom) { let rom: Rom = match fs::read(args.rom) {
Ok(data) => Rom::load(data), Ok(data) => Rom::load(data),

View file

@ -5,7 +5,7 @@ use gilrs::ConnectedGamepadsIterator;
use minifb::Key; use minifb::Key;
// use std::io::{stdout, Write}; // use std::io::{stdout, Write};
mod mmio; pub mod mmio;
pub(crate) mod rom; pub(crate) mod rom;
pub(crate) type Address = u16; pub(crate) type Address = u16;

View file

@ -41,7 +41,7 @@ pub struct Gpu {
} }
impl 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 tile_window = if enable_tile_window {
let mut window = Window::new( let mut window = Window::new(
"Tiles", "Tiles",

View file

@ -3,11 +3,13 @@ use minifb::Window;
use crate::{ use crate::{
processor::{ processor::{
get_bit, get_bit,
gpu::{ memory::{
bits_to_mapped_colour, scale_buffer, Palette, TiledataArea, TILE_WINDOW_HEIGHT, mmio::gpu::{
TILE_WINDOW_HEIGHT_SCALED, TILE_WINDOW_WIDTH, TILE_WINDOW_WIDTH_SCALED, 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, FACTOR,
}; };

View file

@ -1,6 +1,8 @@
mod apu; mod apu;
pub(crate) mod gpu;
mod joypad; mod joypad;
mod serial; mod serial;
pub use apu::Apu; pub use apu::Apu;
pub use gpu::Gpu;
pub use joypad::Joypad; pub use joypad::Joypad;
pub use serial::Serial; pub use serial::Serial;

View file

@ -1,6 +1,9 @@
use std::time::Instant; use std::time::Instant;
use self::{gpu::Gpu, memory::Memory, timer::Timers}; use self::{
memory::{mmio::Gpu, Memory},
timer::Timers,
};
use crate::{ use crate::{
util::{clear_bit, get_bit}, util::{clear_bit, get_bit},
verbose_println, verbose_println,
@ -8,7 +11,6 @@ use crate::{
use gilrs::Gilrs; use gilrs::Gilrs;
use minifb::Window; use minifb::Window;
pub mod gpu;
mod instructions; mod instructions;
pub mod memory; pub mod memory;
mod opcodes; mod opcodes;