Add rfp register support

This commit is contained in:
Ry 2022-09-18 16:34:14 -07:00
parent aae6632dfd
commit 7d1f636239
2 changed files with 3 additions and 2 deletions

View File

@ -158,4 +158,4 @@ body_str_chars = {
} }
register = ${ "r" ~ register_num } register = ${ "r" ~ register_num }
register_num = @{ ASCII_DIGIT+ | "sp" | "esp" } register_num = @{ ASCII_DIGIT+ | "sp" | "esp" | "fp" }

View File

@ -814,8 +814,9 @@ fn parse_operand(mut pair: pest::iterators::Pair<Rule>, is_pointer: bool) -> Ast
let register_num_pair = operand_value_pair.into_inner().next().unwrap(); let register_num_pair = operand_value_pair.into_inner().next().unwrap();
let register_num = if register_num_pair.as_str() == "sp" { 32 } let register_num = if register_num_pair.as_str() == "sp" { 32 }
else if register_num_pair.as_str() == "esp" { 33 } else if register_num_pair.as_str() == "esp" { 33 }
else if register_num_pair.as_str() == "fp" { 34 }
else { register_num_pair.as_str().parse::<u8>().unwrap() }; else { register_num_pair.as_str().parse::<u8>().unwrap() };
if register_num > 33 { panic!("register number out of range"); } if register_num > 34 { panic!("register number out of range"); }
if is_pointer { if is_pointer {
AstNode::RegisterPointer(register_num) AstNode::RegisterPointer(register_num)
} else { } else {