labast/src/stack.rs
2024-02-05 09:05:48 +02:00

25 lines
496 B
Rust

#[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()
};
}
}