aboutsummaryrefslogtreecommitdiff
path: root/src/memory.rs
diff options
context:
space:
mode:
authorkrolxon <krolyxon@tutanota.com>2026-01-04 18:39:25 +0530
committerkrolxon <krolyxon@tutanota.com>2026-01-04 18:39:25 +0530
commit4809d7159f373a358da4932571e2219b39b561ed (patch)
treee4251acc18ebe6419e3b55cccf3efbf0099ee6f5 /src/memory.rs
initial commit
Diffstat (limited to 'src/memory.rs')
-rw-r--r--src/memory.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/memory.rs b/src/memory.rs
new file mode 100644
index 0000000..dbcebed
--- /dev/null
+++ b/src/memory.rs
@@ -0,0 +1,17 @@
+pub struct Memory {
+ pub data: [u8; 65536],
+}
+
+impl Memory {
+ pub fn new() -> Self {
+ Self { data: [0; 65536] }
+ }
+
+ pub fn read(&self, addr: u16) -> u8 {
+ self.data[addr as usize]
+ }
+
+ pub fn write(&mut self, addr: u16, value: u8) {
+ self.data[addr as usize] = value;
+ }
+}