labast/src/stack.rs

25 lines
496 B
Rust
Raw Permalink Normal View History

2024-02-05 07:05:48 +00:00
#[derive(Clone, Debug)]
pub struct Instruction {
pub name: String,
pub arg: String,
pub data: u16
}
#[derive(Clone, Debug)]
pub struct Stack {
pub program: Vec<Instruction>,
pub program_counter: u16,
pub labels: [Option<i16>; 256],
pub memory: Vec<u16>
}
impl Stack {
pub fn new() -> Stack {
return Stack {
program: Vec::new(),
program_counter: 0,
labels: [None; 256],
memory: Vec::new()
};
}
}