Virtual 4001 CPU - Memory.h

IF YOU HAVE JUST ARRIVED HERE, PLEASE SEE: http://megalomaniacbore.blogspot.co.uk/2014/04/virtual-cpu-in-c-4001-cpu.html


//-------------- Memory.h ----------------------------

#ifndef CPU_MEMORY
#define CPU_MEMORY

namespace CPU_4001
{

// Because C++ does not work directly in byte sized memory as numbers
// we'll use the byte sized character type as our byte of memory.
typedef unsigned char byte;

class Memory
{
public:

/// A constant we're going to define which
/// tells us the maximum address we can
/// read or write from.
const byte c_MaxAddress;

private:

/// This is the memory space we're going to
/// be using.
byte* m_MemorySpace;

public:

/// Construct a Memory class instance
/// for us, and clear the memory
Memory();

/// Delete the memory class, releasing
/// all the allocated memory space
~Memory();

/// Function to clear the memory values all to zero
void Clear();

/// Function to read the given address value
const byte& Read (const byte& p_Address);

/// Function to write the value to the given address
void Write (const byte& p_Address, const byte& p_Value);

};

}

#endif

2 comments:

  1. hey, this is what i was looking for, u guess 4001 is the emulator of the intel 4004 processor? I search the direct hadrware access via c++ any suggestions?

    ReplyDelete
    Replies
    1. http://megalomaniacbore.blogspot.co.uk/2014/04/virtual-cpu-in-c-4001-cpu.html

      Delete