forked from n3tael/labast
25 lines
496 B
Rust
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()
|
||
|
};
|
||
|
}
|
||
|
}
|