mirror of
https://github.com/cc65/cc65.git
synced 2024-06-26 05:29:30 +00:00
Followed discussions in the Pull reequest #681.
In particular, renamed "virtual operands" to "inline parameters".
This commit is contained in:
parent
9283e9ca98
commit
03bb2f6a48
|
@ -542,16 +542,16 @@ code. The following attributes are recognized:
|
||||||
range, where <tt/label/ is the label name given with the <tt/NAME/
|
range, where <tt/label/ is the label name given with the <tt/NAME/
|
||||||
attribute, and <tt/offs/ is the offset within the data.
|
attribute, and <tt/offs/ is the offset within the data.
|
||||||
|
|
||||||
<tag><tt>VOPERAND</tt></tag>
|
<tag><tt>PARAMSIZE</tt></tag>
|
||||||
This optional attribute is followed by a numerical value. It tells the
|
This optional attribute is followed by a numerical value. It tells the
|
||||||
assembler that subroutine calls to this label follow "virtual operands"
|
assembler that subroutine calls to this label follow "inline parameters"
|
||||||
of the given bytes like this:
|
of the given bytes like this:
|
||||||
|
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
JSR LabelWith2BytesOfVoperand
|
JSR LabelWithParamSize2
|
||||||
.byte $00, $10 ; virtual operands
|
.byte $00, $10
|
||||||
; return here
|
(return here)
|
||||||
BIT $0F
|
code...
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
</descrip>
|
</descrip>
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned short SubroutineVOperandSize[0x10000];
|
static unsigned short SubroutineParamSize[0x10000];
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
|
@ -748,18 +748,22 @@ void OH_JmpAbsoluteXIndirect (const OpcDesc* D)
|
||||||
|
|
||||||
void OH_JsrAbsolute (const OpcDesc* D)
|
void OH_JsrAbsolute (const OpcDesc* D)
|
||||||
{
|
{
|
||||||
unsigned VOperandSize = SubroutineVOperandSize[GetCodeWord(PC+1)];
|
unsigned ParamSize = SubroutineParamSize[GetCodeWord(PC+1)];
|
||||||
OH_Absolute (D);
|
OH_Absolute (D);
|
||||||
if (VOperandSize > 0) {
|
if (ParamSize > 0) {
|
||||||
unsigned RemainingBytes;
|
unsigned RemainingBytes;
|
||||||
|
unsigned BytesLeft;
|
||||||
PC += D->Size;
|
PC += D->Size;
|
||||||
RemainingBytes = GetRemainingBytes();
|
RemainingBytes = GetRemainingBytes();
|
||||||
if (RemainingBytes < VOperandSize) {
|
if (RemainingBytes < ParamSize) {
|
||||||
VOperandSize = RemainingBytes;
|
ParamSize = RemainingBytes;
|
||||||
}
|
}
|
||||||
if (VOperandSize > 0) {
|
BytesLeft = ParamSize;
|
||||||
DataByteLine (VOperandSize); /* FIXME: follow BytesPerLine */
|
while (BytesLeft > 0) {
|
||||||
PC += VOperandSize;
|
unsigned Chunk = (BytesLeft > BytesPerLine)? BytesPerLine : BytesLeft;
|
||||||
|
DataByteLine (Chunk);
|
||||||
|
BytesLeft -= Chunk;
|
||||||
|
PC += Chunk;
|
||||||
}
|
}
|
||||||
PC -= D->Size;
|
PC -= D->Size;
|
||||||
}
|
}
|
||||||
|
@ -767,7 +771,7 @@ void OH_JsrAbsolute (const OpcDesc* D)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SetSubroutineVOperand (unsigned Addr, unsigned Size)
|
void SetSubroutineParamSize (unsigned Addr, unsigned Size)
|
||||||
{
|
{
|
||||||
SubroutineVOperandSize[Addr] = Size;
|
SubroutineParamSize[Addr] = Size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ void OH_JmpAbsoluteIndirect (const OpcDesc* D);
|
||||||
void OH_JmpAbsoluteXIndirect (const OpcDesc* D);
|
void OH_JmpAbsoluteXIndirect (const OpcDesc* D);
|
||||||
void OH_JsrAbsolute (const OpcDesc*);
|
void OH_JsrAbsolute (const OpcDesc*);
|
||||||
|
|
||||||
void SetSubroutineVOperand (unsigned Addr, unsigned Size);
|
void SetSubroutineParamSize (unsigned Addr, unsigned Size);
|
||||||
|
|
||||||
|
|
||||||
/* End of handler.h */
|
/* End of handler.h */
|
||||||
|
|
|
@ -381,7 +381,7 @@ static void LabelSection (void)
|
||||||
{ "ADDR", INFOTOK_ADDR },
|
{ "ADDR", INFOTOK_ADDR },
|
||||||
{ "NAME", INFOTOK_NAME },
|
{ "NAME", INFOTOK_NAME },
|
||||||
{ "SIZE", INFOTOK_SIZE },
|
{ "SIZE", INFOTOK_SIZE },
|
||||||
{ "VOPERAND", INFOTOK_VOPERAND },
|
{ "PARAMSIZE", INFOTOK_PARAMSIZE },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Locals - initialize to avoid gcc warnings */
|
/* Locals - initialize to avoid gcc warnings */
|
||||||
|
@ -389,7 +389,7 @@ static void LabelSection (void)
|
||||||
char* Comment = 0;
|
char* Comment = 0;
|
||||||
long Value = -1;
|
long Value = -1;
|
||||||
long Size = -1;
|
long Size = -1;
|
||||||
long VOperand = -1;
|
long ParamSize = -1;
|
||||||
|
|
||||||
/* Skip the token */
|
/* Skip the token */
|
||||||
InfoNextTok ();
|
InfoNextTok ();
|
||||||
|
@ -451,14 +451,14 @@ static void LabelSection (void)
|
||||||
InfoNextTok ();
|
InfoNextTok ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INFOTOK_VOPERAND:
|
case INFOTOK_PARAMSIZE:
|
||||||
InfoNextTok ();
|
InfoNextTok ();
|
||||||
if (VOperand >= 0) {
|
if (ParamSize >= 0) {
|
||||||
InfoError ("VOperand already given");
|
InfoError ("ParamSize already given");
|
||||||
}
|
}
|
||||||
InfoAssureInt ();
|
InfoAssureInt ();
|
||||||
InfoRangeCheck (1, 0x10000);
|
InfoRangeCheck (1, 0x10000);
|
||||||
VOperand = InfoIVal;
|
ParamSize = InfoIVal;
|
||||||
InfoNextTok ();
|
InfoNextTok ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -498,8 +498,8 @@ static void LabelSection (void)
|
||||||
} else {
|
} else {
|
||||||
AddExtLabelRange ((unsigned) Value, Name, Size);
|
AddExtLabelRange ((unsigned) Value, Name, Size);
|
||||||
}
|
}
|
||||||
if (VOperand >= 0) {
|
if (ParamSize >= 0) {
|
||||||
SetSubroutineVOperand ((unsigned) Value, (unsigned) VOperand);
|
SetSubroutineParamSize ((unsigned) Value, (unsigned) ParamSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Define the comment */
|
/* Define the comment */
|
||||||
|
|
|
@ -105,7 +105,7 @@ typedef enum token_t {
|
||||||
INFOTOK_COMMENT,
|
INFOTOK_COMMENT,
|
||||||
INFOTOK_ADDR,
|
INFOTOK_ADDR,
|
||||||
INFOTOK_SIZE,
|
INFOTOK_SIZE,
|
||||||
INFOTOK_VOPERAND,
|
INFOTOK_PARAMSIZE,
|
||||||
|
|
||||||
/* ASMINC section */
|
/* ASMINC section */
|
||||||
INFOTOK_FILE,
|
INFOTOK_FILE,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user