       CP/M 3 System Guide                               Disk I/O Functions

                           BIOS Function 23:    MULTIO

                        Set Count of Consecutive Sectors
                                 for READ or WRITE

                    Entry Parameters:    C=Multisector Count

                    Returned Values:     None

             To transfer logically consecutive disk sectors to or from
       contiguous memory locations, the BDOS issues a MULTIO call, followed
       by a series of READ or WRITE calls.        This allows the BIOS to
       transfer multiple sectors in a single disk operation.  The maximum
       value of the sector count is dependent on the physical sector size,
       ranging from 128 with 128-byte sectors, to 4 with 4096-byte sectors.
       Thus, the BIOS can transfer up to 16K directly to or from the TPA
       with a single operation.

             The BIOS can directly transfer all of the specified sectors to
       or from the DMA buffer in one operation and then count down the
       remaining calls to READ or WRITE.

             If the disk format uses a skew table to minimize rotational
       latency when single records are transferred, it is more difficult to
       optimize transfer time for multisector transfers.        One way of
       utilizing the multisector count with a skewed disk format is to
       place the sector numbers and associated DMA addresses into a table
       until either the residual multisector count reaches zero, or the
       track number changes.     Then you can sort the saved requests by
       physical sector to allow all of the required sectors on the track to
       be read in one rotation.  Each sector must be transferred to or from
       its proper DMA address.

             When an error occurs during a multisector transfer, you can
       either reset the multiple sector counters in the BIOS and return the
       error immediately, or you can save the error status and return it to
       the BDOS on the last READ or WRITE call of the MULTIO operation.








                                           63

     CP/M 3 System Guide                              Disk I/O Functions

                         BIOS Function 24: FLUSH

                      Force Physical Buffer Flushing
                        for User-supported Deblocking

           Entry Parameters: None

           Returned Values:    A=OOOH if no error occurred
                               A=001H if physical error occurred
                               A=002H if disk is Read-Only

          The flush buffers entry point allows the system to force
     physical sector buffer flushing when your BIOS is performing its own
     record blocking and deblocking.

          The BDOS calls the FLUSH routine to ensure that no dirty
     buffers remain in memory. The    BIOS should immediately write any
     buffers that contain unwritten data.

          Normally, the FLUSH function is  superfluous, because the BDOS
     supports blocking/deblocking internally.  It is required, however,
     for those systems that support blocking/deblocking in the BIOS, as
     many CP/M 2.2 systems do.

     Note: if you do not implement FLUSH, the routine must return a zero
     in register A.      You can accomplish this with the following
     instructions:

             xra      a
             ret


     3.4.4 Memory Select and Move Functions

          This section defines the memory management functions MOVE,
     XMOVE, SELMEM, and SETBNK.








                                         64

        CP/M 3 System Guide               Memory Select and Move Functions

                            BIOS Function 25:    MOVE

                           Memory-to-Memory Block Move

                  Entry Parameters:    HL=Destination address
                                       DE=Source address
                                       BC=Co'unt

                  Returned Values:     HL and DE must point to
                                       next bytes following move
                                       operation

             The BDOS calls the MOVE  routine to perform memory to memory
        block moves to allow use of the Z80 LDIR instruction or special DMA
        hardware, if available.  Note that the arguments in HL and DE are
        reversed from the ZBO machine instruction, necessitating the use of
        XCHG instructions on either side of the LDIR.  The BDOS uses this
        routine for all large memory copy operations.  On return, the HL and
        DE registers are expected to point to the next bytes following the
        move.

             Usually, the BDOS expects MOVE to transfer data within the
        currently selected bank or common memory.     However, if the BDOS
        calls the XMOVE entry point before calling MOVE, the MOVE routine
        must perform an interbank transfer.








                                           65
                                                                               AN
     CP/M 3 System Guide               Memory Select and Move Functions

                         BIOS Function 27: SELMEM

                             Select Memory Bank

                      Entry Parameters: A=Memory Bank

                      Returned Values;   None

          The SELMEM entry point is only present in banked systems.  The
     banked version of the CP/M 3 BDOS calls SELMEM to select the current
     memory bank for further instruction execution or buffer references.
     You must preserve or restore all registers other than the
     accumulator, A, upon exit.


                         BIOS Function 28:    SETBNK

                       Specify Bank for DMA Operation

                      Entry Parameters:    A=Memory Bank

                      Returned Values:     None

          SETBNK only occurs in the banked version of CP/M 3. SETBNK
     specifies the bank that the subsequent disk READ or WRITE routine
     must use for memory transfers.    The BDOS always makes a call to
     SETBNK to identify the DMA bank before performing a READ or WRITE
     call.  Note that the BDOS does not reference banks other than 0 or 1
     unless another bank is specified by the BANK field of a Data Buffer
     Control Block (BCB).


                          BIOS Function 29: XMOVE

                        Set Banks for Following MOVE

                    Entry Parameters: B=destination   bank
                                        C=source bank

                    Returned Values:    None

          XMOVE is provided for banked systems that support memory-to-
     memory DMA transfers over the entire extended address range.
     Systems with this feature can have their data buffers located in an



                                         66

        CP/M 3 System Guide               Memory Select and Move Functions

        alternate bank instead of in common memory, as is usually required.
        An XMOVE call affects only the following MOVE call.  All subsequent
        MOVE calls apply to the memory selected by the latest call to
        SELMEM.  After a call to the XMOVE function, the following call to
        the MOVE function is not more than 128 bytes of data.  If you do not
        implement XMOVE, the first instruction must be a RET instruction.

        3.4.5 Clock Support Function

             This section defines the clock support function TIME.


                              BIOS Function 26: TIME

                                 Get and Set Time

                      Entry Parameters: C=Time Get/Set Flag

                       Returned values:    None

             The BDOS calls the TIME function to indicate to the BIOS
        whether it has just set the Time and Date fields in the SCB, or
        whether the BDOS is about to get the Time and Date from the SCB.  On
        entry to the TIME function, a zero in register C indicates that the
        BIOS should update the Time and Date fields in the SCB.  A OFFH in
        register C indicates that the BDOS has just set the Time and Date in
        the SCB and the BIOS should update its clock.   Upon exit, you must
        restore register pairs HL and DE to their entry values.

             This entry point is for systems that must interrogate the clock
        to determine the time.  Systems in which the clock is capable of
        generating an interrupt should use an interrupt service routine to
        set the Time and Date fields on a regular basis.

        3.5 Banking Considerations

             This section discusses considerations for separating your BIOS
        into resident and banked modules.      You can place part of your
        customized BIOS in common memory, and part of it in Bank 0.
        However, the following data structures and routines must remain in
        common memory:

           o   the BIOS stack
           o   the BIOS jump vector
           o   Disk Parameter Blocks
           o   memory management routines
           o   the CHRTBL data structure
           o   all character I/O routines
           o   portions of the disk I/O routines


                                            67

     CP/M 3 System Guide                     3.5 Banking Considerations

          You can place portions of the disk I/O routines in the system
     bank, Bank 0. In a banked environment, if the disk I/O hardware
     supports DMA transfers to and from banks other than the currently
     selected bank, the disk I/O drivers can reside in Bank 0. If the
     system has a DMA controller that supports block moves from memory to
     memory between banks, CP/M 3 also allows you to place the blocking
     and deblocking buffers in any bank other than Bank 1, instead of
     common memory.

          If your disk controller supports data transfers only into the
     currently selected bank, then the code that initiates and performs a
     data transfer must reside in common memory.  In this case, the disk
     I/O transfer routines must select the DMA bank, perform the
     transfer, then reselect Bank 0.      The routine in common memory
     performs the following procedure:

          1) Selects the DMA bank that SETBNK saved.
          2) Performs physical I/O.
          3) Reselects Bank 0.
          4) Returns to the calling READ or WRITE routine in Bank 0.

          Note that Bank 0 is in context (selected) when the BDOS calls
     the system initialization functions BOOT and DRVTBL; the disk I/O
     routines HOME, SELDSK, SETTRK, SETSEC, SETDMA, READ, WRITE, SECTRN,
     MULTIO, and FLUSH; and the memory management routines KMOVE and
     SETBNK.

          Bank 0 or Bank 1 is in context when the BDOS calls the system
     initialization routines WBOOT, DEVTBL, and DEVINI; the character I/O
     routines CONST, CONIN, CONOUT, LIST, AUXOUT, AUXIN, LISTST, CONOST,
     AUXIST, and AUXOST, the memory select and move routines MOVE and
     SELMEM, and the clock support routine TIME.

          You can place a portion of the character I/O routines in Bank 0
     if you place the following procedure in common memory.

          1) Swap stacks to a local stack in common.
          2) Save the current bank.
          3) Select Bank 0.
          4) Call the appropriate character I/O routine.
          5) Reselect the saved bank.
          6) Restore the stack.








                                         68

        CP/M 3 System Guide          3.6 Assembling and Linking Your BIOS

        3.6 Asseiabling and Linking Your BIOS

             This section assumes you have developed a BIOS3.ASM or
        BNKBIOS3.ASM file appropriate to your specific hardware environment.
        Use the Digital Research Relocatable Macro Assembler Rr4ACTM to
        assemble the BIOS.    Use the Digital Research Linker LINK-8   OTM to
        create the BIOS3.SPR and BNKBIOS3.SPR files.  The SPR files are part
        of the input to the GENCPM program.

             In a banked environment, your CP/M 3 BIOS can consist of two
        segments: a banked segment and a common segment.  This allows you
        to minimize common memory usage to maximize the size of the TPA.  To
        prepare a banked BIOS, place code and data that must reside in
        common in the CSEG segment, and code and data that can reside in the
        system bank in the DSEG segment.  When you link the BIOS, LINK-80
        creates the BNKBIOS3.SPR file with all the CSEG code and data first,
        then the DSEG code and data.

             After assembling the BIOS with RMAC, link your BNKBIOS using
        LINK-80 with the [B] option.  The [B] option aligns the DSEG on a
        page boundary, and places the length of the CSEG into the
        BNKBIOS3.SPR header page.

             Use the following procedure to prepare a BIOS3.SPR or
        BNKBIOS3.SPR file from your customized BIOS.

             1)  Assemble your BIOS3.ASM or BNKBIOS3.ASM file with the
                 relocatable assembler RMAC.COM to produce a relocatable
                 file of type REL.      Assemble SCB.ASM to produce the
                 relocatable file SCB.REL.

                 Assembling the Nonbanked BIOS:

                 A>RKAC BIOS3

                 Assembling the Banked BIOS:

                 A>RMAC BNKBIOS3

              2) Link the BIOS3.REL or BNKBIOS3.REL file and the SCB.REL file
                 with LINK-80 to produce the BIOS3.SPR or BNKBIOS3.SPR file.
                 The [OS] option with LINK causes the output of a System
                 Page Relocatable (SPR) file.

                 Linking the Nonbanked BIOS:

                 A>LINK BIOS3[OS]=BIOS3,SCB

                 Linking the Banked BIOS:

                 A>LINK BNKBIOS3[B]=BNKBIOS3,SCB






                                             69
    CP/M 3 System Guide           3.6 Assembling and Linking Your BIOS

         The preceding examples show command lines for linking a banked
    and nonbanked BIOS.       In these examples, the BIOS3.REL and
    BNKBIOS3.REL are the files of your assembled BIOS.  SCB.REL contains
    the definitions of the System Control Block variables.       The [B]
    option implies the COS] option.

                                End of Section 3








                                        70

                                      Section 4

                         CP/M 3 Sample BIOS Modules



               This section discusses the modular organization of the example
         CP/M 3 BIOS on your distribution disk.  For previous CP/M operating
         systems, it was necessary to generate all input/output drivers from
         a single assembler source file.        Such a file is difficult to
         maintain when the BIOS supports several peripherals.  As a result,
         Digital Research is distributing the BIOS for CP/M 3 in several
         small modules.

               The organization of the BIOS into separate modules allows you
         to write or modify any I/O driver independently of the other
         modules.  For example, you can easily add another disk I/O driver
         for a new controller with minimum impact on the other parts of the
         BIOS.

         4.1 Functional Sumary of BIOS Modules

               The modules of the BIOS are BIOSKRNL.ASM, SCB.ASM, BOOT.ASM,
         MOVE.ASM, CHARIO.ASM, DRVTBL.ASM, and a disk I/O module for each
         supported disk controller in the configuration.

               BIOSKRNL.ASM is the kernel, root, or supervisor module of the
         BIOS.  The SCB.ASM module contains references to locations in the
         System Control Block.      You can customize the other modules to
         support any hardware configuration.  To customize your system, add
         or modify external modules other than the kernel and the SCE.ASM
         module.

               Digital Research supplies the BIOSKRNL.ASM module.  This module
         is the fixed, invariant portion of the BIOS, aiid the interface from
         the BDOS to all BIOS functions.    It is supplied in source form for
         reference only, and you should not modify it except for the equate
         statement described in the following paragraph.

               You must be sure the equate statement (banked equ true) at the
         start of the BIOSKRNL.ASM source file is correct for your system
         configuration.  Digital Research distributes the BIOSKRNL.ASM file
         for a banked system.     If you are creating a BIOS for a nonbanked
         system, change the equate statement to the following:

                  banked equ false

         and reassemble with RMAC.  This is the only change you should make
         to the BIOSKRNL.ASM file.

               Table 4-1 summarizes the modules in the CP/M 3 BIOS.






                                           71

    CP/M 3 System Guide        4.1 Functional Summary of BIOS Modules

              Table 4-1.  CP/M 3 BIOS Module Function Summary

         Module       Function

         BIOSKRNL.ASM

                      Performs basic system initialization, and
                      dispatches character and disk I/O.

         SCB.ASM module

                      Contains the public definitions of the
                      various fields in the System Control Block.
                      The BIOS can reference the public variables.

         BOOT.ASM module

                      Performs system initialization other than
                      character and disk I/O.  BOOT loads the CCP
                      for cold starts and reloads it for warm
                      starts.

         CHARIO.ASM module

                      Performs all character device initialization,
                      input, output, and status polling.      CHARIO
                      contains the character device characteristics
                      table.

         DRVTBL.ASM module

                      Points to the data structures for each
                      conf igured disk drive.     The drive table
                      determines which physical disk unit is
                      associated with which logical drive.       The
                      data structure for each disk drive is called
                      an Extended Disk Parameter Header (XDPH).

         Disk I/O modules

                      Initialize disk controllers and execute READ
                      and WRITE code for disk controllers.       You
                      must provide an XDPH for each supported unit,
                      and a separate disk I/O module for each
                      controller in the system.     To add another
                      disk controller for which a prewritten module
                      exists, add its XDPH names to the DRVTBL and
                      link in the new module.






                                    72

        CP/M 3 System Guide        4.1 Functional Summary of BIOS Modules

                              Table 4-1. (continued)

              Module      Function

              MOVE.ASM module

                          Performs memory-to-memory moves and bank
                          selects.


        4.2 Conventions   Used in BIOS Modules

              The Digital Research RMAC relocating assembler and LINK-80
        linkage editor allow a module to reference a symbol contained in
        another module by name.  This is called an external reference.  The
        Microsoft relocatable object module format that RMAC and LINK use
        allows six-character names for externally defined symbols.  External
        names must be declared PUBLIC in the module in which they are
        defined.  The external names must be declared EXTRN in any modules
        that reference them.

              The modular BIOS defines a number of external names for
        specific purposes.  Some of these are defined as public in the root
        module, BIOSKRNL.ASM. Others are declared external in the root and
        must be defined by the system implementor.  Section 4.4 contains a
        table summarizing all predefined external symbols used by the
        modular BIOS.

              External names can refer to either code or data.            All
        predefined external names in the modular BIOS prefixed with      a @
        character refer to data items.  All external names prefixed with a ?
        character refer to a code label.  To prevent conflicts with future
        extensions, user-defined external names should not contain these
        characters.

        4.3 Interactions of Modules

              The root module of the BIOS, BIOSKRNL.ASM, handles all BDOS
        calls, performs interfacing functions, and simplifies the individual
        modules you need to create.

        4.3.1 initial Boot

              BIOSKRNL.ASM initializes all configured devices in the
        following order:

              1) BIOSKRNL calls ?CINIT in the CHARIO module for each of the
                 16 character devices and initializes the devices.

              2) BIOSKRNL invokes the INIT entry point of each XDPH in the
                 FD1797SD module.




                                         73

     CP/M 3 System Guide                    4.3 Interactions of Modules

          3 )BIOSKRNL calls the ?INIT entry of the BOOT module to
             initialize other system hardware, such as memory
             controllers, interrupts, and clocks.  It prints a sign-on
             message specific to the system, if desired.

          4) BIOSKRNL calls ?LDCCP in the BOOT module to load the CCP
             into the TPA.

          5) The BIOSKRNL module sets up Page Zero of the TPA with the
             appropriate jump vectors, and passes control to the CCP.

     4.3.2 Character I/O Operation

          The CHARIO module performs all physical character I/O.  This
     module contains both the character device table (@CTBL) and the
     routines for character input, output, initialization, and status
     polling.  The character device table, @CTBL, contains the ASCII name
     of each device, mode information, and the current baud rate of
     serial devices.

          To support logical to physical redirection of character
     devices, CP/M 3 supplies a 16-bit assignment vector for each logical
     device.   The bits in these vectors correspond to the physical
     devices.  The character I/O interface routines in BIOSKRNL handle
     all device assignment, calling the appropriate character I/O
     routines with the correct device number.  The BIOSKRNL module also
     handles XON/XOFF processing on output devices where it is enabled.

          You can use the DEVICE utility to assign several physical
     devices to a logical device.  The BIOSKRNL root module polls the
     assigned physical devices, and either reads a character from the
     first ready input device that is selected, or sends the character to
     all of the selected output devices as they become ready.

     4.3.3 Disk I/O Operation

          The BIOSKRNL module handles all BIOS calls associated with disk
     I/O.  It initializes global variables with the parameters for each
     operation, then invokes the READ or WRITE routine for a particular
     controller.   The SELDSK routine in the BIOSKRNL calls the LOGIN
     routine for a controller when the BDOS initiates a drive login.
     This allows disk density or media type to be automatically
     determined.

          The DRVTBL module contains the sixteen-word drive table, @DTBL.
     The order of the entries in @DTBL determines the logical to physical
     drive assignment.  Each word in @DTBL contains the address of a DPH,
     which is part of an XDPH, as shown in Table 4-10.  The word contains
     a zero if the drive does not exist.  The XDPH contains the addresses
     of the INIT, LOGIN, READ, and WRITE entry points of the I/O driver
     for a particular controller.  When the actual drivers are called,
     globally accessible variables contain the various parameters of the
     operation, such as the track and sector.



                                     74

        CP/M 3 system Guide       4.4 Predefined Variables and Subroutines

        4.4 Predefined Variables and Subroutines

             The modules of the BIOS define public variables which other
        modules can reference.  Table 4-2 contains a summary of each public
        symbol and the module that defines it.

                      Table 4-2.  Public Symbols in CP/M 3 BIOS

                                                                  Defined
            Symbol               Function and Use                 in Module

            @ADRV        Byte, Absolute drive code                BIOSKRNL
            @CBNK        Byte, Current CPU bank                   BIOSKRNL
            @CNT         Byte, Multisector count                  BIOSKRNL
            @CTBL        Table, Character device  table           CHARIO
            @DBNK        Byte, Bank for disk I/O                  BIOSKRNL
            @DMA         Word, DMA address                        BIOSKRNL
            @DTBL        Table, Drive table                       DRVTBL
            @RDRV        Byte, Relative drive code (UNIT)         BIOSKRNL
            @SECT        Word, Sector address                     BIOSKRNL
            @TRK         Word, Track number                       BIOSKRNL

            ?BANK        Bank select                              MOVE
            ?Ci          Character device input                   CHARIO
            ?CINIT       Character device initialization          CHARIO
            ?CIST        Character device input status            CHARIO
            ?CO          Character device output                  CHARIO
            ?COST        Character device output status           CHARIO
            ?INIT        General initialization                   BOOT
            ?LDCCP       Load CCP for cold start                  BOOT
            ?MOVE        Move memory to memory                    MOVE
            ?PDEC        Print decimal number                     BIOSKRNL
            ?PDERR       Print BIOS disk error  header            BIOSKRNL
            ?PMSG        Print message                            BIOSKRNL
            ?RLCCP       Reload CCP for warm start                BOOT
            ?XMOVE       Set banks for extended move              MOVE
            ?TIME        Set or Get time                          BOOT


              The System Control Block defines public variables that other
         modules can reference.  The System Control Block variables @CIVEC,
         @COVEC, @AIVEC, @AOVEC, and @LOVEC are referenced by BIOSKR,-NL.ASM.
         The variable @BNKBF can be used by ?LDCCP and ?RLCCP to implement
         interbank block moves.     The public variable names @ERMDE, @FX,
         @RESEL, @VINFO, @CRDSK, @USRCD, and @CRDf4A are used for error
         routines which intercept BDOS errors.  The publics @DATE, @HOUR,
         @MIN, and @SEC can be updated by an interrupt-driven real-time
         clock. @MXTPA contains the current BDOS entry point.

               Disk I/O operation parameters are passed in the following
         global variables, as shown in Table 4-3.





                                           75

     CP/M 3 System Guide       4.4 Predefined Variables and Subroutines

                  Table 4-3.  Global Variables in BIOSKIRNL.ASM

         Variable   I                    Meaning

          @ADRV      Byte; contains the absolute drive code (O
                     through F for A through P) that CP/M is
                     referencing for READ and WRITE operations.  The
                     SELDSK routine in the BIOSKRNL module obtains
                     this value from the BDOS and places it in @DRV.
                     The absolute drive code is used to print error
                     messages.

          @RDRV      Byte; contains the relative drive code for READ
                     and WRITE operations.  The relative drive code
                     is the UNIT number of the controller in a given
                     disk I/O module.     BIOSKRNL obtains the unit
                     number from the XDPH.  This is the actual drive
                     code a driver should send to the controller.

          @TRK       Word; contains the starting track for READ and
                     WRITE.

          @SECT      Word; contains the starting sector for READ and
                     WRITE.

          @DMA       Word; contains the starting disk transfer
                     address.

          @DBNK      Byte; contains the bank of the DMA buffer.

          @CNT       Byte; contains the physical sector count for
                     the operations that follow.

          @CBNK      Byte; contains the current bank for code
                     execution.


          Several utility subroutines are defined in the BIOSKRNL.ASM
     module, as shown in Table 4-4.

            Table 4-4.  Public Utility Subroutines in BIOSKRNL.ASK

          utility I                    meaning

          ?PMSG      Print string starting at <HL>, stop at null
                     (0).

          ?PDEC      Print binary number in decimal from HL.

          ?PDERR     Print disk error message header using current
                     disk parameters: <CR><LF>BIOS Error on d:, T-
                     nn, S-nn.





                                      76

        CP/M 3 System Guide        4.4 Predefined Variables and Subroutines

              All BIOS entry points in the jump vector are declared as public
         for general reference by other BIOS modules, as shown in Table 4-5.

                 Table 4-5.    Public Names in the BIOS Jump Vector

             Public Name                        Function

                 ?BOOT         Cold boot entry
                 ?WBOOT        Warm boot entry
                 ?CONST        Console input status
                 ?CONIN        Console input
                 ?CONO         Console output
                 ?LIST         List output
                 ?AUXO         Auxiliary output
                 ?AUXI         Auxiliary input
                 ?HOME         Home disk drive
                 ?SLDSK        Select disk drive
                 ?ST12RK       Set track
                 ?STSEC        Set sector
                 ?STDMA        Set DMA address
                 ?READ         Read record
                 ?WRITE        write record
                 ?LISTS        List status
                 ?SCTRN        Translate sector
                 ?CONOS        Console output status
                 ?AUXIS        Auxiliary input status
                 ?AUXOS        Auxiliary output status
                 ?DVTBL        Return character device table address
                 ?DEVIN        Initialize character device
                 ?DRTBL        Return disk drive table address
                 ?MLTIO        Set multiple sector count
                 ?FLUSH        Flush deblocking buffers (not implemented)
                 ?MOV          Move memory block
                 ?TIM          Signal set or get time from clock
                 ?BNKSL        Set bank for further execution
                 ?STBNK        Set bank for DMA
                 ?XMOV         Set banks for next move


         4.5 BOOT 14odule

               The BOOT module performs general system initialization, and
         loads and reloads the CCP.  Table 4-6 shows the entry points of the
         BOOT module.








                                           77

    CP/M 3 System Guide                                  4.5 BOOT Module

                     Table 4-6.  BOOT Module Entry Points

          Module                          Meaning

          ?INIT           The BIOSKRNL module calls ?INIT during
                          cold start to perform hardware
                          initialization other than character and
                          disk I/O.   Typically, this hardware can
                          include time-of-day clocks, interrupt
                          systems, and special I/O ports used for
                          bank selection.

          ?LDCCP          BIOSKRNL calls ?LDCCP during cold start to
                          load the CCP into the TPA.  The CCP can be
                          loaded either from the system tracks of
                          the boot device or from a file, at the
                          discretion of the system implementor.  In
                          a banked system, you can place a copy of
                          the CCP in a reserved area of another bank
                          to increase the performance of the ?RLCCP
                          routine.

          ?RLCCP          BIOSKRNL calls ?RLCCP during warm start to
                          reload the CCP into the TPA.  In a banked
                          system, the CCP can be copied from an
                          alternate bank to eliminate any disk
                          access.   Otherwise, the CCP should be
                          loaded from either the system tracks of
                          the boot device or from a file.


    4.6 Character 1/0

          The CHARIO module handles all character device interfacing.
    The CHARIO module contains the character device definition table
    @CTBL, the character input routine ?CI , the character output routine
    ?CO, the character input status routine ?CIST, the character output
    status routine ?COST, and the character device initialization
    routine ?CINIT.

          The BIOS root module, BIOSKRNL.ASM, handles all character I/O
    redirection.    This module determines the appropriate devices to
    perform operations and executes the actual operation by calling ?CI,
    ?CO, ?CIST, and ?COST with the proper device number(s).

          @CTBL is the external name for the structure CHRTBL described
    in Section 3 of this manual.     @CTBL contains an 8-byte entry for
    each physical device def-ined by this BIOS.  The table is terminated
    by a zero byte after the last entry.

          The first field of the character device table, @CTBL, is the 6-
    byte device name.  This device name should be all upper-case, left-
    justified, and padded with ASCII spaces (20H).




                                     78

           CP/M 3 System Guide                                             4.6 Character I/O

                 The second field of @CTBL is 1 byte containing bits that
           Indicate the type of device and its current mode, as shown in Table
           4-7.

                                          Table 4-7.  Mode Bits

                    Mod                                Meaning

                    00000001           Input device (such as a keyboard)
                    00000010           output device (such as a printer)
                    00000011           Input/output device (such as a terminal
                                       or modem)
                    00000100           Device has software-selectable baud
                                       rates
                    00001000           Device may use XON protocol
                    00010000           XON/XOFF protocol enabled

                 The third     field of @CTBL is 1 byte and contains the current
           baud  rate for serial devices. The high-order nibble of this field
           is reserved for future use and should be set to zero.  The low-order
           four bits contain the current baud rate as shown in Table 4-8.  Many
           systems do not support all of these baud rates.

                            Table 4-8. Baud         Rates for Serial Devices

                                  Decin                          Baud Rate

                                       0            0000            none
                                       1            0 001           50
                                       2            0 0 10          75
                                       3            0011            110
                                       4            0 10 0          134. 5
                                       5            0101            150
                                       6            0110            300
                                       7            0111            600
                                       8            1000            120 0
                                       9            1001            1800
                                       10           1010            2400
                                       11           1011            3600
                                       12           1100            4800
                                       13           1101            7 200
                                       14           1110            9600
                                       15           iiii            19200

                  Table 4-'9 shows the entry        points to the routines in the CHARIO
           module.       The BIOSKRNL module calls these routines to perform
           machine-dependent character I/O.







                                                       79

     CP/M 3 System Guide                              4.6 Character I/O

                      Table 4-9.  Character Device Labels

          Label      Meaning

          ?Ci     Character Device Input

                     ?CI is called with a device number in register
                     B. It should wait for the next available input
                     character , then return the character in
                     register A. The character should be in 8-bit
                     ASCII with no parity.

          ?CO     Character Device Output

                     ?CO is called with a device number in register
                     B and a character in register C.     It should
                     wait until the device is ready to accept
                     another character and then send the character.
                     The character is in 8-bit ASCII with no parity.

          ?CIST   Character Device Input Status

                     ?CIST is called with a device number in
                     register B. It should return with register A
                     set to zero if the device specified has no
                     input character ready; and should return with A
                     set to OFFH if the device specified has an
                     input character ready to be read.

          ?COST   Character Device Output Status

                     ?COST is called with a device number in
                     register B. It should return with register A
                     set to zero if the device specified cannot
                     accept a character immediately, and should
                     return with A set to OFFH if the device is
                     ready to accept a character.

          ?CINIT Character Device Initialization

                     ?CINIT is called for each of the 16 character
                     devices, and initializes the devices.  Register
                     C contains the device number.       The ?CINIT
                     routine initializes the physical character
                     device specified in register C to the baud rate
                     contained in the appropriate entry of the
                     CHRTBL.  You only need to supply this routine
                     if I/O redirection has been implemented.  It is
                     referenced only by the DEVICE utility supplied
                     with CP/M 3.





                                     80

        CP/M 3 System Guide                                    4.7 Disk I/O


        4.7 Disk 1/0

              The separation of the disk I/O section of the BIOS into several
        modules allows you to support each particular disk controller
        independently from the rest of the system.       A manufacturer can
        supply the code for a controller in object module form, and you can
        link it into any existing modular BIOS to function with other
        controllers in the system.

              The data structure called the Extended Disk Parameter Header,
        or XDPH, contains all the necessary information about a disk drive.
        BIOSKRNL.ASM locates the XDPH for a particular logical drive using
        the Drive Table.    The XDPH contains the addresses of the READ,
        WRITE, initialization, and login routines.  The XDPH also contains
        the relative unit number of the drive on the controller, the current
        media type, and the Disk Parameter Header (DPH) that the BDOS
        requires.  Section 3 of this manual describes the Disk Parameter
        Header.

              The code to read and write from a particular drive is
        independent of the actual CP/M logical drive assignment, and works
        with the relative unit number of the drive on the controller.  The
        position of the XDPH entry in the DRVTBL determines the actual CP/M
        3 drive code.

        4.7.1 Disk 1/0 Structure

              The BIOS requires a DRVTBL module to locate the disk driver.
        it also requires a disk module for each controller that is
        supported.

              The drive table module, DRVTBL, contains the addresses of each
        XDPH defined in the system.  Each XDPH referenced in the DRVTBL must
        be declared external to link the table with the actual disk modules.

              The XDPHs are the only public entry points in the disk I/O
        modules.  The root module references the XDPHs to locate the actual
        1/0 driver code to perform sector READS and WRITES.  When the READ
        and WRITE routines are called, the parameters controlling the READ
        or WRITE operation are contained in a series of global variables
        that are declared public in the root module.

        4.7.2 Drive Table Module (DRVTBL)

              The drive table module, DRVTBL, def ines the CP/M absolute drive
        codes associated with the physical disks.

              The DRVTBL module contains one public label, @DTBL. @DTBL is a
        16-word table containing the addresses of up to 16 XDPH'S.  Each
        XDPH name must be declared external in the DRVTBL.  The first entry
        corresponds to drive A, and the last to drive P. You must set an
        entry to 0 if the corresponding drive is undefined.  Selecting an
        undefined drive causes a BDOS SELECT error.




                                          81

      CP/M 3 System Guide                                           4.7 Disk I/O

      4.7.3 Extended Disk Parameter Headers (XDPHS)

            An Extended Disk Parameter Header (XDPH) consists of a prefix
      and a regular Disk Parameter Header as described in Section 3. The
      label of a XDPH references the start of the DPH.  The fields of the
      prefix are located at relative offsets from the XDPH label.

            The XDPHs for each unit of a controller are the only entry
      points in a particular disk drive module.  They contain both the DPH
      for the drive and the addresses of the various action routines for
      that drive, including READ, WRITE, and initialization.  Figure 4-1
      shows the format of the Extended Disk Parameter Header.

            ADDRESS          LOW BYTE          HIGH BYTE
                        0                 7 8             15

            XDPH-10               addr of sector WRITE

            XDPH-8                addr of sector READ

            XDPH-6                 addr of drive LOGIN

            XDPH-4                  addr of drive INIT

            XDPH-2             unit                type
                                                                   start of
            XDPH+O                addr of translate table          regular DPH

            XDPH+2              0                   0

            XDPH+4              0                   0

            XDPH+6              0                   0

            XDPH+B              0                   0

            XDPH+10         Media Flag              0

            XDPH+12                   addr of DPB

            XDPH+14                   addr of CSV

            XDPH+16                   addr of ALV

            XDPH+18                 addr of DIRBCB

            XDPH+20                 addr of DTABCB

            XDPH+22                  acidr of HASH

            XDPH+24          riash bank


                              Figure 4-1.  XDPH Format


                                          82

        CP/M 3 System Guide                                    4.7 Disk I/O

              Table 4-10 describes the fields of each Extended Disk Parameter
        Header.

                           Table 4-10.  Fields of Each XDPH

              Field                            Meaning

              WRITE           The WRITE word contains the address of the
                              sector WRITE routine for the drive.

              READ            The READ word contains the address of the
                              sector READ routine for the drive.

              LOGIN           The LOGIN word contains the address of the
                              LOGIN routine for the drive.

              INIT            The INIT word contains the address of the
                              f irst-time initialization code for the
                              drive.

              UNIT            The UNIT byte contains the drive code
                              relative to the disk controller.  This is
                              the value placed in @RDRV prior to calling
                              the READ, WRITE, and LOGIN entry points of
                              the drive.

              TYPE            The TYPE byte is unused by the BIOS root,
                              and is reserved for the driver to keep the
                              current density or media type to support
                              multiple-format disk subsystems.

              regular DPH     The remaining fields of the XDPH comprise
                              a standard DPH, as discussed in Section 3
                              of this manual.


         4.7.4 Subroutine Entry Points

              The pointers contained in the XDPH reference the actual code
         entry points to a disk driver module.       These routines are not
         declared public.  Only the XDPH itself is public.  The BIOS root
         references the XDPHs only through the @DTBL.  Table 4-11 shows the
         BIOS subroutine entry points.






                                          83
                                                                                 AN
    CP/M 3 System Guide                                      4.7 Disk I/O


                     Table 4-11.  Subroutine Entry Points

          Entry Point                       meaning

             WRITE        When the WRITE routine is called, the
                          address of the XDPH is passed in registers
                          DE.    The parameters for the WRITE
                          operation are contained in the public
                          variables @ADRV, @RDRV, @TRK, @SECT, @DMA,
                          and @DBNK.     The WRITE routine should
                          return an error code in register A. The
                          code 00 means a successful operation, 01
                          means a permanent error occurred, and 02
                          means the drive is write-protected if that
                          feature is supported.

             READ         When the READ routine is called, the
                          address of the XDPH is contained in
                          registers DE.  The parameters for the READ
                          operation are contained in the public
                          variables @ADRV, @RDRV, @TRK, @SECT, @DMA,
                          and @DBNK.  The READ routine should return
                          an error code in register A. A code of 00
                          means a successful operation and 01 means
                          a permanent error occurred.

             LOGIN        The LOGIN routine is called before the
                          BDOS logs into the drive, and allows the
                          automatic determination of density.  The
                          LOGIN routine can alter the various
                          parameters in the DPH, including the
                          translate table address (TRANS) and the
                          Disk Parameter Block (DPB) .     The LOGIN
                          routine can also set the TYPE byte.  On
                          single media type systems, the LOGIN
                          routine can simply return.  When LOGIN is
                          called, the registers DE point to the XDPH
                          for this drive.

             INIT         The BOOT entry of the BIOSKRNL module
                          calls each INIT routine during cold start
                          and prior to any other disk accesses.
                          INIT can perform any necessary hardware
                          initialization, such as setting up the
                          controller and interrupt vectors, if any.


    4.7.5    Error Handling and Recovery

          The READ and WRITE routines should perform several retries of
    an operation that produces an error.    If the error is related to a
    seek operation or a record not found condition, the retry routine
    can home or restore the drive, and then seek the correct track.  The
    exact sequence of events is hardware-dependent.




                                      84

        CP/M 3 System Guide                                     4.7 Disk I/O

             When a nonrecoverable error occurst the READ or WRITE routines
        can print an error message informing the operator of the details of
        the error.  The BIOSKRNL module supplies a subroutine, ?PDERR, to
        print a standard BIOS error message header.  This routine prints the
        following message:

                BIOS Err on D: T-nn S-nn

        The D: is the selected drive, and T-nn and S-nn display the track
        and sector number for the operation.  The READ and WRITE routines
        should print the exact cause of the error after this message, such
        as Not Ready, or Write Protect.       The driver can then ask the
        operator if additional retries are desired, and return an error code
        to the BDOS if they are not.

             However, if the @ERMDE byte in the System Control Block
        indicates the BDOS is returning error codes to the application
        program without printing error messages, the BIOS should simply
        return an error without any message.

        4.7.6 Multiple Sector I/O

             The root module global variable @CNT contains the multisector
        count.   Refer to Sections 2.5 and 3.4.3 for a discussion of the
        considerations regarding multirecord 1/0.

        4.8 MOVE Module

             The MOVE Module performs memory-to-memory block moves and
        controls bank selection.        The ?MOVE and ?XMOVE entry points
        correspond directly to the MOVE and XMOVE jump vector routines
        documented in Section 3. Table 4-12 shows the entry points for the
        MOVE module.








                                          85

     CP/M 3 Sytem Guide                                  4.8 MOVE Module

                     Table 4-12.  Move Module Entry Points

        Entry Point     Meaning

        ?MOVE Memory-to-memory move

                        ?MOVE is called with the source address for
                        the move in register DE, the destination
                        address in register HL, and the byte count in
                        register BC.  If ?XMOVE has been called since
                        the last call to ?MOVE, an interbank move must
                        be performed.  On return, registers HL and DE
                        must point to the next bytes after the MOVE.
                        This routine can use special DMA hardware for
                        the interbank move capability, and can use the
                        ZBO LDIR instruction for intrabank moves.

        ?XMOVE Set banks for one following ?MOVE

                        ?XMOVE is called with the destination bank in
                        register B and the source bank in register C.
                        Interbank moves are only invoked if the DPHs
                        specify deblocking buffers in alternate banks.
                        ?XMOVE only applies to one call to ?MOVE.
                        (Not implemented in the example.)

        ?BANK Set bank for execution

                        ?BANK is called with the bank address in
                        register A.    This bank address has already
                        been stored in @CBNK for future reference.
                        All registers except A must be maintained upon
                        return.


     4.9 Linking Modules into the BIOS

          The following lines are examples of typical link commands to
     build a modular BIOS ready for system generation with GENCPK:

     LINK BNKBIOS3[b]=BNKBIOS,SCB,BOOT,CHARIO,MOVE,DRVTBL,<disk-modules>

     LINK BIOS3[os]=BIOS,SCB,BOOT,CHARIO,MOVE,DRVTBL,<disk-modules>

                                End of Section 4








                                      86

                                     Section 5

                               System Generation



              This section describes the use of the GENCPM utility to create
        a memory image CPM3.SYS file containing the elements of the CP/M 3
        operating system.     This section also describes customizing the
        LDRBIOS portion of the CPMLDR program, and the operation of CPMLDR
        to read the CPM3.SYS file into memory.        Finally, this section
        describes the procedure to follow to boot CP/M 3.

              In the nonbanked system, GENCPM creates the CPM3.SYS file from
        the BDOS3.SPR and your customized BIOS3.SPR files.  In the banked
        system, GENCPM creates the CPM3.  SYS f i le from the RESBDOS3.  SPR f i le,
        the BNKBDOS3.SPR file, and your customized BNKBIOS3.SPR file.

              If your BIOS contains a segment that can reside in banked
        memory, GENCPM separates the code and data in BNKBIOS3.SPR into a
        banked portion which resides in Bank 0 just below common memory, and
        a resident portion which resides in common memory.

              GENCPM relocates the system modules, and can allocate physical
        record buffers, allocation vectors, checksum vectors, and hash
        tables as requested in the BIOS data structures.  It also relocates
        references to the System Control Block, as described on page 27.
        GENCPM accepts its command input from a file, GENCPM.DAT, or
        interactively from the console.

        5.1 GENCPM Utility

        Syntax:

                GENCPM JAUTO I AUTO DISPLAYI

        Purpose:

              GENCPM creates a memory image CPM3.SYS file, containing the
        CP/M 3 BDOS and customized BIOS.  The GENCPM utility performs late
        resolution of intermodule references between system modules.  GENCPM
        can accept its command input interactively from the console or from
        a file GENCPM.DAT.

              In the nonbanked system, GENCPM creates a CPM3.SYS file from
        the BDOS3.SPR and BIOS3.SPR files.  In the banked system, GENCPM
        creates the CPM3.SYS file from the RESBDOS3.SPR, the BNKBDOS3.SPR
        and the BNKBIOS3.SPR files.  Remember to back up your CPM3.SYS file
        before executing GENCPM, because GENCPM deletes any existing
        CPM3.SYS file before it generates a new system.







                                         87

      CP/M 3 System Guide                         5.1 The GENCPM Utility

      Input Files:

              Banked System       Nonbanked System

              BNKBIOS3.SPR          BIOS3.SPR
              RESBDOS3.SPR          BDOS3.SPR
              BNKBDOS3.SPR

              optionally GENCPM.DAT

      Output File:

              CPM3.SYS

              optionally GENCPM.DAT

           GENCpm determines the location of the system modules in memory
      and, optionally, the number of physical record buffers allocated to
      the system.    GENCPM can specify the location of hash tables
      requested by the Disk Parameter Headers (DPHS) in the BIOS.  GENCPM
      can allocate all required disk buffer space and create all the
      required Buffer Control Blocks (BCBs).      GENCPM can also create
      checksum vectors and allocation vectors.

           GENCPM can get its input from a file GENCPM.DAT. The values in
      the file replace the default values of GENCPM.  If you enter the
      AUTO parameter in the command line GENCPM gets its input from the
      file GENCPM.DAT and generates a new system displaying only its sign-
      on and sign-off messages on the console.  If AUTO is specified and a
      GENCPM.DAT file does not exist on the current drive, GENCPM reverts
      to manual generation.

           If you enter the AUTO DISPLAY parameter in the command line,
      GENCPM automatically generates a new system and displays all
      questions on the console.     If AUTO DISPLAY is specified and a
      GENCPM.DAT file does not exist on the current drive, GENCPM reverts
      to manual generation.   If GENCPM is running in AUTO mode and an
      error occurs, it reverts to manual generation and starts from the
      beginning.

           The GENCPM.DAT file is an ASCII file of variable names and
      their associated values.  In the'following discussion, a variable
      name in the GENCPM.DAT file is referred to as a Question Variable.
      A line in the GENCPM.DAT file takes the following general form:

              Question Variable = value I ? I ?value <CR><LF>

                   value = #decimal value
                            or hexadecimal value
                            or drive letter (A - P)
                            or Yes, No, Y, or N






                                      88

        CP/M 3 system Guide                        5.1 The GENCPM Utility

             You can specify a default value by following a question mark
        with the appropriate value, for example ?A or ?25 or ?Y.         The
        question mark tells GENCPM to stop and prompt the user for input,
        then continue automatically.  At a ?value entry, GENCPM displays the
        default value and stops for verification.

             The following pages display GENCPM questions.  The items in
        parentheses are the default values.         The Question Variable
        associated with the question is shown below the explanation of the
        answers to the questions.

        Program Questions:

        Use GENCPM.DAT for defaults (Y) ?

                Enter Y - GENCPM gets its default values from the file
                GENCPM.DAT.

                Enter N - GENCPM uses the built-in default values.

                No Question Variable is associated with this question

        Create a new GENCPM.DAT file (N) ?

                Enter N - GENCPM does not create a new GENCPM.DAT fil,

                Enter Y - After GENCPM generates the new CPM3.SYS file it
                creates a new GENCPM.DAT file containing the default
                values.

                Question Variable: CRDATAF

        Display Load Table at Cold Boot (Y) ?

                Enter Y - On Cold Boot the system displays the load table
                containing the filename, filetype, hex starting address,
                length of system modules, and the TPA size.

                Enter N - System displays only the TPA size on cold boot.

                Question Variable: PRTMSG

        Number of console columns (#80) ?

                Enter the number of columns (characters-per-line) for your
                console.

                A character in the last column must not force a new line
                for console editing in CP/M 3. If your terminal forces a
                new line automatically, decrement the column count by one.

                Question Variable: PAGWID





                                        89

     CP/M 3 System Guide                        5.1 The GENCPM Utility


     Number of lines per console page (#24) ?

             Enter the number of the lines per screen for your console.

             Question Variable: PAGLEN

     Backspace echoes erased character (N) ?

             Enter N - Backspace (Ctrl-H, 08H) moves back one column and
             erases the previous character.

             Enter Y - Backspace moves forward one column and displays
             the previous character.

             Question Variable: BACKSPC

     Rubout echoes erased character (Y) ?

             Enter Y  - Rubout (7FH) moves forward one column and
             displays the previous character.

             Enter N  - Rubout moves back one column and erases the
             previous character.

             Question Variable: RUBOUT

     Initial default drive (A:) ?

             Enter the drive code the prompt is to display at cold boot.

             Question Variable: BOOTDRV

     Top page of memory (FF) ?

             Enter the page address that is to be the top of the
             operating system.  OFFH is the top of a 64K system.

             Question Variable: MEMTOP

     Bank-switched memory (Y) ?

             Enter Y - GENCPM uses the banked system files.

             Enter N - GENCPM uses the nonbanked system files.

             Question Variable: BNKSWT

     Common memory base page (CO) ?

             This question is displayed only if you answered Y to the
             previous question.  Enter the page address of the start of
             common memory.

             Question Variable: COMBAS





                                     90

        CP/M 3 System Guide                         5.1 The GENCPM Utility

        Long error messages (Y) ?

                This question is displayed only if you answered Y to bank-
                switched memory.

                Enter Y - CP/M 3 error messages contain the BDOS function
                number and the name of the file on which the operation was
                attempted.

                Enter N - CP/M 3 error messages do not display the function
                number or file.

                Question Variable: LERROR

        Double allocation vectors (Y) ?

                This question is displayed only if you answered N to bank-
                switched memory.      For more information about double
                allocation vectors, see the definition of the Disk
                Parameter Header ALV field in Section 3.

                Enter Y - GENCPM creates double-bit allocation vectors for
                each drive.

                Enter N - GENCPM creates single-bit allocation vectors for
                each drive.

                Question Variable: DBLALV

        Accept new system definition (Y) ?

                Enter Y   GENCPM proceeds to the next set of questions.

                Enter N     GENCPM repeats the previous questions and
                displays your previous input in the default parentheses.
                You can modify your answers.

                No Question Variable is associated with this question.

        Number of memory segments (#3) ?

                GENCPM displays this question if you answered Y to bank-
                switched memory.

                Enter the number of memory segments in the system.  Do not
                count common memory or memory in Bank 1, the TPA bank, as a
                memory segment.  A maximum of 16 (O - 15) memory segments
                are allowed.    The memory segments define to GENCPM the
                memory available for buffer and hash table allocation.  Do
                not include the part of Bank 0 that is reserved for the
                operating system.

                Question Variable: NUMSEGS






                                        91

     CP/M 3 System Guide                        5.1 The GENCPM Utility

     CP/M 3 Base,size,bank (8E,32,00)

     Enter memory segment table:
     Base,size,bank (00,8E,00) ?
     Base,size,bank (00,CO,02) ?
     Base,size,bank (00,CO,03) ?

             Enter the base page, the length, and the bank of the memory
             segment.

             Question Variable: MEMSEGO# where       0 to F hex

     Accept new memory segment table entries (Y) ?

             Enter Y   GENCPM displays the next group of questions.

             Enter N     GENCPM displays the memory segment table
             definition questions again.

             No Question Variable is associated with this question.

     Setting up directory hash tables:

             Enable hashing for drive d: (Y)

             GENCPM displays this question if there is a Drive Table and
             if the DPHs for a given drive have an OFFFEH in the hash
             table address field of the DPH.  The question is asked for
             every drive d: defined in the BIOS.

             Enter Y - Space is allocated for the Hash Table.         The
             address and bank of the Hash Table is entered into the DPH.

             Enter N - No space is allocated for a Hash Table for that
             drive.

             Question Variable: HASHDRVD where d = drives A-P.

     Setting up Blocking/Deblocking buffers:

             GENCPM displays the next set of questions if either or both
             the DTABCB field or the DIRBCB field contain OFFFEH.

     Number of directory buffers for drive d: (#l) ? 10

             This question appears only if you are generating a banked
             system.  Enter the number of directory buffers to allocate
             for the specified drive.     In a banked system, directory
             buffers are allocated only inside Bank 0. In a nonbanked
             system, one directory buffer is allocated above the BIOS.

             Question Variable: NDIRRECD where d = drives A-P.







                                     92

       CP/M 3 System Guide                            5.1 The GENCPM Utility

       Number of data buffers for drive d: (#l) ? 1

                This question appears only if you are generating a Banked
                system.  Enter the number of data buffers to allocate for
                the specified drive.  In a banked system, data buffers can
                only be allocated outside Bank 1, and in common.  You can
                only allocate data buffers in alternate banks if your BIOS
                supports interbank moves.       In a nonbanked system, data
                buffers are allocated above the BIOS.

                Question Variable: NDTARECD where d = drives A-P.

       Share buffer(s) with which drive (A:) ?

                This question appears only if you answered zero to either
                of the above questions.  Enter the drive letter (A-P) of
                the drive with which you want this drive to share a buffer.

                Question Variable: ODIRDRVD for directory records where d
                = drives A-P.

                Question Variable:     ODTADRVD for data records where d
                drives A-P.

       Allocate buffers outside of Commom (N) ?

                This question appears if the BIOS XMOVE routine is
                implemented.

                Answer Y - GENCPM allocates data buffers outside of common
                and Bank 0.

                Answer N - GENCPM allocates data buffers in common.

                Question Variable: ALTBNKSD where d = drives A-P.

       Overlay  Directory buffer for drive d: (Y) ?

                This question appears only if you are generating a
                nonbanked system.

                Enter Y    this drive shares a directory buffer with another
                drive.

                Enter N    GENCPM allocates an additional directory buffer
                above the BIOS.

                Question Variable: OVLYDIRD where d = drives A-P.








                                          93

    CP/M 3 System Guide                           5.1 The GENCPM Utility

    Overlay  Data buffer for drive d: (Y) ?

             This question appears only if you are generating a
             nonbanked system.

             Enter Y - this drive shares a data buffer with another
             drive.

             Enter N - GENCPM allocates an additional data buffer above
             the BIOS.

             Question Variable: OVLYDTAD for directory records where d
             = drives A-P.

    Accept new buffer definitions (Y) ?

             Enter Y   GENCPM creates the CPM3.SYS file and terminates.

             Enter N    GENCPM redisplays all of the buffer definition
             questions.

             No Question Variable is associated with this question.

    Examples:

          The following section contains examples of two system
    generation sessions.  If no entry follows a program question, assume
    RETURN was entered to select the default value in parentheses.
    Entries different from the default appear after the question mark.

         EXAMPLE OF CONTENTS OF GENCPM.DAT FILE

         combas = cO <CR>
         lerror = ? <CR>
         numsegs   3 <CR>
         memsegOO    00,80,00 <CR>
         memsegol    Od,b3,02 <CR>
         memsegof    ?00,cO,10 <CR>
         hashdrva    y <CR>
         hashdrvd    n <CR>
         ndirreca    20 <CR>
         ndtarecf    10 <CR>

         EXAMPLE OF  SYSTEM GENERATION WITH BANKED MEMORY

         A>GENCPM

         CP/M 3.0 System Generation
         Copyright (C) 1982, Digital Research

         Default entries are shown in (parens).
         Default base is Hex, precede entry with # for decimal



                                      94

        CP/M 3 System Guide                         5.1 The GENCPM Utility


            Use GENCPM.DAT for defaults (Y) ?

            Create a new GENCPM.DAT file (N) ?

            Display Load Map at Cold Boot (Y) ?

            Number of console columns (#80) ?
            Number of lines in console page (#24) ?
            Backspace echoes erased character (N) ?
            Rubout echoes erased character (N) ?

            Initial default drive (A:) ?

            Top page of memory (FF) ?
            Bank switched memory (Y) ?
            Common memory base page (CO) ?

            Long error  messages (Y) ?

            Accept new  system definition (Y) ?

            Setting up  Allocation vector for drive A:
            Setting up  Checksum vector for drive A:
            Setting up  Allocation vector for drive B:
            Setting up  Checksum vector for drive B:
            Setting up  Allocation vector for drive C:
            Setting up  Checksum vector for drive C:
            Setting up  Allocation vector for drive D:
            Setting up  Checksum vector for drive D:

                Bank 1  and Common are not included
                in the  memory segment table.

            Number of memory segments (#3) ?

            CP/M 3 Base,size,bank (8B,35,00)

            Enter memory segment table:
             Base,size,bank (00,8B,00)   ?
             Base,size,bank (OD,B3,02)   ?
             Base,size,bank (00,CO,03)   ?

             CP/M 3 Sys     SBOOH 3500H Bank 00
             Memseg No. 00 OOOOH BBOOH Bank 00
             Memseg No. 01  ODOOH B300H   Bank 02
             Memseg No. 02  OOOOH COOOH   Bank 03

            Accept new memory segment   table entries (Y) ?

            Setting up directory hash   tables:
             Enable hashing for drive   A: (Y) ?
             Enable hashing for drive   B: (Y) ?
             Enable hashing for drive   C: (Y) ?
             Enable hashing for drive   D: (Y) ?



                                         9 5

    CP/M 3 System Guide                        5.1 The GENCPM Utility



        Setting up Blocking/Deblocking buffers:

        The physical record size is 020OH:

              Available space in 256 byte pages:
              TPA = 0OF4H, Bank 0 = OOBBH, Other banks = 0166H

                        Number of directory buffers for drive A: (#32) ?

              Available space in 256 byte pages:
              TPA = 0OF4H, Bank 0 = 0049H, Other banks = 0166H

                        Number of data buffers for drive A: (#2) ?
                        Allocate buffers outside of Common (N) ?

              Available space in 256 byte pages:
              TPA = OOFOH, Bank 0 = 0049H, Other banks = 0166H

                        Number of directory buffers for drive B; (#32) ?

              Available space in 256 byte pages:
              TPA = OOFOH, Bank 0 = 0007H, Other banks = 0166H

                        Number of data buffers for drive B: (#O) ?
                        Share buffer(s) with which drive (A:) ?

        The physical record size is 008OH:

              Available space in 256 byte pages:
              TPA = OOFOH, Bank 0 = 0007H, Other banks = 0166H

                        Number of directory buffers for drive C: (410) ?

              Available space in 256 byte pages:
              TPA = OOFOH, Bank 0 = OOOIH, Other banks = 0166H

                        Number of directory buffers for drive D: (#O) ?
                        Share buffer(s) with which drive (C:) ?

              Available space in 256 byte pages:
              TPA = OOFOH, Bank 0 = 0001H, Other banks = 0166H

         Accept new buffer definitions (Y) ?

          BNKBIOS3 SPR F600H 0600H
          BNKBIOS3 SPR BIOOH OFOOH
          RESBDOS3 SPR FOOOH 0600H
          BNKBDOS3 SPR 8700H 2AOOH

         *** CP/M 3.0 SYSTEM GENERATION DONE

     In the preceding example GENCPM displays the resident portion of
     BNKBIOS3.SPR first, followed by the banked portion.




                                    96

        CP/M 3 System Guide                         5.1 The GENCPM Utility

            EXAMPLE OF SYSTEM GENERATION WITH NONBANKED MEMORY

            A>GENCPM

            CP/M 3.0 System Generation
            Copyright (C) 1982, Digital Research

            Default entries are shown in (parens).
            Default base is Hex, precede entry with    for decimal

            Use GENCPM.DAT for defaults (Y) ?

            Create a new GENCPM.DAT file (N) ?

            Display Load Map at Cold Boot (Y) ?

            Number of console columns (#80) ?
            Number of lines in console page (#24) ?
            Backspace echoes erased character (N) ?
            Rubout echoes erased character (N) ?

            Initial default drive (A:) ?

            Top page of memory (FF) ?
            Bank switched memory (Y) ? N

            Double allocation vectors (Y) ?

            Accept new system definition (Y) ?

            Setting up Blocking/Deblocking buffers:

            The physical record size is 020OH:

                 Available space in 256 byte pages:
                 TPA = OOD8H

                     Directory buffer required
                     and allocated for drive A:

                 Available space in 256 byte pages:
                 TPA = OOD5H

                           Overlay Data buffer for drive A: (Y) ?

                 Available space in 256 byte pages:
                 TPA = OOD5H

                           Overlay Directory buffer for drive B: (Y) ?
                           Share buffer(s) with which drive (A:) ?

                 Available space in 256 byte pages:
                 TPA = OOD5H





                                        97

    CP/M 3 System Guide                         5.1 The GENCPM Utility

                        Overlay Data buffer for drive B: (Y) ?
                        Share buffer(s) with which drive (A:) ?

        The physical record size is OOBOH:

              Available space in 256 byte pages:
              TPA = 0005H

                        Overlay Directory buffer for drive C: (Y) ?
                        Share buffer(s) with which drive (A:) ?

              Available space in 256 byte pages:
              TPA = OOD5H

                        Overlay Directory buffer for drive D: (Y) ?
                        Share buffer(s) with which drive (C;) ?

              Available space in 256 byte pages:
              TPA = OOD5H

         Accept new buffer definitions (Y) ?

          BIOS3    SPR F300H OBOOH
          BDOS3    SPR D600H 1DOOH

         *** CP/M 3.0 SYSTEM GENERATION DONE

         A>


     5.2 Customizing the CPMLDR

          The CPMLDR resides on the system tracks of a CP/M 3 system
     disk, and loads the CPM3.SYS file into memory to cold start the
     system.  CPMLDR contains the LDRBDOS supplied by Digital Research,
     and must contain your customized LDRBIOS.

          The system tracks for CP/M 3 contain the customized Cold Start
     Loader, CPMLDR with the customized LDRBIOS, and possibly the CCP.

          The COPYSYS utility places the Cold Start Loader, the CPMLDR,
     and optionally the CCP on the system tracks, as shown in Table 5-1.








                                     98

        CP/M 3 System Guide                      5.2 Customizing the CPMLDR


                Table 5-1.   Sample CP/M 3 System Track Organization

           Track   Sector    Page     Memory Address    CP/M 3 Module Name
                           t

            00       01                Boot Address      Cold Start Loader


            00       02       00          0100H              CPMLDR

                                                              and

            uu       /1       09          OA80H              LDRBDOS

            00       22       10          OBOOH              LDRBIOS


            0'0      26       12          ODOOH               and
            01       01       12          OD80H


            01       26       25          IAOOH               CCP




              Typically the Cold Start Loader is loaded into memory from
        Track 0, Sector 1 of the system tracks when the reset button is
        depressed.  The Cold Start Loader then loads CPMLDR from the system
        tracks into memory.

              Alternatively, if you are starting from an existing CP/M 2
        system, you can run CPMLDR.COM as a transient program.  CP/M 2 loads
        CPMLDR.COM into memory at location 100H.       CPMLDR then reads the
        CPM3.SYS file from User 0 on drive A and loads it into memory.

              Use the following procedure to create a customized CPMLDR.COM
        file, including your customized LDRBIOS:

              1) Prepare a LDRBIOS.ASM file.

              2) Assemble the LDRBIOS file with RMAC to produce a LDRBIOS.REL
                 file.

              3) Link the supplied CPMLDR.REL file with the LDRBIOS.REL file
                 you created to produce a CPMLDR.COM file.

                 A>LINK CPf4LDR[LlOO]=CPNLDR,LDRBIOS

                 Replace the address 100 with the load address to which your
                 boot loader loads CPMLDR.COM. You must include a bias of
                 100H bytes for buffer space when you determine the load
                 address.





                                          99

     CP/M 3 System Guide                       5.2 Customizing the CPMLDR

          The CPMLDR requires a customized LDRBIOS to perform disk input
     and console output.  The LDRBIOS is essentially a nonbanked BIOS.
     The LDRBIOS has the same JMP vector as the regular CP/M 3 BIOS.  The
     LDRBIOS is called only to perform disk reads (READ) from one drive,
     console output (CONOUT) for sign-on messages, and minimal system
     initialization.

          The CPMLDR calls the BOOT entry point at the beginning of the
     LDRBIOS to allow it to perform any necessary hardware
     initialization.     The BOOT entry point should return to CPMLDR
     instead of loading and branching to the CCP, as a BIOS normally
     does.  Note that interrupts are not disabled when the LDRBIOS BOOT
     routine is called.

          Test your LDRBIOS completely to ensure that it properly
     performs console character output and disk reads.  Check that the
     proper tracks and sectors are addressed on all reads and that data
     is transferred to the proper memory locations.

          You should assemble the LDRBIOS.ASM file      with a relocatable
     origin of OOOOH.     Assemble the LDRBIOS with RMAC to produce a
     LDRBIOS.REL file.  Link the LDRBIOS.REL file with the CPMLDR.REL
     file supplied by Digital Research to create a CPMLDR.COM .file. Use
     the L option in LINK to specify the load origin (address) to which
     the boot loader on track 0 sector 1 loads the CPMLDR.COM file.

          Unnecessary BIOS functions can be deleted from the LDRBIOS to
     conserve space.  There is one absolute restriction on the length of
     the LDRBIOS; it cannot extend above the base of the banked portion
     of CP/M 3.    (GENCPM lists the base address of CP/M 3 in its load
     map.)   If you plan to boot CP/M 3 from standard, single-density,
     eight-inch floppy disks, your CPMLDR must not be longer than 1980H
     to place the CPMLDR.COM file on two system tracks with the boot
     sector.  If the CCP resides on the system tracks with the Cold Start
     Loader and CPMLDR, the combined lengths must not exceed 1980H.

     5.3 CPKLDR Utility

     Syntax:

              CPMLDR

     Purpose:

          CPMLDR loads the CP/M 3 system file CPM3.SYS into Bank 0 and
     transfers control to the BOOT routine in the customized BIOS.  You
     can specify in GENCPM for CPMLDR to display a load table containing
     the names and addresses of the system modules.

          The CPM3.SYS file contains the CP/M 3 BDOS and customized BIOS.
     The file CPM3.SYS must be on drive A in USER 0.        You can execute
     CPMLDR under SID  Tll or DDT TM to help debug the BIOS.   A $B in the
     default File Control Block (FCB) causes CPMLDR to execute a RST 7
     (SID breakpoint) just before jumping to the CP/M 3 Cold Boot BIOS
     entry point.


                                       100

          CP/M 3 System Guide                            5.3 CPMLDR Utility

          Input File:

                  CPM3.SYS

          Examples:

                  A>CPMLDR
                  CP/M V3.0  Loader
                  Copyright  (C) 1982, Digital Research

                   BNKBIOS3  SPR F600H OAOOH
                   BNKBIOS3  SPR BBOOH 0500H
                   RESBDOS3  SPR F100H 0500H
                   BNKBDOS3  SPR 9AOOH 2100H

                   60K TPA
                  A>


               In the preceding example, CPMLDR displays its name and version
          number, the Digital Research copyright message, and a four-column
          load table containing the filename, filetype, hex starting address,
          and length of the system modules.     CPMLDR completes its sign-on
          message by indicating the size of the Transient Program Area (TPA)
          in kilobytes.  The CCP then displays the system prompt, A>.

          5.4   Booting CP/M 3

               The CP/M 3 cold start operation loads the CCP, BDOS, and BIOS
          modules into their proper locations in memory and passes control to
          the cold start entry point (BIOS Function 0: BOOT) in the BIOS.
          Typically, a PROM-based loader initiates a cold start by loading
          sector 0 on track I of the system tracks into memory and jumping to
          it. This first sector contains the Cold Start Loader.  The Cold
          Start Loader loads the CPMLDR.COM program into memory and jumps to
          it.  CPMLDR loads the CPM3.SYS file into memory and jumps to the
          BIOS cold start entry point.








                                          101

    CP/M 3 System Guide                              5.4 Booting CP/M 3


          To boot the CP/M 3 system, use the following procedure:

          1) Create the CPM3.SYS file.

          2) Copy the CPM3.SYS file to the boot drive.

          3) Create a CPMLDR.COM for your machine.

          4 )Place the CPMLDR.COM file on your system tracks using SYSGEN
             with CP/M 2 or COPYSYS with CP/M 3. The boot loader must
             place the CPMLDR.Com file at the address at which it
             originated.  If CPMLDR has been linked to load at 100H, you
             can run CPMLDR under CP/M 2.

          The COPYSYS utility handles initialization of the system
    tracks.  The source of COPYSYS is included with the standard CP/M 3
    system because you need to customize COPYSYS to support nonstandard
    system disk formats.    COPYSYS copies the Cold Start Loader, the
    CPMLDR.COM file, and optionally the CCP to the system tracks.  Refer
    to the COPYSYS.ASM source file on the distribution disk.

                                End of Section 5








                                     102

                                     Section 6

                              Debugging the BIOS



             This section describes a sample debugging session for a
        nonbanked CP/M 3 BIOS.  You must create and debug your nonbanked
        system first, then bring up the banked system.       Note that your
        system probably displays addresses that differ from the addresses in
        the following example.

             You can use SID, Digital Research' s Symbolic Debugger Program,
        running under CP/M 2.2, to help debug your customized BIOS.  The
        following steps outline a sample debugging session.

              1) Determine the amount of memory available to CP/M 3 when the
                 debugger and CP/M 2.2 are in memory.  To do this, load the
                 debugger under CP/M 2.2 and list the jump instruction at
                 location 0005H.  In the following example of a 64K system,
                 C500 is the base address of the debugger, and also the
                 maximum top of memory that you can specify in GENCPM for
                 your customized CP/M 3 system.

                 A>SID
                 CP/M 3 SID - Version 3.0
                 #L5
                 0005 JMP C500




              2) Running under CP/M 2.2, use GENCPM to generate a CPM3.SYS
                 file, which specifies a top of memory that is less than the
                 base address of the debugger, as determined by the previous
                 step. Allow at least 256K bytes for a patch area.    In this
                 example, you can specify C3 to GENCPM as the top of memory
                 for your CP/M 3 system.

                  A>GENCPM


                  ;op page of memory (FF)?  C3





              3) Now you have created a system small enough to debug under
                 SID.  Use SID to load the CPMLDR.COM file, as shown in the




                                         10 3

    CP/M 3 System Guide                            6 Debugging the BIOS

             following example:

             A>SID CP14LDR.COM
             CP/M 3 SID - Version 3.0
             NEXT MSZE PC END
             OE80 OEBO 0100 D4FF


         4)  Use the I command in SID, as shown in the next example, to
             place the characters $B into locations 005DH and 005EH of
             the default FCB based at 005CH.  The $B causes CPMLDR.COM
             to break after loading the CPM3.SYS file into memory.

             #I$B

         5)  Transfer control to CPMLDR using the G command:

             #G

             At this point, the screen clears and the following
             information appears:

             CP/M V3.0 LOADER
             Copyright (c) 1982, Digital Research

               BIOS3   SPR AAOO OBOO
               BDOS3   SPR 8BOO 1FOO

              34K TPA

                OlA9


          6) With the CP/M 3 system in the proper location, you can set
             passpoints in your BIOS.       Use the L command with the
             address specified as the beginning of the BIOS by the
             CPMLDR load table as shown in step 5 above.  This L command
             causes SID to display the BIOS jump vector which begins at
             that address.    The jump vector indicates the beginning
             address of each subroutine in the table.  For example, the
             first jump instruction in the example below is to the Cold
             Boot subroutine.

             #LAAOO








                                      104

        CP/M 3 System Guide                            6 Debugging the BIOS


                 The output from your BIOS might look like this:

                 JMP AA68
                 JMP AA8E
                 JMP ABA4
                 JMP ABAF
                 JMP ABCA




              7) Now set a passpoint in the Cold BOOT routine.  Use the P
                 command with an address to set a passpoint at that address.

                 #PAA68

              8) Continue with the CPMLDR.COM program by entering the G
                 command, followed by the address of Cold Boot, the first
                 entry in the BIOS jump vector.

                 #GAAOO

              9) In response to the G command, the CPMLDR transfers control
                 to the CP/M 3 operating system.  If you set a passpoint in
                 the Cold BOOT routine, the program stops executing, control
                 transfers to SID, and you can begin tracing the BOOT
                 routine.

              10) When you know the BOOT routine is functioning correctly,
                 enter passpoints for the other routines you want to trace,
                 and begin tracing step by step to determine the location of
                 problems.

              Refer to the Digital Research Symbolic Instruction Debugger
        User's Guide (SID) in the Programmer's Utilities Guide for the CP/M
        Family of Operating Systems for a discussion of all the SID
        commands.

                                    End of Section 6








                                          105

                                     Appendix A

                        Removable Media Considerations



               All disk drives under CP/M 3 are classified as either permanent
         or removable.  In general, removable drives support media changes;
         permanent drives do not.     Setting the high-order    bit in the CKS
         field in a drive's Disk Parameter Block (DPB) marks the drive as a
         permanent drive.

               The BDOS file system distinguishes between permanent and
         removable drives.  If a drive is permanent, the BDOS always accepts
         the contents of physical record buffers as valid.  In addition, it
         also accepts the results of hash table searches on the drive.

               On removable drives, the status of physical record buffers is
         more  complicated. Because of the potential for media change, the
         BDOS must discard directory buffers before performing most directory
         related BDOS function calls.      This is required because the BDOS
         detects media changes by reading directory records.  When it reads a
         directory record, the BDOS computes a checksum for the record, and
         compares the checksum to the currently stored value in the drive's
         checksum vector .   If the checksum values do not match, the BDOS
         assumes the media has changed.  Thus, the BDOS can only detect a
         media change by an actual directory READ operation.

               A similar situation occurs with directory hashing on removable
         drives.   Because the directory hash table is a memory-resident
         table, the BDOS must verify all unsuccessful hash table searches on
         removable  drives by accessing the directory.

               The net result of these actions is that there is a significant
         performance penalty  associated with removable drives as compared to
         permanent drives.       In addition, the protection provided by
         classifying a drive  as removable is not total.     media changes are
         only detected during  directory operations. If the media is changed
         on a drive during     BDOS WRITE operations, the new disk can be
         damaged.

               The BIOS media flag facility gives you another option for
         supporting drives with removable media.        However, to use this
         option, the disk controller must be capable of generating an
         interrupt when the drive door is opened.  If your hardware provides
         this support, you can improve the handling of removable media by
         implementing the following procedure:

               1) Mark the drive as a permanent drive and set the DPB CKS
                  parameter to th'e total number of directory entries, divided
                  by four.  For example, set the CKS field for a disk with 96
                  directory entries to 8018H.






                                           10 7

     CP/M 3 System Guide              A Removable Media Considerations

          2) Implement an interrupt service routine that sets the @MEDIA
             flag in the System Control Block and the DPH MEDIA byte for
             the drive that signaled the door open condition.

          By using the media flag facility, you gain the performance
     advantage associated with permanent drives on drives that support
     removable media.  The BDOS checks the System Control Block @MEDIA
     flag on entry for all disk-related function calls.  If the flag has
     not been set, it implies that no disks on the system have been
     changed.  If the flag is set, the BDOS checks the DPH MEDIA flag of
     each currently logged-in disk.  If the DPH MEDIA flag of a drive is
     set, the BDOS reads the entire directory on the drive to determine
     whether the drive has had a media change before performing any other
     operations on the drive.  In addition, it temporarily classifies any
     permanent disk with the DPH MEDIA flag set as a removable drive.
     Thus, the BDOS discards all directory physical record buffers when a
     drive door is opened to force all directory READ operations to
     access the disk.

          To summarize, using the BIOS MEDIA flag with removable drives
     offers two important benefits.  First, because a removable drive can
     be classified as permanent, performance is enhanced.          Second,
     because the BDOS immediately checks the entire directory before
     performing any disk-related function an the drive if the drive's DPH
     MEDIA flag is set, disk integrity is enhanced.

                               End of Appendix A








                                     108

                                     A endix B

                               Auto-density Support


              AUto-density support refers to the capability of CP/M 3 to
         support different types of media on a single drive.  For example,
         some floppy-disk drives accept single-sided and double-sided disks
         in both single-density and double-density formats.  Auto-density
         support requires that the BIOS be able to determine the current
         density when SELDSK is called and to subsequently be able to detect
         a change in disk format when the READ or WRITE routines are called.

              To support multiple disk formats, the drivers BIOS driver must
         include a Disk Parameter Block (DPB) for each type of disk or
         include code to generate the proper DPB parameters dynamically.  In
         addition, the BIOS driver must determine the proper format of the
         disk when the SELDSK entry point is called with register E bit 0
         equal to 0 (initial SELDSK calls).        If the BIOS driver cannot
         determine the format, it can return OOOOH in register pair HL to
         indicate the select was not successful.  Otherwise, it must update
         the Disk Parameter Header (DPH) to address a DPB that describes the
         current media, and return the address of the DPH to the BDOS.

         Note: all subsequent SELDSK calls with register E bit 0 equal to 1,
         the BIOS driver must continue to return the address of the DPH
         returned in the initial SELDSK call.       The value OOOOH is only a
         legal return value for initial SELDSK calls.

              After a driver's SELDSK routine has determined the format of a
         disk, the driver's READ and WRITE routines assume this is the
         correct format until an error is detected.     If an error is detected
         and the driver determines that the media has been changed to another
         format, it must return the value OFFH in register A and set the
         media flag in the System Control Block.  This signals the BDOS that
         the media has changed and the next BIOS call to the drive will be an
         initial SELDSK call.  Do not modify the drivers DPH or DPB until the
         initial SELDSK call is made.  Note that the BDOS can detect a change
         in media and will make an initial SELDSK call, even though the BIOS
         READ and WRITE routines have not detected a disk format change.
         However, the SELDSK routine must always determine the format on
         initial calls.

               A drive's Disk Parameter Header (DPH) has associated with it
         several uninitialized data areas:        the allocation vector, the
         checksum vector, the directory hash table, and physical record
         buffers.  The size of these areas is determined by DPB parameters.
         If space for these areas is explicitly allocated in the BIOS, the
         DPB that requires the most space determines the amount of memory to
         allocate.    If the BIOS defers the allocation of these areas to
         GENCPM, the DPH must be initialized to the DPB with the largest
         space requirements.   If one DPB is not largest in all of the above
         categories, a false one must be constructed so that GENCPM allocates
         sufficient space for each data area.

                                     End of Appendix B



                                           I 0 9

                                   Appendix C

                           Modif
                                  Ving a CP/M 2 BIOS



              If you are modifying an existing CP/M 2.2 BIOS, you must note
        the following changes.

           o The BIOS jump vector is expanded from 17 entry points in CP/M
              2.2 to 33 entry points in CP/M 3.      You must implement the
              necessary additional routines.

           o  The Disk Parameter Header and Disk Parameter Block data
              structures are expanded.

              See Section 3 of this manual, "CP/M 3 BIOS Functional
        Specifications," for details of the BIOS data structures and
        subroutines.  The following table shows all CP/M 3 BIOS functions
        with the changes necessary to support CP/M 3.

                          Table C-1.  CP/M 3 BIOS Functions

              Function        Meaning

              BIOS Function 00: BOOT

                              The address for the JMP at location 5 must
                              be obtained from @MXTPA in the System
                              Control Block.

              BIOS Function 01: WBOOT

                              The address for the JMP at location 5 must
                              be obtained from @MXTPA in the System
                              Control Block.  The CCP can be reloaded
                              from a file.

              BIOS Function 02: CONST

                              Can be implemented unchanged.

              BIOS Function 03: CONIN

                              Can be implemented unchanged.  Do not mask
                              the high-order bit.

