nl.kbna.dioscuri.module.screen
Class Screen

java.lang.Object
  extended by nl.kbna.dioscuri.module.Module
      extended by nl.kbna.dioscuri.module.ModuleScreen
          extended by nl.kbna.dioscuri.module.screen.Screen

public class Screen
extends ModuleScreen

An implementation of a hardware visual screen module.

See Also:
Metadata module ******************************************** general.type : screen general.name : Compatible CRT/LCD computer screen general.architecture : Von Neumann general.description : General implementation of a monitor. general.creator : Tessella Support Services, Koninklijke Bibliotheek, Nationaal Archief of the Netherlands general.version : 1.0 general.keywords : screen, monitor, CRT, TFT, LCD general.relations : video general.yearOfIntroduction : general.yearOfEnding : general.ancestor : general.successor : screen.resolutionRange : unlimited screen.colorDepth : 256

Field Summary
protected static int BLUE
           
(package private)  byte[] codePage
           
(package private)  boolean codePageReqsUpdate
           
(package private)  boolean[] codePageUpdateIndex
           
protected  java.awt.image.ColorModel colourModel
           
private  int cursorPosPrevX
           
private  int cursorPosPrevY
           
protected  java.awt.image.DataBuffer dataBuffer
           
private  boolean debugMode
           
private  Emulator emu
           
private  int fontHeight
           
protected  java.awt.image.BufferedImage[] fontImages
           
private  int fontWidth
           
protected  java.awt.image.BufferedImage graphicTile
           
protected static int GREEN
           
private  byte horizPanning
           
protected  java.awt.image.BufferedImage image
           
protected  int imageType
           
private  boolean isObserved
           
private  short lineCompare
           
private static java.util.logging.Logger logger
           
private static int MODULE_ID
           
private static java.lang.String MODULE_NAME
           
private static java.lang.String MODULE_TYPE
           
private  java.lang.String[] moduleConnections
           
protected  byte[][] palette
           
protected  byte[] pixels
           
protected  java.awt.image.WritableRaster raster
           
protected static int RED
           
protected  java.awt.image.SampleModel sampleModel
           
private  int screenHeight
           
private  ScreenPanel screenPanel
           
private  int screenWidth
           
private  int textColumns
           
private  int textRows
           
private  byte vertPanning
           
protected  ModuleVideo video
           
private  int xTileSize
           
private  int yTileSize
           
 
Constructor Summary
Screen(Emulator owner)
          Class constructor
 
Method Summary
 void clearScreen()
          Set the screen image to black
private  void createCodePage437Images()
          Create character images from code page 437 hex values
 java.lang.String[] getConnection()
          Returns a String[] with all names of modules it needs to be connected to
 byte[] getData(Module requester)
          Returns data from this module
 boolean getDebugMode()
          Returns the status of the debug mode toggle
 java.lang.String getDump()
          Returns a dump of this module
 int getID()
          Returns the ID of the module
 java.lang.String getName()
          Returns the name of the module
 javax.swing.JPanel getScreen()
          Return a reference to the actual screen
 int getScreenColumns()
          Return the number of columns on screen (text based)
 int getScreenHeight()
          Return height of screen in number of pixels
 int getScreenRows()
          Return the number of rows on screen (text based)
 int getScreenWidth()
          Return width of screen in number of pixels
 java.lang.String getType()
          Returns the type of the module
 boolean isConnected()
          Checks if this module is connected to operate normally
 boolean isObserved()
          Returns the status of observed toggle
 boolean reset()
          Reset all parameters of module
 void setByteInCodePage(int index, byte data)
          Update a byte in the codePage
 boolean setConnection(Module mod)
          Sets up a connection with another module
 boolean setData(byte[] data, Module sender)
          Set data for this module
 boolean setData(java.lang.String[] data, Module sender)
          Sets given String[] data for this module
 void setDebugMode(boolean status)
          Sets the debug mode toggle
private  void setImage(int width, int height)
          Set an image with data on screen
 void setObserved(boolean status)
          Sets the observed toggle
 boolean setPaletteColour(byte index, int red, int green, int blue)
          Set a colour in the private colourmap to a particular RGB value
 void setScreenSize(int width, int height)
          Set the screen size in number of pixels
 void start()
          Starts the module
 void stop()
          Stops the module
 void updateCodePage(int start)
          Update the complete character set
private  void updateFontImage(int index, int[] fontData, int fontWidth, int fontHeight)
          Replace a BufferedImage in the font table with new data
 void updateGraphicsTile(byte[] tile, int x0, int y0)
          Update a tile on screen with given bytes A tile is a part of the screenbuffer
