mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 10:42:07 +00:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
193cc06561 | ||
|
|
f3b475453f | ||
|
|
0c71f5a4e9 | ||
|
|
4b0dfd4f4a | ||
|
|
2d117f68c9 | ||
|
|
8954858bf7 | ||
|
|
4877e6dbba | ||
|
|
ec171c5f00 | ||
|
|
840ddcecd2 | ||
|
|
c00f7409ee | ||
|
|
92449a4fe4 | ||
|
|
4e2a035838 | ||
|
|
df25fa73af | ||
|
|
03bb2d04c3 | ||
|
|
4dc376b0ee | ||
|
|
3dec5698db | ||
|
|
f8bbe9be48 | ||
|
|
4d01b2d5ac | ||
|
|
086f02c1d9 | ||
|
|
8ed6c32ae7 | ||
|
|
d0e0525302 | ||
|
|
318c981c00 | ||
|
|
5c7db42fc4 | ||
|
|
4be92e14e6 | ||
|
|
1b155d9d4c | ||
|
|
f9a1aba0d8 |
34
Makefile
34
Makefile
@@ -15,8 +15,15 @@ PNGCFLAGS := `${PKG_CONFIG} --static --cflags libpng`
|
|||||||
PNGLDFLAGS := `${PKG_CONFIG} --static --libs-only-L libpng`
|
PNGLDFLAGS := `${PKG_CONFIG} --static --libs-only-L libpng`
|
||||||
PNGLDLIBS := `${PKG_CONFIG} --static --libs-only-l libpng`
|
PNGLDLIBS := `${PKG_CONFIG} --static --libs-only-l libpng`
|
||||||
|
|
||||||
|
VERSION_STRING := `git describe --tags --dirty --always 2>/dev/null`
|
||||||
|
|
||||||
WARNFLAGS := -Wall -Werror
|
WARNFLAGS := -Wall -Werror
|
||||||
CFLAGS := ${WARNFLAGS} -g -std=c99 -D_POSIX_C_SOURCE=200809L -Iinclude
|
|
||||||
|
# Overridable CFLAGS
|
||||||
|
CFLAGS := -g
|
||||||
|
# Non-overridable CFLAGS
|
||||||
|
REALCFLAGS := ${CFLAGS} ${WARNFLAGS} -std=c99 -D_POSIX_C_SOURCE=200809L \
|
||||||
|
-Iinclude -DBUILD_VERSION_STRING=\"${VERSION_STRING}\"
|
||||||
|
|
||||||
YFLAGS :=
|
YFLAGS :=
|
||||||
LFLAGS := --nounistd
|
LFLAGS := --nounistd
|
||||||
@@ -44,7 +51,9 @@ rgbasm_obj := \
|
|||||||
src/extern/err.o \
|
src/extern/err.o \
|
||||||
src/extern/reallocarray.o \
|
src/extern/reallocarray.o \
|
||||||
src/extern/strlcpy.o \
|
src/extern/strlcpy.o \
|
||||||
src/extern/strlcat.o
|
src/extern/strlcat.o \
|
||||||
|
src/extern/version.o
|
||||||
|
|
||||||
|
|
||||||
src/asm/asmy.h: src/asm/asmy.c
|
src/asm/asmy.h: src/asm/asmy.c
|
||||||
src/asm/locallex.o src/asm/globlex.o src/asm/lexer.o: src/asm/asmy.h
|
src/asm/locallex.o src/asm/globlex.o src/asm/lexer.o: src/asm/asmy.h
|
||||||
@@ -61,32 +70,35 @@ rgblink_obj := \
|
|||||||
src/link/parser.o \
|
src/link/parser.o \
|
||||||
src/link/script.o \
|
src/link/script.o \
|
||||||
src/link/symbol.o \
|
src/link/symbol.o \
|
||||||
src/extern/err.o
|
src/extern/err.o \
|
||||||
|
src/extern/version.o
|
||||||
|
|
||||||
src/link/parser.h: src/link/parser.c
|
src/link/parser.h: src/link/parser.c
|
||||||
src/link/lexer.o: src/link/parser.h
|
src/link/lexer.o: src/link/parser.h
|
||||||
|
|
||||||
rgbfix_obj := \
|
rgbfix_obj := \
|
||||||
src/fix/main.o \
|
src/fix/main.o \
|
||||||
src/extern/err.o
|
src/extern/err.o \
|
||||||
|
src/extern/version.o
|
||||||
|
|
||||||
rgbgfx_obj := \
|
rgbgfx_obj := \
|
||||||
src/gfx/gb.o \
|
src/gfx/gb.o \
|
||||||
src/gfx/main.o \
|
src/gfx/main.o \
|
||||||
src/gfx/makepng.o \
|
src/gfx/makepng.o \
|
||||||
src/extern/err.o
|
src/extern/err.o \
|
||||||
|
src/extern/version.o
|
||||||
|
|
||||||
rgbasm: ${rgbasm_obj}
|
rgbasm: ${rgbasm_obj}
|
||||||
$Q${CC} ${CFLAGS} -o $@ ${rgbasm_obj} -lm
|
$Q${CC} ${REALCFLAGS} -o $@ ${rgbasm_obj} -lm
|
||||||
|
|
||||||
rgblink: ${rgblink_obj}
|
rgblink: ${rgblink_obj}
|
||||||
$Q${CC} ${CFLAGS} -o $@ ${rgblink_obj}
|
$Q${CC} ${REALCFLAGS} -o $@ ${rgblink_obj}
|
||||||
|
|
||||||
rgbfix: ${rgbfix_obj}
|
rgbfix: ${rgbfix_obj}
|
||||||
$Q${CC} ${CFLAGS} -o $@ ${rgbfix_obj}
|
$Q${CC} ${REALCFLAGS} -o $@ ${rgbfix_obj}
|
||||||
|
|
||||||
rgbgfx: ${rgbgfx_obj}
|
rgbgfx: ${rgbgfx_obj}
|
||||||
$Q${CC} ${CFLAGS} ${PNGLDFLAGS} -o $@ ${rgbgfx_obj} ${PNGLDLIBS}
|
$Q${CC} ${REALCFLAGS} ${PNGLDFLAGS} -o $@ ${rgbgfx_obj} ${PNGLDLIBS}
|
||||||
|
|
||||||
# Rules to process files
|
# Rules to process files
|
||||||
|
|
||||||
@@ -96,11 +108,11 @@ rgbgfx: ${rgbgfx_obj}
|
|||||||
.l.o:
|
.l.o:
|
||||||
$Q${RM} $*.c
|
$Q${RM} $*.c
|
||||||
$Q${LEX} ${LFLAGS} -o $*.c $<
|
$Q${LEX} ${LFLAGS} -o $*.c $<
|
||||||
$Q${CC} ${CFLAGS} -c -o $@ $*.c
|
$Q${CC} ${REALCFLAGS} -c -o $@ $*.c
|
||||||
$Q${RM} $*.c
|
$Q${RM} $*.c
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$Q${CC} ${CFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
$Q${CC} ${REALCFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
|
|
||||||
# Target used to remove all files generated by other Makefile targets.
|
# Target used to remove all files generated by other Makefile targets.
|
||||||
|
|
||||||
|
|||||||
@@ -18,18 +18,23 @@
|
|||||||
|
|
||||||
#include "asm/localasm.h"
|
#include "asm/localasm.h"
|
||||||
|
|
||||||
|
#define MAXUNIONS 128
|
||||||
|
#define MAXMACROARGS 256
|
||||||
|
#define MAXINCPATHS 128
|
||||||
|
|
||||||
extern SLONG nLineNo;
|
extern SLONG nLineNo;
|
||||||
extern ULONG nTotalLines;
|
extern ULONG nTotalLines;
|
||||||
extern ULONG nPC;
|
extern ULONG nPC;
|
||||||
extern ULONG nPass;
|
extern ULONG nPass;
|
||||||
extern ULONG nIFDepth;
|
extern ULONG nIFDepth;
|
||||||
|
extern bool skipElif;
|
||||||
|
extern ULONG nUnionDepth;
|
||||||
|
extern ULONG unionStart[MAXUNIONS];
|
||||||
|
extern ULONG unionSize[MAXUNIONS];
|
||||||
extern char tzCurrentFileName[_MAX_PATH + 1];
|
extern char tzCurrentFileName[_MAX_PATH + 1];
|
||||||
extern struct Section *pCurrentSection;
|
extern struct Section *pCurrentSection;
|
||||||
extern struct sSymbol *tHashedSymbols[HASHSIZE];
|
extern struct sSymbol *tHashedSymbols[HASHSIZE];
|
||||||
extern struct sSymbol *pPCSymbol;
|
extern struct sSymbol *pPCSymbol;
|
||||||
extern bool oDontExpandStrings;
|
extern bool oDontExpandStrings;
|
||||||
|
|
||||||
#define MAXMACROARGS 256
|
|
||||||
#define MAXINCPATHS 128
|
|
||||||
|
|
||||||
#endif /* // ASM_H */
|
#endif /* // ASM_H */
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ extern void fstk_RunRept(ULONG count);
|
|||||||
FILE *
|
FILE *
|
||||||
fstk_FindFile(char *);
|
fstk_FindFile(char *);
|
||||||
|
|
||||||
|
int fstk_GetLine(void);
|
||||||
|
|
||||||
extern int yywrap(void);
|
extern int yywrap(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ struct sSymbol {
|
|||||||
struct Section *pSection;
|
struct Section *pSection;
|
||||||
ULONG ulMacroSize;
|
ULONG ulMacroSize;
|
||||||
char *pMacro;
|
char *pMacro;
|
||||||
SLONG(*Callback) (struct sSymbol *);
|
SLONG(*Callback) (struct sSymbol *);
|
||||||
|
char tzFileName[_MAX_PATH + 1]; /* File where the symbol was defined. */
|
||||||
|
ULONG nFileLine; /* Line where the symbol was defined. */
|
||||||
};
|
};
|
||||||
#define SYMF_RELOC 0x001 /* symbol will be reloc'ed during
|
#define SYMF_RELOC 0x001 /* symbol will be reloc'ed during
|
||||||
* linking, it's absolute value is
|
* linking, it's absolute value is
|
||||||
|
|||||||
6
include/common.h
Normal file
6
include/common.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef RGBDS_COMMON_H
|
||||||
|
#define RGBDS_COMMON_H
|
||||||
|
|
||||||
|
#define RGBDS_OBJECT_VERSION_STRING "RGB5"
|
||||||
|
|
||||||
|
#endif /* RGBDS_COMMON_H */
|
||||||
21
include/extern/version.h
vendored
Normal file
21
include/extern/version.h
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Antonio Nino Diaz <antonio_nd@outlook.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PACKAGE_VERSION_MAJOR (0)
|
||||||
|
#define PACKAGE_VERSION_MINOR (3)
|
||||||
|
#define PACKAGE_VERSION_PATCH (2)
|
||||||
|
|
||||||
|
const char * get_package_version_string(void);
|
||||||
@@ -89,6 +89,9 @@ struct sSymbol {
|
|||||||
SLONG nSectionID; /* internal to object.c */
|
SLONG nSectionID; /* internal to object.c */
|
||||||
struct sSection *pSection;
|
struct sSection *pSection;
|
||||||
SLONG nOffset;
|
SLONG nOffset;
|
||||||
|
char *pzObjFileName; /* Object file where the symbol is located. */
|
||||||
|
char *pzFileName; /* Source file where the symbol was defined. */
|
||||||
|
ULONG nFileLine; /* Line where the symbol was defined. */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ePatchType {
|
enum ePatchType {
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
void sym_Init(void);
|
void sym_Init(void);
|
||||||
void sym_CreateSymbol(char *tzName, SLONG nValue, SLONG nBank);
|
void sym_CreateSymbol(char *tzName, SLONG nValue, SLONG nBank,
|
||||||
|
char *tzObjFileName, char *tzFileName, ULONG nFileLine);
|
||||||
SLONG sym_GetValue(char *tzName);
|
SLONG sym_GetValue(char *tzName);
|
||||||
SLONG sym_GetBank(char *tzName);
|
SLONG sym_GetBank(char *tzName);
|
||||||
|
|
||||||
|
|||||||
315
src/asm/asmy.y
315
src/asm/asmy.y
@@ -23,7 +23,7 @@ ULONG ulNewMacroSize;
|
|||||||
void
|
void
|
||||||
bankrangecheck(char *name, ULONG secttype, SLONG org, SLONG bank)
|
bankrangecheck(char *name, ULONG secttype, SLONG org, SLONG bank)
|
||||||
{
|
{
|
||||||
SLONG minbank, maxbank;
|
SLONG minbank = 0, maxbank = 0;
|
||||||
char *stype = NULL;
|
char *stype = NULL;
|
||||||
switch (secttype) {
|
switch (secttype) {
|
||||||
case SECT_ROMX:
|
case SECT_ROMX:
|
||||||
@@ -289,70 +289,75 @@ void copymacro( void )
|
|||||||
yyskipbytes( ulNewMacroSize+4 );
|
yyskipbytes( ulNewMacroSize+4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isIf( char *s )
|
ULONG isIf(char *s)
|
||||||
{
|
{
|
||||||
return( (strncasecmp(s,"If",2)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[2]) );
|
return((strncasecmp(s,"If",2) == 0) && isWhiteSpace(s[-1]) && isWhiteSpace(s[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isElse( char *s )
|
ULONG isElif(char *s)
|
||||||
{
|
{
|
||||||
return( (strncasecmp(s,"Else",4)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[4]) );
|
return((strncasecmp(s,"Elif",4) == 0) && isWhiteSpace(s[-1]) && isWhiteSpace(s[4]));
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isEndc( char *s )
|
ULONG isElse(char *s)
|
||||||
{
|
{
|
||||||
return( (strncasecmp(s,"Endc",4)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[4]) );
|
return((strncasecmp(s,"Else",4) == 0) && isWhiteSpace(s[-1]) && isWhiteSpace(s[4]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void if_skip_to_else( void )
|
ULONG isEndc(char *s)
|
||||||
{
|
{
|
||||||
SLONG level=1, len, instring=0;
|
return((strncasecmp(s,"Endc",4) == 0) && isWhiteSpace(s[-1]) && isWhiteSpace(s[4]));
|
||||||
char *src=pCurrentBuffer->pBuffer;
|
}
|
||||||
|
|
||||||
while( *src && level )
|
void if_skip_to_else()
|
||||||
{
|
{
|
||||||
if( *src=='\n' )
|
SLONG level = 1;
|
||||||
nLineNo+=1;
|
bool inString = false;
|
||||||
|
char *src=pCurrentBuffer->pBuffer;
|
||||||
|
|
||||||
if( instring==0 )
|
while (*src && level) {
|
||||||
{
|
if (*src == '\n') {
|
||||||
if( isIf(src) )
|
nLineNo++;
|
||||||
{
|
|
||||||
level+=1;
|
|
||||||
src+=2;
|
|
||||||
}
|
|
||||||
else if( level==1 && isElse(src) )
|
|
||||||
{
|
|
||||||
level-=1;
|
|
||||||
src+=4;
|
|
||||||
}
|
|
||||||
else if( isEndc(src) )
|
|
||||||
{
|
|
||||||
level-=1;
|
|
||||||
if( level!=0 )
|
|
||||||
src+=4;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( *src=='\"' )
|
|
||||||
instring=1;
|
|
||||||
src+=1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if (!inString) {
|
||||||
if( *src=='\\' )
|
if (isIf(src)) {
|
||||||
{
|
level++;
|
||||||
src+=2;
|
src += 2;
|
||||||
|
|
||||||
|
} else if (level == 1 && isElif(src)) {
|
||||||
|
level--;
|
||||||
|
skipElif = false;
|
||||||
|
|
||||||
|
} else if (level == 1 && isElse(src)) {
|
||||||
|
level--;
|
||||||
|
src += 4;
|
||||||
|
|
||||||
|
} else if (isEndc(src)) {
|
||||||
|
level--;
|
||||||
|
if (level != 0) {
|
||||||
|
src += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (*src=='\"') {
|
||||||
|
inString = true;
|
||||||
|
}
|
||||||
|
src++;
|
||||||
}
|
}
|
||||||
else if( *src=='\"' )
|
} else {
|
||||||
{
|
switch (*src) {
|
||||||
src+=1;
|
case '\\':
|
||||||
instring=0;
|
src += 2;
|
||||||
}
|
break;
|
||||||
else
|
|
||||||
{
|
case '\"':
|
||||||
src+=1;
|
src++;
|
||||||
|
inString = false;
|
||||||
|
|
||||||
|
default:
|
||||||
|
src++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,57 +366,56 @@ void if_skip_to_else( void )
|
|||||||
fatalerror("Unterminated IF construct");
|
fatalerror("Unterminated IF construct");
|
||||||
}
|
}
|
||||||
|
|
||||||
len=src-pCurrentBuffer->pBuffer;
|
SLONG len = src - pCurrentBuffer->pBuffer;
|
||||||
|
|
||||||
yyskipbytes( len );
|
yyskipbytes(len);
|
||||||
yyunput( '\n' );
|
yyunput('\n');
|
||||||
nLineNo-=1;
|
nLineNo--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void if_skip_to_endc( void )
|
void if_skip_to_endc()
|
||||||
{
|
{
|
||||||
SLONG level=1, len, instring=0;
|
SLONG level = 1;
|
||||||
char *src=pCurrentBuffer->pBuffer;
|
bool inString = false;
|
||||||
|
char *src=pCurrentBuffer->pBuffer;
|
||||||
|
|
||||||
while( *src && level )
|
while (*src && level) {
|
||||||
{
|
if (*src == '\n') {
|
||||||
if( *src=='\n' )
|
nLineNo++;
|
||||||
nLineNo+=1;
|
}
|
||||||
|
|
||||||
if( instring==0 )
|
if (!inString) {
|
||||||
{
|
if (isIf(src)) {
|
||||||
if( isIf(src) )
|
level++;
|
||||||
{
|
src += 2;
|
||||||
level+=1;
|
|
||||||
src+=2;
|
} else if (isEndc(src)) {
|
||||||
}
|
level--;
|
||||||
else if( isEndc(src) )
|
if (level != 0) {
|
||||||
{
|
src += 4;
|
||||||
level-=1;
|
}
|
||||||
if( level!=0 )
|
|
||||||
src+=4;
|
} else {
|
||||||
}
|
if (*src=='\"') {
|
||||||
else
|
inString = true;
|
||||||
{
|
}
|
||||||
if( *src=='\"' )
|
src++;
|
||||||
instring=1;
|
|
||||||
src+=1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
switch (*src) {
|
||||||
if( *src=='\\' )
|
case '\\':
|
||||||
{
|
src += 2;
|
||||||
src+=2;
|
break;
|
||||||
}
|
|
||||||
else if( *src=='\"' )
|
case '\"':
|
||||||
{
|
src++;
|
||||||
src+=1;
|
inString = false;
|
||||||
instring=0;
|
break;
|
||||||
}
|
|
||||||
else
|
default:
|
||||||
{
|
src++;
|
||||||
src+=1;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -420,11 +424,39 @@ void if_skip_to_endc( void )
|
|||||||
fatalerror("Unterminated IF construct");
|
fatalerror("Unterminated IF construct");
|
||||||
}
|
}
|
||||||
|
|
||||||
len=src-pCurrentBuffer->pBuffer;
|
SLONG len = src - pCurrentBuffer->pBuffer;
|
||||||
|
|
||||||
yyskipbytes( len );
|
yyskipbytes(len);
|
||||||
yyunput( '\n' );
|
yyunput('\n');
|
||||||
nLineNo-=1;
|
nLineNo--;
|
||||||
|
}
|
||||||
|
|
||||||
|
void startUnion() {
|
||||||
|
if (!pCurrentSection) {
|
||||||
|
fatalerror("UNIONs must be inside a SECTION");
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG unionIndex = nUnionDepth;
|
||||||
|
nUnionDepth++;
|
||||||
|
if (nUnionDepth > MAXUNIONS) {
|
||||||
|
fatalerror("Too many nested UNIONs");
|
||||||
|
}
|
||||||
|
|
||||||
|
unionStart[unionIndex] = nPC;
|
||||||
|
unionSize[unionIndex] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateUnion() {
|
||||||
|
ULONG unionIndex = nUnionDepth - 1;
|
||||||
|
ULONG size = nPC - unionStart[unionIndex];
|
||||||
|
|
||||||
|
if (size > unionSize[unionIndex]) {
|
||||||
|
unionSize[unionIndex] = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
nPC = unionStart[unionIndex];
|
||||||
|
pCurrentSection->nPC = unionStart[unionIndex];
|
||||||
|
pPCSymbol->nValue = unionStart[unionIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
@@ -492,7 +524,7 @@ void if_skip_to_endc( void )
|
|||||||
%token <tzSym> T_POP_SET
|
%token <tzSym> T_POP_SET
|
||||||
%token <tzSym> T_POP_EQUS
|
%token <tzSym> T_POP_EQUS
|
||||||
|
|
||||||
%token T_POP_INCLUDE T_POP_PRINTF T_POP_PRINTT T_POP_PRINTV T_POP_IF T_POP_ELSE T_POP_ENDC
|
%token T_POP_INCLUDE T_POP_PRINTF T_POP_PRINTT T_POP_PRINTV T_POP_IF T_POP_ELIF T_POP_ELSE T_POP_ENDC
|
||||||
%token T_POP_IMPORT T_POP_EXPORT T_POP_GLOBAL
|
%token T_POP_IMPORT T_POP_EXPORT T_POP_GLOBAL
|
||||||
%token T_POP_DB T_POP_DS T_POP_DW T_POP_DL
|
%token T_POP_DB T_POP_DS T_POP_DW T_POP_DL
|
||||||
%token T_POP_SECTION
|
%token T_POP_SECTION
|
||||||
@@ -502,6 +534,7 @@ void if_skip_to_endc( void )
|
|||||||
%token T_POP_MACRO
|
%token T_POP_MACRO
|
||||||
%token T_POP_ENDM
|
%token T_POP_ENDM
|
||||||
%token T_POP_RSRESET T_POP_RSSET
|
%token T_POP_RSRESET T_POP_RSSET
|
||||||
|
%token T_POP_UNION T_POP_NEXTU T_POP_ENDU
|
||||||
%token T_POP_INCBIN T_POP_REPT
|
%token T_POP_INCBIN T_POP_REPT
|
||||||
%token T_POP_CHARMAP
|
%token T_POP_CHARMAP
|
||||||
%token T_POP_SHIFT
|
%token T_POP_SHIFT
|
||||||
@@ -627,6 +660,7 @@ simple_pseudoop : include
|
|||||||
| printt
|
| printt
|
||||||
| printv
|
| printv
|
||||||
| if
|
| if
|
||||||
|
| elif
|
||||||
| else
|
| else
|
||||||
| endc
|
| endc
|
||||||
| import
|
| import
|
||||||
@@ -639,6 +673,9 @@ simple_pseudoop : include
|
|||||||
| section
|
| section
|
||||||
| rsreset
|
| rsreset
|
||||||
| rsset
|
| rsset
|
||||||
|
| union
|
||||||
|
| nextu
|
||||||
|
| endu
|
||||||
| incbin
|
| incbin
|
||||||
| charmap
|
| charmap
|
||||||
| rept
|
| rept
|
||||||
@@ -740,6 +777,31 @@ rb : T_LABEL T_POP_RB uconst
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
union : T_POP_UNION {
|
||||||
|
startUnion();
|
||||||
|
};
|
||||||
|
|
||||||
|
nextu : T_POP_NEXTU {
|
||||||
|
if (nUnionDepth <= 0) {
|
||||||
|
fatalerror("Found NEXTU outside of a UNION construct");
|
||||||
|
}
|
||||||
|
|
||||||
|
updateUnion();
|
||||||
|
};
|
||||||
|
|
||||||
|
endu : T_POP_ENDU {
|
||||||
|
if (nUnionDepth <= 0) {
|
||||||
|
fatalerror("Found ENDU outside of a UNION construct");
|
||||||
|
}
|
||||||
|
|
||||||
|
updateUnion();
|
||||||
|
|
||||||
|
nUnionDepth--;
|
||||||
|
nPC = unionStart[nUnionDepth] + unionSize[nUnionDepth];
|
||||||
|
pCurrentSection->nPC = nPC;
|
||||||
|
pPCSymbol->nValue = nPC;
|
||||||
|
};
|
||||||
|
|
||||||
ds : T_POP_DS uconst
|
ds : T_POP_DS uconst
|
||||||
{ out_Skip( $2 ); }
|
{ out_Skip( $2 ); }
|
||||||
;
|
;
|
||||||
@@ -867,26 +929,47 @@ printf : T_POP_PRINTF const
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
if : T_POP_IF const
|
if : T_POP_IF const {
|
||||||
{
|
nIFDepth++;
|
||||||
nIFDepth+=1;
|
if (!$2) {
|
||||||
if( !$2 )
|
if_skip_to_else(); // Continue parsing after ELSE, or at ELIF or ENDC keyword
|
||||||
{
|
|
||||||
if_skip_to_else(); /* will continue parsing just after ELSE or just at ENDC keyword */
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
else : T_POP_ELSE
|
elif : T_POP_ELIF const {
|
||||||
{
|
if (nIFDepth <= 0) {
|
||||||
if_skip_to_endc(); /* will continue parsing just at ENDC keyword */
|
fatalerror("Found ELIF outside an IF construct");
|
||||||
}
|
}
|
||||||
;
|
|
||||||
|
|
||||||
endc : T_POP_ENDC
|
if (skipElif) {
|
||||||
{
|
// This is for when ELIF is reached at the end of an IF or ELIF block for which the condition was true.
|
||||||
nIFDepth-=1;
|
if_skip_to_endc(); // Continue parsing at ENDC keyword
|
||||||
}
|
|
||||||
;
|
} else {
|
||||||
|
// This is for when ELIF is skipped to because the condition of the previous IF or ELIF block was false.
|
||||||
|
skipElif = true;
|
||||||
|
|
||||||
|
if (!$2) {
|
||||||
|
if_skip_to_else(); // Continue parsing after ELSE, or at ELIF or ENDC keyword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
else : T_POP_ELSE {
|
||||||
|
if (nIFDepth <= 0) {
|
||||||
|
fatalerror("Found ELSE outside an IF construct");
|
||||||
|
}
|
||||||
|
|
||||||
|
if_skip_to_endc(); // Continue parsing at ENDC keyword
|
||||||
|
};
|
||||||
|
|
||||||
|
endc : T_POP_ENDC {
|
||||||
|
if (nIFDepth <= 0) {
|
||||||
|
fatalerror("Found ENDC outside an IF construct");
|
||||||
|
}
|
||||||
|
|
||||||
|
nIFDepth--;
|
||||||
|
};
|
||||||
|
|
||||||
const_3bit : const
|
const_3bit : const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ extern FILE *dependfile;
|
|||||||
/*
|
/*
|
||||||
* defines for nCurrentStatus
|
* defines for nCurrentStatus
|
||||||
*/
|
*/
|
||||||
#define STAT_isInclude 0
|
#define STAT_isInclude 0 /* 'Normal' state as well */
|
||||||
#define STAT_isMacro 1
|
#define STAT_isMacro 1
|
||||||
#define STAT_isMacroArg 2
|
#define STAT_isMacroArg 2
|
||||||
#define STAT_isREPTBlock 3
|
#define STAT_isREPTBlock 3
|
||||||
|
|
||||||
@@ -151,6 +151,37 @@ popcontext(void)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
fstk_GetLine(void)
|
||||||
|
{
|
||||||
|
struct sContext *pLastFile, **ppLastFile;
|
||||||
|
|
||||||
|
switch (nCurrentStatus) {
|
||||||
|
case STAT_isInclude:
|
||||||
|
/* This is the normal mode, also used when including a file. */
|
||||||
|
return nLineNo;
|
||||||
|
case STAT_isMacro:
|
||||||
|
break; /* Peek top file of the stack */
|
||||||
|
case STAT_isMacroArg:
|
||||||
|
return nLineNo; /* ??? */
|
||||||
|
case STAT_isREPTBlock:
|
||||||
|
break; /* Peek top file of the stack */
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((pLastFile = pFileStack) != NULL) {
|
||||||
|
ppLastFile = &pFileStack;
|
||||||
|
while (pLastFile->pNext) {
|
||||||
|
ppLastFile = &(pLastFile->pNext);
|
||||||
|
pLastFile = *ppLastFile;
|
||||||
|
}
|
||||||
|
return pLastFile->nLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is only reached if the lexer is in REPT or MACRO mode but there
|
||||||
|
* are no saved contexts with the origin of said REPT or MACRO. */
|
||||||
|
fatalerror("fstk_GetLine: Internal error.");
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
yywrap(void)
|
yywrap(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -329,8 +329,13 @@ struct sLexInitString staticstrings[] = {
|
|||||||
|
|
||||||
{"if", T_POP_IF},
|
{"if", T_POP_IF},
|
||||||
{"else", T_POP_ELSE},
|
{"else", T_POP_ELSE},
|
||||||
|
{"elif", T_POP_ELIF},
|
||||||
{"endc", T_POP_ENDC},
|
{"endc", T_POP_ENDC},
|
||||||
|
|
||||||
|
{"union", T_POP_UNION},
|
||||||
|
{"nextu", T_POP_NEXTU},
|
||||||
|
{"endu", T_POP_ENDU},
|
||||||
|
|
||||||
{"wram0", T_SECT_WRAM0},
|
{"wram0", T_SECT_WRAM0},
|
||||||
{"vram", T_SECT_VRAM},
|
{"vram", T_SECT_VRAM},
|
||||||
{"romx", T_SECT_ROMX},
|
{"romx", T_SECT_ROMX},
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "asm/main.h"
|
#include "asm/main.h"
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
#include "extern/reallocarray.h"
|
#include "extern/reallocarray.h"
|
||||||
|
#include "extern/version.h"
|
||||||
|
|
||||||
int yyparse(void);
|
int yyparse(void);
|
||||||
void setuplex(void);
|
void setuplex(void);
|
||||||
@@ -22,7 +23,9 @@ char **cldefines;
|
|||||||
|
|
||||||
clock_t nStartClock, nEndClock;
|
clock_t nStartClock, nEndClock;
|
||||||
SLONG nLineNo;
|
SLONG nLineNo;
|
||||||
ULONG nTotalLines, nPass, nPC, nIFDepth, nErrors;
|
ULONG nTotalLines, nPass, nPC, nIFDepth, nUnionDepth, nErrors;
|
||||||
|
bool skipElif;
|
||||||
|
ULONG unionStart[128], unionSize[128];
|
||||||
|
|
||||||
extern int yydebug;
|
extern int yydebug;
|
||||||
|
|
||||||
@@ -276,7 +279,7 @@ static void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"Usage: rgbasm [-hvE] [-b chars] [-Dname[=value]] [-g chars] [-i path]\n"
|
"Usage: rgbasm [-EhVvw] [-b chars] [-Dname[=value]] [-g chars] [-i path]\n"
|
||||||
" [-M dependfile] [-o outfile] [-p pad_value] file.asm\n");
|
" [-M dependfile] [-o outfile] [-p pad_value] file.asm\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -322,7 +325,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
newopt = CurrentOptions;
|
newopt = CurrentOptions;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "b:D:g:hi:M:o:p:vEw")) != -1) {
|
while ((ch = getopt(argc, argv, "b:D:g:hi:M:o:p:EVvw")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'b':
|
case 'b':
|
||||||
if (strlen(optarg) == 2) {
|
if (strlen(optarg) == 2) {
|
||||||
@@ -336,6 +339,9 @@ main(int argc, char *argv[])
|
|||||||
case 'D':
|
case 'D':
|
||||||
opt_AddDefine(optarg);
|
opt_AddDefine(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'E':
|
||||||
|
newopt.exportall = true;
|
||||||
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
if (strlen(optarg) == 4) {
|
if (strlen(optarg) == 4) {
|
||||||
newopt.gbgfx[0] = optarg[1];
|
newopt.gbgfx[0] = optarg[1];
|
||||||
@@ -371,17 +377,18 @@ main(int argc, char *argv[])
|
|||||||
"between 0 and 0xFF");
|
"between 0 and 0xFF");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
printf("rgbasm %s\n", get_package_version_string());
|
||||||
|
exit(0);
|
||||||
case 'v':
|
case 'v':
|
||||||
newopt.verbose = true;
|
newopt.verbose = true;
|
||||||
break;
|
break;
|
||||||
case 'E':
|
|
||||||
newopt.exportall = true;
|
|
||||||
break;
|
|
||||||
case 'w':
|
case 'w':
|
||||||
newopt.warnings = false;
|
newopt.warnings = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
@@ -414,6 +421,8 @@ main(int argc, char *argv[])
|
|||||||
nLineNo = 1;
|
nLineNo = 1;
|
||||||
nTotalLines = 0;
|
nTotalLines = 0;
|
||||||
nIFDepth = 0;
|
nIFDepth = 0;
|
||||||
|
skipElif = true;
|
||||||
|
nUnionDepth = 0;
|
||||||
nPC = 0;
|
nPC = 0;
|
||||||
nPass = 1;
|
nPass = 1;
|
||||||
nErrors = 0;
|
nErrors = 0;
|
||||||
@@ -437,9 +446,15 @@ main(int argc, char *argv[])
|
|||||||
errx(1, "Unterminated IF construct (%ld levels)!", nIFDepth);
|
errx(1, "Unterminated IF construct (%ld levels)!", nIFDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nUnionDepth != 0) {
|
||||||
|
errx(1, "Unterminated UNION construct (%ld levels)!", nUnionDepth);
|
||||||
|
}
|
||||||
|
|
||||||
nTotalLines = 0;
|
nTotalLines = 0;
|
||||||
nLineNo = 1;
|
nLineNo = 1;
|
||||||
nIFDepth = 0;
|
nIFDepth = 0;
|
||||||
|
skipElif = true;
|
||||||
|
nUnionDepth = 0;
|
||||||
nPC = 0;
|
nPC = 0;
|
||||||
nPass = 2;
|
nPass = 2;
|
||||||
nErrors = 0;
|
nErrors = 0;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "asm/main.h"
|
#include "asm/main.h"
|
||||||
#include "asm/rpn.h"
|
#include "asm/rpn.h"
|
||||||
#include "asm/fstack.h"
|
#include "asm/fstack.h"
|
||||||
|
#include "common.h"
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
|
|
||||||
void out_SetCurrentSection(struct Section * pSect);
|
void out_SetCurrentSection(struct Section * pSect);
|
||||||
@@ -282,6 +283,9 @@ writesymbol(struct sSymbol * pSym, FILE * f)
|
|||||||
fputc(type, f);
|
fputc(type, f);
|
||||||
|
|
||||||
if (type != SYM_IMPORT) {
|
if (type != SYM_IMPORT) {
|
||||||
|
fputstring(pSym->tzFileName, f);
|
||||||
|
fputlong(pSym->nFileLine, f);
|
||||||
|
|
||||||
fputlong(sectid, f);
|
fputlong(sectid, f);
|
||||||
fputlong(offset, f);
|
fputlong(offset, f);
|
||||||
}
|
}
|
||||||
@@ -460,6 +464,8 @@ checkcodesection(void)
|
|||||||
pCurrentSection->nType != SECT_ROMX) {
|
pCurrentSection->nType != SECT_ROMX) {
|
||||||
fatalerror("Section '%s' cannot contain code or data (not ROM0 or ROMX)",
|
fatalerror("Section '%s' cannot contain code or data (not ROM0 or ROMX)",
|
||||||
pCurrentSection->pzName);
|
pCurrentSection->pzName);
|
||||||
|
} else if (nUnionDepth > 0) {
|
||||||
|
fatalerror("UNIONs cannot contain code or data");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,7 +505,9 @@ out_WriteObject(void)
|
|||||||
struct PatchSymbol *pSym;
|
struct PatchSymbol *pSym;
|
||||||
struct Section *pSect;
|
struct Section *pSect;
|
||||||
|
|
||||||
fwrite("RGB4", 1, 4, f);
|
fwrite(RGBDS_OBJECT_VERSION_STRING, 1,
|
||||||
|
strlen(RGBDS_OBJECT_VERSION_STRING), f);
|
||||||
|
|
||||||
fputlong(countsymbols(), f);
|
fputlong(countsymbols(), f);
|
||||||
fputlong(countsections(), f);
|
fputlong(countsections(), f);
|
||||||
|
|
||||||
@@ -613,6 +621,10 @@ out_FindSection(char *pzName, ULONG secttype, SLONG org, SLONG bank, SLONG align
|
|||||||
void
|
void
|
||||||
out_SetCurrentSection(struct Section * pSect)
|
out_SetCurrentSection(struct Section * pSect)
|
||||||
{
|
{
|
||||||
|
if (nUnionDepth > 0) {
|
||||||
|
fatalerror("Cannot change the section within a UNION");
|
||||||
|
}
|
||||||
|
|
||||||
pCurrentSection = pSect;
|
pCurrentSection = pSect;
|
||||||
nPC = pSect->nPC;
|
nPC = pSect->nPC;
|
||||||
|
|
||||||
@@ -651,12 +663,11 @@ out_NewAlignedSection(char *pzName, ULONG secttype, SLONG alignment, SLONG bank)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output an absolute byte
|
* Output an absolute byte (bypassing ROM/union checks)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
out_AbsByte(int b)
|
out_AbsByteBypassCheck(int b)
|
||||||
{
|
{
|
||||||
checkcodesection();
|
|
||||||
checksectionoverflow(1);
|
checksectionoverflow(1);
|
||||||
b &= 0xFF;
|
b &= 0xFF;
|
||||||
if (nPass == 2)
|
if (nPass == 2)
|
||||||
@@ -667,6 +678,16 @@ out_AbsByte(int b)
|
|||||||
pPCSymbol->nValue += 1;
|
pPCSymbol->nValue += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Output an absolute byte
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
out_AbsByte(int b)
|
||||||
|
{
|
||||||
|
checkcodesection();
|
||||||
|
out_AbsByteBypassCheck(b);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
out_AbsByteGroup(char *s, int length)
|
out_AbsByteGroup(char *s, int length)
|
||||||
{
|
{
|
||||||
@@ -689,6 +710,9 @@ out_Skip(int skip)
|
|||||||
pCurrentSection->nPC += skip;
|
pCurrentSection->nPC += skip;
|
||||||
nPC += skip;
|
nPC += skip;
|
||||||
pPCSymbol->nValue += skip;
|
pPCSymbol->nValue += skip;
|
||||||
|
} else if (nUnionDepth > 0) {
|
||||||
|
while (skip--)
|
||||||
|
out_AbsByteBypassCheck(CurrentOptions.fillchar);
|
||||||
} else {
|
} else {
|
||||||
checkcodesection();
|
checkcodesection();
|
||||||
while (skip--)
|
while (skip--)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
.Nd Game Boy assembler
|
.Nd Game Boy assembler
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm rgbasm
|
.Nm rgbasm
|
||||||
.Op Fl Ehvw
|
.Op Fl EhVvw
|
||||||
.Op Fl b Ar chars
|
.Op Fl b Ar chars
|
||||||
.Op Fl D Ar name Ns Op = Ns Ar value
|
.Op Fl D Ar name Ns Op = Ns Ar value
|
||||||
.Op Fl g Ar chars
|
.Op Fl g Ar chars
|
||||||
@@ -72,6 +72,8 @@ Write an object file to the given filename.
|
|||||||
.It Fl p Ar pad_value
|
.It Fl p Ar pad_value
|
||||||
When padding an image, pad with this value.
|
When padding an image, pad with this value.
|
||||||
The default is 0x00.
|
The default is 0x00.
|
||||||
|
.It Fl V
|
||||||
|
Print the version of the program and exit.
|
||||||
.It Fl v
|
.It Fl v
|
||||||
Be verbose.
|
Be verbose.
|
||||||
.It Fl w
|
.It Fl w
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
.\"
|
.\"
|
||||||
.Dd April 17, 2017
|
.Dd July 22, 2017
|
||||||
.Dt RGBASM 5
|
.Dt RGBASM 5
|
||||||
.Os RGBDS Manual
|
.Os RGBDS Manual
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -275,7 +275,7 @@ Alternatively you can use = as a synonym for SET.
|
|||||||
.Pp
|
.Pp
|
||||||
.Dl COUNT = 2
|
.Dl COUNT = 2
|
||||||
.Pp
|
.Pp
|
||||||
.It Sy RSSET , RERESET , RB , RW
|
.It Sy RSSET , RSRESET , RB , RW
|
||||||
.Pp
|
.Pp
|
||||||
The RS group of commands is a handy way of defining structures:
|
The RS group of commands is a handy way of defining structures:
|
||||||
.Pp
|
.Pp
|
||||||
@@ -549,6 +549,9 @@ The following symbols are defined by the assembler:
|
|||||||
.It Ic EQU Ta Ic __UTC_HOUR__ Ta Ta Current hour, 0-23
|
.It Ic EQU Ta Ic __UTC_HOUR__ Ta Ta Current hour, 0-23
|
||||||
.It Ic EQU Ta Ic __UTC_MINUTE__ Ta Ta Current minute, 0-59
|
.It Ic EQU Ta Ic __UTC_MINUTE__ Ta Ta Current minute, 0-59
|
||||||
.It Ic EQU Ta Ic __UTC_SECOND__ Ta Ta Current second, 0-59
|
.It Ic EQU Ta Ic __UTC_SECOND__ Ta Ta Current second, 0-59
|
||||||
|
.It Ic EQU Ta Ic __RGBDS_MAJOR__ Ta Ta Major version number of RGBDS.
|
||||||
|
.It Ic EQU Ta Ic __RGBDS_MINOR__ Ta Ta Minor version number of RGBDS.
|
||||||
|
.It Ic EQU Ta Ic __RGBDS_PATCH__ Ta Ta Patch version number of RGBDS.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
.Sh DEFINING DATA
|
.Sh DEFINING DATA
|
||||||
@@ -612,6 +615,41 @@ You can also include only part of a file with
|
|||||||
The example below includes 256 bytes from data.bin starting from byte 78.
|
The example below includes 256 bytes from data.bin starting from byte 78.
|
||||||
.Pp
|
.Pp
|
||||||
.Dl INCBIN \[dq]data.bin\[dq],78,256
|
.Dl INCBIN \[dq]data.bin\[dq],78,256
|
||||||
|
.Ss Unions
|
||||||
|
Unions allow multiple memory allocations to share the same space in memory,
|
||||||
|
like unions in C.
|
||||||
|
This allows you to easily reuse memory for different purposes, depending on
|
||||||
|
the game's state.
|
||||||
|
.Pp
|
||||||
|
You create unions using the
|
||||||
|
.Ic UNION ,
|
||||||
|
.Ic NEXTU
|
||||||
|
and
|
||||||
|
.Ic ENDU
|
||||||
|
keywords.
|
||||||
|
.Ic NEXTU
|
||||||
|
lets you create a new block of allocations, and you may use it as many times
|
||||||
|
within a union as necessary.
|
||||||
|
.Pp
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
UNION
|
||||||
|
Name: ds 8
|
||||||
|
Nickname: ds 8
|
||||||
|
NEXTU
|
||||||
|
Health: dw
|
||||||
|
Something: ds 3
|
||||||
|
Lives: db
|
||||||
|
NEXTU
|
||||||
|
Temporary: ds 19
|
||||||
|
ENDU
|
||||||
|
.Ed
|
||||||
|
.Pp
|
||||||
|
This union will use up 19 bytes, as this is the size of the largest block
|
||||||
|
(the last one, containing 'Temporary').
|
||||||
|
Of course, as 'Name', 'Health', and 'Temporary' all point to the same memory
|
||||||
|
locations, writes to any one of these will affect values read from the others.
|
||||||
|
.Pp
|
||||||
|
Unions may be used in any section, but code and data may not be included.
|
||||||
.Sh THE MACRO LANGUAGE
|
.Sh THE MACRO LANGUAGE
|
||||||
.Pp
|
.Pp
|
||||||
.Ss Printing things during assembly
|
.Ss Printing things during assembly
|
||||||
@@ -704,27 +742,48 @@ calls infinitely (or until you run out of memory, whichever comes first).
|
|||||||
.Dl INCLUDE \[dq]irq.inc\[dq]
|
.Dl INCLUDE \[dq]irq.inc\[dq]
|
||||||
.Pp
|
.Pp
|
||||||
.Ss Conditional assembling
|
.Ss Conditional assembling
|
||||||
The three commands
|
The four commands
|
||||||
.Ic IF ,
|
.Ic IF ,
|
||||||
.Ic ELSE
|
.Ic ELIF ,
|
||||||
|
.Ic ELSE ,
|
||||||
and
|
and
|
||||||
.Ic ENDC
|
.Ic ENDC
|
||||||
are used to conditionally assemble parts of your file.
|
are used to conditionally assemble parts of your file.
|
||||||
This is a powerful feature commonly used in macros.
|
This is a powerful feature commonly used in macros.
|
||||||
.Pp
|
.Pp
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
IF 2+2==4
|
IF NUM < 0
|
||||||
PRINTT \[dq]2+2==4\[rs]n\[dq]
|
PRINTT \[dq]NUM < 0\[rs]n\[dq]
|
||||||
|
ELIF NUM == 0
|
||||||
|
PRINTT \[dq]NUM == 0\[rs]n\[dq]
|
||||||
ELSE
|
ELSE
|
||||||
PRINTT \[dq]2+2!=4\[rs]n\[dq]
|
PRINTT \[dq]NUM > 0\[rs]n\[dq]
|
||||||
ENDC
|
ENDC
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
|
.Ic ELIF
|
||||||
|
and
|
||||||
.Ic ELSE
|
.Ic ELSE
|
||||||
block is optional.
|
blocks are optional.
|
||||||
.Ic IF No / Ic ELSE No / Ic ENDC
|
.Ic IF No / Ic ELIF No / Ic ELSE No / Ic ENDC
|
||||||
blocks can be nested.
|
blocks can be nested.
|
||||||
|
.Pp
|
||||||
|
Note that if an
|
||||||
|
.Ic ELSE
|
||||||
|
block is found before an
|
||||||
|
.Ic ELIF
|
||||||
|
block, the
|
||||||
|
.Ic ELIF
|
||||||
|
block will be ignored.
|
||||||
|
All
|
||||||
|
.Ic ELIF
|
||||||
|
blocks must go before the
|
||||||
|
.Ic ELSE
|
||||||
|
block.
|
||||||
|
Also, if there is more than one
|
||||||
|
.Ic ELSE
|
||||||
|
block, all of them but the first one are ignored.
|
||||||
.Ss Integer and Boolean expressions
|
.Ss Integer and Boolean expressions
|
||||||
An expression can be composed of many things.
|
An expression can be composed of many things.
|
||||||
Expressions are always evaluated using signed 32-bit math.
|
Expressions are always evaluated using signed 32-bit math.
|
||||||
@@ -956,6 +1015,15 @@ machine.
|
|||||||
.It Sx __ISO_8601_UTC__
|
.It Sx __ISO_8601_UTC__
|
||||||
.It Sx __LINE__
|
.It Sx __LINE__
|
||||||
.It Sx __TIME__
|
.It Sx __TIME__
|
||||||
|
.It Sx __RGBDS_MAJOR__
|
||||||
|
.It Sx __RGBDS_MINOR__
|
||||||
|
.It Sx __RGBDS_PATCH__
|
||||||
|
.It Sx __UTC_YEAR__
|
||||||
|
.It Sx __UTC_MONTH__
|
||||||
|
.It Sx __UTC_DAY__
|
||||||
|
.It Sx __UTC_HOUR__
|
||||||
|
.It Sx __UTC_MINUTE__
|
||||||
|
.It Sx __UTC_SECOND__
|
||||||
.It Sx _NARG
|
.It Sx _NARG
|
||||||
.It Sx _PI
|
.It Sx _PI
|
||||||
.It Sx _RS
|
.It Sx _RS
|
||||||
@@ -970,6 +1038,7 @@ machine.
|
|||||||
.It Sx DIV
|
.It Sx DIV
|
||||||
.It Sx DS
|
.It Sx DS
|
||||||
.It Sx DW
|
.It Sx DW
|
||||||
|
.It Sx ELIF
|
||||||
.It Sx ELSE
|
.It Sx ELSE
|
||||||
.It Sx ENDC
|
.It Sx ENDC
|
||||||
.It Sx ENDM
|
.It Sx ENDM
|
||||||
|
|||||||
@@ -8,11 +8,13 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "asm/asm.h"
|
#include "asm/asm.h"
|
||||||
|
#include "asm/fstack.h"
|
||||||
#include "asm/symbol.h"
|
#include "asm/symbol.h"
|
||||||
#include "asm/main.h"
|
#include "asm/main.h"
|
||||||
#include "asm/mymath.h"
|
#include "asm/mymath.h"
|
||||||
#include "asm/output.h"
|
#include "asm/output.h"
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
|
#include "extern/version.h"
|
||||||
|
|
||||||
struct sSymbol *tHashedSymbols[HASHSIZE];
|
struct sSymbol *tHashedSymbols[HASHSIZE];
|
||||||
struct sSymbol *pScope = NULL;
|
struct sSymbol *pScope = NULL;
|
||||||
@@ -108,6 +110,8 @@ createsymbol(char *s)
|
|||||||
(*ppsym)->pMacro = NULL;
|
(*ppsym)->pMacro = NULL;
|
||||||
(*ppsym)->pSection = NULL;
|
(*ppsym)->pSection = NULL;
|
||||||
(*ppsym)->Callback = NULL;
|
(*ppsym)->Callback = NULL;
|
||||||
|
strcpy((*ppsym)->tzFileName, tzCurrentFileName);
|
||||||
|
(*ppsym)->nFileLine = fstk_GetLine();
|
||||||
return (*ppsym);
|
return (*ppsym);
|
||||||
} else {
|
} else {
|
||||||
fatalerror("No memory for symbol");
|
fatalerror("No memory for symbol");
|
||||||
@@ -517,7 +521,8 @@ sym_AddEqu(char *tzSym, SLONG value)
|
|||||||
|
|
||||||
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
|
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
|
||||||
if (nsym->nType & SYMF_DEFINED) {
|
if (nsym->nType & SYMF_DEFINED) {
|
||||||
yyerror("'%s' already defined", tzSym);
|
yyerror("'%s' already defined in %s(%d)",
|
||||||
|
tzSym, nsym->tzFileName, nsym->nFileLine);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
nsym = createsymbol(tzSym);
|
nsym = createsymbol(tzSym);
|
||||||
@@ -549,7 +554,8 @@ sym_AddString(char *tzSym, char *tzValue)
|
|||||||
|
|
||||||
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
|
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
|
||||||
if (nsym->nType & SYMF_DEFINED) {
|
if (nsym->nType & SYMF_DEFINED) {
|
||||||
yyerror("'%s' already defined", tzSym);
|
yyerror("'%s' already defined in %s(%d)",
|
||||||
|
tzSym, nsym->tzFileName, nsym->nFileLine);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
nsym = createsymbol(tzSym);
|
nsym = createsymbol(tzSym);
|
||||||
@@ -652,7 +658,8 @@ sym_AddReloc(char *tzSym)
|
|||||||
|
|
||||||
if ((nsym = findsymbol(tzSym, scope)) != NULL) {
|
if ((nsym = findsymbol(tzSym, scope)) != NULL) {
|
||||||
if (nsym->nType & SYMF_DEFINED) {
|
if (nsym->nType & SYMF_DEFINED) {
|
||||||
yyerror("'%s' already defined", tzSym);
|
yyerror("'%s' already defined in %s(%d)",
|
||||||
|
tzSym, nsym->tzFileName, nsym->nFileLine);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
nsym = createsymbol(tzSym);
|
nsym = createsymbol(tzSym);
|
||||||
@@ -781,7 +788,8 @@ sym_AddMacro(char *tzSym)
|
|||||||
|
|
||||||
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
|
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
|
||||||
if (nsym->nType & SYMF_DEFINED) {
|
if (nsym->nType & SYMF_DEFINED) {
|
||||||
yyerror("'%s' already defined", tzSym);
|
yyerror("'%s' already defined in %s(%d)",
|
||||||
|
tzSym, nsym->tzFileName, nsym->nFileLine);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
nsym = createsymbol(tzSym);
|
nsym = createsymbol(tzSym);
|
||||||
@@ -848,6 +856,9 @@ sym_PrepPass2(void)
|
|||||||
sym_AddString("__UTC_HOUR__", SavedHOUR);
|
sym_AddString("__UTC_HOUR__", SavedHOUR);
|
||||||
sym_AddString("__UTC_MINUTE__", SavedMINUTE);
|
sym_AddString("__UTC_MINUTE__", SavedMINUTE);
|
||||||
sym_AddString("__UTC_SECOND__", SavedSECOND);
|
sym_AddString("__UTC_SECOND__", SavedSECOND);
|
||||||
|
sym_AddEqu("__RGBDS_MAJOR__", PACKAGE_VERSION_MAJOR);
|
||||||
|
sym_AddEqu("__RGBDS_MINOR__", PACKAGE_VERSION_MINOR);
|
||||||
|
sym_AddEqu("__RGBDS_PATCH__", PACKAGE_VERSION_PATCH);
|
||||||
sym_AddSet("_RS", 0);
|
sym_AddSet("_RS", 0);
|
||||||
|
|
||||||
sym_AddEqu("_NARG", 0);
|
sym_AddEqu("_NARG", 0);
|
||||||
|
|||||||
34
src/extern/version.c
vendored
Normal file
34
src/extern/version.c
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Antonio Nino Diaz <antonio_nd@outlook.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "extern/version.h"
|
||||||
|
|
||||||
|
const char * get_package_version_string(void)
|
||||||
|
{
|
||||||
|
static char s[50];
|
||||||
|
|
||||||
|
/* The following conditional should be simplified by the compiler. */
|
||||||
|
if (strlen(BUILD_VERSION_STRING) == 0) {
|
||||||
|
snprintf(s, sizeof(s), "v%d.%d.%d", PACKAGE_VERSION_MAJOR,
|
||||||
|
PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCH);
|
||||||
|
return s;
|
||||||
|
} else {
|
||||||
|
return BUILD_VERSION_STRING;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,12 +22,13 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
|
#include "extern/version.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"usage: rgbfix [-Ccjsv] [-i game_id] [-k licensee_str] [-l licensee_id]\n"
|
"usage: rgbfix [-CcjsVv] [-i game_id] [-k licensee_str] [-l licensee_id]\n"
|
||||||
" [-m mbc_type] [-n rom_version] [-p pad_value] [-r ram_size]\n"
|
" [-m mbc_type] [-n rom_version] [-p pad_value] [-r ram_size]\n"
|
||||||
" [-t title_str] file\n");
|
" [-t title_str] file\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -63,13 +64,13 @@ main(int argc, char *argv[])
|
|||||||
char *id; /* game ID in ASCII */
|
char *id; /* game ID in ASCII */
|
||||||
char *newlicensee; /* new licensee ID, two ASCII characters */
|
char *newlicensee; /* new licensee ID, two ASCII characters */
|
||||||
|
|
||||||
int licensee; /* old licensee ID */
|
int licensee = 0; /* old licensee ID */
|
||||||
int cartridge; /* cartridge hardware ID */
|
int cartridge = 0; /* cartridge hardware ID */
|
||||||
int ramsize; /* RAM size ID */
|
int ramsize = 0; /* RAM size ID */
|
||||||
int version; /* mask ROM version number */
|
int version = 0; /* mask ROM version number */
|
||||||
int padvalue; /* to pad the rom with if it changes size */
|
int padvalue = 0; /* to pad the rom with if it changes size */
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "Cci:jk:l:m:n:p:sr:t:v")) != -1) {
|
while ((ch = getopt(argc, argv, "Cci:jk:l:m:n:p:sr:t:Vv")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'C':
|
case 'C':
|
||||||
coloronly = true;
|
coloronly = true;
|
||||||
@@ -177,6 +178,9 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
title = optarg;
|
title = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
printf("rgbfix %s\n", get_package_version_string());
|
||||||
|
exit(0);
|
||||||
case 'v':
|
case 'v':
|
||||||
validate = true;
|
validate = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
.Nd Game Boy checksum fixer
|
.Nd Game Boy checksum fixer
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm rgbfix
|
.Nm rgbfix
|
||||||
.Op Fl Ccjsv
|
.Op Fl CcjsVv
|
||||||
.Op Fl i Ar game_id
|
.Op Fl i Ar game_id
|
||||||
.Op Fl k Ar licensee_str
|
.Op Fl k Ar licensee_str
|
||||||
.Op Fl l Ar licensee_id
|
.Op Fl l Ar licensee_id
|
||||||
@@ -108,6 +108,8 @@ or
|
|||||||
.Pc .
|
.Pc .
|
||||||
If both this and the game ID are set, the game ID will overwrite the
|
If both this and the game ID are set, the game ID will overwrite the
|
||||||
overlapping portion of the title.
|
overlapping portion of the title.
|
||||||
|
.It Fl V
|
||||||
|
Print the version of the program and exit.
|
||||||
.It Fl v
|
.It Fl v
|
||||||
Validate the header and fix checksums: the Nintendo character area
|
Validate the header and fix checksums: the Nintendo character area
|
||||||
.Pq Ad 0x104 Ns \(en Ns Ad 0x133 ,
|
.Pq Ad 0x104 Ns \(en Ns Ad 0x133 ,
|
||||||
|
|||||||
@@ -14,17 +14,19 @@
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "extern/version.h"
|
||||||
#include "gfx/main.h"
|
#include "gfx/main.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"usage: rgbgfx [-DFfhPTuv] [-d #] [-o outfile] [-p palfile] [-t mapfile]\n"
|
"usage: rgbgfx [-DFfhPTuVv] [-d #] [-o outfile] [-p palfile] [-t mapfile]\n"
|
||||||
"[-x #] infile\n");
|
" [-x #] infile\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,27 +51,30 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
depth = 2;
|
depth = 2;
|
||||||
|
|
||||||
while((ch = getopt(argc, argv, "DvFfd:hx:Tt:uPp:o:")) != -1) {
|
while((ch = getopt(argc, argv, "Dd:Ffho:Tt:uPp:Vvx:")) != -1) {
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
case 'D':
|
case 'D':
|
||||||
opts.debug = true;
|
opts.debug = true;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'd':
|
||||||
opts.verbose = true;
|
depth = strtoul(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
opts.hardfix = true;
|
opts.hardfix = true;
|
||||||
case 'f':
|
case 'f':
|
||||||
opts.fix = true;
|
opts.fix = true;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
|
||||||
depth = strtoul(optarg, NULL, 0);
|
|
||||||
break;
|
|
||||||
case 'h':
|
case 'h':
|
||||||
opts.horizontal = true;
|
opts.horizontal = true;
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'o':
|
||||||
opts.trim = strtoul(optarg, NULL, 0);
|
opts.outfile = optarg;
|
||||||
|
break;
|
||||||
|
case 'P':
|
||||||
|
opts.palout = true;
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
opts.palfile = optarg;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
opts.mapout = true;
|
opts.mapout = true;
|
||||||
@@ -80,17 +85,18 @@ main(int argc, char *argv[])
|
|||||||
case 'u':
|
case 'u':
|
||||||
opts.unique = true;
|
opts.unique = true;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'V':
|
||||||
opts.palout = true;
|
printf("rgbgfx %s\n", get_package_version_string());
|
||||||
|
exit(0);
|
||||||
|
case 'v':
|
||||||
|
opts.verbose = true;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'x':
|
||||||
opts.palfile = optarg;
|
opts.trim = strtoul(optarg, NULL, 0);
|
||||||
break;
|
|
||||||
case 'o':
|
|
||||||
opts.outfile = optarg;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
.Nd Game Boy graphics converter
|
.Nd Game Boy graphics converter
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm rgbgfx
|
.Nm rgbgfx
|
||||||
.Op Fl DfFhPTv
|
.Op Fl DfFhPTVv
|
||||||
.Op Fl o Ar outfile
|
.Op Fl o Ar outfile
|
||||||
.Op Fl d Ar depth
|
.Op Fl d Ar depth
|
||||||
.Op Fl p Ar palfile
|
.Op Fl p Ar palfile
|
||||||
@@ -70,6 +70,8 @@ removing the file extension, and appending
|
|||||||
.Pa .tilemap .
|
.Pa .tilemap .
|
||||||
.It Fl u
|
.It Fl u
|
||||||
Truncate repeated tiles. Useful with tilemaps.
|
Truncate repeated tiles. Useful with tilemaps.
|
||||||
|
.It Fl V
|
||||||
|
Print the version of the program and exit.
|
||||||
.It Fl v
|
.It Fl v
|
||||||
Verbose.
|
Verbose.
|
||||||
Print errors when the command line parameters and the parameters in
|
Print errors when the command line parameters and the parameters in
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ AssignFloatingBankSections(enum eSectionType type)
|
|||||||
|
|
||||||
if ((org = area_AllocAnyBank(pSection->nByteSize, pSection->nAlign, type)) != -1) {
|
if ((org = area_AllocAnyBank(pSection->nByteSize, pSection->nAlign, type)) != -1) {
|
||||||
if (options & OPT_OVERLAY) {
|
if (options & OPT_OVERLAY) {
|
||||||
errx(1, "All sections must be fixed when using overlay");
|
errx(1, "All sections must be fixed when using an overlay file.");
|
||||||
}
|
}
|
||||||
pSection->nOrg = org & 0xFFFF;
|
pSection->nOrg = org & 0xFFFF;
|
||||||
pSection->nBank = org >> 16;
|
pSection->nBank = org >> 16;
|
||||||
@@ -512,7 +512,7 @@ AssignSections(void)
|
|||||||
if (pSection->oAssigned == 0
|
if (pSection->oAssigned == 0
|
||||||
&& pSection->nOrg != -1 && pSection->nBank == -1) {
|
&& pSection->nOrg != -1 && pSection->nBank == -1) {
|
||||||
if (options & OPT_OVERLAY) {
|
if (options & OPT_OVERLAY) {
|
||||||
errx(1, "All sections must be fixed when using overlay");
|
errx(1, "All sections must be fixed when using an overlay file.");
|
||||||
}
|
}
|
||||||
switch (pSection->Type) {
|
switch (pSection->Type) {
|
||||||
case SECT_ROMX:
|
case SECT_ROMX:
|
||||||
@@ -566,16 +566,21 @@ CreateSymbolTable(void)
|
|||||||
((pSect->tSymbols[i]->pSection == pSect) ||
|
((pSect->tSymbols[i]->pSection == pSect) ||
|
||||||
(pSect->tSymbols[i]->pSection == NULL))) {
|
(pSect->tSymbols[i]->pSection == NULL))) {
|
||||||
if (pSect->tSymbols[i]->pSection == NULL)
|
if (pSect->tSymbols[i]->pSection == NULL)
|
||||||
sym_CreateSymbol(pSect->tSymbols[i]->
|
sym_CreateSymbol(
|
||||||
pzName,
|
pSect->tSymbols[i]->pzName,
|
||||||
pSect->tSymbols[i]->
|
pSect->tSymbols[i]->nOffset,
|
||||||
nOffset, -1);
|
-1,
|
||||||
|
pSect->tSymbols[i]->pzObjFileName,
|
||||||
|
pSect->tSymbols[i]->pzFileName,
|
||||||
|
pSect->tSymbols[i]->nFileLine);
|
||||||
else
|
else
|
||||||
sym_CreateSymbol(pSect->tSymbols[i]->
|
sym_CreateSymbol(
|
||||||
pzName,
|
pSect->tSymbols[i]->pzName,
|
||||||
pSect->nOrg +
|
pSect->nOrg + pSect->tSymbols[i]->nOffset,
|
||||||
pSect->tSymbols[i]->
|
pSect->nBank,
|
||||||
nOffset, pSect->nBank);
|
pSect->tSymbols[i]->pzObjFileName,
|
||||||
|
pSect->tSymbols[i]->pzFileName,
|
||||||
|
pSect->tSymbols[i]->nFileLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pSect = pSect->pNext;
|
pSect = pSect->pNext;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
|
#include "extern/version.h"
|
||||||
#include "link/object.h"
|
#include "link/object.h"
|
||||||
#include "link/output.h"
|
#include "link/output.h"
|
||||||
#include "link/assign.h"
|
#include "link/assign.h"
|
||||||
@@ -33,7 +34,7 @@ static void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"usage: rgblink [-twd] [-l linkerscript] [-m mapfile] [-n symfile] [-O overlay]\n"
|
"usage: rgblink [-dtVw] [-l linkerscript] [-m mapfile] [-n symfile] [-O overlay]\n"
|
||||||
" [-o outfile] [-p pad_value] [-s symbol] file [...]\n");
|
" [-o outfile] [-p pad_value] [-s symbol] file [...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -52,7 +53,7 @@ main(int argc, char *argv[])
|
|||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "l:m:n:o:O:p:s:twd")) != -1) {
|
while ((ch = getopt(argc, argv, "dl:m:n:O:o:p:s:tVw")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'l':
|
case 'l':
|
||||||
SetLinkerscriptName(optarg);
|
SetLinkerscriptName(optarg);
|
||||||
@@ -76,8 +77,7 @@ main(int argc, char *argv[])
|
|||||||
errx(1, "Invalid argument for option 'p'");
|
errx(1, "Invalid argument for option 'p'");
|
||||||
}
|
}
|
||||||
if (fillchar < 0 || fillchar > 0xFF) {
|
if (fillchar < 0 || fillchar > 0xFF) {
|
||||||
fprintf(stderr, "Argument for option 'p' must be between 0 and 0xFF");
|
errx(1, "Argument for option 'p' must be between 0 and 0xFF");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
@@ -98,7 +98,7 @@ main(int argc, char *argv[])
|
|||||||
* This option implies OPT_CONTWRAM.
|
* This option implies OPT_CONTWRAM.
|
||||||
*/
|
*/
|
||||||
options |= OPT_DMG_MODE;
|
options |= OPT_DMG_MODE;
|
||||||
/* fallthrough */
|
/* FALLTHROUGH */
|
||||||
case 'w':
|
case 'w':
|
||||||
/* Set to set WRAM as a single continuous block as on
|
/* Set to set WRAM as a single continuous block as on
|
||||||
* DMG. All WRAM sections must be WRAM0 as bankable WRAM
|
* DMG. All WRAM sections must be WRAM0 as bankable WRAM
|
||||||
@@ -106,6 +106,9 @@ main(int argc, char *argv[])
|
|||||||
* will raise an error. */
|
* will raise an error. */
|
||||||
options |= OPT_CONTWRAM;
|
options |= OPT_CONTWRAM;
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
printf("rgblink %s\n", get_package_version_string());
|
||||||
|
exit(0);
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
|||||||
@@ -3,11 +3,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
#include "link/assign.h"
|
#include "link/assign.h"
|
||||||
#include "link/mylink.h"
|
#include "link/mylink.h"
|
||||||
@@ -116,7 +118,7 @@ AllocSection(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct sSymbol *
|
struct sSymbol *
|
||||||
obj_ReadSymbol(FILE * f)
|
obj_ReadSymbol(FILE * f, char *tzObjectfile)
|
||||||
{
|
{
|
||||||
struct sSymbol *pSym;
|
struct sSymbol *pSym;
|
||||||
|
|
||||||
@@ -126,7 +128,14 @@ obj_ReadSymbol(FILE * f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
readasciiz(&pSym->pzName, f);
|
readasciiz(&pSym->pzName, f);
|
||||||
if ((pSym->Type = (enum eSymbolType) fgetc(f)) != SYM_IMPORT) {
|
pSym->Type = (enum eSymbolType)fgetc(f);
|
||||||
|
|
||||||
|
pSym->pzObjFileName = tzObjectfile;
|
||||||
|
|
||||||
|
if (pSym->Type != SYM_IMPORT) {
|
||||||
|
readasciiz(&pSym->pzFileName, f);
|
||||||
|
pSym->nFileLine = readlong(f);
|
||||||
|
|
||||||
pSym->nSectionID = readlong(f);
|
pSym->nSectionID = readlong(f);
|
||||||
pSym->nOffset = readlong(f);
|
pSym->nOffset = readlong(f);
|
||||||
}
|
}
|
||||||
@@ -219,8 +228,11 @@ obj_ReadRGBSection(FILE * f)
|
|||||||
SLONG nNumberOfPatches;
|
SLONG nNumberOfPatches;
|
||||||
struct sPatch **ppPatch, *pPatch;
|
struct sPatch **ppPatch, *pPatch;
|
||||||
|
|
||||||
fread(pSection->pData, sizeof(UBYTE),
|
if (fread(pSection->pData, sizeof(UBYTE),
|
||||||
pSection->nByteSize, f);
|
pSection->nByteSize, f) != pSection->nByteSize) {
|
||||||
|
err(1, "Read error.");
|
||||||
|
}
|
||||||
|
|
||||||
nNumberOfPatches = readlong(f);
|
nNumberOfPatches = readlong(f);
|
||||||
ppPatch = &pSection->pPatches;
|
ppPatch = &pSection->pPatches;
|
||||||
|
|
||||||
@@ -245,8 +257,10 @@ obj_ReadRGBSection(FILE * f)
|
|||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(pPatch->pRPN, sizeof(UBYTE),
|
if (fread(pPatch->pRPN, sizeof(UBYTE),
|
||||||
pPatch->nRPNSize, f);
|
pPatch->nRPNSize, f) != pPatch->nRPNSize) {
|
||||||
|
errx(1, "Read error.");
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
pPatch->pRPN = NULL;
|
pPatch->pRPN = NULL;
|
||||||
|
|
||||||
@@ -263,7 +277,7 @@ obj_ReadRGBSection(FILE * f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
obj_ReadRGB(FILE * pObjfile)
|
obj_ReadRGB(FILE * pObjfile, char *tzObjectfile)
|
||||||
{
|
{
|
||||||
struct sSection *pFirstSection;
|
struct sSection *pFirstSection;
|
||||||
SLONG nNumberOfSymbols, nNumberOfSections, i;
|
SLONG nNumberOfSymbols, nNumberOfSections, i;
|
||||||
@@ -280,7 +294,7 @@ obj_ReadRGB(FILE * pObjfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nNumberOfSymbols; i += 1)
|
for (i = 0; i < nNumberOfSymbols; i += 1)
|
||||||
tSymbols[i] = obj_ReadSymbol(pObjfile);
|
tSymbols[i] = obj_ReadSymbol(pObjfile, tzObjectfile);
|
||||||
} else
|
} else
|
||||||
tSymbols = (struct sSymbol **) & dummymem;
|
tSymbols = (struct sSymbol **) & dummymem;
|
||||||
|
|
||||||
@@ -325,21 +339,24 @@ obj_ReadRGB(FILE * pObjfile)
|
|||||||
void
|
void
|
||||||
obj_ReadOpenFile(FILE * pObjfile, char *tzObjectfile)
|
obj_ReadOpenFile(FILE * pObjfile, char *tzObjectfile)
|
||||||
{
|
{
|
||||||
char tzHeader[8];
|
char tzHeader[strlen(RGBDS_OBJECT_VERSION_STRING) + 1];
|
||||||
|
|
||||||
fread(tzHeader, sizeof(char), 4, pObjfile);
|
if (fread(tzHeader, sizeof(char), strlen(RGBDS_OBJECT_VERSION_STRING),
|
||||||
tzHeader[4] = 0;
|
pObjfile) != strlen(RGBDS_OBJECT_VERSION_STRING)) {
|
||||||
if (strncmp(tzHeader, "RGB", 3) == 0) {
|
errx(1, "%s: Read error.", tzObjectfile);
|
||||||
switch (tzHeader[3]) {
|
}
|
||||||
case '3':
|
|
||||||
case '4': // V4 supports OAM sections, but is otherwise identical
|
tzHeader[strlen(RGBDS_OBJECT_VERSION_STRING)] = 0;
|
||||||
obj_ReadRGB(pObjfile);
|
|
||||||
break;
|
if (strncmp(tzHeader, RGBDS_OBJECT_VERSION_STRING,
|
||||||
default:
|
strlen(RGBDS_OBJECT_VERSION_STRING)) == 0) {
|
||||||
errx(1, "'%s' uses an unsupported object file version (%s). Please reassemble it.", tzObjectfile, tzHeader);
|
obj_ReadRGB(pObjfile, tzObjectfile);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
errx(1, "'%s' is not a valid object", tzObjectfile);
|
for (int i = 0; i < strlen(RGBDS_OBJECT_VERSION_STRING); i++)
|
||||||
|
if (!isprint(tzHeader[i]))
|
||||||
|
tzHeader[i] = '?';
|
||||||
|
errx(1, "%s: Invalid file or object file version [%s]",
|
||||||
|
tzObjectfile, tzHeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "extern/err.h"
|
||||||
#include "link/mylink.h"
|
#include "link/mylink.h"
|
||||||
#include "link/mapfile.h"
|
#include "link/mapfile.h"
|
||||||
#include "link/main.h"
|
#include "link/main.h"
|
||||||
@@ -24,7 +25,10 @@ writehome(FILE * f, FILE * f_overlay)
|
|||||||
|
|
||||||
if (f_overlay != NULL) {
|
if (f_overlay != NULL) {
|
||||||
fseek(f_overlay, 0L, SEEK_SET);
|
fseek(f_overlay, 0L, SEEK_SET);
|
||||||
fread(mem, 1, MaxAvail[BANK_ROM0], f_overlay);
|
if (fread(mem, 1, MaxAvail[BANK_ROM0], f_overlay) !=
|
||||||
|
MaxAvail[BANK_ROM0]) {
|
||||||
|
warnx("Failed to read data from overlay file.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
memset(mem, fillchar, MaxAvail[BANK_ROM0]);
|
memset(mem, fillchar, MaxAvail[BANK_ROM0]);
|
||||||
}
|
}
|
||||||
@@ -58,7 +62,10 @@ writebank(FILE * f, FILE * f_overlay, SLONG bank)
|
|||||||
|
|
||||||
if (f_overlay != NULL && bank <= MaxOverlayBank) {
|
if (f_overlay != NULL && bank <= MaxOverlayBank) {
|
||||||
fseek(f_overlay, bank*0x4000, SEEK_SET);
|
fseek(f_overlay, bank*0x4000, SEEK_SET);
|
||||||
fread(mem, 1, MaxAvail[bank], f_overlay);
|
if (fread(mem, 1, MaxAvail[bank], f_overlay) !=
|
||||||
|
MaxAvail[bank]) {
|
||||||
|
warnx("Failed to read data from overlay file.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
memset(mem, fillchar, MaxAvail[bank]);
|
memset(mem, fillchar, MaxAvail[bank]);
|
||||||
}
|
}
|
||||||
@@ -104,18 +111,15 @@ Output(void)
|
|||||||
if (tzOverlayname) {
|
if (tzOverlayname) {
|
||||||
f_overlay = fopen(tzOverlayname, "rb");
|
f_overlay = fopen(tzOverlayname, "rb");
|
||||||
if (!f_overlay) {
|
if (!f_overlay) {
|
||||||
fprintf(stderr, "Failed to open overlay file %s\n", tzOverlayname);
|
errx(1, "Failed to open overlay file %s\n", tzOverlayname);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
fseek(f_overlay, 0, SEEK_END);
|
fseek(f_overlay, 0, SEEK_END);
|
||||||
if (ftell(f_overlay) % 0x4000 != 0) {
|
if (ftell(f_overlay) % 0x4000 != 0) {
|
||||||
fprintf(stderr, "Overlay file must be aligned to 0x4000 bytes\n");
|
errx(1, "Overlay file must be aligned to 0x4000 bytes.");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
MaxOverlayBank = (ftell(f_overlay) / 0x4000) - 1;
|
MaxOverlayBank = (ftell(f_overlay) / 0x4000) - 1;
|
||||||
if (MaxOverlayBank < 1) {
|
if (MaxOverlayBank < 1) {
|
||||||
fprintf(stderr, "Overlay file be at least 0x8000 bytes\n");
|
errx(1, "Overlay file must be at least 0x8000 bytes.");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
if (MaxOverlayBank > MaxBankUsed) {
|
if (MaxOverlayBank > MaxBankUsed) {
|
||||||
MaxBankUsed = MaxOverlayBank;
|
MaxBankUsed = MaxOverlayBank;
|
||||||
|
|||||||
@@ -20,9 +20,7 @@
|
|||||||
.Nd Game Boy linker
|
.Nd Game Boy linker
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm rgblink
|
.Nm rgblink
|
||||||
.Op Fl t
|
.Op Fl dtVw
|
||||||
.Op Fl w
|
|
||||||
.Op Fl d
|
|
||||||
.Op Fl m Ar mapfile
|
.Op Fl m Ar mapfile
|
||||||
.Op Fl n Ar symfile
|
.Op Fl n Ar symfile
|
||||||
.Op Fl O Ar overlayfile
|
.Op Fl O Ar overlayfile
|
||||||
@@ -95,6 +93,8 @@ have to be consistent.
|
|||||||
See
|
See
|
||||||
.Xr rgblink 5
|
.Xr rgblink 5
|
||||||
for more information about its format.
|
for more information about its format.
|
||||||
|
.It Fl V
|
||||||
|
Print the version of the program and exit.
|
||||||
.El
|
.El
|
||||||
.Sh EXAMPLES
|
.Sh EXAMPLES
|
||||||
All you need for a basic ROM is an object file, which can be made into a ROM
|
All you need for a basic ROM is an object file, which can be made into a ROM
|
||||||
|
|||||||
@@ -12,8 +12,10 @@
|
|||||||
struct ISymbol {
|
struct ISymbol {
|
||||||
char *pzName;
|
char *pzName;
|
||||||
SLONG nValue;
|
SLONG nValue;
|
||||||
SLONG nBank;
|
SLONG nBank; /* -1 = constant */
|
||||||
//-1 = const
|
char tzObjFileName[_MAX_PATH + 1]; /* Object file where the symbol was defined. */
|
||||||
|
char tzFileName[_MAX_PATH + 1]; /* Source file where the symbol was defined. */
|
||||||
|
ULONG nFileLine; /* Line where the symbol was defined. */
|
||||||
struct ISymbol *pNext;
|
struct ISymbol *pNext;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,7 +78,8 @@ sym_GetBank(char *tzName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sym_CreateSymbol(char *tzName, SLONG nValue, SLONG nBank)
|
sym_CreateSymbol(char *tzName, SLONG nValue, SLONG nBank, char *tzObjFileName,
|
||||||
|
char *tzFileName, ULONG nFileLine)
|
||||||
{
|
{
|
||||||
if (strcmp(tzName, "@") == 0)
|
if (strcmp(tzName, "@") == 0)
|
||||||
return;
|
return;
|
||||||
@@ -92,7 +95,10 @@ sym_CreateSymbol(char *tzName, SLONG nValue, SLONG nBank)
|
|||||||
if (nBank == -1)
|
if (nBank == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
errx(1, "Symbol '%s' defined more than once", tzName);
|
errx(1, "'%s' in both %s : %s(%d) and %s : %s(%d)",
|
||||||
|
tzName, tzObjFileName, tzFileName, nFileLine,
|
||||||
|
(*ppSym)->tzObjFileName,
|
||||||
|
(*ppSym)->tzFileName, (*ppSym)->nFileLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +108,11 @@ sym_CreateSymbol(char *tzName, SLONG nValue, SLONG nBank)
|
|||||||
(*ppSym)->nValue = nValue;
|
(*ppSym)->nValue = nValue;
|
||||||
(*ppSym)->nBank = nBank;
|
(*ppSym)->nBank = nBank;
|
||||||
(*ppSym)->pNext = NULL;
|
(*ppSym)->pNext = NULL;
|
||||||
|
strncpy((*ppSym)->tzObjFileName, tzObjFileName,
|
||||||
|
sizeof((*ppSym)->tzObjFileName));
|
||||||
|
strncpy((*ppSym)->tzFileName, tzFileName,
|
||||||
|
sizeof((*ppSym)->tzFileName));
|
||||||
|
(*ppSym)->nFileLine = nFileLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
.\"
|
.\"
|
||||||
.Dd April 17, 2017
|
.Dd July 22, 2017
|
||||||
.Dt RGBDS 5
|
.Dt RGBDS 5
|
||||||
.Os RGBDS Manual
|
.Os RGBDS Manual
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -42,7 +42,7 @@ is a 0‐terminated string of
|
|||||||
.Bd -literal
|
.Bd -literal
|
||||||
; Header
|
; Header
|
||||||
|
|
||||||
BYTE ID[4] ; "RGB4"
|
BYTE ID[4] ; "RGB5"
|
||||||
LONG NumberOfSymbols ; The number of symbols used in this file
|
LONG NumberOfSymbols ; The number of symbols used in this file
|
||||||
LONG NumberOfSections ; The number of sections used in this file
|
LONG NumberOfSections ; The number of sections used in this file
|
||||||
|
|
||||||
@@ -59,6 +59,10 @@ REPT NumberOfSymbols ; Number of symbols defined in this object file.
|
|||||||
|
|
||||||
IF Type != 1 ; If symbol is defined in this object file.
|
IF Type != 1 ; If symbol is defined in this object file.
|
||||||
|
|
||||||
|
STRING FileName ; File where the symbol is defined.
|
||||||
|
|
||||||
|
LONG LineNum ; Line number in the file where the symbol is defined.
|
||||||
|
|
||||||
LONG SectionID ; The section number (of this object file) in which
|
LONG SectionID ; The section number (of this object file) in which
|
||||||
; this symbol is defined.
|
; this symbol is defined.
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
fname=$(mktemp)
|
fname=$(mktemp)
|
||||||
rc=0
|
rc=0
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
fname=$(mktemp)
|
fname=$(mktemp)
|
||||||
|
|
||||||
for i in *.asm; do
|
for i in *.asm; do
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
otemp=$(mktemp)
|
otemp=$(mktemp)
|
||||||
gbtemp=$(mktemp)
|
gbtemp=$(mktemp)
|
||||||
gbtemp2=$(mktemp)
|
gbtemp2=$(mktemp)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
otemp=$(mktemp)
|
otemp=$(mktemp)
|
||||||
gbtemp=$(mktemp)
|
gbtemp=$(mktemp)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user