1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-21 10:32:08 +00:00

Added A02 Assembler to Makefile

This commit is contained in:
Curtis F Kaylor 2019-11-15 14:30:43 -05:00
parent 37d0fee589
commit 1b061ec033
3 changed files with 26 additions and 21 deletions

View File

@ -4,5 +4,6 @@ mainfile=src/c02.c
outfile=c02
c02: ${incfiles} ${mainfile}
gcc ${gccopts} ${incfiles} ${mainfile} -o ${outfile}
gcc ${gccopts} a02.h a02.c -o a02
clean:
rm ${outfile}
rm ${outfile} a02

34
a02.c
View File

@ -284,6 +284,21 @@ void outwrd(int w) {
outbyt(w >> 8);
}
/* Lookup Opcode */
int lkpopc(struct opc opl[]) {
if (DEBUG) printf("Looking up Mnemonic %s\n", mnmnc);
token = 0xFF; //Set Token to Invalid
char mne[5]; strncpy(mne, mnmnc, 4); mne[4] = 0; //Truncate Mnemonic to Four Characters
for (int i=0; opl[i].name[0]; i++) {
if (strcmp(opl[i].name, mne)) continue;
token = opl[i].token;
amode = opl[i].amode;
if (DEBUG) printf("Found token %02X, amode %04X\n", token, amode);
return TRUE;
}
return FALSE;
}
/* Assemble BYTE Pseudo-Op */
void asmbyt(void) {
if (DEBUG) puts("Assembling BYTE Pseudo-Op");
@ -405,21 +420,6 @@ int asmpso(int dot) {
return TRUE;
}
/* Lookup Opcode */
int lkpopc(struct opc opl[]) {
if (DEBUG) printf("Looking up Mnemonic %s\n", mnmnc);
token = 0xFF; //Set Token to Invalid
char mne[5]; strncpy(mne, mnmnc, 4); mne[4] = 0; //Truncate Mnemonic to Four Characters
for (int i=0; opl[i].name[0]; i++) {
if (strcmp(opl[i].name, mne)) continue;
token = opl[i].token;
amode = opl[i].amode;
if (DEBUG) printf("Found token %02X, amode %04X\n", token, amode);
return TRUE;
}
return FALSE;
}
/* Check for Valid Addressing Mode */
int chkmod(int mode) {
char* s = NULL; //Pointer to Addressing Mode Description
@ -513,9 +513,9 @@ void dbgopc(void) {
case 0x11: puts("(Indirect)"); break;
case 0x04: puts("ZeroPage"); break;
case 0x0C: puts("Absolute"); break;
case 0x14: puts("ZeroPage,X"); break;
case 0x14: if ((token == 0x82 || token == 0xA2)) puts("ZeroPage,Y");
else puts("ZeroPage,X"); break;
case 0x1C: puts("Absolute,X"); break;
case 0x14: puts("ZeroPage,Y"); break;
case 0x18: puts("Absolute,Y"); break;
default: puts("UNKOWN");
}

10
c02.ppj
View File

@ -8,7 +8,7 @@ POC_PROJECT_TYPE = 13#
POC_PROJECT_OUTPUTDIR = output#
POC_PROJECT_RESULTDIR = .#
POC_PROJECT_ARGUMENTS = #
POC_PROJECT_WORKPATH = .#
POC_PROJECT_WORKPATH = src#
POC_PROJECT_EXECUTOR = #
POC_PROJECT_ZIPEXTRA = #
CC = pocc.exe#
@ -153,8 +153,10 @@ output\label.obj: \
src\label.c \
src\asm.h \
src\common.h \
src\files.h \
src\label.h \
src\parse.h
src\parse.h \
src\vars.h
$(CC) $(CCFLAGS) "$!" -Fo"$@"
#
@ -164,9 +166,11 @@ output\parse.obj: \
src\parse.c \
src\asm.h \
src\common.h \
src\expr.h \
src\files.h \
src\label.h \
src\parse.h
src\parse.h \
src\stmnt.h
$(CC) $(CCFLAGS) "$!" -Fo"$@"
#