add pretty-printer for assembled instructions

This commit is contained in:
2020-10-05 00:32:08 +02:00
parent 986f3be6a2
commit 34e339b1ca
11 changed files with 247 additions and 12 deletions
+12 -1
View File
@@ -10,6 +10,9 @@ use crsn::runtime::fault::Fault;
use crsn::runtime::run_thread::{state::RunState, ThreadInfo};
use crate::defs::ScreenOp;
use crsn::sexp::Sexp;
use crsn::sexp;
use crsn::utils::A;
#[derive(Debug)]
struct Opts {
@@ -123,7 +126,15 @@ impl OpTrait for ScreenOp {
Ok(eres)
}
//
fn to_sexp(&self) -> Sexp {
match self {
ScreenOp::SetOpt { opt, val } => sexp::list(&[A("sc-opt"), A(opt), A(val)]),
ScreenOp::ScreenInit { width, height } => sexp::list(&[A("sc-init"), A(width), A(height)]),
ScreenOp::SetPixel { x, y, color } => sexp::list(&[A("sc-px"), A(x), A(y), A(color)]),
ScreenOp::Blit { force } => sexp::list(&[A("sc-blit"), A(force)])
}
}
}
fn init(state: &mut RunState, width: Value, height: Value) -> Result<(), Fault> {