From 945e321301df72bccb8d6abf2975b6871926b9a0 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Thu, 20 Apr 2017 16:09:14 -0500 Subject: [PATCH] Tweaks to new 6502 assembler (ggn), added dependency info for makefile. --- 6502.c | 28 ++++++++++++++++++++-------- makefile | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- version.h | 2 +- 3 files changed, 67 insertions(+), 12 deletions(-) diff --git a/6502.c b/6502.c index 0e203f0..afc0ba1 100644 --- a/6502.c +++ b/6502.c @@ -19,11 +19,11 @@ #define UPSEG_SIZE 0x10010L // size of 6502 code buffer, 64K+16bytes -// +// Internal vars +static uint16_t orgmap[1024][2]; // Mark all 6502 org changes + // Exported vars -// const char in_6502mode[] = "directive illegal in .6502 section"; -static uint16_t orgmap[1024][2]; // Mark all 6502 org changes uint16_t * currentorg = &orgmap[0][0]; // Current org range // @@ -345,7 +345,12 @@ void m6502cg(int op) // y,foo // p = string[tok[1]]; - + // ggn: the following code is effectively disabled as it would make + // single letter labels not work correctly (would not identify the + // label properly). And from what I understand it's something to + // keep compatibility with the coinop assembler which is probably + // something we don't care about much :D +#if 0 if (*tok == SYMBOL && p[1] == EOS && tok[2] == ',') { tok += 3; // Past: SYMBOL ',' @@ -369,6 +374,7 @@ void m6502cg(int op) } not_coinop: +#endif if (expr(exprbuf, &eval, &eattr, NULL) < 0) return; @@ -550,8 +556,10 @@ badmode: // Generate 6502 object output file. // // ggn: converted into a com/exe/xex output format -// Notes: 1. The $FFFF is only mandatory for the first segment, but let's dump it everywhere for now -// 2. It's still dumping pages instead of more fine grained stuff. Should look into this - a8 people don't like waste so much ;) +// Notes: 1. The $FFFF is only mandatory for the first segment, but let's +// dump it everywhere for now +// 2. It's still dumping pages instead of more fine grained stuff. +// Should look into this - a8 people don't like waste so much ;) void m6502obj(int ofd) { uint16_t exeheader[3]; @@ -571,9 +579,13 @@ void m6502obj(int ofd) { exeheader[1] = l[0]; exeheader[2] = l[1] - 1; - size_t unused = write(ofd, headpoint, headsize); // Write header + + // Write header + size_t unused = write(ofd, headpoint, headsize); unused = write(ofd, p + l[0], l[1] - l[0]); - headpoint = &exeheader[1]; // Skip the $FFFF after first segment, it's not mandatory + + // Skip the $FFFF after first segment, it's not mandatory + headpoint = &exeheader[1]; headsize = 4; } } diff --git a/makefile b/makefile index 49e00db..747f4cc 100644 --- a/makefile +++ b/makefile @@ -79,6 +79,9 @@ kwgen : kwgen.o # Build RMAC executable # +6502.o : 6502.c 6502.h + $(CC) $(CFLAGS) -c 6502.c + amode.o : amode.c amode.h $(CC) $(CFLAGS) -c amode.c @@ -127,9 +130,6 @@ sect.o : sect.c sect.h symbol.o : symbol.c symbol.h $(CC) $(CFLAGS) -c symbol.c -6502.o : 6502.c 6502.h - $(CC) $(CFLAGS) -c 6502.c - token.o : token.c token.h $(CC) $(CFLAGS) -c token.c @@ -143,3 +143,46 @@ rmac : $(OBJS) clean: $(rm) $(OBJS) kwgen.o 68kgen.o rmac kwgen 68kgen kwtab.h 68ktab.h mntab.h risckw.h 6502kw.h +# +# Dependencies +# +6502.o: 6502.c direct.h rmac.h symbol.h expr.h error.h mach.h amode.h \ + procln.h token.h riscasm.h sect.h +68kgen.o: 68kgen.c +amode.o: amode.c amode.h rmac.h symbol.h error.h token.h expr.h kwtab.h \ + mntab.h parmode.h +debug.o: debug.c debug.h rmac.h symbol.h amode.h direct.h mark.h sect.h \ + token.h +direct.o: direct.c direct.h rmac.h symbol.h 6502.h error.h expr.h \ + listing.h mach.h amode.h macro.h mark.h procln.h token.h riscasm.h \ + sect.h kwtab.h +eagen.o: eagen.c eagen.h rmac.h symbol.h amode.h sect.h mark.h error.h \ + mach.h riscasm.h eagen0.c +error.o: error.c error.h rmac.h symbol.h token.h listing.h +expr.o: expr.c expr.h rmac.h symbol.h direct.h error.h listing.h mach.h \ + amode.h procln.h token.h riscasm.h sect.h kwtab.h +kwgen.o: kwgen.c +listing.o: listing.c listing.h rmac.h symbol.h version.h token.h procln.h \ + sect.h error.h +mach.o: mach.c mach.h amode.h rmac.h symbol.h eagen.h error.h direct.h \ + procln.h token.h riscasm.h sect.h kwtab.h 68ktab.h +macro.o: macro.c macro.h rmac.h symbol.h debug.h direct.h error.h expr.h \ + listing.h procln.h token.h +mark.o: mark.c mark.h rmac.h symbol.h error.h object.h riscasm.h sect.h +object.o: object.c object.h rmac.h symbol.h error.h mark.h riscasm.h \ + sect.h +procln.o: procln.c procln.h rmac.h symbol.h token.h 6502.h amode.h \ + direct.h error.h expr.h listing.h mach.h macro.h riscasm.h sect.h \ + kwtab.h mntab.h risckw.h 6502kw.h +riscasm.o: riscasm.c riscasm.h rmac.h symbol.h amode.h direct.h error.h \ + expr.h mark.h procln.h token.h sect.h risckw.h kwtab.h +rmac.o: rmac.c rmac.h symbol.h 6502.h debug.h direct.h error.h expr.h \ + listing.h mark.h macro.h object.h procln.h token.h riscasm.h sect.h \ + version.h +sect.o: sect.c sect.h rmac.h symbol.h 6502.h direct.h error.h expr.h \ + listing.h mach.h amode.h mark.h riscasm.h token.h +symbol.o: symbol.c symbol.h error.h rmac.h listing.h object.h procln.h \ + token.h +token.o: token.c token.h rmac.h symbol.h error.h macro.h procln.h sect.h \ + kwtab.h + diff --git a/version.h b/version.h index 03ad2d0..f5be1b8 100644 --- a/version.h +++ b/version.h @@ -15,7 +15,7 @@ #define MAJOR 1 // Major version number #define MINOR 6 // Minor version number -#define PATCH 0 // Patch release number +#define PATCH 1 // Patch release number #endif // __VERSION_H__ -- 2.37.2