forked from MightyPork/crsn
fixes, graphic acceleration commands, upscaling pixels
This commit is contained in:
@@ -45,8 +45,12 @@ impl<'a> TokenParser<'a> {
|
||||
/// Get error if not empty.
|
||||
/// The argument is substituted into the phrase "Instruction needs ...!" - i.e. "one Wr argument and a list or string"
|
||||
pub fn ensure_empty(&self, what_arguments : &str) -> Result<(), CrsnError> {
|
||||
self.ensure_empty_custom(&format!("Instruction needs {}!", what_arguments))
|
||||
}
|
||||
|
||||
pub fn ensure_empty_custom(&self, msg : &str) -> Result<(), CrsnError> {
|
||||
if self.have_more() {
|
||||
Err(CrsnError::Parse(format!("Instruction needs {}!", what_arguments).into(), self.start_pos.clone()))
|
||||
Err(CrsnError::Parse(msg.to_string().into(), self.start_pos.clone()))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -115,10 +115,12 @@ impl RunState {
|
||||
}
|
||||
|
||||
/// Read a `Rd` value
|
||||
#[inline]
|
||||
pub fn read(&mut self, rd: impl Into<Rd>) -> Result<Value, Fault> {
|
||||
let rd = rd.into();
|
||||
// TODO dedupe
|
||||
match rd.0 {
|
||||
RdData::Immediate(v) => Ok(v),
|
||||
RdData::Register(Register::Gen(rn)) => {
|
||||
if likely(rn < REG_COUNT as u8) {
|
||||
trace!("Rd {:?} = {}", rd, self.frame.gen[rn as usize]);
|
||||
@@ -135,7 +137,6 @@ impl RunState {
|
||||
Err(Fault::RegisterNotExist { reg: Register::Global(rn) })
|
||||
}
|
||||
}
|
||||
RdData::Immediate(v) => Ok(v),
|
||||
RdData::Register(Register::Arg(rn)) => {
|
||||
if likely(rn < REG_COUNT as u8) {
|
||||
trace!("Rd {:?} = {}", rd, self.frame.arg[rn as usize]);
|
||||
|
||||
Reference in New Issue
Block a user