Bit32 value[MAX_PARAM_VALUE];
unsigned int vp; /*value pointer, index into the value table.*/
char *label;
Bit32 value[MAX_PARAM_VALUE];
unsigned int vp; /*value pointer, index into the value table.*/
char *label;
-static BOOL peekValue(machine_6502 *machine, AddrMode adm, Pointer *pointer, Bit16 PC){
+static BOOL peekValue(machine_6502 *machine, m6502_AddrMode adm, Pointer *pointer, Bit16 PC){
/* manZeroNeg - Manage the negative and zero flags */
static void manZeroNeg(machine_6502 *machine, Bit8 value){
/* manZeroNeg - Manage the negative and zero flags */
static void manZeroNeg(machine_6502 *machine, Bit8 value){
machine->regP = setBit(machine->regP, OVERFLOW_FL, bitOn(ptr.value, OVERFLOW_FL));
machine->regP = setBit(machine->regP, NEGATIVE_FL, bitOn(ptr.value, NEGATIVE_FL));
machine->regP = setBit(machine->regP, OVERFLOW_FL, bitOn(ptr.value, OVERFLOW_FL));
machine->regP = setBit(machine->regP, NEGATIVE_FL, bitOn(ptr.value, NEGATIVE_FL));
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
doCompare(machine,machine->regA,&ptr);
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
doCompare(machine,machine->regA,&ptr);
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
doCompare(machine,machine->regX,&ptr);
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
doCompare(machine,machine->regX,&ptr);
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
doCompare(machine,machine->regY,&ptr);
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
doCompare(machine,machine->regY,&ptr);
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
machine->regPC = ptr.addr;
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
machine->regPC = ptr.addr;
}
machine->regX = machine->regA;
manZeroNeg(machine,machine->regX);
}
machine->regX = machine->regA;
manZeroNeg(machine,machine->regX);
}
machine->regA = machine->regX;
manZeroNeg(machine,machine->regA);
}
machine->regA = machine->regX;
manZeroNeg(machine,machine->regA);
}
Bit16 value = machine->regX + 1;
machine->regX = value & 0xFF;
manZeroNeg(machine, machine->regX);
}
Bit16 value = machine->regX + 1;
machine->regX = value & 0xFF;
manZeroNeg(machine, machine->regX);
}
machine->regY = machine->regA;
manZeroNeg(machine, machine->regY);
}
machine->regY = machine->regA;
manZeroNeg(machine, machine->regY);
}
machine->regA = machine->regY;
manZeroNeg(machine, machine->regA);
}
machine->regA = machine->regY;
manZeroNeg(machine, machine->regA);
}
Bit16 value = machine->regY + 1;
machine->regY = value & 0xff;
manZeroNeg(machine, machine->regY);
}
Bit16 value = machine->regY + 1;
machine->regY = value & 0xff;
manZeroNeg(machine, machine->regY);
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
Bit16 nr = stackPop(machine);
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
Bit16 nr = stackPop(machine);
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
memStoreByte(machine,ptr.addr,machine->regA);
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
memStoreByte(machine,ptr.addr,machine->regA);
}
machine->regX = stackPop(machine);
manZeroNeg(machine, machine->regX);
}
machine->regX = stackPop(machine);
manZeroNeg(machine, machine->regX);
}
machine->regA = stackPop(machine);
manZeroNeg(machine, machine->regA);
}
machine->regA = stackPop(machine);
manZeroNeg(machine, machine->regA);
}
machine->regP = stackPop(machine);
machine->regP = setBit(machine->regP, FUTURE_FL, 1);
}
machine->regP = stackPop(machine);
machine->regP = setBit(machine->regP, FUTURE_FL, 1);
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
memStoreByte(machine,ptr.addr,machine->regX);
}
Pointer ptr;
BOOL isValue = getValue(machine, adm, &ptr);
warnValue(isValue);
memStoreByte(machine,ptr.addr,machine->regX);
}
#define SETOP(num, _name, _Imm, _ZP, _ZPX, _ZPY, _ABS, _ABSX, _ABSY, _INDX, _INDY, _SNGL, _BRA, _func) \
{opcodes[num].name[3] = '\0'; \
#define SETOP(num, _name, _Imm, _ZP, _ZPX, _ZPY, _ABS, _ABSX, _ABSY, _INDX, _INDY, _SNGL, _BRA, _func) \
{opcodes[num].name[3] = '\0'; \
/* opIndex() - Search the opcode table for a match. If found return
the index into the optable and the address mode of the opcode. If
the opcode is not found then return -1. */
/* opIndex() - Search the opcode table for a match. If found return
the index into the optable and the address mode of the opcode. If
the opcode is not found then return -1. */
/* XXX could catch errors by setting a addressmode of error or something */
*adm = machine->opcache[opcode].adm;
return machine->opcache[opcode].index;
/* XXX could catch errors by setting a addressmode of error or something */
*adm = machine->opcache[opcode].adm;
return machine->opcache[opcode].index;
/* fileToBuffer() - Allocates a buffer and loads all of the file into memory. */
static char *fileToBuffer(const char *filename){
const int defaultSize = 1024;
/* fileToBuffer() - Allocates a buffer and loads all of the file into memory. */
static char *fileToBuffer(const char *filename){
const int defaultSize = 1024;
-void hexDump(machine_6502 *machine, Bit16 start, Bit16 numbytes, FILE *output){
+void m6502_hexDump(machine_6502 *machine, Bit16 start, Bit16 numbytes, FILE *output){
int backward = (param->lbladdr < machine->defaultCodePC);
pushByte(machine, (backward) ? 0xff - diff : diff - 1);
}
int backward = (param->lbladdr < machine->defaultCodePC);
pushByte(machine, (backward) ? 0xff - diff : diff - 1);
}
for(i = 0; i < NUM_OPCODES; i++){
if (strcmp(machine->opcodes[i].name, command) == 0){
op = machine->opcodes[i];
for(i = 0; i < NUM_OPCODES; i++){
if (strcmp(machine->opcodes[i].name, command) == 0){
op = machine->opcodes[i];
p->command, p->label->label, p->label->addr,
p->param->label, p->param->lbladdr);
}
p->command, p->label->label, p->label->addr,
p->param->label, p->param->lbladdr);
}
machine_6502 *machine;
machine = ecalloc(1, sizeof(machine_6502));
assignOpCodes(machine->opcodes);
machine_6502 *machine;
machine = ecalloc(1, sizeof(machine_6502));
assignOpCodes(machine->opcodes);
Pointer ptr;
int opidx = opIndex(machine,opcode,&adm);
int stacksz = STACK_TOP - machine->regSP;
Pointer ptr;
int opidx = opIndex(machine,opcode,&adm);
int stacksz = STACK_TOP - machine->regSP;
- hexDump(machine,(STACK_TOP - stacksz) + 1, stacksz, output);
+ m6502_hexDump(machine,(STACK_TOP - stacksz) + 1, stacksz, output);
void disassemble(machine_6502 *machine, FILE *output){
/* Read the opcode
increment the program counter
print the opcode
loop until end of program. */
void disassemble(machine_6502 *machine, FILE *output){
/* Read the opcode
increment the program counter
print the opcode
loop until end of program. */
-void eval_file(machine_6502 *machine, const char *filename, Plotter plot, void *plotterState){
+#ifdef READ_FILES
+void m6502_eval_file(machine_6502 *machine, const char *filename, m6502_Plotter plot, void *plotterState){
-void start_eval_file(machine_6502 *machine, const char *filename, Plotter plot, void *plotterState){
+void m6502_start_eval_file(machine_6502 *machine, const char *filename, m6502_Plotter plot, void *plotterState){
-void start_eval_string(machine_6502 *machine, const char *code,
- Plotter plot, void *plotterState){
+void m6502_start_eval_string(machine_6502 *machine, const char *code,
+ m6502_Plotter plot, void *plotterState){