jmce - 1_02

jmce.sim.terminal
Class SampleTerminal

java.lang.Object
  extended by jmce.sim.AbstractHardware
      extended by jmce.sim.AbstractPeripheral
          extended by jmce.sim.Device<java.lang.Integer>
              extended by jmce.sim.Serial
                  extended by jmce.sim.terminal.Terminal
                      extended by jmce.sim.terminal.SampleTerminal
All Implemented Interfaces:
Console, Hardware, Peripheral
Direct Known Subclasses:
Hazeltine1500, VT100, Z19

public class SampleTerminal
extends Terminal

Sample terminal implements only CR,LF,TAB,BACK-SPACE

Also implements all low level function used by more sophisticated terminal emulator like insert line, delete line etc.

Properties

Version:
1.01
Author:
Mario Viara

Field Summary
protected  int abortKey
           
 
Fields inherited from class jmce.sim.terminal.Terminal
BLINK, HI, NORMAL, REVERSE, SPACE, UNDERLINE
 
Fields inherited from class jmce.sim.AbstractPeripheral
cpu
 
Constructor Summary
SampleTerminal()
           
SampleTerminal(java.lang.String name)
           
 
Method Summary
 void clearEol()
           
 void clearEos()
           
 void clearFromLine()
          Clear from the begin of the line to the cursor
 void clearToCursor()
          Clear the display from the begin to the cursor
 void cls()
           
 void defineFunctionKey(int k, char c)
           
 void defineFunctionKey(int k, java.lang.String s)
           
 void deleteChar()
           
 void deleteLine()
           
 void down()
           
 int getAbortKey()
           
 int getAtt()
           
 int getAtt(int pos)
           
 int getAtt(int r, int c)
           
 Memory getAttMemory()
           
 int getChar(int pos)
           
 int getChar(int r, int c)
           
 Memory getCharMemory()
           
 int getCol()
           
 boolean getCursor()
           
 java.lang.String getEchoFile()
           
 java.awt.Font getFont()
           
 int getFontSize()
           
 java.lang.String getFunctionKey(int k)
           
 int getNumCol()
           
 int getNumRow()
           
 int getNumStatus()
           
 int getRow()
           
 int getScreenSize()
           
 int getWindowSize()
           
 void home()
           
 void init(Hardware parent)
          Initialize the hardware.
 void insertChar()
           
 void insertChar(int c)
           
 void insertLine()
           
 void left()
           
 void printStatusLine(int r, java.lang.Object o)
          Print a string on the status line.
 void putchar(int c)
           
 void reset()
          Reset the the device to the initial state.
 void restoreCursor()
           
 void right()
           
 void saveCursor()
           
 void scrollDown(int from, int size, int n)
           
 void scrollUp(int from, int size, int n)
           
 void setAbortKey(int n)
           
 void setAtt(int n)
           
 void setChar(int pos, int c)
           
 void setChar(int r, int c, int ch)
           
 void setCursor(int row, int col)
           
static void setDefaultCRT(java.lang.Class clazz)
           
static void setDefaultCRT(java.lang.String name)
           
 void setEchoFile(java.lang.String file)
           
 void setFont(java.awt.Font font)
           
 void setFontSize(int size)
           
 void setNumCol(int col)
           
 void setNumRow(int row)
           
 void setNumStatus(int n)
           
 void setStatusLine(int r, int c, java.lang.Object o)
          Print a String at the specified position of the status line.
 java.lang.String toString()
           
 void up()
           
 void write(java.lang.Integer k)
          Write data in the output buffer
 
Methods inherited from class jmce.sim.terminal.Terminal
createTerminal
 
Methods inherited from class jmce.sim.Serial
print, println, println
 
Methods inherited from class jmce.sim.Device
addInputConsumer, addInputProducer, addOutputConsumer, addOutputProducer, getConnected, read, readOutput, readyRead, readyReadOutput, readyWrite, removeInputConsumer, removeOutputConsumer, setConnected, writeInput
 
Methods inherited from class jmce.sim.AbstractPeripheral
idle, registerCPU, setIdle, setLive
 
Methods inherited from class jmce.sim.AbstractHardware
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, setHardware, setHardware, setName
 
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, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, setHardware, setHardware, setName
 

Field Detail

abortKey

protected int abortKey
Constructor Detail

SampleTerminal

public SampleTerminal()

SampleTerminal

public SampleTerminal(java.lang.String name)
Method Detail

setDefaultCRT

public static void setDefaultCRT(java.lang.String name)
                          throws SIMException
Throws:
SIMException

setDefaultCRT

public static void setDefaultCRT(java.lang.Class clazz)

getFontSize

public int getFontSize()
Specified by:
getFontSize in class Terminal

setFontSize

