// 6502.h // Main elements of the 6502 CPU #ifndef CPU_H #define CPU_H #include"stdio.h" #include"core.h" byte acc, X, Y, P, S = 0x00; address PC = 0x0000; byte* Memory; byte* ROM; // FLAGS #define flag_N 0x80 // Negative #define flag_V 0x40 // Overflow #define flag_B 0x10 // BRK command #define flag_D 0x08 // Decimal mode #define flag_I 0x04 // IRQ disable #define flag_Z 0x02 // Zero #define flag_C 0x01 // Carry byte getFlag(byte flag); // Get the value of a flag. void setFlag(byte flag, int x); // Set a flag with some value. void flagSet(byte flag); // Sets some flag. void flagClear(byte flag); // Clears some flag. // Functions which perform reusable routines for finding if a specific flag should be set. void setFlagN(byte x); //Perform prior to any changes void setFlagV(byte x, byte y); //void setFlagB(); //May not need since its dependent on the BRK insturction //void setFlagD(); //Might not be necessary. //void setFlagI(); //Need to work on. void setFlagZ(int x); //void setFlagC(); //Only 6 instructions, 2 not including stack instructions, use the carry flag. // The following two may be better defined within apple.c //byte getMemory(address x); // Retrieve value from the computers address space. // It is important not to directly access the memory array because some value hold special meaning. //void setMemory(address x, byte y); // Set a piece of memory to some value. byte getStack(); // Get top value of the stack. void setStack(byte z); // Set top value of the stack. #endif