mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
asm: moved includes to include/asm/
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
This commit is contained in:
@@ -20,7 +20,7 @@ rgbasm: $(obj)
|
||||
gcc -Wall -o $@ $^ -lm
|
||||
|
||||
.c.o:
|
||||
gcc -Wall -DGAMEBOY -I. -I.. -Iinclude -Igameboy -g -c -o $@ $<
|
||||
gcc -Wall -DGAMEBOY -I. -I.. -I../../include -Igameboy -g -c -o $@ $<
|
||||
|
||||
.y.c:
|
||||
bison -d -o $@ $^
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "symbol.h"
|
||||
#include "fstack.h"
|
||||
#include "types.h"
|
||||
#include "main.h"
|
||||
#include "lexer.h"
|
||||
|
||||
#include "asm/symbol.h"
|
||||
#include "asm/fstack.h"
|
||||
#include "asm/types.h"
|
||||
#include "asm/main.h"
|
||||
#include "asm/lexer.h"
|
||||
|
||||
/*
|
||||
* RGBAsm - FSTACK.C (FileStack routines)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "symbol.h"
|
||||
#include "lexer.h"
|
||||
#include "rpn.h"
|
||||
#include "asmy.h"
|
||||
#include "asm/symbol.h"
|
||||
#include "asm/lexer.h"
|
||||
#include "asm/rpn.h"
|
||||
#include "asm/asmy.h"
|
||||
|
||||
struct sLexInitString localstrings[] = {
|
||||
{ "adc", T_Z80_ADC },
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include "asm.h"
|
||||
#include "symbol.h"
|
||||
#include "rpn.h"
|
||||
#include "asmy.h"
|
||||
#include "symbol.h"
|
||||
#include "main.h"
|
||||
#include "lexer.h"
|
||||
#include "asm/asm.h"
|
||||
#include "asm/symbol.h"
|
||||
#include "asm/rpn.h"
|
||||
#include "asm/asmy.h"
|
||||
#include "asm/symbol.h"
|
||||
#include "asm/main.h"
|
||||
#include "asm/lexer.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/* asm.h
|
||||
*
|
||||
* Contains some assembler-wide defines and externs
|
||||
*
|
||||
* Copyright 1997 Carsten Sorensen
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ASM_H
|
||||
#define ASM_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
#include "symbol.h"
|
||||
#include "localasm.h"
|
||||
#include "asmotor.h"
|
||||
|
||||
extern SLONG nLineNo;
|
||||
extern ULONG nTotalLines;
|
||||
extern ULONG nPC;
|
||||
extern ULONG nPass;
|
||||
extern ULONG nIFDepth;
|
||||
extern char tzCurrentFileName[_MAX_PATH + 1];
|
||||
extern struct Section *pCurrentSection;
|
||||
extern struct sSymbol *tHashedSymbols[HASHSIZE];
|
||||
extern struct sSymbol *pPCSymbol;
|
||||
extern UBYTE oDontExpandStrings;
|
||||
|
||||
#define MAXMACROARGS 9
|
||||
#define MAXINCPATHS 16
|
||||
|
||||
#endif // ASM_H
|
||||
@@ -1,41 +0,0 @@
|
||||
/* fstack.h
|
||||
*
|
||||
* Contains some assembler-wide defines and externs
|
||||
*
|
||||
* Copyright 1997 Carsten Sorensen
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FSTACK_H
|
||||
#define FSTACK_H
|
||||
|
||||
#include "asm.h"
|
||||
#include "types.h"
|
||||
#include "lexer.h"
|
||||
|
||||
struct sContext {
|
||||
YY_BUFFER_STATE FlexHandle;
|
||||
struct sSymbol *pMacro;
|
||||
struct sContext *pNext;
|
||||
char tzFileName[_MAX_PATH + 1];
|
||||
char *tzMacroArgs[MAXMACROARGS + 1];
|
||||
SLONG nLine;
|
||||
ULONG nStatus;
|
||||
FILE *pFile;
|
||||
char *pREPTBlock;
|
||||
ULONG nREPTBlockCount;
|
||||
ULONG nREPTBlockSize;
|
||||
};
|
||||
|
||||
extern ULONG fstk_RunInclude(char *s);
|
||||
extern void fstk_RunMacroArg(SLONG s);
|
||||
extern ULONG fstk_Init(char *s);
|
||||
extern void fstk_Dump(void);
|
||||
extern void fstk_AddIncludePath(char *s);
|
||||
extern ULONG fstk_RunMacro(char *s);
|
||||
extern void fstk_RunRept(ULONG count);
|
||||
extern void fstk_FindFile(char *s);
|
||||
|
||||
extern int yywrap(void);
|
||||
|
||||
#endif
|
||||
@@ -1,151 +0,0 @@
|
||||
typedef union {
|
||||
char tzSym[MAXSYMLEN + 1];
|
||||
char tzString[256];
|
||||
struct Expression sVal;
|
||||
SLONG nConstValue;
|
||||
} YYSTYPE;
|
||||
#define T_NUMBER 258
|
||||
#define T_STRING 259
|
||||
#define T_OP_LOGICNOT 260
|
||||
#define T_OP_LOGICOR 261
|
||||
#define T_OP_LOGICAND 262
|
||||
#define T_OP_LOGICEQU 263
|
||||
#define T_OP_LOGICGT 264
|
||||
#define T_OP_LOGICLT 265
|
||||
#define T_OP_LOGICGE 266
|
||||
#define T_OP_LOGICLE 267
|
||||
#define T_OP_LOGICNE 268
|
||||
#define T_OP_ADD 269
|
||||
#define T_OP_SUB 270
|
||||
#define T_OP_OR 271
|
||||
#define T_OP_XOR 272
|
||||
#define T_OP_AND 273
|
||||
#define T_OP_SHL 274
|
||||
#define T_OP_SHR 275
|
||||
#define T_OP_MUL 276
|
||||
#define T_OP_DIV 277
|
||||
#define T_OP_MOD 278
|
||||
#define T_OP_NOT 279
|
||||
#define T_OP_DEF 280
|
||||
#define T_OP_BANK 281
|
||||
#define T_OP_SIN 282
|
||||
#define T_OP_COS 283
|
||||
#define T_OP_TAN 284
|
||||
#define T_OP_ASIN 285
|
||||
#define T_OP_ACOS 286
|
||||
#define T_OP_ATAN 287
|
||||
#define T_OP_ATAN2 288
|
||||
#define T_OP_FDIV 289
|
||||
#define T_OP_FMUL 290
|
||||
#define T_OP_STRCMP 291
|
||||
#define T_OP_STRIN 292
|
||||
#define T_OP_STRSUB 293
|
||||
#define T_OP_STRLEN 294
|
||||
#define T_OP_STRCAT 295
|
||||
#define T_OP_STRUPR 296
|
||||
#define T_OP_STRLWR 297
|
||||
#define NEG 298
|
||||
#define T_LABEL 299
|
||||
#define T_ID 300
|
||||
#define T_POP_EQU 301
|
||||
#define T_POP_SET 302
|
||||
#define T_POP_EQUS 303
|
||||
#define T_POP_INCLUDE 304
|
||||
#define T_POP_PRINTF 305
|
||||
#define T_POP_PRINTT 306
|
||||
#define T_POP_PRINTV 307
|
||||
#define T_POP_IF 308
|
||||
#define T_POP_ELSE 309
|
||||
#define T_POP_ENDC 310
|
||||
#define T_POP_IMPORT 311
|
||||
#define T_POP_EXPORT 312
|
||||
#define T_POP_GLOBAL 313
|
||||
#define T_POP_DB 314
|
||||
#define T_POP_DS 315
|
||||
#define T_POP_DW 316
|
||||
#define T_POP_SECTION 317
|
||||
#define T_POP_RB 318
|
||||
#define T_POP_RW 319
|
||||
#define T_POP_MACRO 320
|
||||
#define T_POP_ENDM 321
|
||||
#define T_POP_RSRESET 322
|
||||
#define T_POP_RSSET 323
|
||||
#define T_POP_INCBIN 324
|
||||
#define T_POP_REPT 325
|
||||
#define T_POP_SHIFT 326
|
||||
#define T_POP_ENDR 327
|
||||
#define T_POP_FAIL 328
|
||||
#define T_POP_WARN 329
|
||||
#define T_SECT_BSS 330
|
||||
#define T_SECT_VRAM 331
|
||||
#define T_SECT_CODE 332
|
||||
#define T_SECT_HOME 333
|
||||
#define T_SECT_HRAM 334
|
||||
#define T_Z80_ADC 335
|
||||
#define T_Z80_ADD 336
|
||||
#define T_Z80_AND 337
|
||||
#define T_Z80_BIT 338
|
||||
#define T_Z80_CALL 339
|
||||
#define T_Z80_CCF 340
|
||||
#define T_Z80_CP 341
|
||||
#define T_Z80_CPL 342
|
||||
#define T_Z80_DAA 343
|
||||
#define T_Z80_DEC 344
|
||||
#define T_Z80_DI 345
|
||||
#define T_Z80_EI 346
|
||||
#define T_Z80_EX 347
|
||||
#define T_Z80_HALT 348
|
||||
#define T_Z80_INC 349
|
||||
#define T_Z80_JP 350
|
||||
#define T_Z80_JR 351
|
||||
#define T_Z80_LD 352
|
||||
#define T_Z80_LDIO 353
|
||||
#define T_Z80_NOP 354
|
||||
#define T_Z80_OR 355
|
||||
#define T_Z80_POP 356
|
||||
#define T_Z80_PUSH 357
|
||||
#define T_Z80_RES 358
|
||||
#define T_Z80_RET 359
|
||||
#define T_Z80_RETI 360
|
||||
#define T_Z80_RST 361
|
||||
#define T_Z80_RL 362
|
||||
#define T_Z80_RLA 363
|
||||
#define T_Z80_RLC 364
|
||||
#define T_Z80_RLCA 365
|
||||
#define T_Z80_RR 366
|
||||
#define T_Z80_RRA 367
|
||||
#define T_Z80_RRC 368
|
||||
#define T_Z80_RRCA 369
|
||||
#define T_Z80_SBC 370
|
||||
#define T_Z80_SCF 371
|
||||
#define T_Z80_STOP 372
|
||||
#define T_Z80_SLA 373
|
||||
#define T_Z80_SRA 374
|
||||
#define T_Z80_SRL 375
|
||||
#define T_Z80_SUB 376
|
||||
#define T_Z80_SWAP 377
|
||||
#define T_Z80_XOR 378
|
||||
#define T_MODE_A 379
|
||||
#define T_MODE_B 380
|
||||
#define T_MODE_C 381
|
||||
#define T_MODE_C_IND 382
|
||||
#define T_MODE_D 383
|
||||
#define T_MODE_E 384
|
||||
#define T_MODE_H 385
|
||||
#define T_MODE_L 386
|
||||
#define T_MODE_AF 387
|
||||
#define T_MODE_BC 388
|
||||
#define T_MODE_BC_IND 389
|
||||
#define T_MODE_DE 390
|
||||
#define T_MODE_DE_IND 391
|
||||
#define T_MODE_SP 392
|
||||
#define T_MODE_SP_IND 393
|
||||
#define T_MODE_HL 394
|
||||
#define T_MODE_HL_IND 395
|
||||
#define T_MODE_HL_INDDEC 396
|
||||
#define T_MODE_HL_INDINC 397
|
||||
#define T_CC_NZ 398
|
||||
#define T_CC_Z 399
|
||||
#define T_CC_NC 400
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
@@ -1,64 +0,0 @@
|
||||
#ifndef LEXER_H
|
||||
#define LEXER_H
|
||||
|
||||
#include "types.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define LEXHASHSIZE 512
|
||||
|
||||
struct sLexInitString {
|
||||
char *tzName;
|
||||
ULONG nToken;
|
||||
};
|
||||
|
||||
struct sLexFloat {
|
||||
ULONG(*Callback) (char *s, ULONG size);
|
||||
ULONG nToken;
|
||||
};
|
||||
|
||||
struct yy_buffer_state {
|
||||
char *pBufferStart;
|
||||
char *pBuffer;
|
||||
ULONG nBufferSize;
|
||||
ULONG oAtLineStart;
|
||||
};
|
||||
|
||||
enum eLexerState {
|
||||
LEX_STATE_NORMAL,
|
||||
LEX_STATE_MACROARGS
|
||||
};
|
||||
|
||||
#define INITIAL 0
|
||||
#define macroarg 3
|
||||
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
|
||||
extern void yy_set_state(enum eLexerState i);
|
||||
extern YY_BUFFER_STATE yy_create_buffer(FILE * f);
|
||||
extern YY_BUFFER_STATE yy_scan_bytes(char *mem, ULONG size);
|
||||
extern void yy_delete_buffer(YY_BUFFER_STATE);
|
||||
extern void yy_switch_to_buffer(YY_BUFFER_STATE);
|
||||
extern ULONG lex_FloatAlloc(struct sLexFloat *tok);
|
||||
extern void lex_FloatAddRange(ULONG id, UWORD start, UWORD end);
|
||||
extern void lex_FloatDeleteRange(ULONG id, UWORD start, UWORD end);
|
||||
extern void lex_FloatAddFirstRange(ULONG id, UWORD start, UWORD end);
|
||||
extern void lex_FloatDeleteFirstRange(ULONG id, UWORD start, UWORD end);
|
||||
extern void lex_FloatAddSecondRange(ULONG id, UWORD start, UWORD end);
|
||||
extern void lex_FloatDeleteSecondRange(ULONG id, UWORD start, UWORD end);
|
||||
extern void lex_Init(void);
|
||||
extern void lex_AddStrings(struct sLexInitString *lex);
|
||||
extern void lex_SetBuffer(char *buffer, ULONG len);
|
||||
extern ULONG yylex(void);
|
||||
extern void yyunput(char c);
|
||||
extern void yyunputstr(char *s);
|
||||
extern void yyskipbytes(ULONG count);
|
||||
extern void yyunputbytes(ULONG count);
|
||||
|
||||
extern YY_BUFFER_STATE pCurrentBuffer;
|
||||
|
||||
#ifdef __GNUC__
|
||||
extern void strupr(char *s);
|
||||
extern void strlwr(char *s);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
struct sOptions {
|
||||
ULONG endian;
|
||||
char gbgfx[4];
|
||||
char binary[2];
|
||||
SLONG fillchar; // -1 == random
|
||||
};
|
||||
|
||||
extern char *tzNewMacro;
|
||||
extern ULONG ulNewMacroSize;
|
||||
extern SLONG nGBGfxID;
|
||||
extern SLONG nBinaryID;
|
||||
|
||||
extern struct sOptions DefaultOptions;
|
||||
extern struct sOptions CurrentOptions;
|
||||
extern void opt_Push(void);
|
||||
extern void opt_Pop(void);
|
||||
extern void opt_Parse(char *s);
|
||||
|
||||
void fatalerror(char *s);
|
||||
void yyerror(char *s);
|
||||
|
||||
extern char temptext[1024];
|
||||
|
||||
#define YY_FATAL_ERROR fatalerror
|
||||
|
||||
#ifdef YYLMAX
|
||||
#undef YYLMAX
|
||||
#endif
|
||||
#define YYLMAX 65536
|
||||
|
||||
#endif
|
||||
@@ -1,119 +0,0 @@
|
||||
#ifndef LINK_H
|
||||
#define LINK_H 1
|
||||
|
||||
/* RGB0 .obj format:
|
||||
*
|
||||
* Header
|
||||
* Symbols
|
||||
* Sections
|
||||
*
|
||||
* Header:
|
||||
* "RGB0"
|
||||
* LONG NumberOfSymbols
|
||||
* LONG NumberOfSections
|
||||
*
|
||||
* Symbols:
|
||||
* Symbol[NumberOfSymbols]
|
||||
*
|
||||
* Symbol:
|
||||
* char Name (NULL terminated)
|
||||
* char nType
|
||||
* if( nType!=SYM_IMPORT )
|
||||
* {
|
||||
* LONG SectionID
|
||||
* LONG Offset
|
||||
* }
|
||||
*
|
||||
* Sections:
|
||||
* Section[NumberOfSections]
|
||||
*
|
||||
* Section:
|
||||
* LONG SizeInBytes
|
||||
* char Type
|
||||
* if( Type!=BSS )
|
||||
* {
|
||||
* char Data[SizeInBytes]
|
||||
* Patches
|
||||
* }
|
||||
*
|
||||
* Patches:
|
||||
* LONG NumberOfPatches
|
||||
* Patch[NumberOfPatches]
|
||||
*
|
||||
* Patch:
|
||||
* char Filename NULL-terminated
|
||||
* LONG LineNo
|
||||
* LONG Offset
|
||||
* char Type
|
||||
* LONG RpnByteSize
|
||||
* Rpn[RpnByteSize]
|
||||
*
|
||||
* Rpn:
|
||||
* Operators: 0x00-0x7F
|
||||
* Constants: 0x80 0x00000000
|
||||
* Symbols : 0x81 0x00000000
|
||||
*
|
||||
*/
|
||||
|
||||
enum {
|
||||
RPN_ADD = 0,
|
||||
RPN_SUB,
|
||||
RPN_MUL,
|
||||
RPN_DIV,
|
||||
RPN_MOD,
|
||||
RPN_UNSUB,
|
||||
|
||||
RPN_OR,
|
||||
RPN_AND,
|
||||
RPN_XOR,
|
||||
RPN_UNNOT,
|
||||
|
||||
RPN_LOGAND,
|
||||
RPN_LOGOR,
|
||||
RPN_LOGUNNOT,
|
||||
|
||||
RPN_LOGEQ,
|
||||
RPN_LOGNE,
|
||||
RPN_LOGGT,
|
||||
RPN_LOGLT,
|
||||
RPN_LOGGE,
|
||||
RPN_LOGLE,
|
||||
|
||||
RPN_SHL,
|
||||
RPN_SHR,
|
||||
|
||||
RPN_BANK,
|
||||
|
||||
RPN_HRAM,
|
||||
|
||||
RPN_PCEZP,
|
||||
|
||||
RPN_RANGECHECK,
|
||||
|
||||
RPN_CONST = 0x80,
|
||||
RPN_SYM = 0x81
|
||||
};
|
||||
|
||||
enum {
|
||||
SECT_BSS = 0,
|
||||
SECT_VRAM,
|
||||
SECT_CODE,
|
||||
SECT_HOME,
|
||||
SECT_HRAM
|
||||
};
|
||||
|
||||
enum {
|
||||
SYM_LOCAL = 0,
|
||||
SYM_IMPORT,
|
||||
SYM_EXPORT
|
||||
};
|
||||
|
||||
enum {
|
||||
PATCH_BYTE = 0,
|
||||
PATCH_WORD_L,
|
||||
PATCH_LONG_L,
|
||||
PATCH_WORD_B,
|
||||
PATCH_LONG_B
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef MATH_H
|
||||
#define MATH_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
void math_DefinePI(void);
|
||||
void math_Print(SLONG i);
|
||||
SLONG math_Sin(SLONG i);
|
||||
SLONG math_Cos(SLONG i);
|
||||
SLONG math_Tan(SLONG i);
|
||||
SLONG math_ASin(SLONG i);
|
||||
SLONG math_ACos(SLONG i);
|
||||
SLONG math_ATan(SLONG i);
|
||||
SLONG math_ATan2(SLONG i, SLONG j);
|
||||
SLONG math_Mul(SLONG i, SLONG j);
|
||||
SLONG math_Div(SLONG i, SLONG j);
|
||||
|
||||
#endif
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef OUTPUT_H
|
||||
#define OUTPUT_H 1
|
||||
|
||||
#include "rpn.h"
|
||||
#include "types.h"
|
||||
|
||||
struct Section {
|
||||
char *pzName;
|
||||
UBYTE nType;
|
||||
ULONG nPC;
|
||||
ULONG nOrg;
|
||||
ULONG nBank;
|
||||
struct Section *pNext;
|
||||
struct Patch *pPatches;
|
||||
UBYTE *tData;
|
||||
};
|
||||
|
||||
void out_PrepPass2(void);
|
||||
void out_SetFileName(char *s);
|
||||
void out_NewSection(char *pzName, ULONG secttype);
|
||||
void out_NewAbsSection(char *pzName, ULONG secttype, SLONG org, SLONG bank);
|
||||
void out_AbsByte(int b);
|
||||
void out_RelByte(struct Expression *expr);
|
||||
void out_RelWord(struct Expression *expr);
|
||||
void out_PCRelByte(struct Expression *expr);
|
||||
void out_WriteObject(void);
|
||||
void out_Skip(int skip);
|
||||
void out_BinaryFile(char *s);
|
||||
void out_String(char *s);
|
||||
void out_AbsLong(SLONG b);
|
||||
void out_RelLong(struct Expression *expr);
|
||||
void out_PushSection(void);
|
||||
void out_PopSection(void);
|
||||
|
||||
#endif
|
||||
@@ -1,68 +0,0 @@
|
||||
#ifndef RPN_H
|
||||
#define RPN_H 1
|
||||
|
||||
struct Expression {
|
||||
SLONG nVal;
|
||||
UBYTE tRPN[256];
|
||||
ULONG nRPNLength;
|
||||
ULONG nRPNOut;
|
||||
ULONG isReloc;
|
||||
ULONG isPCRel;
|
||||
};
|
||||
|
||||
ULONG rpn_isReloc(struct Expression *expr);
|
||||
ULONG rpn_isPCRelative(struct Expression *expr);
|
||||
void rpn_Symbol(struct Expression *expr, char *tzSym);
|
||||
void rpn_Number(struct Expression *expr, ULONG i);
|
||||
void rpn_LOGNOT(struct Expression *expr, struct Expression *src1);
|
||||
void rpn_LOGOR(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_LOGAND(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_LOGEQU(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_LOGGT(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_LOGLT(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_LOGGE(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_LOGLE(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_LOGNE(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_ADD(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_SUB(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_XOR(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_OR(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_AND(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_SHL(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_SHR(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_MUL(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_DIV(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_MOD(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2);
|
||||
void rpn_UNNEG(struct Expression *expr, struct Expression *src);
|
||||
void rpn_UNNOT(struct Expression *expr, struct Expression *src);
|
||||
UWORD rpn_PopByte(struct Expression *expr);
|
||||
void rpn_Bank(struct Expression *expr, char *tzSym);
|
||||
void rpn_Reset(struct Expression *expr);
|
||||
int rpn_RangeCheck(struct Expression *expr, struct Expression *src, SLONG low,
|
||||
SLONG high);
|
||||
#ifdef GAMEBOY
|
||||
void rpn_CheckHRAM(struct Expression *expr, struct Expression *src1);
|
||||
#endif
|
||||
#ifdef PCENGINE
|
||||
void rpn_CheckZP(struct Expression *expr, struct Expression *src);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,67 +0,0 @@
|
||||
#ifndef SYMBOL_H
|
||||
#define SYMBOL_H 1
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define HASHSIZE 73
|
||||
#define MAXSYMLEN 256
|
||||
|
||||
struct sSymbol {
|
||||
char tzName[MAXSYMLEN + 1];
|
||||
SLONG nValue;
|
||||
ULONG nType;
|
||||
struct sSymbol *pScope;
|
||||
struct sSymbol *pNext;
|
||||
struct Section *pSection;
|
||||
ULONG ulMacroSize;
|
||||
char *pMacro;
|
||||
SLONG(*Callback) (struct sSymbol *);
|
||||
};
|
||||
|
||||
#define SYMF_RELOC 0x001 /* symbol will be reloc'ed during linking, it's absolute value is unknown */
|
||||
#define SYMF_EQU 0x002 /* symbol is defined using EQU, will not be changed during linking */
|
||||
#define SYMF_SET 0x004 /* symbol is (re)defined using SET, will not be changed during linking */
|
||||
#define SYMF_EXPORT 0x008 /* symbol should be exported */
|
||||
#define SYMF_IMPORT 0x010 /* symbol is imported, it's value is unknown */
|
||||
#define SYMF_LOCAL 0x020 /* symbol is a local symbol */
|
||||
#define SYMF_DEFINED 0x040 /* symbol has been defined, not only referenced */
|
||||
#define SYMF_MACRO 0x080 /* symbol is a macro */
|
||||
#define SYMF_STRING 0x100 /* symbol is a stringsymbol */
|
||||
#define SYMF_CONST 0x200 /* symbol has a constant value, will not be changed during linking */
|
||||
|
||||
void sym_PrepPass1(void);
|
||||
void sym_PrepPass2(void);
|
||||
void sym_AddLocalReloc(char *tzSym);
|
||||
void sym_AddReloc(char *tzSym);
|
||||
void sym_Export(char *tzSym);
|
||||
void sym_PrintSymbolTable(void);
|
||||
struct sSymbol *sym_FindMacro(char *s);
|
||||
void sym_InitNewMacroArgs(void);
|
||||
void sym_AddNewMacroArg(char *s);
|
||||
void sym_SaveCurrentMacroArgs(char *save[]);
|
||||
void sym_RestoreCurrentMacroArgs(char *save[]);
|
||||
void sym_UseNewMacroArgs(void);
|
||||
void sym_FreeCurrentMacroArgs(void);
|
||||
void sym_AddEqu(char *tzSym, SLONG value);
|
||||
void sym_AddSet(char *tzSym, SLONG value);
|
||||
void sym_Init(void);
|
||||
ULONG sym_GetConstantValue(char *s);
|
||||
void sym_Import(char *tzSym);
|
||||
ULONG sym_isConstant(char *s);
|
||||
struct sSymbol *sym_FindSymbol(char *tzName);
|
||||
void sym_Global(char *tzSym);
|
||||
char *sym_FindMacroArg(SLONG i);
|
||||
char *sym_GetStringValue(char *tzSym);
|
||||
void sym_UseCurrentMacroArgs(void);
|
||||
void sym_SetMacroArgID(ULONG nMacroCount);
|
||||
ULONG sym_isString(char *tzSym);
|
||||
void sym_AddMacro(char *tzSym);
|
||||
void sym_ShiftCurrentMacroArgs(void);
|
||||
void sym_AddString(char *tzSym, char *tzValue);
|
||||
ULONG sym_GetValue(char *s);
|
||||
ULONG sym_GetDefinedValue(char *s);
|
||||
ULONG sym_isDefined(char *tzName);
|
||||
void sym_Purge(char *tzName);
|
||||
ULONG sym_isConstDefined(char *tzName);
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef TYPES_H
|
||||
#define TYPES_H 1
|
||||
|
||||
#if defined(AMIGA) || defined(__GNUC__)
|
||||
#define _MAX_PATH 512
|
||||
#endif
|
||||
|
||||
typedef unsigned char UBYTE;
|
||||
typedef signed char SBYTE;
|
||||
typedef unsigned short UWORD;
|
||||
typedef signed short SWORD;
|
||||
typedef unsigned long ULONG;
|
||||
typedef signed long SLONG;
|
||||
|
||||
#define ASM_LITTLE_ENDIAN 0
|
||||
#define ASM_BIG_ENDIAN 1
|
||||
|
||||
#endif
|
||||
@@ -1,10 +1,11 @@
|
||||
#include "asm.h"
|
||||
#include "lexer.h"
|
||||
#include "types.h"
|
||||
#include "main.h"
|
||||
#include "rpn.h"
|
||||
#include "asmy.h"
|
||||
#include "fstack.h"
|
||||
#include "asm/asm.h"
|
||||
#include "asm/lexer.h"
|
||||
#include "asm/types.h"
|
||||
#include "asm/main.h"
|
||||
#include "asm/rpn.h"
|
||||
#include "asm/asmy.h"
|
||||
#include "asm/fstack.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "symbol.h"
|
||||
#include "fstack.h"
|
||||
#include "output.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "asm/symbol.h"
|
||||
#include "asm/fstack.h"
|
||||
#include "asm/output.h"
|
||||
#include "asm/main.h"
|
||||
|
||||
int yyparse(void);
|
||||
void setuplex(void);
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
#include "mymath.h"
|
||||
#include "symbol.h"
|
||||
|
||||
#include "asm/types.h"
|
||||
#include "asm/mymath.h"
|
||||
#include "asm/symbol.h"
|
||||
|
||||
#define fix2double(i) ((double)(i/65536.0))
|
||||
#define double2fix(d) ((SLONG)(d*65536.0))
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "asm.h"
|
||||
#include "output.h"
|
||||
#include "symbol.h"
|
||||
#include "mylink.h"
|
||||
#include "main.h"
|
||||
#include "rpn.h"
|
||||
#include "fstack.h"
|
||||
|
||||
#include "asm/asm.h"
|
||||
#include "asm/output.h"
|
||||
#include "asm/symbol.h"
|
||||
#include "asm/mylink.h"
|
||||
#include "asm/main.h"
|
||||
#include "asm/rpn.h"
|
||||
#include "asm/fstack.h"
|
||||
|
||||
#define SECTIONCHUNK 0x4000
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mylink.h"
|
||||
#include "types.h"
|
||||
#include "symbol.h"
|
||||
#include "asm.h"
|
||||
#include "main.h"
|
||||
#include "rpn.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "asm/mylink.h"
|
||||
#include "asm/types.h"
|
||||
#include "asm/symbol.h"
|
||||
#include "asm/asm.h"
|
||||
#include "asm/main.h"
|
||||
#include "asm/rpn.h"
|
||||
|
||||
void mergetwoexpressions(struct Expression *expr, struct Expression *src1,
|
||||
struct Expression *src2)
|
||||
{
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "asm.h"
|
||||
#include "symbol.h"
|
||||
#include "main.h"
|
||||
#include "mymath.h"
|
||||
#include "output.h"
|
||||
|
||||
#include "asm/asm.h"
|
||||
#include "asm/symbol.h"
|
||||
#include "asm/main.h"
|
||||
#include "asm/mymath.h"
|
||||
#include "asm/output.h"
|
||||
|
||||
/*
|
||||
* RGBAsm - SYMBOL.C - Symboltable stuff
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
%{
|
||||
#include "symbol.h"
|
||||
#include "asm.h"
|
||||
#include "output.h"
|
||||
#include "mylink.h"
|
||||
#include "fstack.h"
|
||||
#include "mymath.h"
|
||||
#include "rpn.h"
|
||||
#include "main.h"
|
||||
#include "lexer.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "asm/symbol.h"
|
||||
#include "asm/asm.h"
|
||||
#include "asm/output.h"
|
||||
#include "asm/mylink.h"
|
||||
#include "asm/fstack.h"
|
||||
#include "asm/mymath.h"
|
||||
#include "asm/rpn.h"
|
||||
#include "asm/main.h"
|
||||
#include "asm/lexer.h"
|
||||
|
||||
char *tzNewMacro;
|
||||
ULONG ulNewMacroSize;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user