blob: d2512313e73d59ec1139e4121b896ae02efb0a3d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
//! 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];
}
}
|