mirror of http://shamusworld.gotdns.org/git/rmac
Fix for #210 - 6502 mode with -fr working
This commit is contained in:
parent
31894aa869
commit
41a8ca9921
21
6502.c
21
6502.c
|
@ -243,6 +243,7 @@ int d_6502()
|
|||
regtab = reg65tab;
|
||||
regcheck = reg65check;
|
||||
regaccept = reg65accept;
|
||||
used_architectures |= M6502;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -570,6 +571,26 @@ void m6502obj(int ofd)
|
|||
}
|
||||
|
||||
|
||||
// Write raw 6502 org'd code.
|
||||
// Super copypasta'd from above function
|
||||
void m6502raw(int ofd)
|
||||
{
|
||||
CHUNK * ch = sect[M6502].scode;
|
||||
|
||||
// If no 6502 code was generated, bail out
|
||||
if ((ch == NULL) || (ch->challoc == 0))
|
||||
return;
|
||||
|
||||
register uint8_t *p = ch->chptr;
|
||||
|
||||
for(uint16_t * l=&orgmap[0][0]; l<currentorg; l+=2)
|
||||
{
|
||||
// Write the segment data
|
||||
uint32_t unused = write(ofd, p + l[0], l[1] - l[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Generate a C64 .PRG output file
|
||||
//
|
||||
|
|
4
direct.c
4
direct.c
|
@ -2027,6 +2027,7 @@ int d_56001(void)
|
|||
regtab = reg56tab;
|
||||
regcheck = reg56check;
|
||||
regaccept = reg56accept;
|
||||
used_architectures |= M56001P | M56001X | M56001Y | M56001L;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2058,6 +2059,7 @@ int d_gpu(void)
|
|||
regtab = regrisctab;
|
||||
regcheck = regrisccheck;
|
||||
regaccept = regriscaccept;
|
||||
//used_architectures |= MGPU; // TODO: Should GPU/DSP have their own dedicated sections in the long run?
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2089,6 +2091,7 @@ int d_dsp(void)
|
|||
regtab = regrisctab;
|
||||
regcheck = regrisccheck;
|
||||
regaccept = regriscaccept;
|
||||
//used_architectures |= MDSP; // TODO: Should GPU/DSP have their own dedicated sections in the long run?
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2361,6 +2364,7 @@ int d_objproc(void)
|
|||
rgpu = 0; // Unset GPU assembly
|
||||
rdsp = 0; // Unset DSP assembly
|
||||
dsp56001 = 0; // Unset 56001 assembly
|
||||
//used_architectures |= MOP; // TODO: Should OP have its own dedicated section in the long run?
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
11
object.c
11
object.c
|
@ -864,9 +864,18 @@ for(int j=0; j<i; j++)
|
|||
}
|
||||
else if (obj_format == RAW)
|
||||
{
|
||||
if (!org68k_active)
|
||||
if (!org68k_active && used_architectures & (!(M6502 | M56001P | M56001X | M56001Y | M56001L)))
|
||||
return error("cannot output absolute binary without a starting address (.org or command line)");
|
||||
|
||||
if (used_architectures & M6502)
|
||||
{
|
||||
// Okay, this is not the best. But it'll have to do until we revamp things a bit with sections.
|
||||
// Basically we assume that if raw output is requested and 6502 mode was switched on, nobody
|
||||
// switched to other architectures. The combination doesn't make much sense anyway for now.
|
||||
m6502raw(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Alloc memory for text + data construction.
|
||||
tds = sect[TEXT].sloc + sect[DATA].sloc;
|
||||
buf = malloc(tds);
|
||||
|
|
2
rmac.c
2
rmac.c
|
@ -62,6 +62,7 @@ int activefpu = FPU_NONE; // Active FPU (none by default)
|
|||
int org68k_active = 0; // .org switch for 68k (only with RAW output format)
|
||||
uint32_t org68k_address; // .org for 68k
|
||||
int correctMathRules; // 1, use C operator precedence in expressions
|
||||
uint32_t used_architectures; // Bitmask that records exactly which architectures were used during assembly
|
||||
|
||||
//
|
||||
// Convert a string to uppercase
|
||||
|
@ -377,6 +378,7 @@ int Process(int argc, char ** argv)
|
|||
regcheck = reg68check; // Idem
|
||||
regaccept = reg68accept; // Idem
|
||||
correctMathRules = 0; // respect operator precedence
|
||||
used_architectures = 0; // Initialise used architectures bitfield
|
||||
// Initialize modules
|
||||
InitSymbolTable(); // Symbol table
|
||||
InitTokenizer(); // Tokenizer
|
||||
|
|
1
rmac.h
1
rmac.h
|
@ -320,6 +320,7 @@ extern int *regbase;
|
|||
extern int *regtab;
|
||||
extern int *regcheck;
|
||||
extern int *regaccept;
|
||||
extern uint32_t used_architectures;
|
||||
|
||||
// Exported functions
|
||||
void strtoupper(char * s);
|
||||
|
|
Loading…
Reference in New Issue