|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.michab.simulator.mos6502.c64.C64Core
A facade to a single instance of a Commodore 64. Years ago that cost
$1000, today only a constructor is needed. The KeyListener
implemented by this class has to be connected to the component receiving the
emulation's keyboard input.
The display property provides a component that represents the Commodore 64's video screen. This has to be displayed in a GUI environment.
As soon as the minimum setup -- connect of the KeyListener and display of
the display component -- has been done a call to the start()
method starts the emulation.
Field Summary | |
static int |
ADR_COLOR_RAM_NEW
Position of the color ram. |
static int |
D_JOYSTICK_0
|
static int |
D_JOYSTICK_1
|
static int |
D_KEYBOARD
|
static java.lang.String |
IMAGE_NAME
|
static int |
NTSC_TICKS_PER_SEC
|
static int |
PAL_TICKS_PER_SEC
|
Constructor Summary | |
C64Core()
Creates an instance of a Commodore 64. |
Method Summary | |
void |
addPropertyChangeListener(java.lang.String name,
java.beans.PropertyChangeListener pcl)
Adds a property change listener to this bean. |
Chip[] |
getCia()
Returns a reference to the emulation's pair of CIA chips. |
Processor |
getCpu()
Returns a reference to the emulation's CPU. |
java.awt.Component |
getDisplay()
Returns a reference on the component that the display is drawn into. |
java.awt.Color |
getFrameColor()
Returns the frame color as set in the C64's VIC chip. |
SystemFile |
getImageFile()
Get the currently attached image file. |
byte[][] |
getImageFileDirectory()
Returns the directory of the currently loaded image file. |
int |
getInputDevice()
Returns the currently selected input device. |
Memory |
getMemory()
Get a reference to the emulation's memory. |
Chip |
getSid()
Returns a reference to the emulation's sound interface device (aka SID). |
Chip |
getVic()
Returns a reference to the emulation's video interface chip (aka VIC). |
boolean |
isImageFileValid(SystemFile file)
Check if the passed file is a valid image file. |
boolean |
isSoundOn()
Check whether sound is enabled. |
void |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
void |
load(byte[] fileName)
Load and start a program. |
void |
removePropertyChangeListener(java.lang.String name,
java.beans.PropertyChangeListener pcl)
Remove a property change listener from this bean. |
void |
reset()
Performs a soft reset. |
void |
reset(boolean hard)
Reset the emulation. |
void |
setImageFile(SystemFile file)
Attaches a file to the emulator. |
void |
setInputDevice(int which)
Selects an input device: joystick 1, joystick 2, or keyboard. |
void |
setSoundOn(boolean what)
Switch sound on or off. |
void |
shutdown()
Shutdown the emulator and release all resources held. |
void |
start()
Starts execution of the system. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String IMAGE_NAME
public static final int D_KEYBOARD
setInputDevice(int)
,
Constant Field Valuespublic static final int D_JOYSTICK_0
setInputDevice(int)
,
Constant Field Valuespublic static final int D_JOYSTICK_1
setInputDevice(int)
,
Constant Field Valuespublic static final int ADR_COLOR_RAM_NEW
public static final int PAL_TICKS_PER_SEC
public static final int NTSC_TICKS_PER_SEC
Constructor Detail |
public C64Core()
Method Detail |
public boolean isImageFileValid(SystemFile file)
file
- The file to check.public void setImageFile(SystemFile file)
IMAGE_NAME
.
file
- The file to attach.public SystemFile getImageFile()
null
if
no image file is attached.public byte[][] getImageFileDirectory()
load(byte[])
public void load(byte[] fileName)
LOAD "fileName",8,1
RUN
on the 64's command line. Note that the ",8" part is autodetected so
don't worry about that.
fileName
- The name of the file to load in CBM ASCII. This file has
to be contained in the currently set image file. The name passed
in here should also be part of the directory list of the image
file. If the file can't be found a C64 error message is printed.setImageFile(SystemFile)
,
getImageFileDirectory()
public void reset(boolean hard)
hard
- A module is detected if the memory location 0x8004 and
following hold the string 'CBM80' in Commodore ASCII. If this
is the case a reset results in a JMP($8000) which was used by
many games to get reset save. Passing true
here
results in a reset even in case a module marker exists.public void reset()
reset(boolean)
public void shutdown()
shutdown()
was called.
public void start()
public Chip getVic()
public Chip getSid()
public Chip[] getCia()
public Processor getCpu()
public Memory getMemory()
public java.awt.Component getDisplay()
public java.awt.Color getFrameColor()
public int getInputDevice()
public void setInputDevice(int which)
which
- One of the constants D_JOYSTICK_0, D_JOYSTICK_1 or
D_KEYBOARD.public boolean isSoundOn()
true
if sound is enabled, false
otherwise.public void setSoundOn(boolean what)
what
- true
to switch sound on, false
otherwise.public void addPropertyChangeListener(java.lang.String name, java.beans.PropertyChangeListener pcl)
public void removePropertyChangeListener(java.lang.String name, java.beans.PropertyChangeListener pcl)
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |