jmce - 1_02

jmce.freescale
Class M68HC05

java.lang.Object
  extended by jmce.sim.AbstractHardware
      extended by jmce.sim.cpu.AbstractCPU
          extended by jmce.freescale.M68HC05
All Implemented Interfaces:
java.lang.Runnable, M68HC05Constants, BreakPointListener, CPU, Hardware, InterruptManager
Direct Known Subclasses:
M68HC08

public class M68HC05
extends AbstractCPU
implements M68HC05Constants

Motorola / Freescale M68HC05 family.

Coded using M68HC05TB.PDF Implemented registers :

Since:
1.02
Author:
Mario Viara

Field Summary
protected  int resetVector
          Address of reset vector (default to invalid address)
 
Fields inherited from class jmce.sim.cpu.AbstractCPU
interrupts, io, memory, NS100MS, NS1MS
 
Fields inherited from interface jmce.freescale.M68HC05Constants
CCR_AND_MASK, CCR_C, CCR_H, CCR_I, CCR_N, CCR_OR_MASK, CCR_Z, EXT_INTERRUPT, M68HC05_RESET_VECTOR, SWI_INTERRUPT, TIMER_INTERRUPT
 
Fields inherited from interface jmce.sim.CPU
BIG_ENDIAN, IO_MEMORY, LITTLE_ENDIAN, MAIN_MEMORY
 
Constructor Summary
  M68HC05()
          Default constructor.
protected M68HC05(java.lang.String name)
          Constructor with name
 
Method Summary
protected  void ccr(int mask, boolean mode)
          Set/clear bit in the CCR register
 int fireISR(Interrupt irq)
          This function must be overridden from sub class that implements interrupt.
 int getWord(int a)
          Read one word (16 bit) from the main memory.
 void init(Hardware parent)
          Initialize the hardware.
protected  void initMemories()
           
protected  void initOpcodes()
          Initialize the CPU opcodes
protected  void initOpcodesJumpAddressingMode(int base, jmce.freescale.M68HC05.CPUOperation op)
          Initialize opcode for jmp/call address mode.
protected  void initPeripherals()
          No peripherals are build in on 6805 this function is present only for compatibility
protected  void initRegisters()
           
 boolean isInterruptEnabled()
          Return the status of the interrupt enable
 int pc()
          Return the register used as program counter
 void pc(int pc)
          Set the program counter.
protected  int pop()
          Pop 8 bit from the stack
protected  int pop16()
          Pop a 16 bit value from the stack.
protected  void push(int value)
          Push a 8 bit value on the stack
protected  void push16(int value)
          Push a 16 bit on the stack.
 void reset()
          Reset the CPU and call all installed ResetListener.
protected  void setResetVector(int r)
          Setup the reset vector used only by sub class
 void setWord(int a, int v)
          Set one word (16 bit) in the main memory
 
Methods inherited from class jmce.sim.cpu.AbstractCPU
abort, addCycleListener, addDecoder, addExceptionListener, addExecBreakPoint, addInterrupt, addIOReadListener, addIOReadListener, addIOWriteListener, addIOWriteListener, addLoader, addMemoryWriteListener, addOffset, addReadBreakPoint, addRegister, addResetListener, addTimerCycle, addTimerMs, addTraceListener, addWriteBreakPoint, bit0, bit7, breakPointEvent, createRuntime, decodeAt, destroy, dumpStatistics, dumpStatistics, dumpTitle, dumpValue, dumpValue, fetch, fireNMI, formatFrequence, getBreakPointAt, getBreakPointCount, getByte, getCallListener, getClock, getClockPerCycle, getCycle, getCycleMillis, getDecoderAt, getDecoderCount, getEndian, getExceptionListenerAt, getExceptionListenerCount, getExecStatistics, getInterruptCount, getInterruptCounter, getInterruptName, getIOByte, getLenghtAt, getMemory, getMemoryAt, getMemoryCount, getMemoryForName, getOpcodeAt, getOpcodes, getRealTime, getRegisterAt, getRegisterCount, getRegisterForName, getResetAddress, getUsage, getUsageDesc, getWordBig, getWordLittle, halt, idle, isBigEndian, isLittleEndian, isRunning, load, load, notifyInterrupt, removeBreakPoint, removeBreakPoint, removeExceptionListener, removeTraceListener, resetRegisters, run, run0, setByte, setCallListener, setClock, setClockPerCycle, setEndian, setIO, setIOByte, setMemory, setOpcode, setRealTime, setResetAddress, setStatusLine, setTill, start, step, step0, stepNoBreak, stop
 
