jfrace.device
Class CPMEmulator

java.lang.Object
  |
  +--jfrace.device.CPMEmulator
All Implemented Interfaces:
java.awt.event.ActionListener, Device, java.util.EventListener, Hardware, java.awt.event.ItemListener

public class CPMEmulator
extends java.lang.Object
implements Device, java.awt.event.ActionListener, java.awt.event.ItemListener

Device which emulates the BIOS for CP/M V2.2.

Author:
Franz-Josef Elmer

Field Summary
static int CONIN
           
static int CONOUT
           
static int CONST
           
static byte DISK_ERROR
          BIOS return value for a disk error.
static java.lang.String DRIVE_A
           
static java.lang.String DRIVE_B
           
static byte ERROR
          BIOS return value for an error.
static int HOME
           
static int LIST
           
static int LISTST
           
static byte OK
          BIOS return value in the case of no error.
static int PUNCH
           
static int READ
           
static int READER
           
static java.lang.String RESET_BUTTON
           
static int SECTRAN
           
static int SELDSK
           
static int SETDMA
           
static int SETSEC
           
static int SETTRK
           
static int WBOOT
          BIOS functions
static int WRITE
           
 
Constructor Summary
CPMEmulator(AddressSpace as, java.lang.String theDiskPath, int jbiosSystemAdrPointer, int biosOffset, byte[] bios, int port, Terminal terminal)
          Create a new instance.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 void coldBoot()
          Cold boot.
 byte getByte(int address)
          Process BIOS function and return register A.
 int getNumberOfBits()
          Returns 8.
 int getNumberOfUnits()
          Returns 1.
 int getValue(int address)
          Returns 0.
 void itemStateChanged(java.awt.event.ItemEvent event)
           
 byte processBIOSFunction(int function, int arg1, int arg2)
          Process a BIOS call.
 void reset()
          Reset.
 void setAddButton(java.awt.Button button)
          Set 'add' button.
 void setByte(int address, byte value)
          Set the BIOS function code.
 void setDisk(int driveIndex, CPMDisk disk)
          Set a disk.
 void setValue(int address, int value)
          Does nothing.
 byte warmBoot()
          Load CCP and BDOS from the first disk found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OK

public static final byte OK
BIOS return value in the case of no error.

ERROR

public static final byte ERROR
BIOS return value for an error.

DISK_ERROR

public static final byte DISK_ERROR
BIOS return value for a disk error.

WBOOT

public static final int WBOOT
BIOS functions

CONST

public static final int CONST

CONIN

public static final int CONIN

CONOUT

public static final int CONOUT

LIST

public static final int LIST

PUNCH

public static final int PUNCH

READER

public static final int READER

HOME

public static final int HOME

SELDSK

public static final int SELDSK

SETTRK

public static final int SETTRK

SETSEC

public static final int SETSEC

SETDMA

public static final int SETDMA

READ

public static final int READ

WRITE

public static final int WRITE

LISTST

public static final int LISTST

SECTRAN

public static final int SECTRAN

DRIVE_A

public static final java.lang.String DRIVE_A

DRIVE_B

public static final java.lang.String DRIVE_B

RESET_BUTTON

public static final java.lang.String RESET_BUTTON
Constructor Detail

CPMEmulator

public CPMEmulator(AddressSpace as,
                   java.lang.String theDiskPath,
                   int jbiosSystemAdrPointer,
                   int biosOffset,
                   byte[] bios,
                   int port,
                   Terminal terminal)
Create a new instance.
Parameters:
as - AddressSpace.
theDiskPath - Directory of the CP/M disks.
jbiosSystemAdrPointer - Address in AddressSpace where JBIOS system address is stored.
biosOffset - First address of the (J)BIOS.
bios - JBIOS binary data.
port - Processor port of the CP/M emulator.
terminal - Terminal.
Method Detail

setDisk

public void setDisk(int driveIndex,
                    CPMDisk disk)
Set a disk.

setAddButton

public void setAddButton(java.awt.Button button)
Set 'add' button.

processBIOSFunction

public byte processBIOSFunction(int function,
                                int arg1,
                                int arg2)
Process a BIOS call.
Parameters:
function - Number of BIOS function.
arg1 - First argument (i.e., BC register).
arg2 - Second argument (i.e., DE register).
Returns:
byte result (for A) and biosResult (for HL).

coldBoot

public void coldBoot()
Cold boot. Stops emulation, restores BIOS, reload BDOS and CCP, and restarts emulation.

warmBoot

public byte warmBoot()
Load CCP and BDOS from the first disk found. In order to find the CCP the method looks whether there is the text COPYRIGHT starting at the 24th byte of an 128 sector.
Returns:
OK if loading was successful.

reset

public void reset()
Reset. Restores BIOS
Specified by:
reset in interface Hardware

getNumberOfBits

public int getNumberOfBits()
Returns 8.
Specified by:
getNumberOfBits in interface Hardware

getNumberOfUnits

public int getNumberOfUnits()
Returns 1.
Specified by:
getNumberOfUnits in interface Device

getValue

public int getValue(int address)
Returns 0.
Specified by:
getValue in interface Device
Following copied from interface: jfrace.Device
Parameters:
address - Memory address.
Returns:
the value.

setValue

public void setValue(int address,
                     int value)
Does nothing.
Specified by:
setValue in interface Device
Following copied from interface: jfrace.Device
Parameters:
address - Memory address.
value - the new value.

getByte

public byte getByte(int address)
Process BIOS function and return register A.
Specified by:
getByte in interface Device
Following copied from interface: jfrace.Device
Parameters:
address - Memory address.
Returns:
the value of the byte at address.

setByte

public void setByte(int address,
                    byte value)
Set the BIOS function code.
Specified by:
setByte in interface Device
Parameters:
address - Will be ignored.
value - BIOS function code.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent event)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener