Bugzilla – Attachment 200 Details for
Bug 210
Output switch -fr with 6502 code is currently non working
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
The patches!
0001-Fix-for-210-6502-mode-with-fr-working.patch (text/plain), 4.08 KB, created by
ggn
on 2022-10-26 13:31:04 CDT
(
hide
)
Description:
The patches!
Filename:
MIME Type:
Creator:
ggn
Created:
2022-10-26 13:31:04 CDT
Size:
4.08 KB
patch
obsolete
>From 9378fb90732a06c086ed59ea66317eda82653e7e Mon Sep 17 00:00:00 2001 >From: ggn <ggn@atari.org> >Date: Wed, 26 Oct 2022 21:30:21 +0300 >Subject: [PATCH] Fix for #210 - 6502 mode with -fr working > >--- > 6502.c | 20 +++++++++++++++++++- > direct.c | 4 ++++ > object.c | 11 ++++++++++- > rmac.c | 2 ++ > rmac.h | 1 + > 5 files changed, 36 insertions(+), 2 deletions(-) > >diff --git a/6502.c b/6502.c >index db6c638..c523086 100644 >--- a/6502.c >+++ b/6502.c >@@ -243,7 +243,7 @@ int d_6502() > regtab = reg65tab; > regcheck = reg65check; > regaccept = reg65accept; >- >+ used_architectures |= M6502; > return 0; > } > >@@ -569,3 +569,21 @@ 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]); >+ } >+} >diff --git a/direct.c b/direct.c >index 65a119d..4511c6a 100644 >--- a/direct.c >+++ b/direct.c >@@ -2006,6 +2006,7 @@ int d_56001(void) > regtab = reg56tab; > regcheck = reg56check; > regaccept = reg56accept; >+ used_architectures |= M56001P | M56001X | M56001Y | M56001L; > return 0; > } > >@@ -2037,6 +2038,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; > } > >@@ -2068,6 +2070,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; > } > >@@ -2340,6 +2343,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; > } > >diff --git a/object.c b/object.c >index 78c225f..6a69fcf 100644 >--- a/object.c >+++ b/object.c >@@ -859,9 +859,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); >diff --git a/rmac.c b/rmac.c >index f88f849..26b1222 100644 >--- a/rmac.c >+++ b/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 >@@ -376,6 +377,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 >diff --git a/rmac.h b/rmac.h >index 6ec6c4d..388adec 100644 >--- a/rmac.h >+++ b/rmac.h >@@ -319,6 +319,7 @@ extern int *regbase; > extern int *regtab; > extern int *regcheck; > extern int *regaccept; >+extern uint32_t used_architectures; > > // Exported functions > void strtoupper(char * s); >-- >2.33.0.windows.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 210
: 200