forked from MightyPork/crsn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
745 B
31 lines
745 B
4 years ago
|
|
||
|
use crsn::asm::error::CrsnError;
|
||
|
use crsn::asm::instr::Op;
|
||
|
use crsn::asm::parse::arg_parser::ArgParser;
|
||
|
use crsn::module::{ParseOpRes};
|
||
|
|
||
|
use crate::defs::ScreenOp;
|
||
|
|
||
|
pub(crate) fn parse(keyword: &str, mut args: ArgParser) -> Result<ParseOpRes<Op>, CrsnError> {
|
||
|
Ok(ParseOpRes::ext(match keyword {
|
||
|
"sc-init" => {
|
||
|
ScreenOp::ScreenInit {
|
||
|
width: args.next_rd()?,
|
||
|
height: args.next_rd()?,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
"sc-px" => {
|
||
|
ScreenOp::SetPixel {
|
||
|
x: args.next_rd()?,
|
||
|
y: args.next_rd()?,
|
||
|
color: args.next_rd()?,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
_other => {
|
||
|
return Ok(ParseOpRes::Unknown(args));
|
||
|
}
|
||
|
}))
|
||
|
}
|