Emu8255
Class Emu8255

java.lang.Object
  extended by Emu8255.Emu8255

public class Emu8255
extends java.lang.Object

This is the main class of the application. It creates the main frame and contains the bulk of the application logic for the Emu8255.


Constructor Summary
Emu8255()
          Default constructor.
 
Method Summary
 void ACKPortAButtonActionPerformedHandler()
          Handler invoked when the Ack on Porta A button is pressed.
 void ACKPortBButtonActionPerformedHandler()
          Handler invoked when the Ack on Porta B button is pressed.
 void Exit(int status)
          Exit application with status code>.
 char GetCharValueFromString(java.lang.String number)
          This method returns the char representation of a number in the form of a string
 char GetControlWord()
          Returns the value of the Control Word as a char.
 int GetGroupAInInt()
          Returns the value for the group A input interrupt.
 int GetGroupAMode()
          Returns the group A mode.
 int GetGroupAOutInt()
          Returns the value for the group A output interrupt.
 int GetGroupBInInt()
          Returns the value for the group B input interrupt.
 int GetGroupBMode()
          Returns the group B mode.
 int GetGroupBOutInt()
          Returns the value for the group B output interrupt.
 int GetInputMode()
          Returns the value for the input mode.
 int GetOutputMode()
          Returns the value for the output mode.
 int GetPC45Dir()
          Returns the value for PC4 and PC5 direction when group A is in mode 1.
 int GetPC67Dir()
          Returns the value for PC6 and PC7 direction when group A is in mode 1.
 int GetPortADir()
          Returns the value for the port A direction.
 int GetPortBDir()
          Returns the value for the port B direction.
 int GetPortCLoDir()
          Returns the value for the port C Lower direction.
 int GetPortCUpDir()
          Returns the value for the port C Upper direction.
 int GetSignedIntegerFromChar(char signed_number)
          This method returns the signed integer representation of the char value passed as argument
 int GetUnsignedIntegerFromChar(char unsigned_number)
          This method returns the unsigned integer representation of the char value passed as argument
 void InputModeAsciiActionPerformedHandler()
          Handler invoked when the Ascii Input Mode is chosen from the menu.
 void InputModeBinaryActionPerformedHandler()
          Handler invoked when the Binary Input Mode is chosen from the menu.
 void InputModeHexadecimalActionPerformedHandler()
          Handler invoked when the Hexadecimal Input Mode is chosen from the menu.
 void InputModeIntegerSignedActionPerformedHandler()
          Handler invoked when the Integer Signed Input Mode is chosen from the menu.
 void InputModeIntegerUnsignedActionPerformedHandler()
          Handler invoked when the Integer Unsigned Input Mode is chosen from the menu.
static void main(java.lang.String[] args)
          main() method.
 void OutputModeAsciiActionPerformedHandler()
          Handler invoked when the Ascii Output Mode is chosen from the menu.
 void OutputModeBinaryActionPerformedHandler()
          Handler invoked when the Binary Output Mode is chosen from the menu.
 void OutputModeHexadecimalActionPerformedHandler()
          Handler invoked when the Hexadecimal Output Mode is chosen from the menu.
 void OutputModeIntegerSignedActionPerformedHandler()
          Handler invoked when the Integer Signed Output Mode is chosen from the menu.
 void OutputModeIntegerUnsignedActionPerformedHandler()
          Handler invoked when the Integer unsigned Output Mode is chosen from the menu.
 void ResetButtonActionPerformedHandler()
          Handler invoked the reset button is pressed.
static boolean Set8259RuntimePort()
          This method reads from the config file the port associated with the Emu8259, wich is supposed to be already written by the Emu8259 itself.
 void SetControlWord(char val)
          Set the control word and update ports status.
 void STBPortAButtonActionPerformedHandler()
          Handler invoked when the Strobe on Porta A button is pressed.
 void STBPortBButtonActionPerformedHandler()
          Handler invoked when the Strobe on Porta B button is pressed.
 java.lang.String ToBinaryString(char value, int padding)
          This method returns the binary representation of the character value according to the value of padding.
 void UseWith8259ActionPerformedHandler(boolean val)
          Handler invoked when a new selection is made in the UseWith8259 submenu in menu File.
 void WaitForAckFromUser(char port)
          This method makes the UI wait for an user input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Emu8255

public Emu8255()
Default constructor.

Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.InterruptedException
main() method. Here is where the main frame is allocated, the port to use in order to communicate with the Emu8259 is read from the config file, the two auxiliary threads are created and started.
One thread checks for a change in the control word, one thread checks when a new value is written to a port.

Throws:
java.lang.InterruptedException
See Also:
CheckControlWord, OutputThread

SetControlWord

public void SetControlWord(char val)
Set the control word and update ports status.

Parameters:
val - Control Word to set.

GetControlWord

public char GetControlWord()
Returns the value of the Control Word as a char.

Returns:
The control word value.

GetGroupAMode

public int GetGroupAMode()
Returns the group A mode. Mode 2 is not implemented here.

Returns:
The group A mode (0, 1, 2).

GetGroupBMode

public int GetGroupBMode()
Returns the group B mode.

Returns:
The group A mode (0, 1).

GetGroupAInInt

public int GetGroupAInInt()
Returns the value for the group A input interrupt.

Returns:
Group A input interrupt (Enabled, Disabled);

GetGroupAOutInt

public int GetGroupAOutInt()
Returns the value for the group A output interrupt.

Returns:
Group A output interrupt (Enabled, Disabled);

GetGroupBInInt

public int GetGroupBInInt()
Returns the value for the group B input interrupt.

Returns:
Group B input interrupt (Enabled, Disabled);