private  void updateImage()
          Refresh the on-screen image
private  void updatePalette()
          Update the colourModel used in the image.
 void updateScreenSize(int newWidth, int newHeight, int newFontWidth, int newFontHeight)
          Update the screen size (if necesarry)
 void updateText(int oldText, int newText, long cursorXPos, long cursorYPos, short[] textModeAttribs, int numberRows)
          Update text on screen at given position Text mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

emu

private Emulator emu

moduleConnections

private java.lang.String[] moduleConnections

screenPanel

private ScreenPanel screenPanel

video

protected ModuleVideo video

isObserved

private boolean isObserved

debugMode

private boolean debugMode

pixels

protected byte[] pixels

dataBuffer

protected java.awt.image.DataBuffer dataBuffer

sampleModel

protected java.awt.image.SampleModel sampleModel

raster

protected java.awt.image.WritableRaster raster

palette

protected byte[][] palette

colourModel

protected java.awt.image.ColorModel colourModel

image

protected java.awt.image.BufferedImage image

imageType

protected int imageType

fontImages

protected java.awt.image.BufferedImage[] fontImages

graphicTile

protected java.awt.image.BufferedImage graphicTile

codePage

byte[] codePage

codePageReqsUpdate

boolean codePageReqsUpdate

codePageUpdateIndex

boolean[] codePageUpdateIndex

textRows

private int textRows

textColumns

private int textColumns

fontWidth

private int fontWidth

fontHeight

private int fontHeight

screenWidth

private int screenWidth

screenHeight

private int screenHeight

horizPanning

private byte horizPanning

vertPanning

private byte vertPanning

lineCompare

private short lineCompare

cursorPosPrevX

private int cursorPosPrevX

cursorPosPrevY

private int cursorPosPrevY

xTileSize

private int xTileSize

yTileSize

private int yTileSize

logger

private static java.util.logging.Logger logger

MODULE_ID

private static final int MODULE_ID
See Also:
Constant Field Values

MODULE_TYPE

private static final java.lang.String MODULE_TYPE
See Also:
Constant Field Values

MODULE_NAME

private static final java.lang.String MODULE_NAME
See Also:
Constant Field Values

RED

protected static final int RED
See Also:
Constant Field Values

GREEN

protected static final int GREEN
See Also:
Constant Field Values

BLUE

protected static final int BLUE
See Also:
Constant Field Values
Constructor Detail

Screen

public Screen(Emulator owner)
Class constructor

Method Detail

getID

public int getID()
Returns the ID of the module

Specified by:
getID in class Module
Returns:
string containing the ID of module
See Also:
Module

getType

public java.lang.String getType()
Returns the type of the module

Specified by:
getType in class Module
Returns:
string containing the type of module
See Also:
Module

getName

public java.lang.String getName()
Returns the name of the module

Specified by:
getName in class Module
Returns:
string containing the name of module
See Also:
Module

getConnection

public java.lang.String[] getConnection()
Returns a String[] with all names of modules it needs to be connected to

Specified by:
getConnection in class Module
Returns:
String[] containing the names of modules, or null if no connections

setConnection

public boolean setConnection(Module mod)
Sets up a connection with another module

Specified by:
setConnection in class Module
Parameters:
mod - Module that is to be connected to this class
Returns:
true if connection has been established successfully, false otherwise
See Also:
Module

isConnected

public boolean isConnected()
Checks if this module is connected to operate normally

Specified by:
isConnected in class Module
Returns:
true if this module is connected successfully, false otherwise

reset

public boolean reset()
Reset all parameters of module

Specified by:
reset in class Module
Returns:
boolean true if module has been reset successfully, false otherwise

start

public void start()
Starts the module

Specified by:
start in class Module
See Also:
Module

stop

public void stop()
Stops the module

Specified by:
stop in class Module
See Also:
Module

isObserved

public boolean isObserved()
Returns the status of observed toggle

Specified by:
isObserved in class Module
Returns:
state of observed toggle
See Also:
Module

setObserved

public void setObserved(boolean status)
Sets the observed toggle

Specified by:
setObserved in class Module
Parameters:
status -
See Also:
Module

getDebugMode

public boolean getDebugMode()
Returns the status of the debug mode toggle

Specified by:
getDebugMode in class Module
Returns:
state of debug mode toggle
See Also:
Module

setDebugMode

public void setDebugMode(boolean status)
Sets the debug mode toggle

Specified by:
setDebugMode in class Module
Parameters:
status -
See Also:
Module

