2017-04-22 18:39:52 +00:00
|
|
|
/*************************************
|
|
|
|
* C02 Common Definitions & Routines *
|
|
|
|
*************************************/
|
|
|
|
|
2017-05-16 00:25:11 +00:00
|
|
|
#ifndef COMMON_H
|
|
|
|
|
|
|
|
#define COMMON_H //Define Guard
|
|
|
|
|
2017-04-22 18:39:52 +00:00
|
|
|
#define FNAMLEN 255 //Maximum File Name Length
|
|
|
|
#define LINELEN 255 //Maximum Input/Output Line Length
|
2017-06-27 00:16:23 +00:00
|
|
|
#define DEFLEN 6 //Maximum Definition Text Length
|
2017-04-22 18:39:52 +00:00
|
|
|
#define MAXDEF 255 //Maximum Number of Definitions
|
|
|
|
#define VARLEN 6 //Maximum Variable Length
|
|
|
|
#define MAXVAR 255 //Maximum Number of Variables
|
2017-05-01 01:17:50 +00:00
|
|
|
#define MAXFNS 16 //Maximum Functions in Stack
|
|
|
|
#define DATASPC 2048 //Space to Allocate for Variable Data
|
2017-04-22 18:39:52 +00:00
|
|
|
#define LABLEN 6 //Maximum Label Length
|
|
|
|
#define LABFMT "L_%04d" //Label Format
|
|
|
|
#define LABSFX ":" //Label Suffix
|
|
|
|
#define MAXLAB 15 //Maximum Number of Labels (Nesting Depth)
|
|
|
|
|
|
|
|
#define CPUOP "PROCESSOR" //Target CPU Pseudo-Operator
|
|
|
|
#define CPUARG "6502" //Target CPU Operand
|
2018-01-28 18:38:17 +00:00
|
|
|
#define ORGOP "ORG" //Origin Pseudo-Op
|
2017-04-22 18:39:52 +00:00
|
|
|
#define EQUOP "EQU" //Equate Pseudo-Op
|
|
|
|
#define BYTEOP "DC" //Define Byte Pseudo-Op
|
|
|
|
#define STROP "DS" //Define String Pseudo-Op
|
2018-01-28 18:38:17 +00:00
|
|
|
#define ALNOP "ALIGN" //Align Pseudo-Op
|
2017-04-22 18:39:52 +00:00
|
|
|
|
|
|
|
#define ASMFMT "%-7s %-3s %-12s %s\n" //Assembly Language Line printf Format
|
|
|
|
|
|
|
|
/* Internal defines */
|
|
|
|
#define TRUE -1
|
|
|
|
#define FALSE 0
|
|
|
|
|
|
|
|
#define DEBUG(fmt, val) if (debug) {prtpos(); printf(fmt, val);}
|
2018-01-28 18:38:17 +00:00
|
|
|
#define DETAIL(fmt, val) if (debug) {printf(fmt, val);}
|
2017-04-22 18:39:52 +00:00
|
|
|
#define ERROR(fmt, val, err) if (debug) {printf(fmt, val);exterr(err);}
|
|
|
|
#define SCMNT(str) if (gencmt) {setcmt(str);}
|
|
|
|
#define ACMNT(str) if (gencmt) {addcmt(str);}
|
|
|
|
#define CCMNT(chr) if (gencmt) {chrcmt(chr);}
|
|
|
|
|
|
|
|
int gencmt; //Generate Assembly Language Comments
|
|
|
|
int debug; //Print Debug Info (TRUE or FALSE)
|
|
|
|
|
|
|
|
int curcol, curlin; //Position in Source Code
|
|
|
|
int savcol, savlin; //Save Position in Source Code
|
|
|
|
|
|
|
|
int nxtchr; //Next Character of Source File to Process
|
|
|
|
int nxtupc; //Next Character Converted to Uppercase
|
|
|
|
int savchr; //Holds nxtchr when switching input files
|
|
|
|
|
2018-01-28 18:38:17 +00:00
|
|
|
char incdir[FNAMLEN]; //Include File Directory
|
2017-04-22 18:39:52 +00:00
|
|
|
char inpnam[FNAMLEN]; //Include File Name
|
|
|
|
|
|
|
|
int alcvar; //Allocate Variables Flag
|
|
|
|
|
2017-05-16 00:25:11 +00:00
|
|
|
int lsrtrn; //Last Statement was a Return
|
|
|
|
|
2017-04-22 18:39:52 +00:00
|
|
|
void exterr(int errnum); //Print current file name & position and exit
|
|
|
|
void expctd(char *expected); //Print Expected message and exit
|
|
|
|
|
|
|
|
void prtpos(); //Print current file name and position
|
|
|
|
|
2017-05-16 00:25:11 +00:00
|
|
|
#endif
|