|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.razvan.jzx.BaseComponent
org.razvan.jzx.BaseIO
public class BaseIO
Base class extended by all I/O components that comprise the emulator.
This class provides basic, common I/O functionality for the I/O subsystem of the emulator. Specific methods are overriden or implemented so as to comply with the Spectrum 48k and the Spectrum 128k models.
IO,
IO| Field Summary | |
|---|---|
static int |
B_BORDER
Bit mask used to determine the border color value. |
static int |
B_DOWN
Bit mask for "joystick down" event. |
static int |
B_EAR
Bit mask used to determien the "tape in" bit. |
static int |
B_FIRE
Bit mask for "joystick fire" event. |
static int |
B_KEMPSTON
Bit mask used to determine if the Kempston joystick is selected. |
static int |
B_KEYBOARD
Bit mask used to determine the keyboard value. |
static int |
B_LEFT
Bit mask for "joystick left" event. |
static int |
B_MIC
Bit mask used to determine the "tape out" bit. |
static int |
B_RIGHT
Bit mask for "joystick right" event. |
static int |
B_SPEAKER
Bit mask used to determine the speaker value. |
static int |
B_ULA
Bit mask used to detemine if the specified port will cause a "select" on the ULA. |
static int |
B_UP
Bit mask for "joystick up" event. |
static int |
LINE_BUF_SIZE
The size of the buffer used for generating sounds. |
protected byte[] |
m_buffer
The sound buffer as it is currently being filled and played. |
protected Z80 |
m_cpu
Cached reference to the Z80 component. |
protected int |
m_index
The current index into the sound buffer. |
protected int[] |
m_inPorts
The input port array. |
protected int[] |
m_keyPorts
The keyboard port array. |
protected int |
m_lastBorderColor
Last border color. |
protected BaseMemory |
m_memory
Cached reference to the memory component. |
protected int[] |
m_outPorts
The output port array. |
protected BaseScreen |
m_screen
Cached reference to the screen component. |
protected int |
m_speakerLevel
|
static int |
P_KEMPSTON
Kempston joystick address. |
static int |
P_SINCLAIR1
Port address for the Sinclair1 joystick (Interface II). |
static int |
P_SINCLAIR2
Port address for the Sinclair2 joystick (Interface II). |
static int |
P_ULA
Port address for the ULA. |
static float |
SAMPLE_FREQ
The sampling frequency for playing sounds with the speaker or AY chip. |
| Fields inherited from class org.razvan.jzx.BaseComponent |
|---|
m_logger, m_spectrum |
| Constructor Summary | |
|---|---|
BaseIO()
|
|
| Method Summary | |
|---|---|
void |
advance(int tStates)
|
void |
andIn(int port16,
int mask8)
INport(port16) = INport(port16) AND mask8 |
void |
andKey(int port16,
int mask8)
KEYport(port16) = KEYport(port16) AND mask8 |
void |
andOut(int port16,
int mask8)
OUTport(port16) = OUTport(port16) AND mask8 |
static int |
getAudioSamplesForTStates(int tStates)
|
int |
in8(int port16)
Process an I/O "in" request. |
void |
init(BaseSpectrum spectrum,
ILogger logger)
Allocate the port arrays and cache the Z80, memory and screen components. |
void |
load(BaseLoader loader)
Extracts the saved border color and outputs it to the appropriate I/O port. |
protected int |
mixSound(int tStates,
int val8)
|
void |
orIn(int port16,
int mask8)
INport(port16) = INport(port16) OR mask8 |
void |
orKey(int port16,
int mask8)
KEYport(port16) = KEYport(port16) OR mask8 |
void |
orOut(int port16,
int mask8)
OUTport(port16) = OUTport(port16) OR mask8 |
void |
out(int port16,
int val8)
Process an I/O "out" request. |
void |
reset()
Set the port arrays to zero. |
void |
terminate()
Release references to all cached components and port arrays. |
| Methods inherited from class org.razvan.jzx.BaseComponent |
|---|
getSpectrum |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final float SAMPLE_FREQ
public static final int LINE_BUF_SIZE
protected byte[] m_buffer
protected int m_index
public static final int P_ULA
public static final int B_ULA
public static final int B_BORDER
public static final int B_MIC
public static final int B_SPEAKER
public static final int B_KEYBOARD
public static final int B_EAR
public static final int P_KEMPSTON
public static final int B_KEMPSTON
public static final int B_RIGHT
public static final int B_LEFT
public static final int B_DOWN
public static final int B_UP
public static final int B_FIRE
public static final int P_SINCLAIR1
public static final int P_SINCLAIR2
protected int m_lastBorderColor
This is used to determine if the newly specified border color should trigger a screen update.
protected int[] m_inPorts
This array is modified by the Z80 I/O instructions.
protected int[] m_outPorts
This array is modified by the Z80 I/O instructions.
protected int[] m_keyPorts
This array is modified by the Keyboard component directly.
protected Z80 m_cpu
This is used to increment the CPU T-states after I/O instructions.
protected BaseMemory m_memory
This is used for all memory page modifications that are triggered by I/O instructions.
protected BaseScreen m_screen
This is used to alter the border color.
protected int m_speakerLevel
| Constructor Detail |
|---|
public BaseIO()
| Method Detail |
|---|
public static int getAudioSamplesForTStates(int tStates)
public void init(BaseSpectrum spectrum,
ILogger logger)
init in class BaseComponentpublic void reset()
reset in class BaseComponentpublic void terminate()
terminate in class BaseComponentpublic int in8(int port16)
The flow of this call is as follows:
See the explicit code comments for specific details.
port16 - The 16-bit I/O input port.
public void out(int port16,
int val8)
The flow of this call is as follows:
See the explicit code comments for specific details.
port16 - The 16-bit I/O output port.val8 - The 8-bit value to write to the I/O port.public void advance(int tStates)
protected int mixSound(int tStates,
int val8)
public void orIn(int port16,
int mask8)
public void andIn(int port16,
int mask8)
public void orOut(int port16,
int mask8)
public void andOut(int port16,
int mask8)
public void orKey(int port16,
int mask8)
public void andKey(int port16,
int mask8)
public void load(BaseLoader loader)
load in class BaseComponent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||