getData

public byte[] getData(Module requester)
Returns data from this module

Specified by:
getData in class Module
Parameters:
Module - requester, the requester of the data
Returns:
byte[] with data
See Also:
Module

setData

public boolean setData(byte[] data,
                       Module sender)
Set data for this module

Specified by:
setData in class Module
Parameters:
byte[] - containing data
Module - sender, the sender of the data
Returns:
true if data is set successfully, false otherwise
See Also:
Module

setData

public boolean setData(java.lang.String[] data,
                       Module sender)
Sets given String[] data for this module

Specified by:
setData in class Module
Parameters:
String[] - data
Module - sender, the sender of the data
Returns:
true if data is set successfully, false otherwise
See Also:
Module

getDump

public java.lang.String getDump()
Returns a dump of this module

Specified by:
getDump in class Module
Returns:
string
See Also:
Module

getScreen

public javax.swing.JPanel getScreen()
Description copied from class: ModuleScreen
Return a reference to the actual screen

Specified by:
getScreen in class ModuleScreen

getScreenRows

public int getScreenRows()
Return the number of rows on screen (text based)

Specified by:
getScreenRows in class ModuleScreen

getScreenColumns

public int getScreenColumns()
Return the number of columns on screen (text based)

Specified by:
getScreenColumns in class ModuleScreen

getScreenWidth

public int getScreenWidth()
Return width of screen in number of pixels

Specified by:
getScreenWidth in class ModuleScreen

getScreenHeight

public int getScreenHeight()
Return height of screen in number of pixels

Specified by:
getScreenHeight in class ModuleScreen

setScreenSize

public void setScreenSize(int width,
                          int height)
Set the screen size in number of pixels

Specified by:
setScreenSize in class ModuleScreen
Parameters:
int - width New width of the screen in pixels
int - height New height of the screen in pixels

updateScreenSize

public void updateScreenSize(int newWidth,
                             int newHeight,
                             int newFontWidth,
                             int newFontHeight)
Update the screen size (if necesarry)

Specified by:
updateScreenSize in class ModuleScreen
Parameters:
newWidth - New screen width in pixels
newHeight - New screen height in pixels
newFontHeight - New font height in pixels
newFontWidth - New font width in pixels

clearScreen

public void clearScreen()
Set the screen image to black

Specified by:
clearScreen in class ModuleScreen

setPaletteColour

public boolean setPaletteColour(byte index,
                                int red,
                                int green,
                                int blue)
Set a colour in the private colourmap to a particular RGB value

Specified by:
setPaletteColour in class ModuleScreen
Parameters:
index - Index into the palette
red - New value of red
green - New value of green
blue - New value of blue
Returns:
true if succesfull update, false otherwise

setByteInCodePage

public void setByteInCodePage(int index,
                              byte data)
Update a byte in the codePage

Specified by:
setByteInCodePage in class ModuleScreen
Parameters:
index - location of byte in codePage array
data - value of new byte

updateCodePage

public void updateCodePage(int start)
Update the complete character set

Specified by:
updateCodePage in class ModuleScreen
Parameters:
start -

updateText

public void updateText(int oldText,
                       int newText,
                       long cursorXPos,
                       long cursorYPos,
                       short[] textModeAttribs,
                       int numberRows)
Description copied from class: ModuleScreen
Update text on screen at given position Text mode. Selected text will replace existing text at given position

Specified by:
updateText in class ModuleScreen

updateGraphicsTile

public void updateGraphicsTile(byte[] tile,
                               int x0,
                               int y0)
Update a tile on screen with given bytes A tile is a part of the screenbuffer

Specified by:
updateGraphicsTile in class ModuleScreen
Parameters:
byte[] - tile containing the bytes of the tile to be updated
int - x0 the start position X
int - y0 the start position Y

setImage

private void setImage(int width,
                      int height)
Set an image with data on screen

Parameters:
width - Width of the image in pixels
height - Height of the image in pixels

updateImage

private void updateImage()
Refresh the on-screen image


updatePalette

private void updatePalette()
Update the colourModel used in the image. Do this after the palette values have been changed


createCodePage437Images

private void createCodePage437Images()
Create character images from code page 437 hex values


updateFontImage

private void updateFontImage(int index,
                             int[] fontData,
                             int fontWidth,
                             int fontHeight)
Replace a BufferedImage in the font table with new data

Parameters:
index - Index of the new character into the font table
fontData - Array of hex values representing the character
fontWidth - Width of the character in pixels
fontHeight - Height of the character in pixels