Compare commits

..

No commits in common. "84724f800046437d608e21f1c8ad07c910cd1f8a" and "d6e290f916a085207e68432d005f185e8ead525c" have entirely different histories.

3 changed files with 1 additions and 12 deletions

View File

@ -89,7 +89,6 @@ pub fn execute(stack: &mut Stack, mut origin_stack: Option<&mut Stack>, mod_name
// Labels
"jmp" => instructions::jmp::jmp(&mut stack.labels, &mut stack.program_counter, instruction.data),
"rjmp" => instructions::rjmp::rjmp(&mut stack.memory, &mut stack.labels, &mut stack.program_counter),
"jnz" => instructions::jnz::jnz(&mut stack.memory, &mut stack.labels, &mut stack.program_counter, instruction.data),
"jz" => instructions::jz::jz(&mut stack.memory, &mut stack.labels, &mut stack.program_counter, instruction.data),
"kjnz" => instructions::kjnz::kjnz(&mut stack.memory, &mut stack.labels, &mut stack.program_counter, instruction.data),

View File

@ -39,4 +39,3 @@ pub mod print;
pub mod println;
pub mod insert;
pub mod random;
pub mod rjmp;

View File

@ -1,9 +0,0 @@
use crate::{errors::RunError, stack::StackVec};
pub fn rjmp(memory: &mut StackVec, labels: &mut [Option<i16>; 256], program_counter: &mut u16) {
let start = memory.pop() as usize;
let end = memory.pop() as usize;
let rand = fastrand::usize(start..end + 1);
*program_counter = (labels[rand].expect(&format!("{}", RunError::UnknownLabel(rand as u16))) - 1) as u16;
}