jmce - 1_02

jmce.sim
Class SysKit

java.lang.Object
  extended by jmce.sim.AbstractHardware
      extended by jmce.sim.AbstractPeripheral
          extended by jmce.sim.SysKit
All Implemented Interfaces:
Hardware, MemoryReadListener, MemoryWriteListener, Peripheral, ResetListener

public final class SysKit
extends AbstractPeripheral
implements MemoryReadListener, MemoryWriteListener, ResetListener

JMCE System kit.

This peripheral permit one iteration from the emulated operating system and the emulator implementing some useful function.

Use only one Read/Write port that can be set using the method port .

This sample Z80 program track the elapsed time of the function dowork on the console :

 
        ld      a,4             ; Start new timer function
        out     (0f0h),a        ;
        call    dowork          ; Do the work ....
        ld      a,5             ; Stop last timer
        put     (0f0h),a        ; Write elapsed time on
                                ; the console (if any!)
 

Version:
1.01 1.01 4 Oct 2010 - Added command SYSKIT_CMD_DEBUG to call the monitor programmatically.
Author:
Mario Viara

Field Summary
protected  int port
          Default base register
static int SYSKIT_CMD_CHECK
          Check SysKit when write this command the 2 successive read will return 0x69 and then 0x96 this permit to check if the syskit is installed
static int SYSKIT_CMD_DEBUG
          Enter in debug @since 1.01
static int SYSKIT_CMD_DELAY
          Release control of the cpu to the emulator
static int SYSKIT_CMD_GETVER
          Get version this command return the version of the class
static int SYSKIT_CMD_NONE
          No command only for internal status
static int SYSKIT_CMD_PRTVER
          Print the version on the console
static int SYSKIT_CMD_RESKIT
          Reset the internal status command
static int SYSKIT_CMD_TSTART
          Create a new millis timer and push on the timer stack
static int SYSKIT_CMD_TSTOP
          Pop a timer from the timer stack and display on the console the elapsed time
static int SYSKIT_VERSION
          Current version
 
Fields inherited from class jmce.sim.AbstractPeripheral
cpu
 
Constructor Summary
SysKit()
           
 
Method Summary
 int getPort()
          Return the current base port.
 void print(java.lang.Object o)
           
 void println()
           
 void println(java.lang.Object o)
           
 void putchar(int c)
           
 int readMemory(Memory m, int address, int v)
          Called when the memory is readed.
 void registerCPU(CPU cpu)
          Register a parent CPU for future reference.
 void reset(CPU cpu)
           
 void setPort(int port)
          Set the new base port.
 java.lang.String toString()
           
 void writeMemory(Memory m, int address, int v, int oldValue)
          Called when a memory write event occours.
 
Methods inherited from class jmce.sim.AbstractPeripheral
idle, setIdle, setLive
 
Methods inherited from class jmce.sim.AbstractHardware
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jmce.sim.Hardware
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName
 

Field Detail

SYSKIT_CMD_CHECK

public static final int SYSKIT_CMD_CHECK
Check SysKit when write this command the 2 successive read will return 0x69 and then 0x96 this permit to check if the syskit is installed

See Also:
Constant Field Values

SYSKIT_CMD_GETVER

public static final int SYSKIT_CMD_GETVER
Get version this command return the version of the class

See Also:
Constant Field Values

SYSKIT_CMD_RESKIT

public static final int SYSKIT_CMD_RESKIT
Reset the internal status command

See Also:
Constant Field Values

SYSKIT_CMD_DELAY

public static final int SYSKIT_CMD_DELAY
Release control of the cpu to the emulator

See Also:
Constant Field Values

SYSKIT_CMD_TSTART

public static final int SYSKIT_CMD_TSTART
Create a new millis timer and push on the timer stack

See Also:
Constant Field Values

SYSKIT_CMD_TSTOP

public static final int SYSKIT_CMD_TSTOP
Pop a timer from the timer stack and display on the console the elapsed time

See Also:
Constant Field Values

SYSKIT_CMD_PRTVER

public static final int SYSKIT_CMD_PRTVER
Print the version on the console

See Also:
Constant Field Values

SYSKIT_CMD_DEBUG

public static final int SYSKIT_CMD_DEBUG
Enter in debug @since 1.01

See Also:
Constant Field Values

SYSKIT_CMD_NONE

public static final int SYSKIT_CMD_NONE
No command only for internal status

See Also:
Constant Field Values

SYSKIT_VERSION

public static final int SYSKIT_VERSION
Current version

See Also:
Constant Field Values

port

protected int port
Default base register

Constructor Detail

SysKit

public SysKit()
Method Detail

getPort

public int getPort()
Return the current base port.


setPort

public void setPort(int port)
Set the new base port.

Parameters:
port -

registerCPU

public void registerCPU(CPU cpu)
                 throws SIMException
Description copied from interface: Peripheral
Register a parent CPU for future reference.

Specified by:
registerCPU in interface Peripheral
Overrides:
registerCPU in class AbstractPeripheral
Throws:
SIMException

reset

public void reset(CPU cpu)
           throws SIMException
Specified by:
reset in interface ResetListener
Throws:
SIMException

readMemory

public int readMemory(Memory m,
                      int address,
                      int v)
               throws SIMException
Description copied from interface: MemoryReadListener
Called when the memory is readed.

This is method is called to notify a read at the specified memory loction.

Specified by:
readMemory in interface MemoryReadListener
Parameters:
m - - Memory readed.
address - - Address where the operation occours.
v - - Value readed from the phisical memory or from previus installed listener.
Returns:
Value readed from the memory.
Throws:
SIMException

writeMemory

public void writeMemory(Memory m,
                        int address,
                        int v,
                        int oldValue)
                 throws SIMException
Description copied from interface: MemoryWriteListener
Called when a memory write event occours.

This method is called when a memory write operation occours in the specified memory.

Specified by:
writeMemory in interface MemoryWriteListener
Parameters:
m - - Memory involved in the write operation.
address - - Address written.
v - - Value written.
oldValue - - Old value of this memory location.
Throws:
SIMException

print

public void print(java.lang.Object o)
           throws SIMException
Throws:
SIMException

println

public void println()
             throws SIMException
Throws:
SIMException

println

public void println(java.lang.Object o)
             throws SIMException
Throws:
SIMException

putchar

public void putchar(int c)
             throws SIMException
Throws:
SIMException

toString

public java.lang.String toString()
Overrides:
toString in class AbstractHardware

jmce - 1_02