Main system WIP
This commit is contained in:
parent
8cfedc63d4
commit
8d5192ff43
@ -1,6 +1,7 @@
|
||||
mod cpu;
|
||||
mod memory;
|
||||
pub mod rom;
|
||||
mod system;
|
||||
|
||||
pub trait Clock {
|
||||
/// Run a clock cycle
|
||||
|
@ -5,6 +5,11 @@ pub struct MemoryBus {
|
||||
}
|
||||
|
||||
impl MemoryBus {
|
||||
pub fn new() -> Self {
|
||||
let ram = [0; MEMORY_SIZE];
|
||||
Self { ram }
|
||||
}
|
||||
|
||||
/// Gets a byte from memory.
|
||||
///
|
||||
/// # Arguments
|
||||
|
@ -1,7 +1,6 @@
|
||||
//! INes 2.0 Format implementation
|
||||
|
||||
use crate::rom::{CpuTiming, NametableMirroring, Rom, RomLoader, RomReadError};
|
||||
use bitflags::bitflags;
|
||||
|
||||
pub struct INesHeader {
|
||||
prg_rom_size_lsb: u8,
|
||||
|
21
core/src/system.rs
Normal file
21
core/src/system.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use crate::cpu::Cpu;
|
||||
use crate::memory::MemoryBus;
|
||||
|
||||
pub struct System {
|
||||
cpu: Cpu,
|
||||
memory_bus: Rc<RefCell<MemoryBus>>,
|
||||
}
|
||||
|
||||
impl System {
|
||||
pub fn new() -> Self {
|
||||
let memory_bus = Rc::new(RefCell::new(MemoryBus::new()));
|
||||
let cpu = Cpu::new(memory_bus);
|
||||
|
||||
Self {
|
||||
cpu,
|
||||
memory_bus
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user