This commit is contained in:
edmccard 2012-04-06 23:48:37 -04:00
parent b7d2356f78
commit 9a758781b5
1 changed files with 45 additions and 0 deletions

45
src/cpu6502.d Normal file
View File

@ -0,0 +1,45 @@
module cpu6502;
enum Strict : bool
{
no, yes
}
enum Cumulative : bool
{
no, yes
}
class Cpu(bool cumulative)
{
struct _Mem
{
// Reads a value from system memory.
ubyte delegate(ushort addr) read;
// Writes a value to system memory.
void delegate(ushort addr, ubyte val) write;
}
_Mem memory;
struct _Clock
{
static if (cumulative)
/*
* Updates the number of cycles executed. Called just
* prior to the final read/write action of each opcode.
*/
void delegate(int cycles) tick;
else
/*
* Increments the number of cycles executed. Called prior
* to each read/write action.
*/
void delegate() tick;
}
_Clock clock;
ubyte A, X, Y, S, P;
}