//! Implementation of memory for the MOS 6502. /// Maximum amount of memory that exists within the emulator. pub const MAXIMUM_MEMORY: usize = 1024 * 64; /// Implementation of memory for the 6502. pub struct Memory { /// Data for the memory. pub data: [u8; MAXIMUM_MEMORY], } impl Memory { /// Creates a new instance of the memory. Returns blank memory with all /// zeroes. pub const fn new() -> Self { Self { data: [0; MAXIMUM_MEMORY], } } /// Resets all data in the memory to zero. This simply allocates a new array /// and sets the memory to the new, zeroed array. pub fn reset(&mut self) { self.data = [0; MAXIMUM_MEMORY]; } }