forked from MightyPork/crsn
add pretty-printer for assembled instructions
This commit is contained in:
+12
-1
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user