Methods inherited from class jmce.sim.AbstractHardware
addHardware, createFrame, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, setHardware, setHardware, setName, toString
 
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, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, setHardware, setHardware, setName
 

Field Detail

resetVector

protected int resetVector
Address of reset vector (default to invalid address)

Constructor Detail

M68HC05

protected M68HC05(java.lang.String name)
Constructor with name


M68HC05

public M68HC05()
Default constructor.

Method Detail

initRegisters

protected void initRegisters()

push

protected void push(int value)
             throws SIMException
Push a 8 bit value on the stack

Throws:
SIMException

pop

protected int pop()
           throws SIMException
Pop 8 bit from the stack

Throws:
SIMException

push16

protected void push16(int value)
               throws SIMException
Push a 16 bit on the stack.

Throws:
SIMException

pop16

protected int pop16()
             throws SIMException
Pop a 16 bit value from the stack.

Throws:
SIMException

setWord

public final void setWord(int a,
                          int v)
                   throws SIMException
Description copied from interface: CPU
Set one word (16 bit) in the main memory

Specified by:
setWord in interface CPU
Parameters:
a - - Address
v - - value
Throws:
SIMException

reset

public void reset()
           throws SIMException
Description copied from class: AbstractCPU
Reset the CPU and call all installed ResetListener.

Reset is performed in this order :

Specified by:
reset in interface Hardware
Overrides:
reset in class AbstractCPU
Throws:
SIMException

fireISR

public int fireISR(Interrupt irq)
            throws SIMException
Description copied from class: AbstractCPU
This function must be overridden from sub class that implements interrupt.

Specified by:
fireISR in interface CPU
Overrides:
fireISR in class AbstractCPU
Throws:
SIMException

pc

public final int pc()
             throws SIMException
Description copied from interface: CPU
Return the register used as program counter

Specified by:
pc in interface CPU
Returns:
- Program counter.
Throws:
SIMException

pc

public final void pc(int pc)
              throws SIMException
Description copied from interface: CPU
Set the program counter.

Specified by:
pc in interface CPU
Parameters:
pc - - New value for the program counter.
Throws:
SIMException

isInterruptEnabled

public final boolean isInterruptEnabled()
Description copied from interface: CPU
Return the status of the interrupt enable

Specified by:
isInterruptEnabled in interface CPU

getWord

public final int getWord(int a)
                  throws SIMException
Description copied from interface: CPU
Read one word (16 bit) from the main memory.

Specified by:
getWord in interface CPU
Parameters:
a - - Address
Returns:
The word at the specified address.
Throws:
SIMException

ccr

protected final void ccr(int mask,
                         boolean mode)
Set/clear bit in the CCR register


initMemories

protected void initMemories()
                     throws SIMException
Throws:
SIMException

initPeripherals

protected void initPeripherals()
                        throws SIMException
No peripherals are build in on 6805 this function is present only for compatibility

Throws:
SIMException

init

public void init(Hardware parent)
          throws SIMException
Description copied from interface: Hardware
Initialize the hardware. This method must be called before any use of the interface. Only set ... / get ... method are allowed to be called before the intialization.

Specified by:
init in interface Hardware
Overrides:
init in class AbstractCPU
Parameters:
parent - Parent of this hardware.
Throws:
SIMException

initOpcodesJumpAddressingMode

protected void initOpcodesJumpAddressingMode(int base,
                                             jmce.freescale.M68HC05.CPUOperation op)
Initialize opcode for jmp/call address mode. The jmp address mode are : direct,extended,indexed16,indexed8 and indexed


initOpcodes

protected void initOpcodes()
Initialize the CPU opcodes


setResetVector

protected void setResetVector(int r)
Setup the reset vector used only by sub class


jmce - 1_02