1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-25 06:31:25 +00:00
C02/common.h

66 lines
2.3 KiB
C
Raw Normal View History

/*************************************
* C02 Common Definitions & Routines *
*************************************/
#ifndef COMMON_H
#define COMMON_H //Define Guard
#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
#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
#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
#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
#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);}
#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
char inpnam[FNAMLEN]; //Include File Name
int alcvar; //Allocate Variables Flag
int lsrtrn; //Last Statement was a Return
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
#endif