dioscuri.module.memory
Class Memory

java.lang.Object
  extended by dioscuri.module.AbstractModule
      extended by dioscuri.module.ModuleMemory
          extended by dioscuri.module.memory.Memory
All Implemented Interfaces:
Module

public class Memory
extends ModuleMemory

An implementation of a hardware memory module.

Contains an array of 2^20 integers, offering 1MB of RAM.

See Also:

Metadata module ******************************************** general.type : memory general.name : 1 Megabyte Random Access Memory general.architecture : Von Neumann general.description : General implementation of 1 MB of flat RAM. general.creator : Tessella Support Services, Koninklijke Bibliotheek, Nationaal Archief of the Netherlands general.version : 1.0 general.keywords : memory, RAM, 1MB, A20 address line general.relations : cpu, mainboard general.yearOfIntroduction : general.yearOfEnding : general.ancestor : general.successor : memory.size : 1 MB

Notes: none


Nested Class Summary
 
Nested classes/interfaces inherited from interface dioscuri.interfaces.Module
Module.Type
 
Field Summary
protected static long A20mask
           
 byte[] ram
           
 
Fields inherited from class dioscuri.module.AbstractModule
type
 
Constructor Summary
Memory(Emulator owner)
          Class constructor
 
Method Summary
 byte getByte(int address)
          Return a byte from memory at a specific address
 java.lang.String getDump()
          Return a dump of module status
 byte[] getWord(int address)
          Returns the value of a word at a specific address Note: words in memory are stored in Little Endian order (LSB, MSB), but this method returns a word in Big Endian order (MSB, LSB) because this is the common way words are used by instructions.
 boolean reset()
          Reset all parameters of module.
 void setA20AddressLine(boolean status)
          Set A20 address line toggle
 void setByte(int address, byte value)
          Set a byte in memory at given address
 void setBytes(int address, byte[] binaryStream)
          Stores an array of bytes in memory starting at a specific address
 void setRamSizeInMB(int ramSizeMB)
          Set RAM Size in megabytes
 void setWatchValueAndAddress(boolean isWatchOn, int watchAddress)
          Set watch toggle and address to trace in memory
 void setWord(int address, byte[] value)
          Stores the value of a word at a specific address Note: words in memory are stored in Little Endian order (LSB, MSB), but this method assumes that a word is given in Big Endian order (MSB, LSB) because this is the common way words are used by instructions.
 
Methods inherited from class dioscuri.module.AbstractModule
getConnection, getConnections, getDebugMode, getExpectedConnections, getType, isConnected, setConnection, setDebugMode, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ram

public byte[] ram

A20mask

protected static long A20mask
Constructor Detail

Memory

public Memory(Emulator owner)
Class constructor

Parameters:
owner -
Method Detail

reset

public boolean reset()
Reset all parameters of module.

Specified by:
reset in interface Module
Specified by:
reset in class AbstractModule
Returns:
true iff the AbstractModule was reset properly.
See Also:
AbstractModule

getDump

public java.lang.String getDump()
Return a dump of module status

Provides a dummy implementation since many of the subclasses of this abstract module class do not need or use a getDump() implementation. The ones that do, can override this method.

Specified by:
getDump in interface Module
Overrides:
getDump in class AbstractModule
Returns:
string containing a dump of this module
See Also:
AbstractModule

getByte

public byte getByte(int address)
Return a byte from memory at a specific address

Specified by:
getByte in class ModuleMemory
Parameters:
address - Flat-address where data can be found
Returns:
the byte at the given address
See Also:
ModuleMemory

setByte

public void setByte(int address,
                    byte value)
Set a byte in memory at given address

Specified by:
setByte in class ModuleMemory
See Also:
ModuleMemory

getWord

public byte[] getWord(int address)
Returns the value of a word at a specific address Note: words in memory are stored in Little Endian order (LSB, MSB), but this method returns a word in Big Endian order (MSB, LSB) because this is the common way words are used by instructions.

Specified by:
getWord in class ModuleMemory
Parameters:
address - Flat-address where data can be found
Returns:
byte[] array [MSB, LSB] containing data, 0xFFFF if address outside RAM_SIZE range
See Also:
ModuleMemory

setWord

public void setWord(int address,
                    byte[] value)
Stores the value of a word at a specific address Note: words in memory are stored in Little Endian order (LSB, MSB), but this method assumes that a word is given in Big Endian order (MSB, LSB) because this is the common way words are used by instructions. However, storage takes place in Little Endian order.

Specified by:
setWord in class ModuleMemory
See Also:
ModuleMemory

setBytes

public void setBytes(int address,
                     byte[] binaryStream)
              throws ModuleException
Stores an array of bytes in memory starting at a specific address

Specified by:
setBytes in class ModuleMemory
Parameters:
address - Flat-address where data is stored
Throws:
ModuleException
See Also:
ModuleMemory

setA20AddressLine

public void setA20AddressLine(boolean status)
Set A20 address line toggle

Specified by:
setA20AddressLine in class ModuleMemory
See Also:
ModuleMemory

setWatchValueAndAddress

public void setWatchValueAndAddress(boolean isWatchOn,
                                    int watchAddress)
Set watch toggle and address to trace in memory

Specified by:
setWatchValueAndAddress in class ModuleMemory
See Also:
ModuleMemory

setRamSizeInMB

public void setRamSizeInMB(int ramSizeMB)
Set RAM Size in megabytes

Specified by:
setRamSizeInMB in class ModuleMemory
See Also:
ModuleMemory