mirror of
https://github.com/RevCurtisP/C02.git
synced 2025-02-21 03:29:25 +00:00
Cleaned up definitions in .h files
This commit is contained in:
parent
2edb6da3cb
commit
bb575122ca
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,3 +1,10 @@
|
||||
#Compiled source code
|
||||
*.exe
|
||||
|
||||
#Pelles C Auxillary Files
|
||||
*.ppx
|
||||
*.tag
|
||||
|
||||
#Files created when compiling a C02 program
|
||||
*/*.asm
|
||||
*/*.bin
|
||||
|
18
asm.c
18
asm.c
@ -42,21 +42,3 @@ void cmtlin()
|
||||
fprintf(outfil, "; %s\n", cmtasm);
|
||||
setcmt("");
|
||||
}
|
||||
|
||||
/* Output a variable definition line *
|
||||
* Uses: word - assembly oprnd */
|
||||
void equlin()
|
||||
{
|
||||
fprintf(outfil, ASMFMT, lblasm, EQUOP, word, "");
|
||||
if (debug) printf(ASMFMT, lblasm, EQUOP, word, "");
|
||||
lblasm[0] = 0;
|
||||
}
|
||||
|
||||
void prolog()
|
||||
{
|
||||
DEBUG("Writing Assembly Prolog\n", 0);
|
||||
asmlin(CPUOP,CPUARG);
|
||||
strcpy(cmtasm, "Program ");
|
||||
strcat(cmtasm, srcnam);
|
||||
cmtlin();
|
||||
}
|
||||
|
5
asm.h
5
asm.h
@ -4,11 +4,6 @@
|
||||
|
||||
char lblasm[LABLEN+2]; //Label to emit on next asm line
|
||||
|
||||
void addcmt(char *s); //Append String to Assembly Line Comment
|
||||
void asmlin(char *opcode, char *oprnd); //Output a line of assembly code
|
||||
void chrcmt(char c); //Append Character to Assembly Line Comment
|
||||
void cmtlin(); //Output a comment lines
|
||||
void equlin(); //Output an equate line
|
||||
void prccmt(); //Process comment
|
||||
void prolog(); //Write Assembly Language Initialization Code
|
||||
void setcmt(char *s); //Set Assembly Line Comment to String
|
||||
|
10
c02.c
10
c02.c
@ -32,7 +32,6 @@ void init()
|
||||
defcnt = 0;
|
||||
varcnt = 0;
|
||||
lblcnt = 0;
|
||||
cmpsgn = 0;
|
||||
curcol = 0;
|
||||
curlin = 0;
|
||||
inpfil = srcfil;
|
||||
@ -80,6 +79,15 @@ void pdrctv()
|
||||
ERROR("Illegal directive %s encountered\n", word, EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void prolog()
|
||||
{
|
||||
DEBUG("Writing Assembly Prolog\n", 0);
|
||||
asmlin(CPUOP,CPUARG);
|
||||
setcmt("Program ");
|
||||
addcmt(srcnam);
|
||||
cmtlin();
|
||||
}
|
||||
|
||||
void epilog()
|
||||
{
|
||||
if (!vrwrtn) vartbl(); //Write Variable Table
|
||||
|
34
c02.ppj
34
c02.ppj
@ -8,7 +8,7 @@ POC_PROJECT_TYPE = 3#
|
||||
POC_PROJECT_OUTPUTDIR = output#
|
||||
POC_PROJECT_RESULTDIR = .#
|
||||
POC_PROJECT_ARGUMENTS = #
|
||||
POC_PROJECT_WORKPATH = #
|
||||
POC_PROJECT_WORKPATH = .#
|
||||
POC_PROJECT_EXECUTOR = #
|
||||
POC_PROJECT_ZIPEXTRA = #
|
||||
CC = pocc.exe#
|
||||
@ -28,8 +28,8 @@ LIB = $(PellesCDir)\Lib\Win;$(PellesCDir)\Lib#
|
||||
# Build c02.exe.
|
||||
#
|
||||
c02.exe: \
|
||||
output\c02.obj \
|
||||
output\asm.obj \
|
||||
output\c02.obj \
|
||||
output\common.obj \
|
||||
output\cond.obj \
|
||||
output\expr.obj \
|
||||
@ -38,7 +38,8 @@ c02.exe: \
|
||||
output\label.obj \
|
||||
output\parse.obj \
|
||||
output\stmnt.obj \
|
||||
output\vars.obj
|
||||
output\vars.obj \
|
||||
output\dclrtn.obj
|
||||
$(LINK) $(LINKFLAGS) -out:"$@" $**
|
||||
|
||||
#
|
||||
@ -49,6 +50,7 @@ output\c02.obj: \
|
||||
asm.h \
|
||||
common.h \
|
||||
cond.h \
|
||||
dclrtn.h \
|
||||
expr.h \
|
||||
files.h \
|
||||
include.h \
|
||||
@ -65,8 +67,7 @@ output\asm.obj: \
|
||||
asm.c \
|
||||
asm.h \
|
||||
common.h \
|
||||
files.h \
|
||||
parse.h
|
||||
files.h
|
||||
$(CC) $(CCFLAGS) "$!" -Fo"$@"
|
||||
|
||||
#
|
||||
@ -120,9 +121,12 @@ output\include.obj: \
|
||||
include.c \
|
||||
asm.h \
|
||||
common.h \
|
||||
dclrtn.h \
|
||||
files.h \
|
||||
include.h \
|
||||
label.h \
|
||||
parse.h \
|
||||
stmnt.h \
|
||||
vars.h
|
||||
$(CC) $(CCFLAGS) "$!" -Fo"$@"
|
||||
|
||||
@ -142,6 +146,7 @@ output\label.obj: \
|
||||
#
|
||||
output\parse.obj: \
|
||||
parse.c \
|
||||
asm.h \
|
||||
common.h \
|
||||
files.h \
|
||||
parse.h
|
||||
@ -154,6 +159,7 @@ output\stmnt.obj: \
|
||||
stmnt.c \
|
||||
asm.h \
|
||||
common.h \
|
||||
cond.h \
|
||||
expr.h \
|
||||
label.h \
|
||||
parse.h \
|
||||
@ -174,6 +180,22 @@ output\vars.obj: \
|
||||
vars.h
|
||||
$(CC) $(CCFLAGS) "$!" -Fo"$@"
|
||||
|
||||
.EXCLUDEDFILES:
|
||||
#
|
||||
# Build dclrtn.obj.
|
||||
#
|
||||
output\dclrtn.obj: \
|
||||
dclrtn.c \
|
||||
asm.h \
|
||||
common.h \
|
||||
cond.h \
|
||||
dclrtn.h \
|
||||
expr.h \
|
||||
label.h \
|
||||
parse.h \
|
||||
stmnt.h \
|
||||
vars.h
|
||||
$(CC) $(CCFLAGS) "$!" -Fo"$@"
|
||||
|
||||
.SILENT:
|
||||
|
||||
.EXCLUDEDFILES:
|
||||
|
147
c02.ppx
147
c02.ppx
@ -1,147 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<settings version="1.0">
|
||||
<category name="expr.h" />
|
||||
<category name="cond.h" />
|
||||
<category name="asm.h">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">0</property>
|
||||
<property name="Top" type="integer">0</property>
|
||||
<property name="Right" type="integer">953</property>
|
||||
<property name="Bottom" type="integer">310</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="c02.c">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">26</property>
|
||||
<property name="Top" type="integer">26</property>
|
||||
<property name="Right" type="integer">979</property>
|
||||
<property name="Bottom" type="integer">336</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="stmnt.c">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">52</property>
|
||||
<property name="Top" type="integer">52</property>
|
||||
<property name="Right" type="integer">1005</property>
|
||||
<property name="Bottom" type="integer">362</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="asm.c">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">78</property>
|
||||
<property name="Top" type="integer">78</property>
|
||||
<property name="Right" type="integer">1031</property>
|
||||
<property name="Bottom" type="integer">388</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="vars.c">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">104</property>
|
||||
<property name="Top" type="integer">104</property>
|
||||
<property name="Right" type="integer">1057</property>
|
||||
<property name="Bottom" type="integer">414</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="parse.c">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">130</property>
|
||||
<property name="Top" type="integer">130</property>
|
||||
<property name="Right" type="integer">1083</property>
|
||||
<property name="Bottom" type="integer">440</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="include.c">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">0</property>
|
||||
<property name="Top" type="integer">0</property>
|
||||
<property name="Right" type="integer">953</property>
|
||||
<property name="Bottom" type="integer">310</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="expr.c">
|
||||
<category name="Foldings">
|
||||
<property name="Line1" type="integer">1</property>
|
||||
<property name="Line2" type="integer">17</property>
|
||||
<property name="Line3" type="integer">35</property>
|
||||
<property name="Line4" type="integer">86</property>
|
||||
<property name="Line5" type="integer">119</property>
|
||||
<property name="Line6" type="integer">203</property>
|
||||
<property name="Line7" type="integer">234</property>
|
||||
</category>
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">26</property>
|
||||
<property name="Top" type="integer">26</property>
|
||||
<property name="Right" type="integer">979</property>
|
||||
<property name="Bottom" type="integer">336</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="parse.h" />
|
||||
<category name="common.h">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">52</property>
|
||||
<property name="Top" type="integer">52</property>
|
||||
<property name="Right" type="integer">1005</property>
|
||||
<property name="Bottom" type="integer">362</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="files.c" />
|
||||
<category name="common.c">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">78</property>
|
||||
<property name="Top" type="integer">78</property>
|
||||
<property name="Right" type="integer">1031</property>
|
||||
<property name="Bottom" type="integer">388</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="label.c">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">104</property>
|
||||
<property name="Top" type="integer">104</property>
|
||||
<property name="Right" type="integer">1057</property>
|
||||
<property name="Bottom" type="integer">414</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="cond.c" />
|
||||
<category name="label.h">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">0</property>
|
||||
<property name="Top" type="integer">0</property>
|
||||
<property name="Right" type="integer">953</property>
|
||||
<property name="Bottom" type="integer">310</property>
|
||||
<property name="Maximized" type="integer">0</property>
|
||||
<property name="Active" type="integer">0</property>
|
||||
</category>
|
||||
</category>
|
||||
<category name="vars.h">
|
||||
<category name="Window">
|
||||
<property name="Left" type="integer">-8</property>
|
||||
<property name="Top" type="integer">-31</property>
|
||||
<property name="Right" type="integer">953</property>
|
||||
<property name="Bottom" type="integer">422</property>
|
||||
<property name="Maximized" type="integer">1</property>
|
||||
<property name="Active" type="integer">1</property>
|
||||
</category>
|
||||
</category>
|
||||
</settings>
|
3
common.h
3
common.h
@ -29,6 +29,7 @@
|
||||
#define TRUE -1
|
||||
#define FALSE 0
|
||||
|
||||
void prtpos(); //Print current file name and position
|
||||
#define DEBUG(fmt, val) if (debug) {prtpos(); printf(fmt, val);}
|
||||
#define DETAIL(fmt, val) if (debug) {printf(fmt, val);}
|
||||
#define ERROR(fmt, val, err) if (debug) {fprintf(stderr, fmt, val);exterr(err);}
|
||||
@ -58,8 +59,6 @@ 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
|
||||
void setblk(int blkflg); //Set Block Flag for Last Label
|
||||
|
||||
void addcmt(char *s); //Append string to comment
|
||||
void chrcmt(char c); //Append character to comment
|
||||
|
6
cond.h
6
cond.h
@ -2,10 +2,4 @@
|
||||
* C02 Conditional Parsing Routines *
|
||||
************************************/
|
||||
|
||||
int cmpsgn; // Comparison contains signed operands
|
||||
|
||||
int enccmp(char c); //Encode Comparison Operator Character
|
||||
void prccmp(); //Process and Compile Comparison Operator
|
||||
void prsflg(int revrse); //Parse Flag Operator
|
||||
int prscmp(int revrse); //Parse Comparison
|
||||
void prscnd(char trmntr, int revrse); //Parse Conditional Expression
|
||||
|
1
expr.c
1
expr.c
@ -77,7 +77,6 @@ void prstrm()
|
||||
strcpy(term, value);
|
||||
DEBUG("Parsed term %s\n", term);
|
||||
chkidx(); //Check for Array Index
|
||||
//chkpst = ispopr(); //Check for Post-Op
|
||||
skpspc();
|
||||
}
|
||||
|
||||
|
7
expr.h
7
expr.h
@ -7,19 +7,12 @@ char term[255]; //Term parsed from equation
|
||||
char fnstck[MAXFNS][VARLEN+1]; //Function Call Stack
|
||||
int fnscnt; //Number of Functions in Stack
|
||||
|
||||
int chkpst; //Check for Post-Operator
|
||||
|
||||
int chkadr(int adract); //Check for and Process Address or String
|
||||
void chkidx(); //Check for, Parse, and Process Index
|
||||
void prcadr(int adract, char* symbol); //Process Address Reference
|
||||
void prcopr(); //Process Arithmetic or Bitwise Operator
|
||||
void prsadr(int adract); //Parse and Compile Address of Operator
|
||||
void prsfnc(char trmntr); //Parse function call
|
||||
void prsftm(); //Parse first term of expession
|
||||
void prsidx(); //Parse Array Index
|
||||
void prstrm(); //Parse Term in Expression
|
||||
void prsstr(int adract); //Parse and Create Anonymous String
|
||||
void prsval(int alwreg); //Parse value (constant or identifier)
|
||||
void prsxpr(char trmntr); //Parse Expression
|
||||
|
||||
|
||||
|
12
include.h
12
include.h
@ -4,19 +4,7 @@
|
||||
|
||||
char line[255]; /*Entire line parsed from include file*/
|
||||
|
||||
void incasm(); //Process assembly language include file
|
||||
void inchdr(); //Process header include file
|
||||
void logdef(); //Print Definition Table to Log File
|
||||
void pascii(); //Parse ASCII Subdirective
|
||||
void pdefin(); //Process define directive
|
||||
void phdwrd(); //Parse Header Word
|
||||
void pincdr(); //Process Include File Directive
|
||||
void pincfl(); //Process include file
|
||||
void pincnm(); //Parse Include File Name
|
||||
void porign(); //Parse Origin Subdirective
|
||||
void pprgma(); //Parse Pragma Directive
|
||||
void pvrtbl(); //Process Vartable Subdirective
|
||||
void prszpg(); //Parse Zeropage Subdirective
|
||||
void rstsrc(); //Restore Source File Pointer
|
||||
void savsrc(); //Save Source File Information
|
||||
void setinc(); //Set Include File Information
|
||||
|
14
parse.h
14
parse.h
@ -22,7 +22,6 @@ int defidx; //Index into Definition Tables
|
||||
int invasc; //Invert ASCII Flag
|
||||
|
||||
int match(char c); //Does Next Character match c
|
||||
int inbtwn(char mn, char mx); //Is Next Character in Range ()mn - mx)
|
||||
int isalph(); //Is Next Character Alphabetic
|
||||
int isanum(); //Is Next Character AlphaNumeric
|
||||
int isapos(); //Is Next Character an Apostrophe
|
||||
@ -41,32 +40,19 @@ int isspc(); //Is Next Character a Space
|
||||
int isvpre(); //Is Next Character a Value Prefix
|
||||
int isxpre(); //Is Next Character an Expression Prefix
|
||||
|
||||
|
||||
|
||||
char escape(char c); //Escape Character
|
||||
void expect(char c); //Look for Character and Exit if not found
|
||||
void fnddef(char *name); //Find Definition
|
||||
char getnxt(); //Return Next Character and Advance
|
||||
void getstr(); //Get String
|
||||
int gettyp(); //Get Value Type
|
||||
void getwrd(); //Get Next Word
|
||||
char invchr(char c); //Invert Character Case
|
||||
int look(char c); //Look for Character
|
||||
void prcidx(char *name, char *index); //Process Array Index
|
||||
void prcpst(char* name, char *index); //Process Post Operator
|
||||
int prsbin(); //Parse Binary Number
|
||||
int prsbyt(); //Parse Numeric Byte
|
||||
int prschr(); //Parse Character Constant
|
||||
void prscon(); //Parse a Constant
|
||||
int prsdec(); //Parse Decimal Number
|
||||
int prsdef(); //Parse Definition
|
||||
int prshex(); //Parse Hexadecimal Number
|
||||
int prsnum(int maxval); //Parse Numeric
|
||||
void prsopr(); //Parse Arithmetic Operator
|
||||
int prspst(char trmntr, char* name, char* index); //Parse Post Operator
|
||||
void skpchr(); //Skip Next Character
|
||||
void skpcmt(); //Skip to End of Comment
|
||||
void skpeol(); //Skip to End of Line
|
||||
void skpspc(); //Advance to Next Printable Character
|
||||
int wordis(char *s); //Does word match s
|
||||
|
||||
|
6
stmnt.h
6
stmnt.h
@ -6,13 +6,9 @@ char asnvar[VARLEN+1]; //Assigned Variable Name
|
||||
char asnidx[VARLEN+1] ; //Assigned Variable Index
|
||||
int asnivt; //Assigned Index Variable Type
|
||||
|
||||
char xstmnt[LINELEN]; //Required Statement
|
||||
char xstmnt[LINELEN]; //Expected Statement
|
||||
|
||||
void bgnblk(char blkchr); //End Program Block
|
||||
void endblk(int blkflg); //End Program Block
|
||||
void pdowhl(); //Parse and Compile WHILE after DO
|
||||
void prcasn(char trmntr); //Process Assignment
|
||||
void prcvar(char trmntr); //Process Variable at Beginning of Statement
|
||||
void prsasn(char trmntr); //Parse and Compile and Assignment
|
||||
void prssif(char trmntr); //Parse Shortcut If
|
||||
void pstmnt(); //Parse and Compile Program Statement
|
||||
|
4
vars.h
4
vars.h
@ -41,13 +41,9 @@ int prmcnt; //Number of Parameters
|
||||
|
||||
void addvar(int m, int t); //Parse and Compile Variable Declaration
|
||||
void chksym(int alwreg, char *name); //Error if Variable not defined
|
||||
int fndvar(char *name); //Lookup variable name in variable table
|
||||
void prsdts(); //Parse Data String
|
||||
void setdat(); //Set Variable Data
|
||||
void setvar(int m, int t); //Set Variable Name and Size
|
||||
void pdecl(int m, int t); //Parse Variable Declaration
|
||||
void prsdat(); //Parse and store variable data
|
||||
void prsdta(); //Parse Data Array
|
||||
void prsdts(); //Parse Data String
|
||||
void prsvar(int alwreg); //Parse Variable
|
||||
void reqvar(int alwary); //Require and Parse Variable Name
|
||||
|
Loading…
x
Reference in New Issue
Block a user