mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-26 13:02:07 +00:00
Use callback for PC's value
This causes it to auto-update whenever the current section's attributes are updated, simplifying the code and eliminating redundancy. This should also overall reduce overhead (one extra function call on each PC evaluation, but less bookkeeping for each byte output)
This commit is contained in:
@@ -64,6 +64,11 @@ static int32_t Callback__LINE__(unused_ struct sSymbol const *sym)
|
||||
return nLineNo;
|
||||
}
|
||||
|
||||
static int32_t CallbackPC(struct sSymbol const *self)
|
||||
{
|
||||
return self->pSection ? self->pSection->nOrg + self->pSection->nPC : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the nValue field of a symbol
|
||||
*/
|
||||
@@ -722,6 +727,7 @@ void sym_Init(void)
|
||||
|
||||
sym_AddReloc("@");
|
||||
pPCSymbol = findsymbol("@", NULL);
|
||||
pPCSymbol->Callback = CallbackPC;
|
||||
sym_AddEqu("_NARG", 0);
|
||||
p_NARGSymbol = findsymbol("_NARG", NULL);
|
||||
p_NARGSymbol->Callback = Callback_NARG;
|
||||
|
||||
Reference in New Issue
Block a user