Z88 Developers' Notes
Contents   Contents of System Calls

OS_Epr, File Eprom Interface

RST 20H, DEFW $F006

IN:
A = reason code:

EP_Save = $00   Blow RAM file to UV Eprom
EP_Load = $03   Copy file from File Area, as RAM file
EP_Req = $06    Check for "oz" File Eprom or File Area in slot C  (OZ 4.2 and newer)
EP_Fetch = $09  Copy saved/deleted file from File Area to RAM     (OZ 4.2 and newer)
EP_Find = $0c   Find active File(name) in File Area in slot C     (OZ 4.2 and newer)
EP_Dir = $0f    Return next filename (starting with first)
EP_First = $12  Return first file entry in File Area in slot C    (OZ 4.2 and newer)
EP_Prev = $15   Return previous file entry in File Area           (OZ 4.2 and newer)
EP_Next = $18   Return next file entry in File Area               (OZ 4.2 and newer)
EP_Last = $1b   Return last file entry in File Area in slot C     (OZ 4.2 and newer)
EP_TotSp = $1e  Return amount of used file space in slot C        (OZ 4.2 and newer)
EP_ActSp = $21  Return active file space in slot C                (OZ 4.2 and newer)
EP_FreSp = $24  Return free file space in slot C                  (OZ 4.2 and newer)
EP_Count = $27  Return number of files in File Area slot C        (OZ 4.2 and newer)
EP_Stat = $2a   Return file entry status (active or deleted)      (OZ 4.2 and newer)
EP_Size = $2d   Return file size of File Entry                    (OZ 4.2 and newer)
EP_Name = $30   Copy File entry name to buffer at (CDE)           (OZ 4.2 and newer)
EP_Image = $33  Return pointer to start of file contents          (OZ 4.2 and newer)
EP_New = $36    Return pointer to future new entry in File Area   (OZ 4.2 and newer)
EP_SvFl = $39   Save RAM file to Flash or UV Eprom to slot C      (OZ 4.2 and newer)
EP_Delete = $3c Mark File Entry as deleted on Flash or UV Eprom   (OZ 4.2 and newer)
EP_Format = $3f Create File Area in slot C (Eprom or Flash Card)  (OZ 4.2 and newer)
EP_NewFile = $42 Write Blow RAM file to slot C                    (OZ 4.2 and newer)
EP_WrBlk = $45  Write a block of bytes to UV Eprom in slot 3      (OZ 4.2 and newer)

BC, DE, HL, IX arguments.
OUT:
Fc = 1, A = error code.
Fc = 0, reason code action successfully ended.

Registers changed after return depends on individual API call.

All OS_Epr mnemonic defintion are found in the "eprom.def" file. All new API entries in OS_Epr of the OZ V4.2 release is a reflection of the implementations done in the standard library. All are used in FlashStore which were the original basis to create these routines to be shareable by other applications, and now availalable in OZ V4.2.



EP_SAVE ($00) - blow RAM file to Eprom in slot 3.
IN:  BHL = pointer to filename, (B=0 means local pointer)

OUT: Fc = 0, file successfully blown on File EPROM.
     Fc = 1:
          A = RC_FAIL ($16), file couldn't be blown on EPROM.

Registers changed after return:
 ..BCDEHL/IXIY same 
AF....../.... different
Write RAM file to UV Eprom card hardware in slot 3 (or available Flash hardware). If a file area does not exist on the card in slot 3, it will be created on the card (if possible). If a file already exists in the file area with the same path/filename, it will automatically marked as deleted.


EP_LOAD ($03) - read file from Eprom in slot 3 into RAM file.
IN:  BHL = pointer to filename (to be found on EPROM)
     IX = output file handle (to store contents of file on EPROM)


OUT: Fc = 0, file successfully moved to RAM filing system.
     Fc = 1:
          A = RC_FAIL ($16), file EPROM not available.
          A = RC_ROOM ($07), no room in filing system for data from EPROM.

Registers changed after return:
 ..BCDEHL/IXIY same 
