net.emustudio.emulib.plugins.memory.Memory Maven / Gradle / Ivy
Show all versions of emulib Show documentation
/*
* Run-time library for emuStudio and plugins.
*
* Copyright (C) 2006-2020 Peter Jakubčo
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package net.emustudio.emulib.plugins.memory;
import net.emustudio.emulib.plugins.Plugin;
/**
* Memory plugin root interface.
*
* Memory can define a "memory context", which can enable additional non-standard functionality, which can be used
* by other plugins.
*
* @see MemoryContext
*/
@SuppressWarnings("unused")
public interface Memory extends Plugin {
/**
* The listener interface for receiving memory related events.
*
* The class that is interested in processing a memory event implements this interface, and the object created with
* that class is registered with a memory, using the memory's addMemoryListener
method. Memory events
* occur even if single cell is changed in memory and then is invoked memChange
method.
*/
interface MemoryListener {
/**
* Invoked when a single memory cell is changed.
*
* @param memoryPosition memory position (address) of changed cell
*/
void memoryChanged(int memoryPosition);
/**
* Some memories can be dynamic-sized. This method is invoked when memory size has changed.
*/
void memorySizeChanged();
}
/**
* Sets program start address.
*
* This method is called by main module when
* compiler finishes compilation process and return known start address of
* compiled program. This start address is then used by CPU, in reset
* operation - PC (program counter, or something similar) should be set
* to this address, accessible via IMemoryContext.getProgramStart()
* method.
*
* @param location starting memory position (address) of a program
*/
void setProgramStart(int location);
/**
* Gets size of memory.
*
* If memory uses some techniques as banking, real
* size of the memory is not computed. It is only returned a value set
* in architecture configuration.
*
* @return basic size of the memory
*/
int getSize();
/**
* Gets program's start address.
*
* The start address is set invoking memory's method Memory.setProgramStart()
by main module
* when compiler finishes compilation process of a program and if the compiler know the starting address.
* This address is used by main module for CPU reset process.
*
* @return program's start address in memory
*/
int getProgramStart();
}