Allow JR between sections

Previously, JR was only allowed if the destination label was in the same
section as the JR. This patch removes this restriction. The check to see
if the relative value overflows is now done when linking the ROM.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
Antonio Niño Díaz
2018-02-22 23:39:41 +00:00
parent d243bd04ef
commit 2ed937db2c
6 changed files with 48 additions and 23 deletions

View File

@@ -455,7 +455,6 @@ static void updateUnion(void)
%type <nConstValue> const_3bit
%type <sVal> const_8bit
%type <sVal> const_16bit
%type <sVal> const_PCrel
%type <nConstValue> sectiontype
%type <tzString> string
@@ -1116,14 +1115,6 @@ constlist_32bit_entry_single : /* empty */
}
;
const_PCrel : relocconst
{
if (!rpn_isPCRelative(&$1))
yyerror("Expression must be PC-relative");
$$ = $1;
}
;
const_8bit : relocconst
{
if( (!rpn_isReloc(&$1)) && (($1.nVal < -128) || ($1.nVal > 255)) )
@@ -1612,12 +1603,12 @@ z80_jp : T_Z80_JP const_16bit
}
;
z80_jr : T_Z80_JR const_PCrel
z80_jr : T_Z80_JR const_16bit
{
out_AbsByte(0x18);
out_PCRelByte(&$2);
}
| T_Z80_JR ccode comma const_PCrel
| T_Z80_JR ccode comma const_16bit
{
out_AbsByte(0x20 | ($2 << 3));
out_PCRelByte(&$4);