unit fn_sio

SIO library for #FujiNet interface.

author: bocianu bocianu@gmail.com


Set of procedures to communicate with #FujiNet interface on SIO level. https://fujinet.online/
This library is a part of 'blibs' - set of custom Mad-Pascal libraries.
https://gitlab.com/bocianu/blibs

Constants:

name:value:description:
FN_MOUNT_READ0
FN_MOUNT_WRITE1

Types:

name:type:description:
FN_StatusStructrecord
  • dataSize: word;
  • connected: byte;
  • errorCode: byte;

end;
Structure used to store Status Command result
FN_HostSlotarray[0..31] of charCharacter string used to store a single host name
FN_HostSlotsarray[0..7] of FN_HostSlotList of all host slots (FN_HostSlot objects)
FN_DeviceSlotrecord
  • hostSlot: byte;
  • mode: byte;
  • filename: array[0..35] of char;

end;
Structure describing a single device slot
FN_DeviceSlotsarray[0..7, 0..sizeof(FN_DeviceSlot) - 1] of charList of all device slots (FN_DeviceSlot objects)

Interface:

name:description:
FN_Open

procedure FN_Open(var fn_uri:PChar);overload;


Opens connection to remote host at selected port using declared protocol.
FN_Open

procedure FN_Open(var fn_uri:PChar; aux1, aux2: byte);overload;


Opens connection to remote host at selected port using declared protocol.
FN_WriteBuffer

procedure FN_WriteBuffer(buf: pointer; len: word);


Writes (sends) data from memory to network device.
    parameters:
  • buf - pointer to starting address of data
  • len - data length (in bytes)
FN_ReadBuffer

procedure FN_ReadBuffer(buf: pointer;len: word);


Reads (receives) data from network device.
    parameters:
  • buf - pointer of buffer to store the incoming data
  • len - data length (in bytes)
FN_ReadStatus

procedure FN_ReadStatus(status: pointer);


Reads network device status and stores information in provided memory location.
    parameters:
  • buf - pointer of buffer to store returned status information
FN_Close

procedure FN_Close;


Closes network connection.
    FN_Command

    function FN_Command(cmd, dstats:byte;dbyt: word;aux1, aux2:byte; dbufa: word):byte;


    Sends SIO command to #FN device
      parameters:
    • cmd - DCB.DCMND byte
    • dstats - DCB.STATS byte
    • dbyt - DCB.DBYT word
    • aux1 - DCB.DAUX1 byte
    • aux2 - DCB.DAUX2 byte
    • dbufa - DCB.DBUFA word
    • returns:
    • (byte) - sio operation result (1 for success)
    FN_GetHostSlots

    procedure FN_GetHostSlots(buf: pointer);


    Retrieves a list of hosts
      parameters:
    • buf - pointer to an FN_HostSlots object
    FN_GetDeviceSlots

    procedure FN_GetDeviceSlots(buf: pointer);


    Retrieves a list of device slots
      parameters:
    • buf - pointer to an FN_DeviceSlots object
    FN_MountHost

    procedure FN_MountHost(hs: byte);


    Mounts host with a given number
      parameters:
    • hs - host slot number (byte)
    FN_UnmountHost

    procedure FN_UnmountHost(hs: byte);


    Unmounts host with a given number
      parameters:
    • hs - host slot number (byte)
    FN_OpenDirectory

    procedure FN_OpenDirectory(hs: byte; buf: pointer; diropt: byte);


    Opens directory for reading
      parameters:
    • hs - host slot number (byte)
    • buf - pointer to the null-terminated path
    • diropt - directory options (byte)
    FN_CloseDirectory

    procedure FN_CloseDirectory(hs: byte);


    Closes a previously opened directory
      parameters:
    • hs - host slot number (byte)
    FN_ReadDirectory

    procedure FN_ReadDirectory(maxlen: byte; hs: byte; buf: pointer);


    Reads a directory entry into `buf`
      parameters:
    • maxlen - maximum length of retrieved data (byte)
    • hs - host slot number (byte)
    • buf - pointer to the null-terminated path
    FN_GetDirectoryPosition

    function FN_GetDirectoryPosition : word;


    Gets the current directory stream position
      returns:
    • (word) - position
    FN_SetDirectoryPosition

    procedure FN_SetDirectoryPosition(pos: word);


    Sets directory stream position
      parameters:
    • pos - position (word)
    FN_SetDeviceFilename

    procedure FN_SetDeviceFilename(ds, hs, mode: byte; buf: pointer);


    Sets filename for mounting
      parameters:
    • ds - disk slot number (byte)
    • hs - host slot number (byte)
    • mode - mounting mode: (FN_MOUNT_READ|FN_MOUNT_WRITE) (byte)
    • buf - pointer to the null-terminated path
    FN_MountDiskImage

    procedure FN_MountDiskImage(slot, mode: byte);


    Mounts disk image already set using FN_SetDeviceFilename
      parameters:
    • slot - disk slot number (byte)
    • mode - mounting mode: (FN_MOUNT_READ|FN_MOUNT_WRITE) (byte)
    FN_UnmountDiskImage

    procedure FN_UnmountDiskImage(slot: byte);


    Unmounts disk image specified by `slot`
      parameters:
    • slot - slot number (byte)