// 6502.h // Main elements of the 6502 CPU #pragma once #include"stdio.h" #include"core.h" // 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.