public void setFontSize(int size)
Specified by:
setFontSize in class Terminal

getFont

public java.awt.Font getFont()
Specified by:
getFont in class Terminal

setFont

public void setFont(java.awt.Font font)
Specified by:
setFont in class Terminal

write

public void write(java.lang.Integer k)
           throws SIMException
Description copied from class: Device
Write data in the output buffer

Overrides:
write in class Device<java.lang.Integer>
Throws:
SIMException

getNumStatus

public int getNumStatus()
Specified by:
getNumStatus in class Terminal

setNumStatus

public void setNumStatus(int n)
Specified by:
setNumStatus in class Terminal

setNumRow

public void setNumRow(int row)
Specified by:
setNumRow in class Terminal

setNumCol

public void setNumCol(int col)
Specified by:
setNumCol in class Terminal

getNumRow

public int getNumRow()
Specified by:
getNumRow in class Terminal

getNumCol

public int getNumCol()
Specified by:
getNumCol in class Terminal

getWindowSize

public int getWindowSize()

getScreenSize

public int getScreenSize()

getCol

public int getCol()
Specified by:
getCol in class Terminal

getRow

public int getRow()
Specified by:
getRow in class Terminal

getCursor

public boolean getCursor()
Specified by:
getCursor in class Terminal

setCursor

public void setCursor(int row,
                      int col)
Specified by:
setCursor in class Terminal

getAtt

public int getAtt()

setAtt

public void setAtt(int n)

setChar

public void setChar(int r,
                    int c,
                    int ch)
             throws SIMException
Throws:
SIMException

setChar

public void setChar(int pos,
                    int c)
             throws SIMException
Throws:
SIMException

setStatusLine

public void setStatusLine(int r,
                          int c,
                          java.lang.Object o)
Description copied from class: Terminal
Print a String at the specified position of the status line.

Specified by:
setStatusLine in class Terminal
Parameters:
r - - Status line
c - - Column
o - - Object to print

printStatusLine

public void printStatusLine(int r,
                            java.lang.Object o)
Description copied from class: Terminal
Print a string on the status line.

The previous value of the status line will be lost. If the status line is not available no text will be print.

Specified by:
printStatusLine in class Terminal
Parameters:
r - - Status line
o - - Object to print

reset

public void reset()
           throws SIMException
Description copied from interface: Hardware
Reset the the device to the initial state. This method will be called after init.

Specified by:
reset in interface Hardware
Overrides:
reset in class AbstractHardware
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 AbstractHardware
Parameters:
parent - Parent of this hardware.
Throws:
SIMException

getAtt

public int getAtt(int r,
                  int c)
           throws SIMException
Throws:
SIMException

getAtt

public int getAtt(int pos)
           throws SIMException
Throws:
SIMException

getChar

public int getChar(int r,
                   int c)
            throws SIMException
Throws:
SIMException

getChar

public int getChar(int pos)
            throws SIMException
Throws:
SIMException

home

public void home()

cls

public void cls()

saveCursor

public void saveCursor()

restoreCursor

public void restoreCursor()

clearEol

public void clearEol()

scrollUp

public void scrollUp(int from,
                     int size,
                     int n)

scrollDown

public void scrollDown(int from,
                       int size,
                       int n)

insertChar

public void insertChar()

insertChar

public void insertChar(int c)

insertLine

public void insertLine()

deleteChar

public void deleteChar()

deleteLine

public void deleteLine()

clearFromLine

public void clearFromLine()
Clear from the begin of the line to the cursor


clearToCursor

public void clearToCursor()
Clear the display from the begin to the cursor


clearEos

public void clearEos()

up

public void up()

down

public void down()

left

public void left()

right

public void right()

putchar

public void putchar(int c)
             throws SIMException
Specified by:
putchar in interface Console
Specified by:
putchar in class Terminal
Throws:
SIMException

defineFunctionKey

public void defineFunctionKey(int k,
                              char c)

defineFunctionKey

public void defineFunctionKey(int k,
                              java.lang.String s)
Specified by:
defineFunctionKey in class Terminal

getFunctionKey

public java.lang.String getFunctionKey(int k)
Specified by:
getFunctionKey in class Terminal

getCharMemory

public Memory getCharMemory()
Specified by:
getCharMemory in class Terminal

getAttMemory

public Memory getAttMemory()
Specified by:
getAttMemory in class Terminal

getEchoFile

public java.lang.String getEchoFile()
Specified by:
getEchoFile in class Terminal

setEchoFile

public void setEchoFile(java.lang.String file)
Specified by:
setEchoFile in class Terminal

getAbortKey

public int getAbortKey()

setAbortKey

public void setAbortKey(int n)

toString

public java.lang.String toString()
Overrides:
toString in class AbstractHardware

jmce - 1_02