GetGroupBOutInt

public int GetGroupBOutInt()
Returns the value for the group B output interrupt.

Returns:
Group B output interrupt (Enabled, Disabled);

GetPortADir

public int GetPortADir()
Returns the value for the port A direction.

Returns:
Port A direction (Input, Output);

GetPortBDir

public int GetPortBDir()
Returns the value for the port B direction.

Returns:
Port B direction (Input, Output);

GetPortCUpDir

public int GetPortCUpDir()
Returns the value for the port C Upper direction.

Returns:
Port C Upper direction (Input, Output);

GetPortCLoDir

public int GetPortCLoDir()
Returns the value for the port C Lower direction.

Returns:
Port C Lower direction (Input, Output);

GetPC45Dir

public int GetPC45Dir()
Returns the value for PC4 and PC5 direction when group A is in mode 1.

Returns:
PC4 and PC5 direction (Input, Output);

GetPC67Dir

public int GetPC67Dir()
Returns the value for PC6 and PC7 direction when group A is in mode 1.

Returns:
PC4 and PC5 direction (Input, Output);

GetInputMode

public int GetInputMode()
Returns the value for the input mode.

Returns:
Input mode (Ascii, Binary, Hexadecimal);

GetOutputMode

public int GetOutputMode()
Returns the value for the output mode.

Returns:
Output mode (Ascii, Binary, Hexadecimal);

Exit

public void Exit(int status)
Exit application with status code>.

Parameters:
status - Exit status.

UseWith8259ActionPerformedHandler

public void UseWith8259ActionPerformedHandler(boolean val)
Handler invoked when a new selection is made in the UseWith8259 submenu in menu File.

Parameters:
val - true if we want to use the Emu8259, false otherwise.

Set8259RuntimePort

public static boolean Set8259RuntimePort()
This method reads from the config file the port associated with the Emu8259, wich is supposed to be already written by the Emu8259 itself.


InputModeAsciiActionPerformedHandler

public void InputModeAsciiActionPerformedHandler()
Handler invoked when the Ascii Input Mode is chosen from the menu.


InputModeBinaryActionPerformedHandler

public void InputModeBinaryActionPerformedHandler()
Handler invoked when the Binary Input Mode is chosen from the menu.


InputModeHexadecimalActionPerformedHandler

public void InputModeHexadecimalActionPerformedHandler()
Handler invoked when the Hexadecimal Input Mode is chosen from the menu.


InputModeIntegerSignedActionPerformedHandler

public void InputModeIntegerSignedActionPerformedHandler()
Handler invoked when the Integer Signed Input Mode is chosen from the menu.


InputModeIntegerUnsignedActionPerformedHandler

public void InputModeIntegerUnsignedActionPerformedHandler()
Handler invoked when the Integer Unsigned Input Mode is chosen from the menu.


OutputModeAsciiActionPerformedHandler

public void OutputModeAsciiActionPerformedHandler()
Handler invoked when the Ascii Output Mode is chosen from the menu.


OutputModeBinaryActionPerformedHandler

public void OutputModeBinaryActionPerformedHandler()
Handler invoked when the Binary Output Mode is chosen from the menu.


OutputModeHexadecimalActionPerformedHandler

public void OutputModeHexadecimalActionPerformedHandler()
Handler invoked when the Hexadecimal Output Mode is chosen from the menu.


OutputModeIntegerSignedActionPerformedHandler

public void OutputModeIntegerSignedActionPerformedHandler()
Handler invoked when the Integer Signed Output Mode is chosen from the menu.


OutputModeIntegerUnsignedActionPerformedHandler

public void OutputModeIntegerUnsignedActionPerformedHandler()
Handler invoked when the Integer unsigned Output Mode is chosen from the menu.


STBPortAButtonActionPerformedHandler

public void STBPortAButtonActionPerformedHandler()
Handler invoked when the Strobe on Porta A button is pressed.


STBPortBButtonActionPerformedHandler

public void STBPortBButtonActionPerformedHandler()
Handler invoked when the Strobe on Porta B button is pressed.


ACKPortAButtonActionPerformedHandler

public void ACKPortAButtonActionPerformedHandler()
Handler invoked when the Ack on Porta A button is pressed.


ACKPortBButtonActionPerformedHandler

public void ACKPortBButtonActionPerformedHandler()
Handler invoked when the Ack on Porta B button is pressed.


GetCharValueFromString

public char GetCharValueFromString(java.lang.String number)
This method returns the char representation of a number in the form of a string

Parameters:
number - The string representing the value.
Returns:
THe char representation.

GetSignedIntegerFromChar

public int GetSignedIntegerFromChar(char signed_number)
This method returns the signed integer representation of the char value passed as argument

Parameters:
signed_number - The signed char to convert
Returns:
The integer representation of the char.

GetUnsignedIntegerFromChar

public int GetUnsignedIntegerFromChar(char unsigned_number)
This method returns the unsigned integer representation of the char value passed as argument

Parameters:
unsigned_number - The unsigned char to convert
Returns:
The integer representation of the char.

ResetButtonActionPerformedHandler

public void ResetButtonActionPerformedHandler()
Handler invoked the reset button is pressed.


WaitForAckFromUser

public void WaitForAckFromUser(char port)
This method makes the UI wait for an user input.
All text fields are non editable, all buttons are disabled except the button Ack corresponding to the port port.

Parameters:
port - Port whose Ack button is the only one enabled.

ToBinaryString

public java.lang.String ToBinaryString(char value,
                                       int padding)
This method returns the binary representation of the character value according to the value of padding.

Parameters:
value - Character whose binary representation is returned.
padding - Padding to be applied.
Returns:
The binary representation of value.