AF....../.... different
Notes:
Before calling OS_Epr and EP_LOAD you should create a new file with an appropriate file name, using GN_Opf, A = OP_OUT. The filename to be searched on EPROM must not contain wildcards (the File EPROM is not organised as the RAM filing system). This call is equivalent to the <>EF command in the FILER. You must close the output file after the data has been copied from EPROM. This call also works with sub file areas (a file area available on an application card in slot 3 - implemented in OZ V4.2 and newer).



EP_REQ ($06) - Check for "oz" File Eprom or File Area in slot C  (OZ 4.2 and newer)

Check for "oz" File Eprom (on a conventional Eprom or on a Flash Memory)
  1. Check for a standard "oz" File Eprom, if that fails -
  2. Check if that slot contains an Application ROM, then check for the Header Identifier below the application bank area. For Flash Cards, the File Header might be on first top bank of a free 64K sector. For UV Eproms, the File Header might be on the first top bank below the application bank area.
  3. If a Rom Front Dor is located in a RAM Card, then this slot is regarded as a non-valid card as a File Eprom, ie. not present.
  4. Check for embedded 'oz' watermark inside an 'OZ' application header. If found, then this indicates that a file area is located at the top of a card above an application area or at the top of an OZ ROM.
    1. A standard 'oz' header is recognized by the top two watermark bytes in the top bank of the file area (either typically at the top of the card, in modulus 64K sectors in Flash Cards or  modulus 16K banks on traditional EPROM's. The complete header has the following format:

         ------------------------------------------------------------------------------
         $3FC0       $00's until
         $3FF7       $01
         $3FF8       4 byte random id
         $3FFC       size of card in banks (2=32K, 8=128K, 16=256K, 64=1Mb)
         $3FFD       sub-type: $7E, $7C, $7A for UV 32K, 128K & 256K cards. $77, $6F for Intel and Amd Flash
         $3FFE       'o'
         $3FFF       'z' (file eprom identifier, lower case 'oz')
         ------------------------------------------------------------------------------

         in hex dump (example):

         00003fc0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
         00003fd0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
         00003fe0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
         00003ff0h: 00 00 00 00 00 00 00 01 73 D1 4B 3C 02 7E 6F 7A ; .........s?<.~oz
         ------------------------------------------------------------------------------

    2. A sub-standard 'oz' header is recognized at offset $3FEE inside an application 'OZ' header that is always placed at the top of the card, with the following format:
   Application Front DOR:

   $3FC0         0 0 0           Link to parent
   $3FC3         0 0 0           Link to brother - this may point to the HELP front DOR
   $3FC6         x x x           Link to son - this points to the first application DOR
   $3FC9         $13             DOR type, ROM Front DOR
   $3FCA         8               DOR length
   $3FCB         'N'             Key for name field (DT_NAM)
   $3FCC         5               Length of name and terminator
   $3FCD         'APPL', 0       NULL-terminated name
   $3FD2         $FF             DOR terminator

   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   Optional file area at top card, above application area:
   $3FEC         x               Size of file area in banks, eg. $02 for a 32K size
   $3FED         $00             64K Reclaim Sector (0=not used)
   $3FEE         'oz'            Application/ROM Card holds file area
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   $3FF8         @0xxxxxxx       Low byte of card ID
   $3FF9         @0xxxxxxx       High byte of card ID
   $3FFA         @0000xxxx       4 bit country code
   $3FFB         $80             Marks external application
   $3FFC         x               Size of card in banks, eg. $02 for a 32K card
   $3FFD         $00             Subtype of card - future expansion
   $3FFE         'OZ'            Card holds applications
   ------------------------------------------------------------------------------
   in hex dump (example):
   00003fc0h: 00 00 00 00 00 00 48 25 08 13 08 4E 05 41 50 50 ; ......H%...N.APP
   00003fd0h: 4C 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 ; L...............
   00003fe0h: 00 00 00 00 00 00 00 00 00 00 00 00 14 00 6F 7A ; ..............oz
   00003ff0h: 00 00 00 00 00 00 00 00 54 43 4C 81 20 00 4F 5A ; .........TCL .OZ
   ------------------------------------------------------------------------------

On partial success, if a Header is not found, Fz = 0 and the returned BHL pointer indicates that the card might hold a file area, beginning at this location.
If the routine returns Fz = 1, it's an identified File Area Header (pointing to 64 byte header in the top of bank B).

Register parameters:

In:
        C = slot number (0, 1, 2 or 3)

Out:
   Success, File Area (or potential) available:
        Fc = 0,
             BHL = pointer to File Header for slot C (B = absolute bank of slot).
                   (or pointer to free space in potential new File Area).
               C = size of File Eprom Area in 16K banks
             Fz = 1, File Header found
                  A = "oz" File Eprom sub type
                  D = size of card in 16K banks (0 - 64)
             Fz = 0, File Header not found
                  A undefined
                  D undefined
   Failure:
        Fc = 1,
             C = C(in)
             A = RC_ONF (File Eprom Card/Area not available; possibly no card in slot)
             A = RC_ROOM (No room for File Area; all banks used for applications)

Registers changed after return:
   .....E../IXIY same
   AFBCD.HL/.... different



EP_Fetch ($09) - Copy saved/deleted file from File Area to RAM  (OZ 4.2 and newer)

Fetch file (image) from File Eprom Card, identified by File Entry at BHL (B=00h-FFh embedded slot mask, HL=0000h-3FFFh bank offset) and store it into
an open file (enabled for writing) in the RAM file system (using the IX handle).

The application is responsible for opening/creating a RAM file, then using this library routine to transfer the contents from the File Eprom to the RAM file system, and then finally close the new RAM file.

IN:
   IX = handle of file stream (opened previously with GN_Opf, A=OP_OUT)
   BHL = pointer to Eprom File Entry (bits 7,6 of B is the slot mask)

OUT:
   Fc = 0,
        File Image transferred successfully to RAM file.

   Fc = 1,
        A = RC_ONF, File Eprom or File Entry was not found in slot
        A = RC_xxx, I/O error during saving process.

Registers changed after return:
   ..BCDEHL/IXIY same
   AF....../.... different



EP_Find ($0C) - Find active File(name) in File Area in slot C  (OZ 4.2 and newer)


IN:
   C = slot number of File Eprom (Area)
   DE = pointer to null-terminated filename to be searched for.
        The filename is excl. device name and must begin with '/'.

OUT:
   Fc = 0, File Eprom available
        Fz = 1, File Entry found.
             BHL = pointer to File Entry in card at slot
        Fz = 0, No file were found on the File Eprom.
             BHL = pointer to free byte on File Eprom in slot

   Fc = 1,
        A = RC_Onf
        File Eprom was not found at slot C

Registers changed after return:
   A..CDE../IXIY same
   .FB...HL/.... different



EP_DIR ($0F) - Fetch filename from Eprom in slot 3:
IN:  BHL = pointer to store returned filename (B=0 means local pointer).

OUT: Fc = 0:
          Filename returned at (HL), null-terminated.
     Fc = 1:
          A = RC_EOF ($09), no more filenames on File EPROM.
          A = RC_FAIL ($16), File EPROM not available.

Registers changed after return:
 ..BCDEHL/IXIY same 
AF....../.... different
Notes:
The first EPR_DIR call will return the first file name, if available. Subsequent calls will return the next filenames in chronological order (as the files were stored on EPROM). It is necessary to read all file names to the end, if you want to re-read the filenames from start at a later time. The buffer to receive the filenames from EPR_DIR must be sufficiently large, e.g. 128 bytes. The FILER uses this to display all available filenames on EPROM. Filenames never contains RAM device references, but always reflect the complete path from the filing system (when blown to EPROM). Old 'deleted' files are not reflected in the list of filenames. This call also works with sub file areas (a file area available on an application card in slot 3 - implemented in OZ V4.2 and newer).


EP_First ($12) - Return first file entry in File Area in slot C  (OZ 4.2 and newer)

If the NULL file is identified as the first file, it is skipped and the next file entry pointer is automatically returned.

IN:
   C = slot number containing File Eprom

OUT:
   Fc = 0, File Eprom available
        Fz = 1, File Entry marked as deleted
        Fz = 0, File Entry is active.
        BHL = pointer to first file entry in slot (B=00h-FFh, HL=0000h-3FFFh).
        (NULL file skipped if found on Intel Flash Card)

   Fc = 1,
        A = RC_Onf
        File Eprom was not found in slot, or File Entry not available

Registers changed after return:
   ...CDE../IXIY same
   AFB...HL/.... different

Notes:
Due to a strange side effect with Intel Flash Chips, a special "NULL" file is saved as the first file to the Card. These bytes occupies the first bytes that otherwise could be interpreted as a random boot command for the Intel chip - the behaviour is an Intel chip suddenly gone into command mode for no particular reason. The NULL file prevents this behaviour by saving a file that avoids any kind of boot commands which sends the chip into command mode when the card has been inserted into a Z88 slot.



EP_Prev ($15) - Return previous file entry in File Area  (OZ 4.2 and newer)

To get the previous file entry, the current file entry pointer must be supplied as argument to this API. The B register defines the absolute bank number which contains the slot mask ($40 for slot 1, $80 for slot 2 and $C0 for slot 3).

IN:
   BHL = pointer to current file entry in slot (B=00h-FFh, HL=0000h-3FFFh).

OUT:
   Fc = 0, File Eprom Area available
        Fz = 1, File Entry marked as deleted
        Fz = 0, File Entry is active.
        BHL = pointer to previous file entry in slot (B=00h-FFh, HL=0000h-3FFFh).

   Fc = 1,
        A = RC_Onf
        File Eprom was not found in slot, or current File entry was the first
        File Entry (an attempt was made to go beyond the bottom of the file area)

Registers changed after return:
   A..CDE../IXIY same
   .FB...HL/.... different



EP_Next ($18) - Return next file entry in File Area               (OZ 4.2 and newer)

To get the next file entry, the current file entry pointer must be supplied as argument to this API. The B register defines the absolute bank number which contains the slot mask ($40 for slot 1, $80 for slot 2 and $C0 for slot 3).

IN:
   BHL = pointer to current File Entry

OUT:
   BHL = pointer to next file entry on File Eprom in slot, or first byte of empty space

   Fc = 0, File Eprom available
        Fz = 1, File Entry marked as deleted
        Fz = 0, File Entry is active.
   Fc = 1,
        A = RC_Onf
        File Eprom was not found in slot, or File Entry not available

Registers changed after return:
   ...CDE../IXIY same
   AFB...HL/.... different



EP_Last ($1B) - Return last file entry in File Area in slot C     (OZ 4.2 and newer)

Return pointer to last file entry on Standard File Eprom, inserted in slot C. The returned B register defines the absolute bank number which contains the slot mask ($40 for slot 1, $80 for slot 2 and $C0 for slot 3).

IN:
   C = slot number containing File Eprom

OUT:
   Fc = 0, File Eprom available
        Fz = 1, File Entry marked as deleted
        Fz = 0, File Entry is active.
        BHL = pointer to last file entry in slot (B=00h-FFh, HL=0000h-3FFFh).

   Fc = 1,
        A = RC_Onf
        File Eprom was not found in slot, or File Entry not available

Registers changed after return:
   ...CDE../IXIY same
   AFB...HL/.... different



EP_TotSp ($1E) - Return amount of used file space in slot C  (OZ 4.2 and newer)

Return amount of active and deleted file space (in bytes) in File Eprom Area, inserted in slot C.

IN:
   C = slot number containing File Eprom Area

OUT:
   Fc = 0, File Eprom available
        BHL = Amount of active file space in bytes (24bit integer, B = MSB)
        CDE = Amount of deleted file space in bytes (24bit integer, C = MSB)

   Fc = 1,
        A = RC_ONF
        File Eprom was not found in slot C.

Registers changed after return:
   ......../IXIY same
   AFBCDEHL/.... different



EP_ActSp ($21) - Return active file space in slot C  (OZ 4.2 and newer)

Return amount of active (visible) file space in File Eprom Area, inserted in slot C (API wrapper of  EP_TotSp).

IN:
   C = slot number containing File Eprom Area

OUT:
   Fc = 0, File Eprom available
        DEBC = Active space (amount of visible files) in bytes
               (DE = high 16bit, BC = low 16bit)

   Fc = 1,
        A = RC_ONF
        File Eprom was not found in slot C.

Registers changed after (succesful) return:
   A.....HL/IXIY same
   .FBCDE../.... different



EP_FreSp ($24) - Return free file space in slot C  (OZ 4.2 and newer)

Return free space in Standard File Eprom Area, inserted in slot C.

IN:
   C = slot number containing File Eprom Area

OUT:
   Fc = 0, File Area available
        DEBC = Free space available
               
(DE = high 16bit, BC = low 16bit)

   Fc = 1, File Area was not found in slot C
        A = RC_ONF

Registers changed after (successful) return:
   ......HL/IXIY same
   AFBCDE../.... different



EP_Count ($27) - Return number of files in File Area slot C  (OZ 4.2 and newer)

Count total of active and deleted files on File Eprom in slot C (excl. NULL file on Intel Flash card).

IN:
   C = slot number containing File Eprom Area

OUT:
   Fc = 0, File Eprom available
        HL = total of active (visible) files
        DE = total of (marked as) deleted files
        (HL + DE are total files in the file area)

   Fc = 1, File Eprom was not found at slot C

Registers changed after return:
   ..BC..../IXIY same
   AF..DEHL/.... different

Notes:
Due to a strange side effect with Intel Flash Chips, a special "NULL" file is saved as the first file to the Card. These bytes occupies the first bytes that otherwise could be interpreted as a random boot command for the Intel chip - the behaviour is an Intel chip suddenly gone into command mode for no particular reason. The NULL file prevents this behaviour by saving a file that avoids any kind of boot commands which sends the chip into command mode when the card has been inserted into a Z88 slot.



EP_Stat ($2A) - Return file entry status (active or deleted)  (OZ 4.2 and newer)

Read File Entry Status information, if available. This routine might be used by applications, but is primarily used internally by OS_Epr.

IN:
   BHL = pointer to start of file entry
        The Bank specifier contains the slot mask, ie. defines which slot
        is being read. HL is the traditional bank offset.

OUT:
   Fc = 0, File Entry available
        Fz = 1, deleted file
        Fz = 0, active file

   Fc = 1, File Entry not available ($FF or $00 was first byte of entry)
        A = RC_Onf (Object not found)

Registers changed after return:
   ..BCDEHL/IXIY same
   AF....../.... different



EP_Size ($2D) - Return file size of File Entry  (OZ 4.2 and newer)

Return file size in CDE of File Entry at pointer BHL (B=00h-FFh embedded slot mask, HL=0000h-3FFFh bank offset).

IN:
   BHL = Pointer to File Entry in card at slot

OUT:
   Fc = 0, File Eprom available
        Fz = 1, File Entry marked as deleted
        Fz = 0, File Entry active
             CDE = size of file (24bit integer, C = high byte)

   Fc = 1,
        A = RC_ONF
        File Eprom was not found in slot, or File Entry not available

Registers changed after return:
   ..B...HL/IXIY same
   AF.CDE../.... different



EP_Name ($30) - Copy File entry name to buffer at (CDE)   (OZ 4.2 and newer)

Return file name of File Entry at BHL (B=00h-FFh embedded slot mask, HL=0000h-3FFFh bank offset).

IN:
   CDE = buffer to hold returned filename, (C = 0, local pointer)
   BHL = pointer to Eprom File Entry in card (B contains embedded slot mask)

OUT:
   Fc = 0, File Eprom available
        Fz = 1, File Entry marked as deleted
        Fz = 0, File Entry marked as active
        A = length of filename
        (CDE) contains a copy of filename, null-terminated.

   Fc = 1,
        A = RC_Onf
        File Eprom was not found in slot, or File Entry not available

Registers changed after return:
   ..BCDEHL/IXIY same
   AF...../.... different



EP_Image ($33) - Return pointer to start of file contents  (OZ 4.2 and newer)

Return pointer to start of file image of File Entry at BHL (B=00h-FFh embedded slot mask, HL=0000h-3FFFh bank offset)

IN:
   BHL = pointer to Eprom File Entry in card at slot (B contains embedded slot mask)

OUT:
   Fc = 0, File Eprom available, File Entry available
        BHL = pointer to start of file image

   Fc = 1,
        A = RC_Onf
        File Eprom was not found in slot, or File Entry not available

Registers changed after return:
   ...CDE../IXIY same
   AFB...HL/.... different



EP_SvFl ($39) - Save RAM file to Flash or UV Eprom to slot C  (OZ 4.2 and newer)

Save RAM file to Flash Memory or UV Eprom file area in slot C (files to UV Eprom only in slot 3).

The routine does NOT handle automatical "deletion" of existing files that matches the filename (excl. device). This must be used by a call to OS_Epr, A=EP_Delete.

Should the actual process of blowing the file image fail, the new File Entry will be marked as deleted, if possible.

The screen is turned off while saving a file to flash file area that is in the same slot as the OZ ROM. During saving, no interference should happen from Blink, because the Blink reads the font bitmaps each 1/100 second:

If the screen were enabled when a byte is written to an address space that is part of OZ ROM chip, the font bitmaps would suddenly be unavailable which would create violent screen flickering during chip command mode. Further, and most importantly, to avoid the Blink doing read-cycles while chip is in command mode.

By switching off the screen, the Blink doesn't read the font bit maps in OZ ROM, and the Flash chip can be in command mode without being disturbed
by the Blink.

Important:
INTEL I28Fxxxx series Flash chips require the 12V VPP pin in slot 3 to successfully blow data to the memory chip. If the Flash Eprom card is inserted in slot 1 or 2, this routine will report a programming failure. It is the responsibility of the application (before using this call) to evaluate the Flash Memory (using the OS_Fep, A=FEP_CDID call) and warn the user that an INTEL Flash Memory Card requires the Z88 slot 3 hardware, so this type of unnecessary error can be avoided. Equally, the application should evaluate that saving to a file that is on an UV Eprom only can be performed in slot 3. This routine will report failure if saving a file to slots 0, 1 or 2.

IN:
         C = slot number (0, 1, 2 or 3)
        IX = size of I/O buffer.
        DE = pointer to I/O buffer, in segment 0/1.
        HL = pointer to filename string (null-terminated), in segment 0/1.
             Filename may contain wildcards (to find first match)
OUT:
        Fc = 0, File successfully saved to Flash File Eprom.
             BHL = pointer to created File Entry in slot C.

        Fc = 1,
             File (Flash) Eprom not available in slot A:
                  A = RC_NFE (not a recognized Flash Memory Chip)
             Not sufficient space to store file (and File Entry Header):
                  A = RC_Room
             Flash Eprom Write Errors:
                  If possible, the new File Entry is marked as deleted.
                  A = RC_VPL, RC_BWR (see "error.def" for details)

             RAM File was not found, or other filename related problems:
                  A = RC_Onf
                  A = RC_Ivf
                  A = RC_use

Registers changed on return:
   ...CDE../IXIY same
   AFB...HL/.... different



EP_New ($36) - Return pointer to future new entry in File Area  (OZ 4.2 and newer)

Return BHL pointer to new file entry (also first byte of free space in File Eprom Area, inserted in slot C).

IN:
   C = slot number containing File Eprom Area

OUT:
   Fc = 0, File Eprom available
        BHL = pointer to first byte of free space (B = absolute bank of slot C)

   Fc = 1, File Area was not found in slot C

Registers changed after return:
   ...CDE../IXIY same
   AFB...HL/.... different



EP_Delete ($3C) - Mark File Entry as deleted on Flash or UV Eprom  (OZ 4.2 and newer)

Mark File Entry as deleted in file area located on Flash or UV Eprom Card, identified by BHL pointer, B=00h-FFh (bits 7,6 is the slot mask), HL=0000h-3FFFh is the bank offset.

The screen is turned off while byte is being written when we're in the same slot as the OZ ROM. During writing, no interference should happen from Blink, because the Blink reads the font bitmaps each 1/100 second:

If the screen were enabled when a byte is written to an address space that is part of OZ ROM chip, the font bitmaps would suddenly be unavailable which would create violent screen flickering during chip command mode. Further, and most importantly, to avoid the Blink doing read-cycles while chip is in command mode.

By switching off the screen, the Blink doesn't read the font bit maps in OZ ROM, and the Flash chip can be in command mode without being disturbed by the Blink.

Important:
INTEL I28Fxxxx series Flash chips require the 12V VPP pin in slot 3 to successfully blow data to the memory chip. If the Flash Eprom card is inserted in slot 1 or 2, this routine will report a programming failure. It is the responsibility of the application (before using this call) to evaluate the Flash Memory (using the OS_Fep, A=FEP_CDID call) and warn the user that an INTEL Flash Memory Card requires the Z88 slot 3 hardware, so this type of unnecessary error can be avoided. Equally, the application should evaluate that saving to a file that is on an UV Eprom only can be performed in slot 3. This routine will report failure if saving a file to slots 0, 1 or 2.

IN:
        BHL = pointer to File Entry (B=00h-FFh, HL=0000h-3FFFh bank offset)
              (bits 7,6 of B is the slot mask)
OUT:
        Fc = 0,
             Marked as deleted.

        Fc = 1,
             A = RC_Onf, File (Flash) Eprom or File Entry not found in slot
             A = RC_VPL, RC_BWR, Flash/UV Eprom  Write Error

Registers changed on return:
   A.BCDEHL/IXIY same
   .F....../.... different



EP_Format ($3f) - Create File Area in slot C, on UV Eprom or Flash Card  (OZ 4.2 and newer)

Create file area header in UV Eprom Card (or Flash card, if available) in slot C. On UV Eprom, only the 64 byte header is created - on Flash Card, the complete file area is formatted and a header created.

IN:
        C = slot number
OUT:
        Fc = 0,
             File Area created in slot C.

        Fc = 1,
             A = RC_VPL, RC_BWR, Flash/UV Eprom Write Error

Registers changed on return:
   A.BCDEHL/IXIY same
   .F....../.... different



EP_NewFile ($42) - Write RAM file to File Card in slot C (OZ 4.2 and newer)
IN:    
C = slot number
BHL = pointer to filename, (B=0 means local pointer)

OUT: Fc = 0, file successfully written to File Card in slot C (Flash or UV Eprom Card).
     Fc = 1:
          A = RC_ error code: file couldn't be written to Card in slot C, not found, in use, etc.

Registers changed after return:
 ..BCDEHL/IXIY same 
AF....../.... different

Write RAM file to recognized card hardware in specified slot C (UV Eprom or Flash). Files written to UV Eprom only works in slot 3. Files written to Intel Flash Cards also only works in slot 3. Files written to AMD Flash Cards can be performed in all slots. If a file area does not exist on the card in slot C, it will be created on the card (if possible). If a file already exists in the file area with the same path/filename, it will automatically marked as deleted.


EP_WrBlk ($45) - Write a block of bytes to UV Eprom in slot 3  (OZ 4.2 and newer)

Blow block of data to UV Eprom in slot 3. Screen will be switched off during operation.

IN:
      C = Blowing algorithm context (also known as File Area sub type)
      DE = source address (local address space pointer)
      IX = length of block
      BHL = destination address in slot 3
OUT:
      Fc = 0 (block blown successfully to UV Eprom)
              BHL updated
      Fc = 1,
              A = RC_BWR (write error)
              A = RC_Onf (unknown blowing algorithm context)

Registers changed after return:
   ...CDE../IXIY same
   AFB...HL/.... different

Notes:
The blowing algorithm context is found in the "card.def" definition file; CB_EP1 (32K) or CB_EP2 (128K or more).