jmce - 1_02

jmce.sim.cpm
Class FCB

java.lang.Object
  extended by jmce.sim.cpm.FCB

public class FCB
extends java.lang.Object

This class rappresent a CP/M FCB (Directory file control block.)

Directory File Control block Space in CP/M is allocated in 128 byte block called record.

Every FCB is 32 byte and have the following layout :


  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
 UU N0 N1 N2 N3 N4 N5 N6 N7 T0 T1 T2 EX S1 S2 RC
 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF


 UU      User 0 - 15 in CP/M 1.4,2.2 0-31 in CP/M 3.0.
           If the file is deleted this byte is set to 0xE5.
           
 N0..N7  File name right filled with spaces.
 T0..T2  File type  right filled with spaces.
 EX      Number of extension 0-31, every extension is 128 record.
 S1      Reserved.
 S2        Reserved.
 RC        Number of record used in the last extension.
 
 A0..AF  Block allocation map 1 if BSM < 256 else each block use 2
           2 consecutive byte LSB first.
 
 

Turbodos mantain the flag for the file in the high bit of the filename :

N0 - Fifo file attribute T0 - Read only T1 - Global file T2 - Archive

Version:
1.01
Author:
Mario Viara
See Also:
DPB

Field Summary
static byte DELETED
          Entry deleted
static int EX
          Offset to extension number
static int RC
          Offset to record counter
static int SIZE
          FCB length
static int USER
          Offset to user number
 
Constructor Summary
FCB()
          Create a new empty FCB
 
Method Summary
 void clear()
          Clear all the data in the FCB
 void clearBlocks()
          Clear all the allocation block map
 boolean getAttributeArchive()
          Return true if the turbodos global attribute is set.
 boolean getAttributeFifo()
          Return true if the turbodos Fifo is set
 boolean getAttributeGlobal()
          Return true if the turbodos global attribute is set.
 boolean getAttributeReadOnly()
          Return true if the turbodos read only is set.
 int getBlockByte(int block)
          Get one allocation block using 1 byte for block
 int getBlockWord(int block)
          Get one allocation block using 1 word for block
 void getBuffer(byte[] buffer, int from)
          Copy in one buffer the FCB
 byte[] getBytes()
          Get the space used by the FCB
 int getEX()
          Get the extension
 java.lang.String getFileName()
          Get the filename in the FCB
 int getRC()
          Get record counter
 int getUser()
          Get the user number
 boolean isDeleted()
          Return true if this FCB is deleted
 void setBlockByte(int block, int value)
           
 void setBlockWord(int block, int value)
           
 void setBuffer(byte[] buffer, int from)
          Copy the FCB from one buffer
 void setDeleted()
          Set this FCB as deleted
 void setEX(int ex)
          Set the extension
 void setFileName(java.lang.String name)
          Set the filename in the FCB
 void setRC(int rc)
          Set record counter
 void setUser(int user)
          Set the user number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZE

public static final int SIZE
FCB length

See Also:
Constant Field Values

DELETED

public static final byte DELETED
Entry deleted

See Also:
Constant Field Values

USER

public static final int USER
Offset to user number

See Also:
Constant Field Values

EX

public static final int EX
Offset to extension number

See Also:
Constant Field Values

RC

public static final int RC
Offset to record counter

See Also:
Constant Field Values
Constructor Detail

FCB

public FCB()
Create a new empty FCB

Method Detail

clear

public void clear()
Clear all the data in the FCB


getBuffer

public void getBuffer(byte[] buffer,
                      int from)
Copy in one buffer the FCB


setBuffer

public void setBuffer(byte[] buffer,
                      int from)
Copy the FCB from one buffer


getBytes

public byte[] getBytes()
Get the space used by the FCB


getUser

public int getUser()
Get the user number


setUser

public void setUser(int user)
Set the user number


setFileName

public void setFileName(java.lang.String name)
Set the filename in the FCB


getFileName

public java.lang.String getFileName()
Get the filename in the FCB


setDeleted

public void setDeleted()
Set this FCB as deleted


isDeleted

public boolean isDeleted()
Return true if this FCB is deleted


getRC

public int getRC()
Get record counter


setRC

public void setRC(int rc)
Set record counter


getEX

public int getEX()
Get the extension


setEX

public void setEX(int ex)
Set the extension


getBlockByte

public int getBlockByte(int block)
Get one allocation block using 1 byte for block


getBlockWord

public int getBlockWord(int block)
Get one allocation block using 1 word for block


setBlockByte

public void setBlockByte(int block,
                         int value)

setBlockWord

public void setBlockWord(int block,
                         int value)

clearBlocks

public void clearBlocks()
Clear all the allocation block map


getAttributeFifo

public boolean getAttributeFifo()
Return true if the turbodos Fifo is set


getAttributeReadOnly

public boolean getAttributeReadOnly()
Return true if the turbodos read only is set.


getAttributeGlobal

public boolean getAttributeGlobal()
Return true if the turbodos global attribute is set.


getAttributeArchive

public boolean getAttributeArchive()
Return true if the turbodos global attribute is set.


jmce - 1_02