+2008-02-16 Borut Razem <borut.razem AT siol.net>
+
+ *
+
2008-02-14 Maarten Brock <sourceforge.brock AT dse.nl>
* .version,
--- /dev/null
+/* asnoice.c */
+
+/*
+ * Extensions to CUG 292 assembler ASxxxx to produce NoICE debug files
+ *
+ * 3-Nov-1997 by John Hartman
+ */
+
+#include <stdio.h>
+#include <setjmp.h>
+#include <string.h>
+#include <ctype.h>
+#include "asm.h"
+
+/* Return basic file name without path or extension.
+ If spacesToUnderscores != 0 then spaces are converted to underscores */
+
+char* BaseFileName( int fileNumber, int spacesToUnderscores )
+{
+ static int prevFile = -1;
+ static char baseName[ PATH_MAX ];
+
+ char *p1, *p2;
+
+ if (fileNumber != prevFile)
+ {
+ prevFile = fileNumber;
+
+ p1 = srcfn[prevFile];
+
+ /* issue a FILE command with full path and extension */
+ fprintf( ofp, ";!FILE %s\n", p1 );
+
+ /* Name starts after any colon or backslash (DOS) */
+ p2 = strrchr( p1, '\\' );
+ if (p2 == NULL) p2 = strrchr( p1, '/' );
+ if (p2 == NULL) p2 = strrchr( p1, ':' );
+ if (p2 == NULL) p2 = p1-1;
+ strcpy( baseName, p2+1 );
+
+ /* Name ends at any separator */
+ p2 = strrchr( baseName, FSEPX );
+ if (p2 != NULL) *p2 = 0;
+ /* SD comment this out since not a ANSI Function */
+ /* strupr( baseName ); */
+
+ if (spacesToUnderscores)
+ {
+ /* Convert spaces to underscores */
+ for (p1 = baseName; *p1; ++p1)
+ if (isspace(*p1))
+ *p1 = '_';
+ }
+ }
+ return baseName;
+}
+
+/* Define a symbol for current location: FILE.line# */
+void DefineNoICE_Line()
+{
+ char name[ NCPS ];
+ struct sym *pSym;
+
+ /* symbol is FILE.nnn */
+ sprintf( name, "%s.%u", BaseFileName( cfile, 0 ), srcline[ cfile ] );
+
+ pSym = lookup( name );
+ pSym->s_type = S_USER;
+ pSym->s_area = dot.s_area;
+ pSym->s_addr = laddr;
+ pSym->s_flag |= S_GBL;
+}
+
+/* Define a symbol for current location: A$FILE$line# */
+void DefineCDB_Line()
+{
+ char name[ NCPS ];
+ struct sym *pSym;
+
+ /* symbol is FILE.nnn */
+ sprintf( name, "A$%s$%u", BaseFileName( cfile, 1 ), srcline[ cfile ] );
+
+ pSym = lookup( name );
+ pSym->s_type = S_USER;
+ pSym->s_area = dot.s_area;
+ pSym->s_addr = laddr;
+ pSym->s_flag |= S_GBL;
+}
+
+#if 0
+OLD VERSION
+/* Define a symbol for current location: FILE.line# */
+void DefineNoICE_Line()
+{
+ static int prevFile = -1;
+ static struct area *pPrevArea = NULL;
+ static char baseName[ PATH_MAX ];
+
+ int j;
+ char *p1, *p2;
+
+ /* Get outfilename without extension for use as base symbol name */
+ if (baseName[0] == 0)
+ {
+ p1 = srcfn[0];
+ p2 = baseName;
+ while ((*p1 != 0) && (*p1 != FSEPX))
+ {
+ *p2++ = *p1++;
+ }
+ *p2 = 0;
+ /* SD Commented this out since it is not a
+ ASNI Function */
+ /* strupr( baseName ); */
+ }
+
+ if ((cfile != prevFile) || (dot.s_area != pPrevArea))
+ {
+ prevFile = cfile;
+ pPrevArea = dot.s_area;
+
+ /* file or area change: issue FILE command with base @ */
+ fprintf( ofp, ";!FILE %s %s_%s\n", srcfn[ cfile ],
+ baseName,
+ dot.s_area->a_id );
+ }
+
+ fprintf( ofp, ";!LINE %u. 0x%X\n", srcline[ cfile ], laddr );
+}
+
+#endif
UTILLIBOBJS = $(UTILSRC:%.c=$(OBJDIR)/%.o)
ASXXLIB = $(srcdir)/../asxxsrc
-ASXXLIBSRC = strcmpi.c assym.c aslex.c
+ASXXLIBSRC = strcmpi.c assym.c aslex.c asnoice.c
ASXXLIBOBJS = $(ASXXLIBSRC:%.c=$(OBJDIR)/%.o)
-SRC = asmain.c assubr.c asnoice.c \
+SRC = asmain.c assubr.c \
asexpr.c asdata.c aslist.c asout.c \
m08ext.c m08pst.c m08mch.c m08adr.c
OBJS = $(SRC:%.c=$(OBJDIR)/%.o)
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\asnoice.c\r
+SOURCE=..\asxxsrc\asnoice.c\r
# End Source File\r
# Begin Source File\r
\r
+++ /dev/null
-/* asnoice.c */
-
-/*
- * Extensions to CUG 292 assembler ASxxxx to produce NoICE debug files
- *
- * 3-Nov-1997 by John Hartman
- */
-
-#include <stdio.h>
-#include <setjmp.h>
-#include <string.h>
-#include <ctype.h>
-#include "asm.h"
-
-/* Return basic file name without path or extension.
- If spacesToUnderscores != 0 then spaces are converted to underscores */
-
-char* BaseFileName( int fileNumber, int spacesToUnderscores )
-{
- static int prevFile = -1;
- static char baseName[ PATH_MAX ];
-
- char *p1, *p2;
-
- if (fileNumber != prevFile)
- {
- prevFile = fileNumber;
-
- p1 = srcfn[prevFile];
-
- /* issue a FILE command with full path and extension */
- fprintf( ofp, ";!FILE %s\n", p1 );
-
- /* Name starts after any colon or backslash (DOS) */
- p2 = strrchr( p1, '\\' );
- if (p2 == NULL) p2 = strrchr( p1, '/' );
- if (p2 == NULL) p2 = strrchr( p1, ':' );
- if (p2 == NULL) p2 = p1-1;
- strcpy( baseName, p2+1 );
-
- /* Name ends at any separator */
- p2 = strrchr( baseName, FSEPX );
- if (p2 != NULL) *p2 = 0;
- /* SD comment this out since not a ANSI Function */
- /* strupr( baseName ); */
-
- if (spacesToUnderscores)
- {
- /* Convert spaces to underscores */
- for (p1 = baseName; *p1; ++p1)
- if (isspace(*p1))
- *p1 = '_';
- }
- }
- return baseName;
-}
-
-/* Define a symbol for current location: FILE.line# */
-void DefineNoICE_Line()
-{
- char name[ NCPS ];
- struct sym *pSym;
-
- /* symbol is FILE.nnn */
- sprintf( name, "%s.%u", BaseFileName( cfile, 0 ), srcline[ cfile ] );
-
- pSym = lookup( name );
- pSym->s_type = S_USER;
- pSym->s_area = dot.s_area;
- pSym->s_addr = laddr;
- pSym->s_flag |= S_GBL;
-}
-
-/* Define a symbol for current location: A$FILE$line# */
-void DefineCDB_Line()
-{
- char name[ NCPS ];
- struct sym *pSym;
-
- /* symbol is FILE.nnn */
- sprintf( name, "A$%s$%u", BaseFileName( cfile, 1 ), srcline[ cfile ] );
-
- pSym = lookup( name );
- pSym->s_type = S_USER;
- pSym->s_area = dot.s_area;
- pSym->s_addr = laddr;
- pSym->s_flag |= S_GBL;
-}
-
-#if 0
-OLD VERSION
-/* Define a symbol for current location: FILE.line# */
-void DefineNoICE_Line()
-{
- static int prevFile = -1;
- static struct area *pPrevArea = NULL;
- static char baseName[ PATH_MAX ];
-
- int j;
- char *p1, *p2;
-
- /* Get outfilename without extension for use as base symbol name */
- if (baseName[0] == 0)
- {
- p1 = srcfn[0];
- p2 = baseName;
- while ((*p1 != 0) && (*p1 != FSEPX))
- {
- *p2++ = *p1++;
- }
- *p2 = 0;
- /* SD Commented this out since it is not a
- ASNI Function */
- /* strupr( baseName ); */
- }
-
- if ((cfile != prevFile) || (dot.s_area != pPrevArea))
- {
- prevFile = cfile;
- pPrevArea = dot.s_area;
-
- /* file or area change: issue FILE command with base @ */
- fprintf( ofp, ";!FILE %s %s_%s\n", srcfn[ cfile ],
- baseName,
- dot.s_area->a_id );
- }
-
- fprintf( ofp, ";!LINE %u. 0x%X\n", srcline[ cfile ], laddr );
-}
-
-#endif
* Alan R. Baldwin
* 721 Berkeley St.
* Kent, Ohio 44240
+ * 31-Feb-2008 AD added -y to create cdb file for non gameboy
*/
/*
#endif /* GAMEBOY */
syminit();
+
+ if (dflag){
+ SaveLinkedFilePath(linkp->f_idp); //Must be the first one...
+ dfp = afile(linkp->f_idp,"cdb",1);
+ if (dfp == NULL)
+ lkexit(1);
+ }
+
for (pass=0; pass<2; ++pass) {
cfp = NULL;
sfp = NULL;
if (rfp != NULL) fclose(rfp);
if (sfp != NULL) fclose(sfp);
if (tfp != NULL) fclose(tfp);
+ if (dfp != NULL) fclose(dfp);
exit(i);
}
case 'J':
++symflag;
break;
- case 'z':
case 'Z':
oflag = 3;
break;
#endif /* SDK */
+#ifndef GAMEBOY
+ case 'z':
+ dflag = 1;
+ return(0);
+#endif
case 'm':
case 'M':
++mflag;
case 'L':
addlib();
return(0);
-
default:
fprintf(stderr, "Invalid option\n");
lkexit(1);
#else /* SDK */
if ((fp = fopen(fb, wf?"w":"r")) == NULL) {
#endif /* SDK */
+ if (strcmp(ft,"adb"))/*Do not complaint for optional adb files*/
+ {
fprintf(stderr, "%s: cannot %s.\n", fb, wf?"create":"open");
lkerr++;
+ }
}
return (fp);
}
"Output:",
" -i Intel Hex as file[IHX]",
" -s Motorola S19 as file[S19]",
+#ifndef GAMEBOY
+ " -z Produce SDCdb debug as file[cdb]",
+#endif
#ifdef SDK
#ifdef GAMEGEAR
- " -z Gamegear image as file[GG]",
+ " -Z Gamegear image as file[GG]",
#else
- " -z Gameboy image as file[GB]",
+ " -Z Gameboy image as file[GB]",
#endif /* GAMEGEAR */
#endif /* SDK */
"List:",
UTILLIBOBJS = $(UTILSRC:%.c=$(OBJDIR)/%.o)
ASXXLIB = $(srcdir)/../asxxsrc
-ASXXLIBSRC = strcmpi.c assym.c aslex.c
+ASXXLIBSRC = strcmpi.c assym.c aslex.c asnoice.c
ASXXLIBOBJS = $(ASXXLIBSRC:%.c=$(OBJDIR)/%.o)
-SRC = asmain.c assubr.c asnoice.c \
+SRC = asmain.c assubr.c \
asexpr.c asdata.c aslist.c asout.c \
i51ext.c i51pst.c i51mch.c i51adr.c
OBJS = $(SRC:%.c=$(OBJDIR)/%.o)
+++ /dev/null
-/* asnoice.c */
-
-/*
- * Extensions to CUG 292 assembler ASxxxx to produce NoICE debug files
- *
- * 3-Nov-1997 by John Hartman
- */
-
-#include <stdio.h>
-#include <setjmp.h>
-#include <string.h>
-#include <ctype.h>
-#include "asm.h"
-
-/* Return basic file name without path or extension.
- If spacesToUnderscores != 0 then spaces are converted to underscores */
-
-char* BaseFileName( int fileNumber, int spacesToUnderscores )
-{
- static int prevFile = -1;
- static char baseName[ PATH_MAX ];
-
- char *p1, *p2;
-
- if (fileNumber != prevFile)
- {
- prevFile = fileNumber;
-
- p1 = srcfn[prevFile];
-
- /* issue a FILE command with full path and extension */
- fprintf( ofp, ";!FILE %s\n", p1 );
-
- /* Name starts after any colon or backslash (DOS) */
- p2 = strrchr( p1, '\\' );
- if (p2 == NULL) p2 = strrchr( p1, '/' );
- if (p2 == NULL) p2 = strrchr( p1, ':' );
- if (p2 == NULL) p2 = p1-1;
- strcpy( baseName, p2+1 );
-
- /* Name ends at any separator */
- p2 = strrchr( baseName, FSEPX );
- if (p2 != NULL) *p2 = 0;
- /* SD comment this out since not a ANSI Function */
- /* strupr( baseName ); */
-
- if (spacesToUnderscores)
- {
- /* Convert spaces to underscores */
- for (p1 = baseName; *p1; ++p1)
- if (isspace(*p1))
- *p1 = '_';
- }
- }
- return baseName;
-}
-
-/* Define a symbol for current location: FILE.line# */
-void DefineNoICE_Line()
-{
- char name[ NCPS ];
- struct sym *pSym;
-
- /* symbol is FILE.nnn */
- sprintf( name, "%s.%u", BaseFileName( cfile, 0 ), srcline[ cfile ] );
-
- pSym = lookup( name );
- pSym->s_type = S_USER;
- pSym->s_area = dot.s_area;
- pSym->s_addr = laddr;
- pSym->s_flag |= S_GBL;
-}
-
-/* Define a symbol for current location: A$FILE$line# */
-void DefineCDB_Line()
-{
- char name[ NCPS ];
- struct sym *pSym;
-
- /* symbol is FILE.nnn */
- sprintf( name, "A$%s$%u", BaseFileName( cfile, 1 ), srcline[ cfile ] );
-
- pSym = lookup( name );
- pSym->s_type = S_USER;
- pSym->s_area = dot.s_area;
- pSym->s_addr = laddr;
- pSym->s_flag |= S_GBL;
-}
-
-#if 0
-OLD VERSION
-/* Define a symbol for current location: FILE.line# */
-void DefineNoICE_Line()
-{
- static int prevFile = -1;
- static struct area *pPrevArea = NULL;
- static char baseName[ PATH_MAX ];
-
- int j;
- char *p1, *p2;
-
- /* Get outfilename without extension for use as base symbol name */
- if (baseName[0] == 0)
- {
- p1 = srcfn[0];
- p2 = baseName;
- while ((*p1 != 0) && (*p1 != FSEPX))
- {
- *p2++ = *p1++;
- }
- *p2 = 0;
- /* SD Commented this out since it is not a
- ASNI Function */
- /* strupr( baseName ); */
- }
-
- if ((cfile != prevFile) || (dot.s_area != pPrevArea))
- {
- prevFile = cfile;
- pPrevArea = dot.s_area;
-
- /* file or area change: issue FILE command with base @ */
- fprintf( ofp, ";!FILE %s %s_%s\n", srcfn[ cfile ],
- baseName,
- dot.s_area->a_id );
- }
-
- fprintf( ofp, ";!LINE %u. 0x%X\n", srcline[ cfile ], laddr );
-}
-
-#endif
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\asnoice.c\r
+SOURCE=..\asxxsrc\asnoice.c\r
# End Source File\r
# Begin Source File\r
\r
CFLAGS = $(CFLAGS) -DINDEXLIB -DMLH_MAP -DSDK
OBJECTS = asdata.obj asexpr.obj aslex.obj aslist.obj asmain.obj \
- asout.obj assubr.obj z80adr.obj z80ext.obj \
+ asout.obj assubr.obj z80adr.obj z80ext.obj asnoice.obj \
z80mch.obj z80pst.obj \
../asxxsrc/strcmpi.obj ../asxxsrc/assym.obj ../asxxsrc/aslex.obj \
../../support/Util/dbuf.obj ../../support/Util/dbuf_string.obj
UTILLIBOBJS = $(UTILSRC:%.c=$(OBJDIR)/%.o)
ASXXLIB = $(srcdir)/../asxxsrc
-ASXXLIBSRC = strcmpi.c assym.c aslex.c
+ASXXLIBSRC = strcmpi.c assym.c aslex.c asnoice.c
ASXXLIBOBJS = $(ASXXLIBSRC:%.c=$(OBJDIR)/%.o)
SRC = asmain.c assubr.c \
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\asxxsrc\asnoice.c\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\asout.c\r
# ADD CPP /D "GAMEBOY"\r
# End Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\asxxsrc\asnoice.c\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\asout.c\r
# End Source File\r
# Begin Source File\r
*/
int lflag; /* -l, generate listing flag
*/
+int cflag; /* -c, generate sdcdb debug info
+ */
int gflag; /* -g, make undefined symbols global flag
*/
int aflag; /* -a, make all symbols global flag
*/
+int jflag; /* -j, generate debug information flag
+ */
int oflag; /* -o, generate relocatable output flag
*/
int sflag; /* -s, generate symbol table flag
* Extensions: P. Felber
*/
-#define VERSION "V01.75"
+#define VERSION "V01.75 + SDCC mods"
/*
* Case Sensitivity Flag
#define OTHERSYSTEM
#endif
+/*
+ * PATH_MAX
+ */
+#include <limits.h>
+#ifndef PATH_MAX /* POSIX, but not required */
+#if defined(_MSC_VER) || defined(__BORLANDC__) /* Microsoft C or Borland C*/
+#include <stdlib.h>
+#define PATH_MAX _MAX_PATH
+#else
+#define PATH_MAX /* define a reasonable value */
+#endif
+#endif
+
+#ifdef _WIN32 /* WIN32 native */
+
+# define NATIVE_WIN32 1
+# ifdef __MINGW32__ /* GCC MINGW32 depends on configure */
+# include "../../sdccconf.h"
+# else
+# include "../../sdcc_vc.h"
+# define PATH_MAX _MAX_PATH
+# endif
+
+#else /* Assume Un*x style system */
+# include "../../sdccconf.h"
+#endif
+
/*
* Assembler definitions.
*/
*/
extern int lflag; /* -l, generate listing flag
*/
+extern int cflag; /* -c, generate sdcdb debug information
+ */
extern int gflag; /* -g, make undefined symbols global flag
*/
extern int aflag; /* -a, make all symbols global flag
*/
+extern int jflag; /* -j, generate debug information flag
+ */
extern int oflag; /* -o, generate relocatable output flag
*/
extern int sflag; /* -s, generate symbol table flag
extern VOID out_rw();
extern VOID out_tw();
+/* asnoice.c */
+extern void DefineNoICE_Line();
+extern void DefineCDB_Line();
+
/* Machine dependent variables */
/*
* Extensions: P. Felber
+ * 13-Feb-08 AD -j and -c as in 8051 as
*/
#include <stdio.h>
* line number
* int lop current line number on page
* int oflag -o, generate relocatable output flag
+ * int jflag -j, generate debug info flag
* int page current page number
* int pflag enable listing pagination
* int pass assembler pass number
++aflag;
break;
+ case 'c':
+ case 'C':
+ ++cflag;
+ break;
+
case 'g':
case 'G':
++gflag;
break;
+ case 'j': /* JLH: debug info */
+ case 'J':
+ ++jflag;
+ ++oflag; /* force object */
+ break;
+
case 'l':
case 'L':
++lflag;
* all the assembler mnemonics.
*/
default:
+ /* if cdb information then generate the line info */
+ if (cflag && (pass == 1))
+ DefineCDB_Line();
+
+ /* JLH: if -j, generate a line number symbol */
+ if (jflag && (pass == 1))
+ {
+ DefineNoICE_Line();
+ }
+
+
machine(mp);
}
goto loop;
char *usetxt[] = {
#ifdef SDK
- "Usage: [-dqxgalopsf] outfile file1 [file2 file3 ...]",
+ "Usage: [-dqxjgalopscf] outfile file1 [file2 file3 ...]",
#else /* SDK */
- "Usage: [-dqxgalopsf] file1 [file2 file3 ...]",
+ "Usage: [-dqxjgalopscf] file1 [file2 file3 ...]",
#endif /* SDK */
" d decimal listing",
" q octal listing",
" x hex listing (default)",
+ " j add line number and debug information to file", /* JLH */
" g undefined symbols made global",
" a all user symbols made global",
#ifdef SDK
" o create object output file1[REL]",
" s create symbol output file1[SYM]",
#endif /* SDK */
+ " c generate sdcdb debug information",
" p disable listing pagination",
" f flag relocatable references by ` in listing file",
" ff flag relocatable references by mode in listing file",