Support for "virtual operands" of subroutines like this:

jsr	SomeProc
.byte	$00, $01 ; argument to SomeProc
; return here from SomeProc
bit	$3F
This commit is contained in:
AIDA Shinra
2018-06-10 18:09:11 +09:00
parent b74ab9de89
commit 9283e9ca98
9 changed files with 66 additions and 4 deletions

View File

@@ -59,6 +59,7 @@
#include "opctable.h"
#include "scanner.h"
#include "segment.h"
#include "handler.h"
@@ -380,6 +381,7 @@ static void LabelSection (void)
{ "ADDR", INFOTOK_ADDR },
{ "NAME", INFOTOK_NAME },
{ "SIZE", INFOTOK_SIZE },
{ "VOPERAND", INFOTOK_VOPERAND },
};
/* Locals - initialize to avoid gcc warnings */
@@ -387,6 +389,7 @@ static void LabelSection (void)
char* Comment = 0;
long Value = -1;
long Size = -1;
long VOperand = -1;
/* Skip the token */
InfoNextTok ();
@@ -448,6 +451,17 @@ static void LabelSection (void)
InfoNextTok ();
break;
case INFOTOK_VOPERAND:
InfoNextTok ();
if (VOperand >= 0) {
InfoError ("VOperand already given");
}
InfoAssureInt ();
InfoRangeCheck (1, 0x10000);
VOperand = InfoIVal;
InfoNextTok ();
break;
default:
Internal ("Unexpected token: %u", InfoTok);
}
@@ -484,6 +498,9 @@ static void LabelSection (void)
} else {
AddExtLabelRange ((unsigned) Value, Name, Size);
}
if (VOperand >= 0) {
SetSubroutineVOperand ((unsigned) Value, (unsigned) VOperand);
}
/* Define the comment */
if (Comment) {