|
|
|
@ -8,6 +8,7 @@ use crsn::asm::data::literal::Addr; |
|
|
|
|
use crsn::runtime::run_thread::{RunThread, ThreadToken}; |
|
|
|
|
use crsn_arith::ArithOps; |
|
|
|
|
use crsn_stacks::StackOps; |
|
|
|
|
use std::time::Duration; |
|
|
|
|
|
|
|
|
|
fn main() { |
|
|
|
|
SimpleLogger::new().init().unwrap(); |
|
|
|
@ -71,12 +72,19 @@ fn main() { |
|
|
|
|
(main |
|
|
|
|
(push 0 10) |
|
|
|
|
(push 0 20) |
|
|
|
|
(call emptystack 0) |
|
|
|
|
(push 0 30) |
|
|
|
|
(pop r0 0) |
|
|
|
|
(pop r0 0) |
|
|
|
|
(pop r0 0) |
|
|
|
|
(halt) |
|
|
|
|
) |
|
|
|
|
(emptystack |
|
|
|
|
(:again) |
|
|
|
|
(pop _ arg0 (z? (ret))) |
|
|
|
|
(j :again) |
|
|
|
|
(ret) |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
"; |
|
|
|
|
|
|
|
|
@ -87,12 +95,14 @@ fn main() { |
|
|
|
|
|
|
|
|
|
let parsed = crsn::asm::assemble(program, parsers.as_slice()).unwrap(); |
|
|
|
|
|
|
|
|
|
let thread1 = RunThread::new(ThreadToken(0), parsed.clone(), Addr(0), &[]); |
|
|
|
|
let mut thread1 = RunThread::new(ThreadToken(0), parsed.clone(), Addr(0), &[]); |
|
|
|
|
thread1.set_speed(Duration::from_millis(1000)); |
|
|
|
|
|
|
|
|
|
let thread2 = RunThread::new(ThreadToken(1), parsed.clone(), Addr(0), &[]); |
|
|
|
|
|
|
|
|
|
let a = thread1.start(); |
|
|
|
|
let b = thread2.start(); |
|
|
|
|
//let b = thread2.start();
|
|
|
|
|
|
|
|
|
|
a.join().unwrap(); |
|
|
|
|
b.join().unwrap(); |
|
|
|
|
//b.join().unwrap();
|
|
|
|
|
} |
|
|
|
|