4 * Extensions to CUG 292 assembler ASxxxx to produce NoICE debug files
6 * 3-Nov-1997 by John Hartman
14 /* Return basic file name without path or extension */
15 static char* BaseFileName( int fileNumber );
17 char* BaseFileName( int fileNumber )
19 static int prevFile = -1;
20 static char baseName[ PATH_MAX ];
24 if (fileNumber != prevFile)
26 prevFile = fileNumber;
30 /* issue a FILE command with full path and extension */
31 fprintf( ofp, ";!FILE %s\n", p1 );
33 /* Name starts after any colon or backslash (DOS) */
34 p2 = strrchr( p1, '\\' );
35 if (p2 == NULL) p2 = strrchr( p1, '/' );
36 if (p2 == NULL) p2 = strrchr( p1, ':' );
37 if (p2 == NULL) p2 = p1-1;
38 strcpy( baseName, p2+1 );
40 /* Name ends at any separator */
41 p2 = strrchr( baseName, FSEPX );
42 if (p2 != NULL) *p2 = 0;
43 /* SD comment this out since not a ANSI Function */
44 /* strupr( baseName ); */
49 /* Define a symbol for current location: FILE.line# */
50 void DefineNoICE_Line()
55 /* symbol is FILE.nnn */
56 sprintf( name, "%s.%u", BaseFileName( cfile ), srcline[ cfile ] );
58 pSym = lookup( name );
59 pSym->s_type = S_USER;
60 pSym->s_area = dot.s_area;
62 pSym->s_flag |= S_GBL;
65 /* Define a symbol for current location: A$FILE$line# */
71 /* symbol is FILE.nnn */
72 sprintf( name, "A$%s$%u", BaseFileName( cfile ), srcline[ cfile ] );
74 pSym = lookup( name );
75 pSym->s_type = S_USER;
76 pSym->s_area = dot.s_area;
78 pSym->s_flag |= S_GBL;
83 /* Define a symbol for current location: FILE.line# */
84 void DefineNoICE_Line()
86 static int prevFile = -1;
87 static struct area *pPrevArea = NULL;
88 static char baseName[ PATH_MAX ];
93 /* Get outfilename without extension for use as base symbol name */
98 while ((*p1 != 0) && (*p1 != FSEPX))
103 /* SD Commented this out since it is not a
105 /* strupr( baseName ); */
108 if ((cfile != prevFile) || (dot.s_area != pPrevArea))
111 pPrevArea = dot.s_area;
113 /* file or area change: issue FILE command with base @ */
114 fprintf( ofp, ";!FILE %s %s_%s\n", srcfn[ cfile ],
119 fprintf( ofp, ";!LINE %u. 0x%X\n", srcline[ cfile ], laddr );