X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=6502.c;h=66f2080977e2a0d73a639252a43867c672da9ef9;hp=89029c1488ed2b328926aa84fd6e345563ddec61;hb=HEAD;hpb=7d748dc6e2259984c9093c48d84ae1ed280632ad diff --git a/6502.c b/6502.c index 89029c1..66f2080 100644 --- a/6502.c +++ b/6502.c @@ -243,6 +243,7 @@ int d_6502() regtab = reg65tab; regcheck = reg65check; regaccept = reg65accept; + used_architectures |= M6502; return 0; } @@ -423,6 +424,8 @@ badmode: DEBUG printf("inf[op][amode]=%d\n", (int)inf[op][amode]); #endif + GENLINENOSYM(); + switch (inf[op][amode]) { case A65_IMPL: // Just leave the instruction @@ -567,3 +570,52 @@ 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]; lchalloc == 0)) + return; + + if (currentorg != &orgmap[1][0]) + { + // More than one 6502 section created, this is not allowed + error("when generating C64 .PRG files only one org section is allowed - aborting"); + return; + } + + SETLE16(header, 0, orgmap[0][0]); + register uint8_t * p = ch->chptr; + + // Write header + uint32_t unused = write(ofd, header, 2); + // Write the data + unused = write(ofd, p + orgmap[0][0], orgmap[0][1] - orgmap[0][0]); +}