blob: b4b7520654809a9a8d384b85d25d13645d7622e5 (
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
27
28
29
30
31
|
use crate::*;
pub struct BedrockCore {
pub mem: ProgramMemory,
pub wst: Stack,
pub rst: Stack,
pub cycle: usize,
}
impl BedrockCore {
pub fn new() -> Self {
Self {
mem: ProgramMemory::new(),
wst: Stack::new(),
rst: Stack::new(),
cycle: 0,
}
}
pub fn with_device_bus<DB>(self, dev: DB) -> BedrockEmulator<DB> {
BedrockEmulator { core: self, dev }
}
pub fn reset(&mut self) {
self.cycle = 0;
self.mem.pc = 0;
self.wst.sp = 0;
self.rst.sp = 0;
}
}
|