mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Replace ULONG by uint32_t
All affected `printf` have been fixed. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -14,24 +14,22 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include "asm/symbol.h"
|
|
||||||
|
|
||||||
#include "asm/localasm.h"
|
#include "asm/localasm.h"
|
||||||
|
#include "asm/symbol.h"
|
||||||
|
|
||||||
#define MAXUNIONS 128
|
#define MAXUNIONS 128
|
||||||
#define MAXMACROARGS 256
|
#define MAXMACROARGS 256
|
||||||
#define MAXINCPATHS 128
|
#define MAXINCPATHS 128
|
||||||
|
|
||||||
extern int32_t nLineNo;
|
extern int32_t nLineNo;
|
||||||
extern ULONG nTotalLines;
|
extern uint32_t nTotalLines;
|
||||||
extern ULONG nPC;
|
extern uint32_t nPC;
|
||||||
extern ULONG nPass;
|
extern uint32_t nPass;
|
||||||
extern ULONG nIFDepth;
|
extern uint32_t nIFDepth;
|
||||||
extern bool skipElif;
|
extern bool skipElif;
|
||||||
extern ULONG nUnionDepth;
|
extern uint32_t nUnionDepth;
|
||||||
extern ULONG unionStart[MAXUNIONS];
|
extern uint32_t unionStart[MAXUNIONS];
|
||||||
extern ULONG unionSize[MAXUNIONS];
|
extern uint32_t 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];
|
||||||
|
|||||||
@@ -13,9 +13,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "asm/asm.h"
|
#include "asm/asm.h"
|
||||||
#include "types.h"
|
|
||||||
#include "asm/lexer.h"
|
#include "asm/lexer.h"
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
struct sContext {
|
struct sContext {
|
||||||
YY_BUFFER_STATE FlexHandle;
|
YY_BUFFER_STATE FlexHandle;
|
||||||
struct sSymbol *pMacro;
|
struct sSymbol *pMacro;
|
||||||
@@ -23,11 +24,11 @@ struct sContext {
|
|||||||
char tzFileName[_MAX_PATH + 1];
|
char tzFileName[_MAX_PATH + 1];
|
||||||
char *tzMacroArgs[MAXMACROARGS + 1];
|
char *tzMacroArgs[MAXMACROARGS + 1];
|
||||||
int32_t nLine;
|
int32_t nLine;
|
||||||
ULONG nStatus;
|
uint32_t nStatus;
|
||||||
FILE *pFile;
|
FILE *pFile;
|
||||||
char *pREPTBlock;
|
char *pREPTBlock;
|
||||||
ULONG nREPTBlockCount;
|
uint32_t nREPTBlockCount;
|
||||||
ULONG nREPTBlockSize;
|
uint32_t nREPTBlockSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -37,8 +38,8 @@ void
|
|||||||
fstk_Init(char *);
|
fstk_Init(char *);
|
||||||
extern void fstk_Dump(void);
|
extern void fstk_Dump(void);
|
||||||
extern void fstk_AddIncludePath(char *s);
|
extern void fstk_AddIncludePath(char *s);
|
||||||
extern ULONG fstk_RunMacro(char *s);
|
extern uint32_t fstk_RunMacro(char *s);
|
||||||
extern void fstk_RunRept(ULONG count);
|
extern void fstk_RunRept(uint32_t count);
|
||||||
FILE *
|
FILE *
|
||||||
fstk_FindFile(char *);
|
fstk_FindFile(char *);
|
||||||
|
|
||||||
|
|||||||
@@ -4,19 +4,17 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
#define LEXHASHSIZE (1 << 11)
|
#define LEXHASHSIZE (1 << 11)
|
||||||
#define MAXSTRLEN 255
|
#define MAXSTRLEN 255
|
||||||
|
|
||||||
struct sLexInitString {
|
struct sLexInitString {
|
||||||
char *tzName;
|
char *tzName;
|
||||||
ULONG nToken;
|
uint32_t nToken;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sLexFloat {
|
struct sLexFloat {
|
||||||
ULONG(*Callback) (char *s, ULONG size);
|
uint32_t(*Callback) (char *s, uint32_t size);
|
||||||
ULONG nToken;
|
uint32_t nToken;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct yy_buffer_state {
|
struct yy_buffer_state {
|
||||||
@@ -24,8 +22,8 @@ struct yy_buffer_state {
|
|||||||
char *pBufferStart; // address where the data is initially written
|
char *pBufferStart; // address where the data is initially written
|
||||||
// after the "safety margin"
|
// after the "safety margin"
|
||||||
char *pBuffer;
|
char *pBuffer;
|
||||||
ULONG nBufferSize;
|
uint32_t nBufferSize;
|
||||||
ULONG oAtLineStart;
|
uint32_t oAtLineStart;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eLexerState {
|
enum eLexerState {
|
||||||
@@ -39,24 +37,24 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
|||||||
|
|
||||||
extern void yy_set_state(enum eLexerState i);
|
extern void yy_set_state(enum eLexerState i);
|
||||||
extern YY_BUFFER_STATE yy_create_buffer(FILE * f);
|
extern YY_BUFFER_STATE yy_create_buffer(FILE * f);
|
||||||
extern YY_BUFFER_STATE yy_scan_bytes(char *mem, ULONG size);
|
extern YY_BUFFER_STATE yy_scan_bytes(char *mem, uint32_t size);
|
||||||
extern void yy_delete_buffer(YY_BUFFER_STATE);
|
extern void yy_delete_buffer(YY_BUFFER_STATE);
|
||||||
extern void yy_switch_to_buffer(YY_BUFFER_STATE);
|
extern void yy_switch_to_buffer(YY_BUFFER_STATE);
|
||||||
extern ULONG lex_FloatAlloc(struct sLexFloat * tok);
|
extern uint32_t lex_FloatAlloc(struct sLexFloat * tok);
|
||||||
extern void lex_FloatAddRange(ULONG id, uint16_t start, uint16_t end);
|
extern void lex_FloatAddRange(uint32_t id, uint16_t start, uint16_t end);
|
||||||
extern void lex_FloatDeleteRange(ULONG id, uint16_t start, uint16_t end);
|
extern void lex_FloatDeleteRange(uint32_t id, uint16_t start, uint16_t end);
|
||||||
extern void lex_FloatAddFirstRange(ULONG id, uint16_t start, uint16_t end);
|
extern void lex_FloatAddFirstRange(uint32_t id, uint16_t start, uint16_t end);
|
||||||
extern void lex_FloatDeleteFirstRange(ULONG id, uint16_t start, uint16_t end);
|
extern void lex_FloatDeleteFirstRange(uint32_t id, uint16_t start, uint16_t end);
|
||||||
extern void lex_FloatAddSecondRange(ULONG id, uint16_t start, uint16_t end);
|
extern void lex_FloatAddSecondRange(uint32_t id, uint16_t start, uint16_t end);
|
||||||
extern void lex_FloatDeleteSecondRange(ULONG id, uint16_t start, uint16_t end);
|
extern void lex_FloatDeleteSecondRange(uint32_t id, uint16_t start, uint16_t end);
|
||||||
extern void lex_Init(void);
|
extern void lex_Init(void);
|
||||||
extern void lex_AddStrings(struct sLexInitString * lex);
|
extern void lex_AddStrings(struct sLexInitString * lex);
|
||||||
extern void lex_SetBuffer(char *buffer, ULONG len);
|
extern void lex_SetBuffer(char *buffer, uint32_t len);
|
||||||
extern ULONG yylex(void);
|
extern uint32_t yylex(void);
|
||||||
extern void yyunput(char c);
|
extern void yyunput(char c);
|
||||||
extern void yyunputstr(char *s);
|
extern void yyunputstr(char *s);
|
||||||
extern void yyskipbytes(ULONG count);
|
extern void yyskipbytes(uint32_t count);
|
||||||
extern void yyunputbytes(ULONG count);
|
extern void yyunputbytes(uint32_t count);
|
||||||
|
|
||||||
extern YY_BUFFER_STATE pCurrentBuffer;
|
extern YY_BUFFER_STATE pCurrentBuffer;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ struct sOptions {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern char *tzNewMacro;
|
extern char *tzNewMacro;
|
||||||
extern ULONG ulNewMacroSize;
|
extern uint32_t ulNewMacroSize;
|
||||||
extern int32_t nGBGfxID;
|
extern int32_t nGBGfxID;
|
||||||
extern int32_t nBinaryID;
|
extern int32_t nBinaryID;
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,14 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "asm/rpn.h"
|
#include "asm/rpn.h"
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
struct Section {
|
struct Section {
|
||||||
char *pzName;
|
char *pzName;
|
||||||
uint8_t nType;
|
uint8_t nType;
|
||||||
ULONG nPC;
|
uint32_t nPC;
|
||||||
ULONG nOrg;
|
uint32_t nOrg;
|
||||||
ULONG nBank;
|
uint32_t nBank;
|
||||||
ULONG nAlign;
|
uint32_t nAlign;
|
||||||
struct Section *pNext;
|
struct Section *pNext;
|
||||||
struct Patch *pPatches;
|
struct Patch *pPatches;
|
||||||
struct Charmap *charmap;
|
struct Charmap *charmap;
|
||||||
@@ -21,9 +20,9 @@ struct Section {
|
|||||||
|
|
||||||
void out_PrepPass2(void);
|
void out_PrepPass2(void);
|
||||||
void out_SetFileName(char *s);
|
void out_SetFileName(char *s);
|
||||||
void out_NewSection(char *pzName, ULONG secttype);
|
void out_NewSection(char *pzName, uint32_t secttype);
|
||||||
void out_NewAbsSection(char *pzName, ULONG secttype, int32_t org, int32_t bank);
|
void out_NewAbsSection(char *pzName, uint32_t secttype, int32_t org, int32_t bank);
|
||||||
void out_NewAlignedSection(char *pzName, ULONG secttype, int32_t alignment, int32_t bank);
|
void out_NewAlignedSection(char *pzName, uint32_t secttype, int32_t alignment, int32_t bank);
|
||||||
void out_AbsByte(int b);
|
void out_AbsByte(int b);
|
||||||
void out_AbsByteGroup(char *s, int length);
|
void out_AbsByteGroup(char *s, int length);
|
||||||
void out_RelByte(struct Expression * expr);
|
void out_RelByte(struct Expression * expr);
|
||||||
|
|||||||
@@ -4,18 +4,18 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
struct Expression {
|
struct Expression {
|
||||||
int32_t nVal;
|
int32_t nVal;
|
||||||
uint8_t tRPN[256];
|
uint8_t tRPN[256];
|
||||||
ULONG nRPNLength;
|
uint32_t nRPNLength;
|
||||||
ULONG nRPNOut;
|
uint32_t nRPNOut;
|
||||||
ULONG isReloc;
|
uint32_t isReloc;
|
||||||
ULONG isPCRel;
|
uint32_t isPCRel;
|
||||||
};
|
};
|
||||||
|
|
||||||
ULONG rpn_isReloc(struct Expression * expr);
|
uint32_t rpn_isReloc(struct Expression * expr);
|
||||||
ULONG rpn_isPCRelative(struct Expression * expr);
|
uint32_t rpn_isPCRelative(struct Expression * expr);
|
||||||
void rpn_Symbol(struct Expression * expr, char *tzSym);
|
void rpn_Symbol(struct Expression * expr, char *tzSym);
|
||||||
void rpn_Number(struct Expression * expr, ULONG i);
|
void rpn_Number(struct Expression * expr, uint32_t i);
|
||||||
void rpn_LOGNOT(struct Expression * expr, struct Expression * src1);
|
void rpn_LOGNOT(struct Expression * expr, struct Expression * src1);
|
||||||
void
|
void
|
||||||
rpn_LOGOR(struct Expression * expr, struct Expression * src1,
|
rpn_LOGOR(struct Expression * expr, struct Expression * src1,
|
||||||
|
|||||||
@@ -11,15 +11,15 @@
|
|||||||
struct sSymbol {
|
struct sSymbol {
|
||||||
char tzName[MAXSYMLEN + 1];
|
char tzName[MAXSYMLEN + 1];
|
||||||
int32_t nValue;
|
int32_t nValue;
|
||||||
ULONG nType;
|
uint32_t nType;
|
||||||
struct sSymbol *pScope;
|
struct sSymbol *pScope;
|
||||||
struct sSymbol *pNext;
|
struct sSymbol *pNext;
|
||||||
struct Section *pSection;
|
struct Section *pSection;
|
||||||
ULONG ulMacroSize;
|
uint32_t ulMacroSize;
|
||||||
char *pMacro;
|
char *pMacro;
|
||||||
int32_t(*Callback) (struct sSymbol *);
|
int32_t(*Callback) (struct sSymbol *);
|
||||||
char tzFileName[_MAX_PATH + 1]; /* File where the symbol was defined. */
|
char tzFileName[_MAX_PATH + 1]; /* File where the symbol was defined. */
|
||||||
ULONG nFileLine; /* Line where the symbol was defined. */
|
uint32_t 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
|
||||||
@@ -39,7 +39,7 @@ struct sSymbol {
|
|||||||
#define SYMF_CONST 0x200 /* symbol has a constant value, will
|
#define SYMF_CONST 0x200 /* symbol has a constant value, will
|
||||||
* not be changed during linking */
|
* not be changed during linking */
|
||||||
|
|
||||||
ULONG calchash(char *s);
|
uint32_t calchash(char *s);
|
||||||
void sym_SetExportAll(uint8_t set);
|
void sym_SetExportAll(uint8_t set);
|
||||||
void sym_PrepPass1(void);
|
void sym_PrepPass1(void);
|
||||||
void sym_PrepPass2(void);
|
void sym_PrepPass2(void);
|
||||||
@@ -57,23 +57,23 @@ void sym_FreeCurrentMacroArgs(void);
|
|||||||
void sym_AddEqu(char *tzSym, int32_t value);
|
void sym_AddEqu(char *tzSym, int32_t value);
|
||||||
void sym_AddSet(char *tzSym, int32_t value);
|
void sym_AddSet(char *tzSym, int32_t value);
|
||||||
void sym_Init(void);
|
void sym_Init(void);
|
||||||
ULONG sym_GetConstantValue(char *s);
|
uint32_t sym_GetConstantValue(char *s);
|
||||||
ULONG sym_isConstant(char *s);
|
uint32_t sym_isConstant(char *s);
|
||||||
struct sSymbol *sym_FindSymbol(char *tzName);
|
struct sSymbol *sym_FindSymbol(char *tzName);
|
||||||
void sym_Global(char *tzSym);
|
void sym_Global(char *tzSym);
|
||||||
char *sym_FindMacroArg(int32_t i);
|
char *sym_FindMacroArg(int32_t i);
|
||||||
char *sym_GetStringValue(char *tzSym);
|
char *sym_GetStringValue(char *tzSym);
|
||||||
void sym_UseCurrentMacroArgs(void);
|
void sym_UseCurrentMacroArgs(void);
|
||||||
void sym_SetMacroArgID(ULONG nMacroCount);
|
void sym_SetMacroArgID(uint32_t nMacroCount);
|
||||||
ULONG sym_isString(char *tzSym);
|
uint32_t sym_isString(char *tzSym);
|
||||||
void sym_AddMacro(char *tzSym);
|
void sym_AddMacro(char *tzSym);
|
||||||
void sym_ShiftCurrentMacroArgs(void);
|
void sym_ShiftCurrentMacroArgs(void);
|
||||||
void sym_AddString(char *tzSym, char *tzValue);
|
void sym_AddString(char *tzSym, char *tzValue);
|
||||||
ULONG sym_GetValue(char *s);
|
uint32_t sym_GetValue(char *s);
|
||||||
ULONG sym_GetDefinedValue(char *s);
|
uint32_t sym_GetDefinedValue(char *s);
|
||||||
ULONG sym_isDefined(char *tzName);
|
uint32_t sym_isDefined(char *tzName);
|
||||||
void sym_Purge(char *tzName);
|
void sym_Purge(char *tzName);
|
||||||
ULONG sym_isConstDefined(char *tzName);
|
uint32_t sym_isConstDefined(char *tzName);
|
||||||
int sym_IsRelocDiffDefined(char *tzSym1, char *tzSym2);
|
int sym_IsRelocDiffDefined(char *tzSym1, char *tzSym2);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "mylink.h"
|
#include "mylink.h"
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
enum eBankCount {
|
enum eBankCount {
|
||||||
BANK_COUNT_ROM0 = 1,
|
BANK_COUNT_ROM0 = 1,
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
#ifndef RGBDS_LINK_LINK_H
|
#ifndef RGBDS_LINK_LINK_H
|
||||||
#define RGBDS_LINK_LINK_H
|
#define RGBDS_LINK_LINK_H
|
||||||
|
|
||||||
#ifndef _MAX_PATH
|
|
||||||
#define _MAX_PATH 512
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
extern int32_t options;
|
extern int32_t options;
|
||||||
|
|
||||||
#define OPT_TINY 0x01
|
#define OPT_TINY 0x01
|
||||||
#define OPT_SMART_C_LINK 0x02
|
#define OPT_SMART_C_LINK 0x02
|
||||||
#define OPT_OVERLAY 0x04
|
#define OPT_OVERLAY 0x04
|
||||||
@@ -93,7 +88,7 @@ struct sSymbol {
|
|||||||
int32_t nOffset;
|
int32_t nOffset;
|
||||||
char *pzObjFileName; /* Object file where the symbol is located. */
|
char *pzObjFileName; /* Object file where the symbol is located. */
|
||||||
char *pzFileName; /* Source file where the symbol was defined. */
|
char *pzFileName; /* Source file where the symbol was defined. */
|
||||||
ULONG nFileLine; /* Line where the symbol was defined. */
|
uint32_t nFileLine; /* Line where the symbol was defined. */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ePatchType {
|
enum ePatchType {
|
||||||
|
|||||||
@@ -3,11 +3,9 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
void sym_Init(void);
|
void sym_Init(void);
|
||||||
void sym_CreateSymbol(char *tzName, int32_t nValue, int32_t nBank,
|
void sym_CreateSymbol(char *tzName, int32_t nValue, int32_t nBank,
|
||||||
char *tzObjFileName, char *tzFileName, ULONG nFileLine);
|
char *tzObjFileName, char *tzFileName, uint32_t nFileLine);
|
||||||
int32_t sym_GetValue(char *tzName);
|
int32_t sym_GetValue(char *tzName);
|
||||||
int32_t sym_GetBank(char *tzName);
|
int32_t sym_GetBank(char *tzName);
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
#define RGBDS_TYPES_H
|
#define RGBDS_TYPES_H
|
||||||
|
|
||||||
#ifndef _MAX_PATH
|
#ifndef _MAX_PATH
|
||||||
#define _MAX_PATH 512
|
#define _MAX_PATH 512
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef unsigned long ULONG;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -18,11 +18,11 @@
|
|||||||
#include "asm/main.h"
|
#include "asm/main.h"
|
||||||
#include "asm/lexer.h"
|
#include "asm/lexer.h"
|
||||||
|
|
||||||
char *tzNewMacro;
|
char *tzNewMacro;
|
||||||
ULONG ulNewMacroSize;
|
uint32_t ulNewMacroSize;
|
||||||
|
|
||||||
void
|
void
|
||||||
bankrangecheck(char *name, ULONG secttype, int32_t org, int32_t bank)
|
bankrangecheck(char *name, uint32_t secttype, int32_t org, int32_t bank)
|
||||||
{
|
{
|
||||||
int32_t minbank = 0, maxbank = 0;
|
int32_t minbank = 0, maxbank = 0;
|
||||||
char *stype = NULL;
|
char *stype = NULL;
|
||||||
@@ -81,8 +81,8 @@ size_t symvaluetostring(char *dest, size_t maxLength, char *sym)
|
|||||||
|
|
||||||
length = i;
|
length = i;
|
||||||
} else {
|
} else {
|
||||||
ULONG value = sym_GetConstantValue(sym);
|
uint32_t value = sym_GetConstantValue(sym);
|
||||||
int fullLength = snprintf(dest, maxLength + 1, "$%lX", value);
|
int fullLength = snprintf(dest, maxLength + 1, "$%X", value);
|
||||||
|
|
||||||
if (fullLength < 0) {
|
if (fullLength < 0) {
|
||||||
fatalerror("snprintf encoding error");
|
fatalerror("snprintf encoding error");
|
||||||
@@ -98,9 +98,9 @@ size_t symvaluetostring(char *dest, size_t maxLength, char *sym)
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG str2int( char *s )
|
uint32_t str2int( char *s )
|
||||||
{
|
{
|
||||||
ULONG r=0;
|
uint32_t r=0;
|
||||||
while( *s )
|
while( *s )
|
||||||
{
|
{
|
||||||
r<<=8;
|
r<<=8;
|
||||||
@@ -109,10 +109,10 @@ ULONG str2int( char *s )
|
|||||||
return( r );
|
return( r );
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG str2int2( char *s, int length )
|
uint32_t str2int2( char *s, int length )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
ULONG r=0;
|
uint32_t r=0;
|
||||||
i = (length - 4 < 0 ? 0 : length - 4);
|
i = (length - 4 < 0 ? 0 : length - 4);
|
||||||
while(i < length)
|
while(i < length)
|
||||||
{
|
{
|
||||||
@@ -123,22 +123,22 @@ ULONG str2int2( char *s, int length )
|
|||||||
return( r );
|
return( r );
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isWhiteSpace( char s )
|
uint32_t isWhiteSpace( char s )
|
||||||
{
|
{
|
||||||
return( s==' ' || s=='\t' || s=='\0' || s=='\n' );
|
return( s==' ' || s=='\t' || s=='\0' || s=='\n' );
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isRept( char *s )
|
uint32_t isRept( char *s )
|
||||||
{
|
{
|
||||||
return( (strncasecmp(s,"REPT",4)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[4]) );
|
return( (strncasecmp(s,"REPT",4)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[4]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isEndr( char *s )
|
uint32_t isEndr( char *s )
|
||||||
{
|
{
|
||||||
return( (strncasecmp(s,"Endr",4)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[4]) );
|
return( (strncasecmp(s,"Endr",4)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[4]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void copyrept( void )
|
void copyrept( void )
|
||||||
{
|
{
|
||||||
int32_t level=1, len, instring=0;
|
int32_t level=1, len, instring=0;
|
||||||
char *src=pCurrentBuffer->pBuffer;
|
char *src=pCurrentBuffer->pBuffer;
|
||||||
@@ -193,7 +193,7 @@ void copyrept( void )
|
|||||||
ulNewMacroSize=len;
|
ulNewMacroSize=len;
|
||||||
|
|
||||||
if ((tzNewMacro = malloc(ulNewMacroSize + 1)) != NULL) {
|
if ((tzNewMacro = malloc(ulNewMacroSize + 1)) != NULL) {
|
||||||
ULONG i;
|
uint32_t i;
|
||||||
|
|
||||||
tzNewMacro[ulNewMacroSize]=0;
|
tzNewMacro[ulNewMacroSize]=0;
|
||||||
for( i=0; i<ulNewMacroSize; i+=1 )
|
for( i=0; i<ulNewMacroSize; i+=1 )
|
||||||
@@ -208,17 +208,17 @@ void copyrept( void )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isMacro( char *s )
|
uint32_t isMacro( char *s )
|
||||||
{
|
{
|
||||||
return( (strncasecmp(s,"MACRO",4)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[5]) );
|
return( (strncasecmp(s,"MACRO",4)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[5]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isEndm( char *s )
|
uint32_t isEndm( char *s )
|
||||||
{
|
{
|
||||||
return( (strncasecmp(s,"Endm",4)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[4]) );
|
return( (strncasecmp(s,"Endm",4)==0) && isWhiteSpace(*(s-1)) && isWhiteSpace(s[4]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void copymacro( void )
|
void copymacro(void)
|
||||||
{
|
{
|
||||||
int32_t level=1, len, instring=0;
|
int32_t level=1, len, instring=0;
|
||||||
char *src=pCurrentBuffer->pBuffer;
|
char *src=pCurrentBuffer->pBuffer;
|
||||||
@@ -274,7 +274,7 @@ void copymacro( void )
|
|||||||
|
|
||||||
if( (tzNewMacro=(char *)malloc(ulNewMacroSize+2))!=NULL )
|
if( (tzNewMacro=(char *)malloc(ulNewMacroSize+2))!=NULL )
|
||||||
{
|
{
|
||||||
ULONG i;
|
uint32_t i;
|
||||||
|
|
||||||
tzNewMacro[ulNewMacroSize]='\n';
|
tzNewMacro[ulNewMacroSize]='\n';
|
||||||
tzNewMacro[ulNewMacroSize+1]=0;
|
tzNewMacro[ulNewMacroSize+1]=0;
|
||||||
@@ -290,22 +290,22 @@ void copymacro( void )
|
|||||||
yyskipbytes( ulNewMacroSize+4 );
|
yyskipbytes( ulNewMacroSize+4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isIf(char *s)
|
uint32_t 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 isElif(char *s)
|
uint32_t isElif(char *s)
|
||||||
{
|
{
|
||||||
return((strncasecmp(s,"Elif",4) == 0) && isWhiteSpace(s[-1]) && isWhiteSpace(s[4]));
|
return((strncasecmp(s,"Elif",4) == 0) && isWhiteSpace(s[-1]) && isWhiteSpace(s[4]));
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isElse(char *s)
|
uint32_t isElse(char *s)
|
||||||
{
|
{
|
||||||
return((strncasecmp(s,"Else",4) == 0) && isWhiteSpace(s[-1]) && isWhiteSpace(s[4]));
|
return((strncasecmp(s,"Else",4) == 0) && isWhiteSpace(s[-1]) && isWhiteSpace(s[4]));
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG isEndc(char *s)
|
uint32_t isEndc(char *s)
|
||||||
{
|
{
|
||||||
return((strncasecmp(s,"Endc",4) == 0) && isWhiteSpace(s[-1]) && isWhiteSpace(s[4]));
|
return((strncasecmp(s,"Endc",4) == 0) && isWhiteSpace(s[-1]) && isWhiteSpace(s[4]));
|
||||||
}
|
}
|
||||||
@@ -436,25 +436,25 @@ void startUnion() {
|
|||||||
if (!pCurrentSection) {
|
if (!pCurrentSection) {
|
||||||
fatalerror("UNIONs must be inside a SECTION");
|
fatalerror("UNIONs must be inside a SECTION");
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG unionIndex = nUnionDepth;
|
uint32_t unionIndex = nUnionDepth;
|
||||||
nUnionDepth++;
|
nUnionDepth++;
|
||||||
if (nUnionDepth > MAXUNIONS) {
|
if (nUnionDepth > MAXUNIONS) {
|
||||||
fatalerror("Too many nested UNIONs");
|
fatalerror("Too many nested UNIONs");
|
||||||
}
|
}
|
||||||
|
|
||||||
unionStart[unionIndex] = nPC;
|
unionStart[unionIndex] = nPC;
|
||||||
unionSize[unionIndex] = 0;
|
unionSize[unionIndex] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateUnion() {
|
void updateUnion() {
|
||||||
ULONG unionIndex = nUnionDepth - 1;
|
uint32_t unionIndex = nUnionDepth - 1;
|
||||||
ULONG size = nPC - unionStart[unionIndex];
|
uint32_t size = nPC - unionStart[unionIndex];
|
||||||
|
|
||||||
if (size > unionSize[unionIndex]) {
|
if (size > unionSize[unionIndex]) {
|
||||||
unionSize[unionIndex] = size;
|
unionSize[unionIndex] = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
nPC = unionStart[unionIndex];
|
nPC = unionStart[unionIndex];
|
||||||
pCurrentSection->nPC = unionStart[unionIndex];
|
pCurrentSection->nPC = unionStart[unionIndex];
|
||||||
pPCSymbol->nValue = unionStart[unionIndex];
|
pPCSymbol->nValue = unionStart[unionIndex];
|
||||||
@@ -794,9 +794,9 @@ endu : T_POP_ENDU {
|
|||||||
if (nUnionDepth <= 0) {
|
if (nUnionDepth <= 0) {
|
||||||
fatalerror("Found ENDU outside of a UNION construct");
|
fatalerror("Found ENDU outside of a UNION construct");
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUnion();
|
updateUnion();
|
||||||
|
|
||||||
nUnionDepth--;
|
nUnionDepth--;
|
||||||
nPC = unionStart[nUnionDepth] + unionSize[nUnionDepth];
|
nPC = unionStart[nUnionDepth] + unionSize[nUnionDepth];
|
||||||
pCurrentSection->nPC = nPC;
|
pCurrentSection->nPC = nPC;
|
||||||
@@ -844,9 +844,8 @@ import_list : import_list_entry
|
|||||||
;
|
;
|
||||||
|
|
||||||
import_list_entry : T_ID {
|
import_list_entry : T_ID {
|
||||||
/* This is done automatically if
|
/* This is done automatically if the label isn't found
|
||||||
* the label isn't found in the
|
* in the list of defined symbols. */
|
||||||
* list of defined symbols. */
|
|
||||||
if( nPass==1 )
|
if( nPass==1 )
|
||||||
warning("IMPORT is a deprecated keyword with no effect: %s", $1);
|
warning("IMPORT is a deprecated keyword with no effect: %s", $1);
|
||||||
}
|
}
|
||||||
@@ -1090,7 +1089,14 @@ relocconst : T_ID
|
|||||||
| T_NUMBER
|
| T_NUMBER
|
||||||
{ rpn_Number(&$$,$1); $$.nVal = $1; }
|
{ rpn_Number(&$$,$1); $$.nVal = $1; }
|
||||||
| string
|
| string
|
||||||
{ char *s; int length; ULONG r; s = $1; length = charmap_Convert(&s); r = str2int2(s, length); free(s); rpn_Number(&$$,r); $$.nVal=r; }
|
{
|
||||||
|
char *s = $1;
|
||||||
|
int length = charmap_Convert(&s);
|
||||||
|
uint32_t r = str2int2(s, length);
|
||||||
|
free(s);
|
||||||
|
rpn_Number(&$$,r);
|
||||||
|
$$.nVal=r;
|
||||||
|
}
|
||||||
| T_OP_LOGICNOT relocconst %prec NEG
|
| T_OP_LOGICNOT relocconst %prec NEG
|
||||||
{ rpn_LOGNOT(&$$,&$2); }
|
{ rpn_LOGNOT(&$$,&$2); }
|
||||||
| relocconst T_OP_LOGICOR relocconst
|
| relocconst T_OP_LOGICOR relocconst
|
||||||
@@ -1792,7 +1798,6 @@ T_MODE_L : T_TOKEN_L
|
|||||||
| T_OP_LOW '(' T_MODE_HL ')'
|
| T_OP_LOW '(' T_MODE_HL ')'
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
ccode : T_CC_NZ { $$ = CC_NZ; }
|
ccode : T_CC_NZ { $$ = CC_NZ; }
|
||||||
| T_CC_Z { $$ = CC_Z; }
|
| T_CC_Z { $$ = CC_Z; }
|
||||||
| T_CC_NC { $$ = CC_NC; }
|
| T_CC_NC { $$ = CC_NC; }
|
||||||
|
|||||||
@@ -9,33 +9,31 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "asm/symbol.h"
|
|
||||||
#include "asm/fstack.h"
|
#include "asm/fstack.h"
|
||||||
#include "types.h"
|
|
||||||
#include "asm/main.h"
|
|
||||||
#include "asm/lexer.h"
|
#include "asm/lexer.h"
|
||||||
|
#include "asm/main.h"
|
||||||
|
#include "asm/symbol.h"
|
||||||
|
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
#include "extern/strl.h"
|
#include "extern/strl.h"
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#include "types.h"
|
||||||
#define PATH_MAX 256
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct sContext *pFileStack;
|
struct sContext *pFileStack;
|
||||||
struct sSymbol *pCurrentMacro;
|
struct sSymbol *pCurrentMacro;
|
||||||
YY_BUFFER_STATE CurrentFlexHandle;
|
YY_BUFFER_STATE CurrentFlexHandle;
|
||||||
FILE *pCurrentFile;
|
FILE *pCurrentFile;
|
||||||
ULONG nCurrentStatus;
|
uint32_t nCurrentStatus;
|
||||||
char tzCurrentFileName[_MAX_PATH + 1];
|
char tzCurrentFileName[_MAX_PATH + 1];
|
||||||
char IncludePaths[MAXINCPATHS][_MAX_PATH + 1];
|
char IncludePaths[MAXINCPATHS][_MAX_PATH + 1];
|
||||||
int32_t NextIncPath = 0;
|
int32_t NextIncPath = 0;
|
||||||
ULONG nMacroCount;
|
uint32_t nMacroCount;
|
||||||
|
|
||||||
char *pCurrentREPTBlock;
|
char *pCurrentREPTBlock;
|
||||||
ULONG nCurrentREPTBlockSize;
|
uint32_t nCurrentREPTBlockSize;
|
||||||
ULONG nCurrentREPTBlockCount;
|
uint32_t nCurrentREPTBlockCount;
|
||||||
|
|
||||||
ULONG ulMacroReturnValue;
|
uint32_t ulMacroReturnValue;
|
||||||
|
|
||||||
extern char *tzObjectname;
|
extern char *tzObjectname;
|
||||||
extern FILE *dependfile;
|
extern FILE *dependfile;
|
||||||
@@ -228,7 +226,7 @@ fstk_AddIncludePath(char *s)
|
|||||||
FILE *
|
FILE *
|
||||||
fstk_FindFile(char *fname)
|
fstk_FindFile(char *fname)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX];
|
char path[_MAX_PATH];
|
||||||
int i;
|
int i;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
@@ -292,7 +290,7 @@ fstk_RunInclude(char *tzFileName)
|
|||||||
/*
|
/*
|
||||||
* Set up a macro for parsing
|
* Set up a macro for parsing
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
fstk_RunMacro(char *s)
|
fstk_RunMacro(char *s)
|
||||||
{
|
{
|
||||||
struct sSymbol *sym;
|
struct sSymbol *sym;
|
||||||
@@ -362,7 +360,7 @@ fstk_RunString(char *s)
|
|||||||
* Set up a repeat block for parsing
|
* Set up a repeat block for parsing
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
fstk_RunRept(ULONG count)
|
fstk_RunRept(uint32_t count)
|
||||||
{
|
{
|
||||||
if (count) {
|
if (count) {
|
||||||
pushcontext();
|
pushcontext();
|
||||||
|
|||||||
@@ -108,25 +108,21 @@ ascii2bin(char *s)
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
ParseFixedPoint(char *s, ULONG size)
|
ParseFixedPoint(char *s, uint32_t size)
|
||||||
{
|
{
|
||||||
//char dest[256];
|
uint32_t i = 0, dot = 0;
|
||||||
ULONG i = 0, dot = 0;
|
|
||||||
|
|
||||||
while (size && dot != 2) {
|
while (size && dot != 2) {
|
||||||
if (s[i] == '.')
|
if (s[i] == '.')
|
||||||
dot += 1;
|
dot += 1;
|
||||||
|
|
||||||
if (dot < 2) {
|
if (dot < 2) {
|
||||||
//dest[i] = s[i];
|
|
||||||
size -= 1;
|
size -= 1;
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//dest[i] = 0;
|
|
||||||
|
|
||||||
yyunputbytes(size);
|
yyunputbytes(size);
|
||||||
|
|
||||||
yylval.nConstValue = (int32_t) (atof(s) * 65536);
|
yylval.nConstValue = (int32_t) (atof(s) * 65536);
|
||||||
@@ -134,8 +130,8 @@ ParseFixedPoint(char *s, ULONG size)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
ParseNumber(char *s, ULONG size)
|
ParseNumber(char *s, uint32_t size)
|
||||||
{
|
{
|
||||||
char dest[256];
|
char dest[256];
|
||||||
|
|
||||||
@@ -146,8 +142,8 @@ ParseNumber(char *s, ULONG size)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
ParseSymbol(char *src, ULONG size)
|
ParseSymbol(char *src, uint32_t size)
|
||||||
{
|
{
|
||||||
char dest[MAXSYMLEN + 1];
|
char dest[MAXSYMLEN + 1];
|
||||||
int copied = 0, size_backup = size;
|
int copied = 0, size_backup = size;
|
||||||
@@ -204,8 +200,8 @@ ParseSymbol(char *src, ULONG size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
PutMacroArg(char *src, ULONG size)
|
PutMacroArg(char *src, uint32_t size)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
@@ -222,8 +218,8 @@ PutMacroArg(char *src, ULONG size)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
PutUniqueArg(char *src, ULONG size)
|
PutUniqueArg(char *src, uint32_t size)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
@@ -399,7 +395,7 @@ struct sLexFloat tMacroUniqueToken = {
|
|||||||
void
|
void
|
||||||
setuplex(void)
|
setuplex(void)
|
||||||
{
|
{
|
||||||
ULONG id;
|
uint32_t id;
|
||||||
|
|
||||||
lex_Init();
|
lex_Init();
|
||||||
lex_AddStrings(staticstrings);
|
lex_AddStrings(staticstrings);
|
||||||
|
|||||||
@@ -6,19 +6,19 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "asm/asm.h"
|
#include "asm/asm.h"
|
||||||
|
#include "asm/fstack.h"
|
||||||
#include "asm/lexer.h"
|
#include "asm/lexer.h"
|
||||||
#include "types.h"
|
|
||||||
#include "asm/main.h"
|
#include "asm/main.h"
|
||||||
#include "asm/rpn.h"
|
#include "asm/rpn.h"
|
||||||
#include "asm/fstack.h"
|
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
|
|
||||||
#include "asmy.h"
|
#include "asmy.h"
|
||||||
|
|
||||||
struct sLexString {
|
struct sLexString {
|
||||||
char *tzName;
|
char *tzName;
|
||||||
ULONG nToken;
|
uint32_t nToken;
|
||||||
ULONG nNameLength;
|
uint32_t nNameLength;
|
||||||
struct sLexString *pNext;
|
struct sLexString *pNext;
|
||||||
};
|
};
|
||||||
#define pLexBufferRealStart (pCurrentBuffer->pBufferRealStart)
|
#define pLexBufferRealStart (pCurrentBuffer->pBufferRealStart)
|
||||||
@@ -32,12 +32,12 @@ extern size_t symvaluetostring(char *dest, size_t maxLength, char *sym);
|
|||||||
struct sLexFloat tLexFloat[32];
|
struct sLexFloat tLexFloat[32];
|
||||||
struct sLexString *tLexHash[LEXHASHSIZE];
|
struct sLexString *tLexHash[LEXHASHSIZE];
|
||||||
YY_BUFFER_STATE pCurrentBuffer;
|
YY_BUFFER_STATE pCurrentBuffer;
|
||||||
ULONG nLexMaxLength; // max length of all keywords and operators
|
uint32_t nLexMaxLength; // max length of all keywords and operators
|
||||||
|
|
||||||
ULONG tFloatingSecondChar[256];
|
uint32_t tFloatingSecondChar[256];
|
||||||
ULONG tFloatingFirstChar[256];
|
uint32_t tFloatingFirstChar[256];
|
||||||
ULONG tFloatingChars[256];
|
uint32_t tFloatingChars[256];
|
||||||
ULONG nFloating;
|
uint32_t nFloating;
|
||||||
enum eLexerState lexerstate = LEX_STATE_NORMAL;
|
enum eLexerState lexerstate = LEX_STATE_NORMAL;
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -59,13 +59,13 @@ lowerstring(char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
yyskipbytes(ULONG count)
|
yyskipbytes(uint32_t count)
|
||||||
{
|
{
|
||||||
pLexBuffer += count;
|
pLexBuffer += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
yyunputbytes(ULONG count)
|
yyunputbytes(uint32_t count)
|
||||||
{
|
{
|
||||||
pLexBuffer -= count;
|
pLexBuffer -= count;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ yy_delete_buffer(YY_BUFFER_STATE buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
YY_BUFFER_STATE
|
YY_BUFFER_STATE
|
||||||
yy_scan_bytes(char *mem, ULONG size)
|
yy_scan_bytes(char *mem, uint32_t size)
|
||||||
{
|
{
|
||||||
YY_BUFFER_STATE pBuffer;
|
YY_BUFFER_STATE pBuffer;
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ yy_create_buffer(FILE * f)
|
|||||||
YY_BUFFER_STATE pBuffer;
|
YY_BUFFER_STATE pBuffer;
|
||||||
|
|
||||||
if ((pBuffer = malloc(sizeof(struct yy_buffer_state))) != NULL) {
|
if ((pBuffer = malloc(sizeof(struct yy_buffer_state))) != NULL) {
|
||||||
ULONG size;
|
uint32_t size;
|
||||||
|
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
size = ftell(f);
|
size = ftell(f);
|
||||||
@@ -148,7 +148,7 @@ yy_create_buffer(FILE * f)
|
|||||||
if ((pBuffer->pBufferRealStart =
|
if ((pBuffer->pBufferRealStart =
|
||||||
malloc(size + 2 + SAFETYMARGIN)) != NULL) {
|
malloc(size + 2 + SAFETYMARGIN)) != NULL) {
|
||||||
char *mem;
|
char *mem;
|
||||||
ULONG instring = 0;
|
uint32_t instring = 0;
|
||||||
|
|
||||||
pBuffer->pBufferStart = pBuffer->pBufferRealStart + SAFETYMARGIN;
|
pBuffer->pBufferStart = pBuffer->pBufferRealStart + SAFETYMARGIN;
|
||||||
pBuffer->pBuffer = pBuffer->pBufferRealStart + SAFETYMARGIN;
|
pBuffer->pBuffer = pBuffer->pBufferRealStart + SAFETYMARGIN;
|
||||||
@@ -199,7 +199,7 @@ yy_create_buffer(FILE * f)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
lex_FloatAlloc(struct sLexFloat *token)
|
lex_FloatAlloc(struct sLexFloat *token)
|
||||||
{
|
{
|
||||||
tLexFloat[nFloating] = *token;
|
tLexFloat[nFloating] = *token;
|
||||||
@@ -221,7 +221,7 @@ lex_CheckCharacterRange(uint16_t start, uint16_t end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lex_FloatDeleteRange(ULONG id, uint16_t start, uint16_t end)
|
lex_FloatDeleteRange(uint32_t id, uint16_t start, uint16_t end)
|
||||||
{
|
{
|
||||||
lex_CheckCharacterRange(start, end);
|
lex_CheckCharacterRange(start, end);
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ lex_FloatDeleteRange(ULONG id, uint16_t start, uint16_t end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lex_FloatAddRange(ULONG id, uint16_t start, uint16_t end)
|
lex_FloatAddRange(uint32_t id, uint16_t start, uint16_t end)
|
||||||
{
|
{
|
||||||
lex_CheckCharacterRange(start, end);
|
lex_CheckCharacterRange(start, end);
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ lex_FloatAddRange(ULONG id, uint16_t start, uint16_t end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lex_FloatDeleteFirstRange(ULONG id, uint16_t start, uint16_t end)
|
lex_FloatDeleteFirstRange(uint32_t id, uint16_t start, uint16_t end)
|
||||||
{
|
{
|
||||||
lex_CheckCharacterRange(start, end);
|
lex_CheckCharacterRange(start, end);
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ lex_FloatDeleteFirstRange(ULONG id, uint16_t start, uint16_t end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lex_FloatAddFirstRange(ULONG id, uint16_t start, uint16_t end)
|
lex_FloatAddFirstRange(uint32_t id, uint16_t start, uint16_t end)
|
||||||
{
|
{
|
||||||
lex_CheckCharacterRange(start, end);
|
lex_CheckCharacterRange(start, end);
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ lex_FloatAddFirstRange(ULONG id, uint16_t start, uint16_t end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lex_FloatDeleteSecondRange(ULONG id, uint16_t start, uint16_t end)
|
lex_FloatDeleteSecondRange(uint32_t id, uint16_t start, uint16_t end)
|
||||||
{
|
{
|
||||||
lex_CheckCharacterRange(start, end);
|
lex_CheckCharacterRange(start, end);
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ lex_FloatDeleteSecondRange(ULONG id, uint16_t start, uint16_t end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lex_FloatAddSecondRange(ULONG id, uint16_t start, uint16_t end)
|
lex_FloatAddSecondRange(uint32_t id, uint16_t start, uint16_t end)
|
||||||
{
|
{
|
||||||
lex_CheckCharacterRange(start, end);
|
lex_CheckCharacterRange(start, end);
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ lex_FloatAddSecondRange(ULONG id, uint16_t start, uint16_t end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct sLexFloat *
|
struct sLexFloat *
|
||||||
lexgetfloat(ULONG nFloatMask)
|
lexgetfloat(uint32_t nFloatMask)
|
||||||
{
|
{
|
||||||
if (nFloatMask == 0) {
|
if (nFloatMask == 0) {
|
||||||
fatalerror("Internal error in lexgetfloat");
|
fatalerror("Internal error in lexgetfloat");
|
||||||
@@ -303,10 +303,10 @@ lexgetfloat(ULONG nFloatMask)
|
|||||||
return (&tLexFloat[i]);
|
return (&tLexFloat[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
lexcalchash(char *s)
|
lexcalchash(char *s)
|
||||||
{
|
{
|
||||||
ULONG hash = 0;
|
uint32_t hash = 0;
|
||||||
|
|
||||||
while (*s) {
|
while (*s) {
|
||||||
hash = (hash * 283) ^ toupper(*s++);
|
hash = (hash * 283) ^ toupper(*s++);
|
||||||
@@ -318,7 +318,7 @@ lexcalchash(char *s)
|
|||||||
void
|
void
|
||||||
lex_Init(void)
|
lex_Init(void)
|
||||||
{
|
{
|
||||||
ULONG i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i = 0; i < LEXHASHSIZE; i++) {
|
for (i = 0; i < LEXHASHSIZE; i++) {
|
||||||
tLexHash[i] = NULL;
|
tLexHash[i] = NULL;
|
||||||
@@ -339,7 +339,7 @@ lex_AddStrings(struct sLexInitString * lex)
|
|||||||
{
|
{
|
||||||
while (lex->tzName) {
|
while (lex->tzName) {
|
||||||
struct sLexString **ppHash;
|
struct sLexString **ppHash;
|
||||||
ULONG hash;
|
uint32_t hash;
|
||||||
|
|
||||||
ppHash = &tLexHash[hash = lexcalchash(lex->tzName)];
|
ppHash = &tLexHash[hash = lexcalchash(lex->tzName)];
|
||||||
while (*ppHash)
|
while (*ppHash)
|
||||||
@@ -377,14 +377,14 @@ lex_AddStrings(struct sLexInitString * lex)
|
|||||||
* buffer will have their bits set in the float mask.
|
* buffer will have their bits set in the float mask.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
yylex_GetFloatMaskAndFloatLen(ULONG *pnFloatMask, ULONG *pnFloatLen)
|
yylex_GetFloatMaskAndFloatLen(uint32_t *pnFloatMask, uint32_t *pnFloatLen)
|
||||||
{
|
{
|
||||||
// Note that '\0' should always have a bit mask of 0 in the "floating"
|
// Note that '\0' should always have a bit mask of 0 in the "floating"
|
||||||
// tables, so it doesn't need to be checked for separately.
|
// tables, so it doesn't need to be checked for separately.
|
||||||
|
|
||||||
char *s = pLexBuffer;
|
char *s = pLexBuffer;
|
||||||
ULONG nOldFloatMask = 0;
|
uint32_t nOldFloatMask = 0;
|
||||||
ULONG nFloatMask = tFloatingFirstChar[(int)*s];
|
uint32_t nFloatMask = tFloatingFirstChar[(int)*s];
|
||||||
|
|
||||||
if (nFloatMask != 0) {
|
if (nFloatMask != 0) {
|
||||||
s++;
|
s++;
|
||||||
@@ -399,7 +399,7 @@ yylex_GetFloatMaskAndFloatLen(ULONG *pnFloatMask, ULONG *pnFloatLen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
*pnFloatMask = nOldFloatMask;
|
*pnFloatMask = nOldFloatMask;
|
||||||
*pnFloatLen = (ULONG)(s - pLexBuffer);
|
*pnFloatLen = (uint32_t)(s - pLexBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -410,8 +410,8 @@ yylex_GetLongestFixed()
|
|||||||
{
|
{
|
||||||
struct sLexString *pLongestFixed = NULL;
|
struct sLexString *pLongestFixed = NULL;
|
||||||
char *s = pLexBuffer;
|
char *s = pLexBuffer;
|
||||||
ULONG hash = 0;
|
uint32_t hash = 0;
|
||||||
ULONG length = 0;
|
uint32_t length = 0;
|
||||||
|
|
||||||
while (length < nLexMaxLength && *s) {
|
while (length < nLexMaxLength && *s) {
|
||||||
hash = (hash * 283) ^ toupper(*s);
|
hash = (hash * 283) ^ toupper(*s);
|
||||||
@@ -605,12 +605,12 @@ yylex_ReadQuotedString()
|
|||||||
fatalerror("Unterminated string");
|
fatalerror("Unterminated string");
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
yylex_NORMAL()
|
yylex_NORMAL()
|
||||||
{
|
{
|
||||||
struct sLexString *pLongestFixed = NULL;
|
struct sLexString *pLongestFixed = NULL;
|
||||||
ULONG nFloatMask, nFloatLen;
|
uint32_t nFloatMask, nFloatLen;
|
||||||
ULONG linestart = AtLineStart;
|
uint32_t linestart = AtLineStart;
|
||||||
|
|
||||||
AtLineStart = 0;
|
AtLineStart = 0;
|
||||||
|
|
||||||
@@ -682,7 +682,7 @@ scanagain:
|
|||||||
return pLongestFixed->nToken;
|
return pLongestFixed->nToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
yylex_MACROARGS()
|
yylex_MACROARGS()
|
||||||
{
|
{
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
@@ -758,7 +758,7 @@ yylex_MACROARGS()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
yylex(void)
|
yylex(void)
|
||||||
{
|
{
|
||||||
switch (lexerstate) {
|
switch (lexerstate) {
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ char **cldefines;
|
|||||||
|
|
||||||
clock_t nStartClock, nEndClock;
|
clock_t nStartClock, nEndClock;
|
||||||
int32_t nLineNo;
|
int32_t nLineNo;
|
||||||
ULONG nTotalLines, nPass, nPC, nIFDepth, nUnionDepth, nErrors;
|
uint32_t nTotalLines, nPass, nPC, nIFDepth, nUnionDepth, nErrors;
|
||||||
bool skipElif;
|
bool skipElif;
|
||||||
ULONG unionStart[128], unionSize[128];
|
uint32_t unionStart[128], unionSize[128];
|
||||||
|
|
||||||
extern int yydebug;
|
extern int yydebug;
|
||||||
|
|
||||||
@@ -480,7 +480,7 @@ main(int argc, char *argv[])
|
|||||||
timespent = ((double)(nEndClock - nStartClock))
|
timespent = ((double)(nEndClock - nStartClock))
|
||||||
/ (double)CLOCKS_PER_SEC;
|
/ (double)CLOCKS_PER_SEC;
|
||||||
if (CurrentOptions.verbose) {
|
if (CurrentOptions.verbose) {
|
||||||
printf("Success! %ld lines in %d.%02d seconds ", nTotalLines,
|
printf("Success! %u lines in %d.%02d seconds ", nTotalLines,
|
||||||
(int) timespent, ((int) (timespent * 100.0)) % 100);
|
(int) timespent, ((int) (timespent * 100.0)) % 100);
|
||||||
if (timespent == 0)
|
if (timespent == 0)
|
||||||
printf("(INFINITY lines/minute)\n");
|
printf("(INFINITY lines/minute)\n");
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include "asm/mymath.h"
|
#include "asm/mymath.h"
|
||||||
#include "asm/symbol.h"
|
#include "asm/symbol.h"
|
||||||
|
|
||||||
|
|||||||
@@ -23,16 +23,16 @@ void out_SetCurrentSection(struct Section * pSect);
|
|||||||
|
|
||||||
struct Patch {
|
struct Patch {
|
||||||
char tzFilename[_MAX_PATH + 1];
|
char tzFilename[_MAX_PATH + 1];
|
||||||
ULONG nLine;
|
uint32_t nLine;
|
||||||
ULONG nOffset;
|
uint32_t nOffset;
|
||||||
uint8_t nType;
|
uint8_t nType;
|
||||||
ULONG nRPNSize;
|
uint32_t nRPNSize;
|
||||||
uint8_t *pRPN;
|
uint8_t *pRPN;
|
||||||
struct Patch *pNext;
|
struct Patch *pNext;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PatchSymbol {
|
struct PatchSymbol {
|
||||||
ULONG ID;
|
uint32_t ID;
|
||||||
struct sSymbol *pSymbol;
|
struct sSymbol *pSymbol;
|
||||||
struct PatchSymbol *pNext;
|
struct PatchSymbol *pNext;
|
||||||
struct PatchSymbol *pBucketNext; // next symbol in hash table bucket
|
struct PatchSymbol *pBucketNext; // next symbol in hash table bucket
|
||||||
@@ -80,8 +80,8 @@ out_PopSection(void)
|
|||||||
fatalerror("No entries in the section stack");
|
fatalerror("No entries in the section stack");
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
getmaxsectionsize(ULONG secttype, char * sectname)
|
getmaxsectionsize(uint32_t secttype, char * sectname)
|
||||||
{
|
{
|
||||||
switch (secttype)
|
switch (secttype)
|
||||||
{
|
{
|
||||||
@@ -101,11 +101,11 @@ getmaxsectionsize(ULONG secttype, char * sectname)
|
|||||||
/*
|
/*
|
||||||
* Count the number of symbols used in this object
|
* Count the number of symbols used in this object
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
countsymbols(void)
|
countsymbols(void)
|
||||||
{
|
{
|
||||||
struct PatchSymbol *pSym;
|
struct PatchSymbol *pSym;
|
||||||
ULONG count = 0;
|
uint32_t count = 0;
|
||||||
|
|
||||||
pSym = pPatchSymbols;
|
pSym = pPatchSymbols;
|
||||||
|
|
||||||
@@ -120,11 +120,11 @@ countsymbols(void)
|
|||||||
/*
|
/*
|
||||||
* Count the number of sections used in this object
|
* Count the number of sections used in this object
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
countsections(void)
|
countsections(void)
|
||||||
{
|
{
|
||||||
struct Section *pSect;
|
struct Section *pSect;
|
||||||
ULONG count = 0;
|
uint32_t count = 0;
|
||||||
|
|
||||||
pSect = pSectionList;
|
pSect = pSectionList;
|
||||||
|
|
||||||
@@ -139,11 +139,11 @@ countsections(void)
|
|||||||
/*
|
/*
|
||||||
* Count the number of patches used in this object
|
* Count the number of patches used in this object
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
countpatches(struct Section * pSect)
|
countpatches(struct Section * pSect)
|
||||||
{
|
{
|
||||||
struct Patch *pPatch;
|
struct Patch *pPatch;
|
||||||
ULONG r = 0;
|
uint32_t r = 0;
|
||||||
|
|
||||||
pPatch = pSect->pPatches;
|
pPatch = pSect->pPatches;
|
||||||
while (pPatch) {
|
while (pPatch) {
|
||||||
@@ -158,7 +158,7 @@ countpatches(struct Section * pSect)
|
|||||||
* Write a long to a file (little-endian)
|
* Write a long to a file (little-endian)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
fputlong(ULONG i, FILE * f)
|
fputlong(uint32_t i, FILE * f)
|
||||||
{
|
{
|
||||||
fputc(i, f);
|
fputc(i, f);
|
||||||
fputc(i >> 8, f);
|
fputc(i >> 8, f);
|
||||||
@@ -180,11 +180,11 @@ fputstring(char *s, FILE * f)
|
|||||||
/*
|
/*
|
||||||
* Return a section's ID
|
* Return a section's ID
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
getsectid(struct Section * pSect)
|
getsectid(struct Section * pSect)
|
||||||
{
|
{
|
||||||
struct Section *sec;
|
struct Section *sec;
|
||||||
ULONG ID = 0;
|
uint32_t ID = 0;
|
||||||
|
|
||||||
sec = pSectionList;
|
sec = pSectionList;
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ getsectid(struct Section * pSect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fatalerror("INTERNAL: Unknown section");
|
fatalerror("INTERNAL: Unknown section");
|
||||||
return ((ULONG) - 1);
|
return ((uint32_t) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -251,8 +251,8 @@ void
|
|||||||
writesymbol(struct sSymbol * pSym, FILE * f)
|
writesymbol(struct sSymbol * pSym, FILE * f)
|
||||||
{
|
{
|
||||||
char symname[MAXSYMLEN * 2 + 1];
|
char symname[MAXSYMLEN * 2 + 1];
|
||||||
ULONG type;
|
uint32_t type;
|
||||||
ULONG offset;
|
uint32_t offset;
|
||||||
int32_t sectid;
|
int32_t sectid;
|
||||||
|
|
||||||
if (pSym->nType & SYMF_IMPORT) {
|
if (pSym->nType & SYMF_IMPORT) {
|
||||||
@@ -295,12 +295,12 @@ writesymbol(struct sSymbol * pSym, FILE * f)
|
|||||||
/*
|
/*
|
||||||
* Add a symbol to the object
|
* Add a symbol to the object
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
addsymbol(struct sSymbol * pSym)
|
addsymbol(struct sSymbol * pSym)
|
||||||
{
|
{
|
||||||
struct PatchSymbol *pPSym, **ppPSym;
|
struct PatchSymbol *pPSym, **ppPSym;
|
||||||
static ULONG nextID = 0;
|
static uint32_t nextID = 0;
|
||||||
ULONG hash;
|
uint32_t hash;
|
||||||
|
|
||||||
hash = calchash(pSym->tzName);
|
hash = calchash(pSym->tzName);
|
||||||
ppPSym = &(tHashedPatchSymbols[hash]);
|
ppPSym = &(tHashedPatchSymbols[hash]);
|
||||||
@@ -369,13 +369,13 @@ allocpatch(void)
|
|||||||
* Create a new patch (includes the rpn expr)
|
* Create a new patch (includes the rpn expr)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
createpatch(ULONG type, struct Expression * expr)
|
createpatch(uint32_t type, struct Expression * expr)
|
||||||
{
|
{
|
||||||
struct Patch *pPatch;
|
struct Patch *pPatch;
|
||||||
uint16_t rpndata;
|
uint16_t rpndata;
|
||||||
uint8_t rpnexpr[2048];
|
uint8_t rpnexpr[2048];
|
||||||
char tzSym[512];
|
char tzSym[512];
|
||||||
ULONG rpnptr = 0, symptr;
|
uint32_t rpnptr = 0, symptr;
|
||||||
|
|
||||||
pPatch = allocpatch();
|
pPatch = allocpatch();
|
||||||
pPatch->nType = type;
|
pPatch->nType = type;
|
||||||
@@ -396,7 +396,7 @@ createpatch(ULONG type, struct Expression * expr)
|
|||||||
symptr = 0;
|
symptr = 0;
|
||||||
while ((tzSym[symptr++] = rpn_PopByte(expr)) != 0);
|
while ((tzSym[symptr++] = rpn_PopByte(expr)) != 0);
|
||||||
if (sym_isConstant(tzSym)) {
|
if (sym_isConstant(tzSym)) {
|
||||||
ULONG value;
|
uint32_t value;
|
||||||
|
|
||||||
value = sym_GetConstantValue(tzSym);
|
value = sym_GetConstantValue(tzSym);
|
||||||
rpnexpr[rpnptr++] = RPN_CONST;
|
rpnexpr[rpnptr++] = RPN_CONST;
|
||||||
@@ -474,9 +474,9 @@ checkcodesection(void)
|
|||||||
* Check if the section has grown too much.
|
* Check if the section has grown too much.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
checksectionoverflow(ULONG delta_size)
|
checksectionoverflow(uint32_t delta_size)
|
||||||
{
|
{
|
||||||
ULONG maxsize = getmaxsectionsize(pCurrentSection->nType,
|
uint32_t maxsize = getmaxsectionsize(pCurrentSection->nType,
|
||||||
pCurrentSection->pzName);
|
pCurrentSection->pzName);
|
||||||
|
|
||||||
if (pCurrentSection->nPC + delta_size > maxsize) {
|
if (pCurrentSection->nPC + delta_size > maxsize) {
|
||||||
@@ -564,7 +564,7 @@ out_SetFileName(char *s)
|
|||||||
* Find a section by name and type. If it doesn't exist, create it
|
* Find a section by name and type. If it doesn't exist, create it
|
||||||
*/
|
*/
|
||||||
struct Section *
|
struct Section *
|
||||||
out_FindSection(char *pzName, ULONG secttype, int32_t org, int32_t bank, int32_t alignment)
|
out_FindSection(char *pzName, uint32_t secttype, int32_t org, int32_t bank, int32_t alignment)
|
||||||
{
|
{
|
||||||
struct Section *pSect, **ppSect;
|
struct Section *pSect, **ppSect;
|
||||||
|
|
||||||
@@ -574,9 +574,9 @@ out_FindSection(char *pzName, ULONG secttype, int32_t org, int32_t bank, int32_t
|
|||||||
while (pSect) {
|
while (pSect) {
|
||||||
if (strcmp(pzName, pSect->pzName) == 0) {
|
if (strcmp(pzName, pSect->pzName) == 0) {
|
||||||
if (secttype == pSect->nType
|
if (secttype == pSect->nType
|
||||||
&& ((ULONG) org) == pSect->nOrg
|
&& ((uint32_t) org) == pSect->nOrg
|
||||||
&& ((ULONG) bank) == pSect->nBank
|
&& ((uint32_t) bank) == pSect->nBank
|
||||||
&& ((ULONG) alignment == pSect->nAlign)) {
|
&& ((uint32_t) alignment == pSect->nAlign)) {
|
||||||
return (pSect);
|
return (pSect);
|
||||||
} else
|
} else
|
||||||
fatalerror
|
fatalerror
|
||||||
@@ -603,7 +603,7 @@ out_FindSection(char *pzName, ULONG secttype, int32_t org, int32_t bank, int32_t
|
|||||||
if (secttype == SECT_ROM0 || secttype == SECT_ROMX) {
|
if (secttype == SECT_ROM0 || secttype == SECT_ROMX) {
|
||||||
/* It is only needed to allocate memory for ROM
|
/* It is only needed to allocate memory for ROM
|
||||||
* sections. */
|
* sections. */
|
||||||
ULONG sectsize = getmaxsectionsize(secttype, pzName);
|
uint32_t sectsize = getmaxsectionsize(secttype, pzName);
|
||||||
if ((pSect->tData = malloc(sectsize)) == NULL)
|
if ((pSect->tData = malloc(sectsize)) == NULL)
|
||||||
fatalerror("Not enough memory for section");
|
fatalerror("Not enough memory for section");
|
||||||
}
|
}
|
||||||
@@ -637,7 +637,7 @@ out_SetCurrentSection(struct Section * pSect)
|
|||||||
* Set the current section by name and type
|
* Set the current section by name and type
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
out_NewSection(char *pzName, ULONG secttype)
|
out_NewSection(char *pzName, uint32_t secttype)
|
||||||
{
|
{
|
||||||
out_SetCurrentSection(out_FindSection(pzName, secttype, -1, -1, 1));
|
out_SetCurrentSection(out_FindSection(pzName, secttype, -1, -1, 1));
|
||||||
}
|
}
|
||||||
@@ -646,7 +646,7 @@ out_NewSection(char *pzName, ULONG secttype)
|
|||||||
* Set the current section by name and type
|
* Set the current section by name and type
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
out_NewAbsSection(char *pzName, ULONG secttype, int32_t org, int32_t bank)
|
out_NewAbsSection(char *pzName, uint32_t secttype, int32_t org, int32_t bank)
|
||||||
{
|
{
|
||||||
out_SetCurrentSection(out_FindSection(pzName, secttype, org, bank, 1));
|
out_SetCurrentSection(out_FindSection(pzName, secttype, org, bank, 1));
|
||||||
}
|
}
|
||||||
@@ -655,7 +655,7 @@ out_NewAbsSection(char *pzName, ULONG secttype, int32_t org, int32_t bank)
|
|||||||
* Set the current section by name and type, using a given byte alignment
|
* Set the current section by name and type, using a given byte alignment
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
out_NewAlignedSection(char *pzName, ULONG secttype, int32_t alignment, int32_t bank)
|
out_NewAlignedSection(char *pzName, uint32_t secttype, int32_t alignment, int32_t bank)
|
||||||
{
|
{
|
||||||
if (alignment < 0 || alignment > 16) {
|
if (alignment < 0 || alignment > 16) {
|
||||||
yyerror("Alignment must be between 0-16 bits.");
|
yyerror("Alignment must be between 0-16 bits.");
|
||||||
@@ -782,7 +782,7 @@ out_AbsWord(int b)
|
|||||||
void
|
void
|
||||||
out_RelWord(struct Expression * expr)
|
out_RelWord(struct Expression * expr)
|
||||||
{
|
{
|
||||||
ULONG b;
|
uint32_t b;
|
||||||
|
|
||||||
checkcodesection();
|
checkcodesection();
|
||||||
checksectionoverflow(2);
|
checksectionoverflow(2);
|
||||||
|
|||||||
@@ -6,12 +6,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "asm/mylink.h"
|
|
||||||
#include "types.h"
|
|
||||||
#include "asm/symbol.h"
|
|
||||||
#include "asm/asm.h"
|
#include "asm/asm.h"
|
||||||
#include "asm/main.h"
|
#include "asm/main.h"
|
||||||
|
#include "asm/mylink.h"
|
||||||
#include "asm/rpn.h"
|
#include "asm/rpn.h"
|
||||||
|
#include "asm/symbol.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
mergetwoexpressions(struct Expression * expr, struct Expression * src1,
|
mergetwoexpressions(struct Expression * expr, struct Expression * src1,
|
||||||
@@ -59,7 +58,7 @@ rpn_PopByte(struct Expression * expr)
|
|||||||
/*
|
/*
|
||||||
* Determine if the current expression is relocatable
|
* Determine if the current expression is relocatable
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
rpn_isReloc(struct Expression * expr)
|
rpn_isReloc(struct Expression * expr)
|
||||||
{
|
{
|
||||||
return (expr->isReloc);
|
return (expr->isReloc);
|
||||||
@@ -68,7 +67,7 @@ rpn_isReloc(struct Expression * expr)
|
|||||||
/*
|
/*
|
||||||
* Determine if the current expression can be pc-relative
|
* Determine if the current expression can be pc-relative
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
rpn_isPCRelative(struct Expression * expr)
|
rpn_isPCRelative(struct Expression * expr)
|
||||||
{
|
{
|
||||||
return (expr->isPCRel);
|
return (expr->isPCRel);
|
||||||
@@ -78,7 +77,7 @@ rpn_isPCRelative(struct Expression * expr)
|
|||||||
* Add symbols, constants and operators to expression
|
* Add symbols, constants and operators to expression
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
rpn_Number(struct Expression * expr, ULONG i)
|
rpn_Number(struct Expression * expr, uint32_t i)
|
||||||
{
|
{
|
||||||
rpn_Reset(expr);
|
rpn_Reset(expr);
|
||||||
pushbyte(expr, RPN_CONST);
|
pushbyte(expr, RPN_CONST);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void helper_RemoveLeadingZeros(char * string){
|
|||||||
int32_t
|
int32_t
|
||||||
Callback_NARG(struct sSymbol * sym)
|
Callback_NARG(struct sSymbol * sym)
|
||||||
{
|
{
|
||||||
ULONG i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
while (currentmacroargs[i] && i < MAXMACROARGS)
|
while (currentmacroargs[i] && i < MAXMACROARGS)
|
||||||
i += 1;
|
i += 1;
|
||||||
@@ -83,10 +83,10 @@ getvaluefield(struct sSymbol * sym)
|
|||||||
/*
|
/*
|
||||||
* Calculate the hash value for a string
|
* Calculate the hash value for a string
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
calchash(char *s)
|
calchash(char *s)
|
||||||
{
|
{
|
||||||
ULONG hash = 5381;
|
uint32_t hash = 5381;
|
||||||
|
|
||||||
while (*s != 0)
|
while (*s != 0)
|
||||||
hash = (hash * 33) ^ (*s++);
|
hash = (hash * 33) ^ (*s++);
|
||||||
@@ -101,7 +101,7 @@ struct sSymbol *
|
|||||||
createsymbol(char *s)
|
createsymbol(char *s)
|
||||||
{
|
{
|
||||||
struct sSymbol **ppsym;
|
struct sSymbol **ppsym;
|
||||||
ULONG hash;
|
uint32_t hash;
|
||||||
|
|
||||||
hash = calchash(s);
|
hash = calchash(s);
|
||||||
ppsym = &(tHashedSymbols[hash]);
|
ppsym = &(tHashedSymbols[hash]);
|
||||||
@@ -232,7 +232,7 @@ sym_Purge(char *tzName)
|
|||||||
/*
|
/*
|
||||||
* Determine if a symbol has been defined
|
* Determine if a symbol has been defined
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
sym_isConstDefined(char *tzName)
|
sym_isConstDefined(char *tzName)
|
||||||
{
|
{
|
||||||
struct sSymbol *psym, *pscope;
|
struct sSymbol *psym, *pscope;
|
||||||
@@ -256,7 +256,7 @@ sym_isConstDefined(char *tzName)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
uint32_t
|
||||||
sym_isDefined(char *tzName)
|
sym_isDefined(char *tzName)
|
||||||
{
|
{
|
||||||
struct sSymbol *psym, *pscope;
|
struct sSymbol *psym, *pscope;
|
||||||
@@ -277,7 +277,7 @@ sym_isDefined(char *tzName)
|
|||||||
/*
|
/*
|
||||||
* Determine if the symbol is a constant
|
* Determine if the symbol is a constant
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
sym_isConstant(char *s)
|
sym_isConstant(char *s)
|
||||||
{
|
{
|
||||||
struct sSymbol *psym, *pscope;
|
struct sSymbol *psym, *pscope;
|
||||||
@@ -314,7 +314,7 @@ sym_GetStringValue(char *tzSym)
|
|||||||
/*
|
/*
|
||||||
* Return a constant symbols value
|
* Return a constant symbols value
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
sym_GetConstantValue(char *s)
|
sym_GetConstantValue(char *s)
|
||||||
{
|
{
|
||||||
struct sSymbol *psym, *pscope;
|
struct sSymbol *psym, *pscope;
|
||||||
@@ -340,7 +340,7 @@ sym_GetConstantValue(char *s)
|
|||||||
/*
|
/*
|
||||||
* Return a symbols value... "estimated" if not defined yet
|
* Return a symbols value... "estimated" if not defined yet
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
sym_GetValue(char *s)
|
sym_GetValue(char *s)
|
||||||
{
|
{
|
||||||
struct sSymbol *psym, *pscope;
|
struct sSymbol *psym, *pscope;
|
||||||
@@ -379,7 +379,7 @@ sym_GetValue(char *s)
|
|||||||
/*
|
/*
|
||||||
* Return a defined symbols value... aborts if not defined yet
|
* Return a defined symbols value... aborts if not defined yet
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
sym_GetDefinedValue(char *s)
|
sym_GetDefinedValue(char *s)
|
||||||
{
|
{
|
||||||
struct sSymbol *psym, *pscope;
|
struct sSymbol *psym, *pscope;
|
||||||
@@ -490,11 +490,11 @@ sym_AddNewMacroArg(char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sym_SetMacroArgID(ULONG nMacroCount)
|
sym_SetMacroArgID(uint32_t nMacroCount)
|
||||||
{
|
{
|
||||||
char s[256];
|
char s[256];
|
||||||
|
|
||||||
sprintf(s, "_%ld", nMacroCount);
|
sprintf(s, "_%u", nMacroCount);
|
||||||
newmacroargs[MAXMACROARGS] = strdup(s);
|
newmacroargs[MAXMACROARGS] = strdup(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,7 +582,7 @@ sym_AddString(char *tzSym, char *tzValue)
|
|||||||
/*
|
/*
|
||||||
* check if symbol is a string equated symbol
|
* check if symbol is a string equated symbol
|
||||||
*/
|
*/
|
||||||
ULONG
|
uint32_t
|
||||||
sym_isString(char *tzSym)
|
sym_isString(char *tzSym)
|
||||||
{
|
{
|
||||||
struct sSymbol *pSym;
|
struct sSymbol *pSym;
|
||||||
|
|||||||
@@ -22,11 +22,14 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
|
|
||||||
#include "link/mylink.h"
|
#include "link/mylink.h"
|
||||||
#include "link/script.h"
|
#include "link/script.h"
|
||||||
|
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
extern int yyparse();
|
extern int yyparse();
|
||||||
|
|
||||||
/* File include stack. */
|
/* File include stack. */
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
#include "types.h"
|
|
||||||
#include "link/mylink.h"
|
#include "link/mylink.h"
|
||||||
#include "link/main.h"
|
#include "link/main.h"
|
||||||
|
|
||||||
|
|||||||
@@ -384,7 +384,7 @@ obj_Readfile(char *tzObjectfile)
|
|||||||
int32_t
|
int32_t
|
||||||
file_Length(FILE * f)
|
file_Length(FILE * f)
|
||||||
{
|
{
|
||||||
ULONG r, p;
|
uint32_t r, p;
|
||||||
|
|
||||||
p = ftell(f);
|
p = ftell(f);
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
|
|||||||
@@ -4,8 +4,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "extern/err.h"
|
#include "extern/err.h"
|
||||||
|
|
||||||
#include "link/main.h"
|
#include "link/main.h"
|
||||||
#include "link/patch.h"
|
#include "link/patch.h"
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define HASHSIZE 73
|
#define HASHSIZE 73
|
||||||
@@ -16,7 +18,7 @@ struct ISymbol {
|
|||||||
int32_t nBank; /* -1 = constant */
|
int32_t nBank; /* -1 = constant */
|
||||||
char tzObjFileName[_MAX_PATH + 1]; /* Object file where the symbol was defined. */
|
char tzObjFileName[_MAX_PATH + 1]; /* Object file where the symbol was defined. */
|
||||||
char tzFileName[_MAX_PATH + 1]; /* Source 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. */
|
uint32_t nFileLine; /* Line where the symbol was defined. */
|
||||||
struct ISymbol *pNext;
|
struct ISymbol *pNext;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -80,7 +82,7 @@ sym_GetBank(char *tzName)
|
|||||||
|
|
||||||
void
|
void
|
||||||
sym_CreateSymbol(char *tzName, int32_t nValue, int32_t nBank, char *tzObjFileName,
|
sym_CreateSymbol(char *tzName, int32_t nValue, int32_t nBank, char *tzObjFileName,
|
||||||
char *tzFileName, ULONG nFileLine)
|
char *tzFileName, uint32_t nFileLine)
|
||||||
{
|
{
|
||||||
if (strcmp(tzName, "@") == 0)
|
if (strcmp(tzName, "@") == 0)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user