// 6502.h // Main elements of the 6502 CPU #pragma once #include"stdio.h" #include"core.h" // CPU 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 // Return a truth value of 1 or 0. byte GetFlag(byte flag); // x can be a conditional, and any non-zero value will set the flag. void SetFlag(byte flag, int x); // Reusable routines for setting specific flags void SetFlag_N(byte x); void SetFlag_V(byte x, byte y); void SetFlag_Z(int x); // Memory access declarations; to be defined somewhere computer-specific, not CPU-specific byte GetMemory(address x); void SetMemory(address x, byte y); // Stack access and manipulation byte GetStack(); void SetStack(byte z);