mirror of http://shamusworld.gotdns.org/git/rmac
.equr overhaul part 5: enabled .equr for all registers for all architectures
This commit is contained in:
parent
d21544da60
commit
09135712da
|
@ -1261,11 +1261,11 @@ Directives relating to the 6502 are described in the chapter on `6502 Support`_.
|
||||||
|
|
||||||
**.equr** *expression*
|
**.equr** *expression*
|
||||||
|
|
||||||
Allows you to name a register. This is only implemented for GPU/DSP
|
Allows you to name a register. For example:
|
||||||
code sections. For example:
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
.gpu
|
||||||
Clipw .equr r19
|
Clipw .equr r19
|
||||||
. . .
|
. . .
|
||||||
add ClipW,r0 ; ClipW actually is r19
|
add ClipW,r0 ; ClipW actually is r19
|
||||||
|
|
8
kw.tab
8
kw.tab
|
@ -73,14 +73,14 @@ fp7 231
|
||||||
equ 61
|
equ 61
|
||||||
.reg 82
|
.reg 82
|
||||||
reg 82
|
reg 82
|
||||||
.equr 148
|
.equr 85
|
||||||
equr 148
|
equr 85
|
||||||
|
.regequ 85
|
||||||
|
regequ 85
|
||||||
.equrundef 50
|
.equrundef 50
|
||||||
equrundef 50
|
equrundef 50
|
||||||
.regundef 50
|
.regundef 50
|
||||||
regundef 50
|
regundef 50
|
||||||
.regequ 148
|
|
||||||
regequ 148
|
|
||||||
set 149
|
set 149
|
||||||
|
|
||||||
r0 151
|
r0 151
|
||||||
|
|
73
procln.c
73
procln.c
|
@ -154,7 +154,7 @@ void Assemble(void)
|
||||||
char * opname = NULL; // Name of dirctve/mnemonic/macro
|
char * opname = NULL; // Name of dirctve/mnemonic/macro
|
||||||
int listflag; // 0: Don't call listeol()
|
int listflag; // 0: Don't call listeol()
|
||||||
WORD rmask; // Register list, for REG
|
WORD rmask; // Register list, for REG
|
||||||
int riscreg; // RISC register
|
int equreg; // RISC register
|
||||||
listflag = 0; // Initialise listing flag
|
listflag = 0; // Initialise listing flag
|
||||||
|
|
||||||
loop: // Line processing loop label
|
loop: // Line processing loop label
|
||||||
|
@ -434,57 +434,48 @@ corresponding register bool to true. Whenever it's undef'ed, set it to false.
|
||||||
When checking to see if it's already been equated, issue a warning.
|
When checking to see if it's already been equated, issue a warning.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (rgpu || rdsp)
|
// Check for register to equate to
|
||||||
|
// This check will change once we split the registers per architecture into their own tables
|
||||||
|
// and out of kw.tab. But for now it'll do...
|
||||||
|
if ((*tok >= KW_D0) && (*tok <= KW_BA))
|
||||||
{
|
{
|
||||||
// GPU/DSP architectures need some special TLC for now
|
sy->sattre = EQUATEDREG; // Mark as equated register
|
||||||
// Check for register to equate to
|
equreg = *tok;
|
||||||
if ((*tok >= KW_R0) && (*tok <= KW_R31))
|
// Check for ",<bank #>" override notation and skip past it.
|
||||||
|
// It is ignored now. Was that ever useful anyway?
|
||||||
|
if ((rgpu ||rdsp) && (tok[1] == ',') && (tok[2] == CONST))
|
||||||
{
|
{
|
||||||
sy->sattre = EQUATEDREG; // Mark as equated register
|
// Advance token pointer and skip everything
|
||||||
riscreg = *tok;
|
tok += 4;
|
||||||
// Check for ",<bank #>" override notation and skip past it.
|
|
||||||
// It is ignored now. Was that ever useful anyway?
|
|
||||||
if ((tok[1] == ',') && (tok[2] == CONST))
|
|
||||||
{
|
|
||||||
// Advance token pointer and skip everything
|
|
||||||
tok += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
eattr = ABS | DEFINED | GLOBAL;
|
|
||||||
eval = riscreg;
|
|
||||||
tok++;
|
|
||||||
}
|
}
|
||||||
// Checking for a register symbol
|
|
||||||
else if (tok[0] == SYMBOL)
|
|
||||||
{
|
|
||||||
sy2 = lookup(string[tok[1]], LABEL, j);
|
|
||||||
|
|
||||||
// Make sure symbol is a valid equreg
|
eattr = ABS | DEFINED | GLOBAL;
|
||||||
if (!sy2 || !(sy2->sattre & EQUATEDREG))
|
eval = equreg;
|
||||||
{
|
tok++;
|
||||||
error("invalid GPU/DSP .equr/.regequ definition");
|
}
|
||||||
goto loop;
|
// Checking for a register symbol
|
||||||
}
|
else if (tok[0] == SYMBOL)
|
||||||
else
|
{
|
||||||
{
|
sy2 = lookup(string[tok[1]], LABEL, j);
|
||||||
eattr = ABS | DEFINED | GLOBAL; // Copy symbol's attributes
|
|
||||||
sy->sattre = sy2->sattre;
|
// Make sure symbol is a valid equreg
|
||||||
eval = (sy2->svalue & 0xFFFFF0FF);
|
if (!sy2 || !(sy2->sattre & EQUATEDREG))
|
||||||
tok += 2;
|
{
|
||||||
}
|
error("invalid .equr/.regequ definition");
|
||||||
|
goto loop;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error("invalid GPU/DSP .equr/.regequ definition");
|
eattr = ABS | DEFINED | GLOBAL; // Copy symbol's attributes
|
||||||
goto loop;
|
sy->sattre = sy2->sattre;
|
||||||
|
eval = (sy2->svalue & 0xFFFFF0FF);
|
||||||
|
tok += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sy->sattre = EQUATEDREG; // Mark as equated register
|
error("invalid .equr/.regequ definition");
|
||||||
eattr = ABS | DEFINED | GLOBAL;
|
goto loop;
|
||||||
eval = *tok;
|
|
||||||
tok++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (equtyp == REG)
|
else if (equtyp == REG)
|
||||||
|
|
1
sect.c
1
sect.c
|
@ -20,6 +20,7 @@
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#define DEF_KW
|
#define DEF_KW
|
||||||
#include "kwtab.h"
|
#include "kwtab.h"
|
||||||
|
#undef DEF_KW
|
||||||
|
|
||||||
// Function prototypes
|
// Function prototypes
|
||||||
void MakeSection(int, uint16_t);
|
void MakeSection(int, uint16_t);
|
||||||
|
|
2
token.h
2
token.h
|
@ -45,7 +45,7 @@
|
||||||
#define DEQUALS 'g' // ==
|
#define DEQUALS 'g' // ==
|
||||||
#define SET 0x95 // Set
|
#define SET 0x95 // Set
|
||||||
#define REG 'R' // Reg
|
#define REG 'R' // Reg
|
||||||
#define EQUREG 0x94 // equreg
|
#define EQUREG 'U' // equreg (must be synchronised with the equate in kw.tab)
|
||||||
#define CCDEF 0xB7 // ccdef
|
#define CCDEF 0xB7 // ccdef
|
||||||
#define DCOLON 'h' // ::
|
#define DCOLON 'h' // ::
|
||||||
#define GE 'i' // >=
|
#define GE 'i' // >=
|
||||||
|
|
Loading…
Reference in New Issue