mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Refactor parsing of ld hl, sp + e8
This commit is contained in:
@@ -354,7 +354,6 @@
|
|||||||
%type <Expression> relocexpr_no_str
|
%type <Expression> relocexpr_no_str
|
||||||
%type <Expression> reloc_3bit
|
%type <Expression> reloc_3bit
|
||||||
%type <Expression> reloc_8bit
|
%type <Expression> reloc_8bit
|
||||||
%type <Expression> reloc_8bit_offset
|
|
||||||
%type <Expression> reloc_16bit
|
%type <Expression> reloc_16bit
|
||||||
|
|
||||||
// Constant numbers
|
// Constant numbers
|
||||||
@@ -403,6 +402,7 @@
|
|||||||
%type <Expression> op_a_n
|
%type <Expression> op_a_n
|
||||||
%type <int32_t> op_a_r
|
%type <int32_t> op_a_r
|
||||||
%type <Expression> op_mem_ind
|
%type <Expression> op_mem_ind
|
||||||
|
%type <Expression> op_sp_offset
|
||||||
|
|
||||||
// Data types used only in specific contexts
|
// Data types used only in specific contexts
|
||||||
%type <AlignmentSpec> align_spec
|
%type <AlignmentSpec> align_spec
|
||||||
@@ -1355,17 +1355,6 @@ reloc_8bit:
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
reloc_8bit_offset:
|
|
||||||
OP_ADD relocexpr {
|
|
||||||
$$ = std::move($2);
|
|
||||||
$$.checkNBit(8);
|
|
||||||
}
|
|
||||||
| OP_SUB relocexpr {
|
|
||||||
$$.makeUnaryOp(RPN_NEG, std::move($2));
|
|
||||||
$$.checkNBit(8);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
reloc_16bit:
|
reloc_16bit:
|
||||||
relocexpr {
|
relocexpr {
|
||||||
$$ = std::move($1);
|
$$ = std::move($1);
|
||||||
@@ -2199,13 +2188,10 @@ sm83_ld:
|
|||||||
;
|
;
|
||||||
|
|
||||||
sm83_ld_hl:
|
sm83_ld_hl:
|
||||||
SM83_LD MODE_HL COMMA MODE_SP reloc_8bit_offset {
|
SM83_LD MODE_HL COMMA MODE_SP op_sp_offset {
|
||||||
sect_ConstByte(0xF8);
|
sect_ConstByte(0xF8);
|
||||||
sect_RelByte($5, 1);
|
sect_RelByte($5, 1);
|
||||||
}
|
}
|
||||||
| SM83_LD MODE_HL COMMA MODE_SP {
|
|
||||||
::error("LD HL, SP is not a valid instruction; use LD HL, SP + 0");
|
|
||||||
}
|
|
||||||
| SM83_LD MODE_HL COMMA reloc_16bit {
|
| SM83_LD MODE_HL COMMA reloc_16bit {
|
||||||
sect_ConstByte(0x01 | (REG_HL << 4));
|
sect_ConstByte(0x01 | (REG_HL << 4));
|
||||||
sect_RelWord($4, 1);
|
sect_RelWord($4, 1);
|
||||||
@@ -2549,6 +2535,20 @@ op_a_n:
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
op_sp_offset:
|
||||||
|
OP_ADD relocexpr {
|
||||||
|
$$ = std::move($2);
|
||||||
|
$$.checkNBit(8);
|
||||||
|
}
|
||||||
|
| OP_SUB relocexpr {
|
||||||
|
$$.makeUnaryOp(RPN_NEG, std::move($2));
|
||||||
|
$$.checkNBit(8);
|
||||||
|
}
|
||||||
|
| %empty {
|
||||||
|
::error("LD HL, SP is not a valid instruction; use LD HL, SP + 0");
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
// Registers and condition codes.
|
// Registers and condition codes.
|
||||||
|
|
||||||
MODE_A:
|
MODE_A:
|
||||||
|
|||||||
Reference in New Issue
Block a user