TURBO ROM

                          Theory of Operation

The TURBO ROM for Kaypro computers interfaces the CP/M operating system
to the actual hardware such as video display and disk drives.  It allows
the addition of expansion hardware such as high capacity floppy disks,
multiple hard disks and Advent Products RAM disks.  It automatically
senses the presence of this hardware and provides the appropriate
drivers to allow the operating system to fully use these new devices.

The following notes may be useful to those wishing to understand the
operation of the ROM.

COLD BOOT

When power is applied, or the reset button is pressed, the following
sequence of events is followed.

1.  A delay of 100 ms to allow for some of the peripheral chips to
    achieve equilibrium.  (MOSTEK parts are much slower than Zilog.)

2.  The peripheral devices are programmed with default values such
    as baud rate etc.

3.  The video driver is initialized and the screen cleared.

4.  The sign-on message is printed.

5.  The presence of the WD1002 hard disk controller is detected, by
    seeing if it comes not busy within 3 seconds.  If so, drive one is
    tested for ready.  We wait up to 20 seconds for it to come up to
    speed.  (Note Drive One is connected to J2 of controller.)

    When ready we issue a restore command and wait up to 25 seconds
    for the completion.  (If any of these tests fail then we have no
    hard disk.)

7.  An attempt is then made to read a 1024 byte sector (8) from the
    first cylinder of the disk.  If this is successful then we check to
    see if the sector is a valid parameter sector.  On 83 machines the
    main part of the hard disk initialization code is contained on the
    second half of the sector.  The first 512 bytes of this parameter
    sector contain the characteristics of the drives and the bad track
    mappings.

    * 84 Machines Only
    If this read fails we attempt to read a 512 byte sector (16) from
    the same cylinder. If this is successful we check for valid
    parameter sector.

    If we have a successful 512 byte sector read but an invalid sector
    then we assume 512 byte sectors of standard Kaypro layout.

8.  * 83 Machines Only
    The code read from the parameter sector is used to check for the
    presence  of a second Hard disk.  Parameter tables for these drives
    are set up in memory along with bad track maps.

9.  The lowest (in terms of select logic 0,1,2,3) floppy drive is
    examined for the presence of a spinning diskette.  If detected the
    logical drive ordering is as follows:

                A -> V  = Floppy Drives
                X -> Y  = Hard Drives           (if present)
                Z       = Ram Disk              (if present)

    If no floppy detected the logical drive ordering is:

                A -> V  = Hard Drives           (if present)
                X -> Y  = Floppy Drives
                Z       = Ram Disk              (if present)

10. An attempt is then made to read the first sector of logical
    drive "A".  This parameter sector conforms with the standard Kaypro
    layout, having the load address, execution address and the number of
    sectors to be loaded.  If we are running on a Kaypro  10 with a 512
    byte/sector hard disk a check is done to see if the system to be
    loaded will over-write the Host Buffer area (see memory layout for
    explanation), and if this occurs (generally only with a 63K system)
    the Host buffer is shortened to 512 bytes and floppy disk formats
    with > 512 bytes/sector are flagged as illegal.

11. The system is then read into memory and control is transferred to
    this system at the specified address.  If the supplied TURBO-BIOS is
    used (highly recommended) then further initialization is performed.
    The nature of this initialization can be modified by the supplied
    configuration program TURBOCFG.

WARM BOOT

On a Warm Boot an attempt is made to read from the logical "A" drive a
fresh copy of the Command Processor and Basic Disk Operating System
(BDOS).  The configuration program TURBOCFG can be used to change the
default drive for this operation.  We recommend using this advanced
option only if you really know what you are doing.  An example may be to
warm boot from the RAM disk without making it drive A.  However, it must
be SYSGENed before the first warm boot takes place.

DISK SELECT (and Deselect)

Floppy drives have removable media while Hard Disks and Ram Disks have
fixed media.  Drives with removable media are treated differently at
select time.  If this is the first select since a disk reset then we
re-determine the format of the diskette in the drive.  (This operation
can be inhibited under special circumstances).  If the format cannot be
determined a BDOS Select error will occur, unlike most BIOS's which
would generate a bad sector error.  Naturally a select error will also
occur if an attempt is made to access a non-existent drive.

A period of time after the last disk operation, a deselect process
occurs.  This first makes sure the contents of the De-Blocking buffer are
written back to the disk if required.  Then the floppy motor is turned
off and if needed both floppy drives are deselected (lights turned off).
If Hard disks are present then each drive seeks the innermost formatted
cylinder and then non-existent drive zero is selected.  This final step
deselects the actual hard drives.

                  DEFINITION OF TABLES USED BY THE ROM

DATA PARAMETER HEADERS (Commonly called DPH's)

The DPH for each logical drive is extended by 2 bytes compared to the
standard DRI definition (see CP/M manual if you are not familiar with
this).  These 2 bytes precede the normal 16 bytes.

The first byte contains information on the logical/physical mapping of
the drives.

------------------------------------------------------------
Byte0   -       logical/physical drive mapping

physical:
        bit 7           -- reserved for future use by Plu*Perfect Systems
        bit 6,5,4
                        000  = Advent Products RAM disk (up to 2 MBytes)
                        001  = reserved for future use
                        010  = Physical Hard Drive 0    (up to 56 MBytes)
                        011  = Physical Hard Drive 1    ( "   "   "     )

                        100  = Physical floppy 1        (48 or 96 TPI)
                        101  = Physical floppy 2
                        110  = Physical floppy 3
                        111  = Physical floppy 4

logical:
        bit 3-0         logical drive A-P
                        0000    =       A
                        0001    =       B
                        0010    =       C
                          .             .
                          .             .
                          .             .
                        1111    =       P

______________________________________
In the second byte, some physical characteristics of the Drive are coded.

Byte1   -       drive characteristics byte defined as follows:-

FLOPPY DRIVE

        bit 7   -       0  = if drive is 48 tpi
                        1  =   "   "     96 tpi

        bit 6   -       0  = redetermine media on fresh select(normal)
                        1  = don't redetermine media on fresh select
                                (used when externally set disk format)

        bit 5   -       unused

HARD DRIVE

        Advent Format -
        bit 7,6,5       number of heads (minus one)

        Kaypro 512 byte/sector format-
        bit 7           0 = platter A (heads 0,1)
                        1 = platter B (heads 2,3)

        bit 6,5         unused

RAM DRIVE

        bit 7,6,5       unused

All drive types

        bit 4   0  = Use ROM DPB tables
                1  = Use RAM DPB tables

        bits 3,2,1,0    Use DPB 0-15 from rom or ram table

Bytes
2 - 18  -       Standard DRI data parameter header.

DATA PARAMETER BLOCK (DPB's)

The DPB's used by the ROM are 3 bytes longer than the standard
definition given by DRI (see CP/M manual if you are not familiar with
this).  These 3 extra bytes precede the normal 15 bytes.

There is a word which points to a sector translation table address.  This
may be zero, a ROM address which is not accessible to external programs
without bank switching, or an externally loaded table in high RAM.

There is then a Byte which characterizes the type of format associated
with this DPB. The bits in this byte are interpreted as follows:

1.  For Floppy Drives: (Media)

        bit 7   -       0  = disk is in 48 tpi format
                        1  = disk is in 96 tpi format

        bit 6   -       0  = standard data sense
                        1  = inverted data bus (only available on 84 ROM)
                                (used only on machines that used chips
                                like 1771/91 without inverters)

        bit 5   -       1  = single density
                        0  = double density

        bit 4,3,2   -   Use algorithm 0-7 to compute physical
                        cylinder, track, sector and side.
                        Note algorithm 7 is reserved for external
                        code, which the user may load.  See later for
                        definition and how to load this code.

                Predefined Algorithms
                -----------------------------------------------
                000     - for 512 byte Kaypro hard disk format
                                                (see below)
                -----------------------------------------------
                001     - for 512/1024 byte Advent hard disk formats
                                                (see below)
                -----------------------------------------------
                010     - single sided floppy
                        phy.cylinder    =track
                        phy.track       =track
                        phy.sector      =sector
                        phy.head(side)  =0
                -----------------------------------------------
                011     - double sided Kaypro/Advent floppy
                        bias            =10
                        phy.cylinder    =int(track/2)
                        phy.track       =phy.cylinder
                        phy.head(side)  =mod(track,2)
                        phy.sector      =sector + side*bias
                -----------------------------------------------
                100     - Micro Cornucopia/Advent 96 tpi,
                        Same as Kaypro except
                        bias            =20
                -----------------------------------------------
                101     - double sided (single long track)
                        Note that zero based sector numbering assumed,
                        fits Legacy formats

                        phy.cylinder    =track
                        phy.track       =track
                        phy.sector      =sector
                        phy.head(side)  =0 if sector < phy_sect/side
                                        =1 if sector >=  phy_sect/side
                -----------------------------------------------
                110     - double sided (odd tracks on back but no sector skew)
                        Same as Kaypro except
                        bias            =0
                -----------------------------------------------
                111     - External routine, parameters
                          in registers on call and return.

                        ENTRY                           EXIT
        HL      none                            physical cylinder to seek
        DE      HSTTRK                          physical track for floppy ctrl
        B       HSTDRV (dph byte 1)             physical head (side)
        C       HSTSEC                          physical sector

                ------------------------------------------------

        bit 1,0 -       00 = 128 physical sector length
                        01 = 256
                        10 = 512
                        11 = 1024

-------------------------------------
2.  For Hard Disk Drives:

        bit 7,6,5               unused

                        (These bytes compatible with floppy use)
        bit 4,3,2       000     -Kaypro 10 original format
                           512 byte  sectors (algorithm for track sector)
                                phy.cylinder    = (track + offset)/2
                                offset = 0              if track < 4
                                offset = track - 4      if 3 < track < 8
                                offset = 4              if track > 7

                                phy.track       = n/a
                                phy.sector      = sector
                                phy.head        = mod(track+offset,2)
                                                         + drvbyt(7)*2
                                drvbyt(7) is bit 7 of byte 1 of DPH

                        (note we abandon trying to maintain
                        duplicate directory on back of platter,
                        if problems, then reformat with our new
                        format)

                        001     -Advent Hard disk format
                            512/1024 byte sectors
                                phy.cylinder    = trackx/#heads
                                phy.track       = n/a
                                phy.sector      = sector
                                phy.head        = mod(trackx,#heads)

                        (Note trackx = badfnc(track).  This corrects
                        desired track for bad tracks.  The bad track
                        function is performed by the following algorithm.

                        I:=0
                        TRACKX:=TRACK
                        DO WHILE(BADTRK(I) >= TRACK)
                                TRACKX:=TRACKX +1
                                I:=I + 1
                        END

                        Where badtrk(i) is a list of bad physical
                        tracks which is terminated with FFFFH entry.
                        We support a maximum of 126 bad tracks per physical
                        drive.)

        bit 1,0 -       00 = not supported
                        01 = not supported
                        10 = 512 byte sectors (only available on 84 ROMs)
                        11 = 1024 byte sectors

------------------------------------------------
3.  Advent Ram Disk Drive:

        bit 7,6,5,4,3,2 unused

        bit 1,0 -       00 = 128 byte sectors
                        01 = not supported
                        10 =    "    "
                        11 =    "    "

-------------------------------------------------

In ROM we have a maximum of 16 DPB's
DPB#

0       Standard Kaypro SS (512 byte sectors)                           floppy
1       Standard Kaypro DS (512 byte sectors)                           floppy
2       Advent SSDD 448 tpi(1024 byte sectors) ( handles Osborne SSDD)  floppy
3       Advent DSDD 48tpi (1024 byte sectors)                           floppy
4       Advent DSDD 96tpi (1024 byte sectors)                           floppy
5       Micro C DSDD 96tpi (512 byte sectors)                           floppy
6*      Xerox 820 SSSD  (128 byte sectors)                              floppy
7*      Osborne SSSD (256 byte sectors)                                 floppy
8*      Epsom QX-10 (U.S. format - not European)                        floppy
9*      Kaypro 10 (original hard disk format)                           hard
10*
11*
12*
13*             reserved for future expansion
14*
15*

* only available on 84 ROMS

In high memory we store the DPB's that have to be dynamically changed or
added.  The first DPB is a reserved entry for use by external programs
who wish to set up a foreign floppy format for the ROM to work with.

The second is always the RAM disk if it exists.  Following this are the
various Hard disks (Advent Format only) which are actually read in from
the parameter sector of the hard disk.  These DPB's are stored in
descending memory order (unlike DPH's above).

                          HIGH MEMORY ARRANGEMENT

The ROM uses the very top of the Kaypro RAM for its working storage.  The
amount of memory used depends on the physical configuration, but in all
cases, memory is dynamically allocated at cold boot time so that the
amount of memory available to user programs is maximized.  The very top
of memory is of fixed layout (which varies slightly between 83 and 84
ROMs) and this is useable by programs which need to find out about the
current environment.

topmem          equ     0FFFFH

;ROMID is 8 byte string of following layout
;               db      checksum        ;zero sum of top 8 bytes in memory
;               jmp     romentry        ;general ROM entry point
;               db      version         ; BCD ver.rev, (hi bit set '84)
;               db      'PPS'

;fixed pointers and storage which are guaranteed to be preserved in
;future releases of the ROM

dphptr: dw      numdrv          ;pointer to start of DPH table
dpbptr: dw      numdpb          ;pointer to start of RAM DPB's
hstptr: dw      hstbuf          ;pointer to Host buffer
                                ;This is the lowest area used by ROM
intptr: dw      intvec          ;pointer to start of interrupt vector
extptr: dw      tsalgr          ;pointer to external trk/sector code
hrdptr: dw      badtr0          ;pointer to hard/floppy disk parameters

;fixed storage that varies between 83 and 84 machines
        83                                      84
     --------                                 ---------
safptr: dw      safcod                          dw      x       ;reserved
cursor: dw      x                       cursor: dw      x       ;video cursor
                                        clkent: dw      clkdrv  ;routine to
                                                                ;clock
                                        curmin: db      minutes ;current time
                                                db      hours

        Interrupt vector for all devices.
        83                              84
     --------                        --------
                                        pioBvc  ;modem dialer
                                        pioAvc  ;RTC interface

                                        sioCv3  ;serial printer
                                        sioCv2
                                        sioCv1
                                        sioCv0

        pioDvc  ;unused                 sioDv3  ;Modem or Unused serial
        pioCvc  ;printer                sioDv2
        pioBvc  ;unused                 sioDv1
        pioAvc  ;system port            sioDv0  ;

        sioAv3                          sioAv3  ;serial data char rec.(error)
        sioAv2                          sioAv2  ;serial data char rec.
        sioAv1                          sioAv1  ;serial data ext. status
        sioAv0                          sioAv0  ;serial data Tx buffer

        sioBv3                          sioBv3  ;keyboard char rec. (error)
        sioBv2                          sioBv2  ;keyboard char rec.
        sioBv1                          sioBv1  ;keyboard ext. status
        sioBv0                          sioBv0  ;keyboard Tx buffer

intvec:                                         ;start of vectors aligned on
                                                ;16 byte boundary

        Stack space for interrupt handlers and ROM

        Code, DIRBUF and other variables

        Area for externally defined floppy drive
        information

xtran:  ds      36              ;36 bytes of physical translation table

        ds      55              ;SPACE for code referred by labels
                                ; invmap and mapit

        db      fmt                             ;current format number
        jmpr    invmap                          ;inverse trk/sector/side
tsalgr: jmpr    mapit                           ;cylinder/sector/head

Miscellaneous disk/video/and other variables
which may change with future ROMS implementation.

                -----------
However the following structure will remain intact though
it will doubtless move.

disblk: db      ..      ;84 machine video blanking disable (00/FF)
                                                        (not currently used)

smflag: db      ..      ;84 machine restricted to 512 byte sectors

stldly: db      z       ;current floppy head settling delay (ms)
hldly:  db      y       ;current floppy head load delay(ms)
fstprt: db      x       ;current floppy step rate (ms)

ftime4: db      x,y,z   ;array of floppy time constants for each drive
ftime3: db      x,y,z
ftime2: db      x,y,z
ftime1: db      x,y,z

muxflg: db      ..      ;flag for presence of Advent decoder board
fstat:  db      ..      ;current floppy arrangement
                        ;7 - Drive 4 96 tpi
                        ;6 - Drive 4 exists
                        ;5 - Drive 3 96 tpi
                        ;4 - Drive 3 exists
                        ;3 - Drive 2 96 tpi
                        ;2 - Drive 2 exists
                        ;1 - Drive 1 96 tpi
                        ;0 - Drive 1 exists (always true)

wdflag: db      ..      ;7 - if parameter sector successfully read
                        ;0 - WD 1002 controller detected

sltmsk: db      ..      ;floppy select mask
                        ; 00000011B     ;normal 2 lines
                        ; 00000001B     ;Kaypro 10 hard disk connected

precp1: db      ..      ;Hard Drive 2 precomp cylinder(coded)
step1:  db      ..      ; "     "   " step rate (coded)
mxcyl1: dw      ...     ; "     "   " maximum formatted cylinder
badtr1: dw      list1   ; "     "   " pointer to start of bad track table

precp0: db      ..      ;as above for drive 1
step0:  db      ..
mxcyl0: dw      ...
badtr0: dw      list0   ;POINTED TO BY HRDPTR AT TOP OF MEMORY

polflg: db      ..      ;set to 00 if type-ahead keyboard (else FF)
belchr: db      ..      ;bell character for keyboard, may have click bit
                        ---------------

                **************************************
                *  Run time determined storage areas *
                **************************************

Actual list of n*18 drive descriptor bytes where n is logical number of
drives.  These are arranged as described above.

numdrv:         db      n               ;logical number of drives
                                        ;pointed to by dphptr

        Followed by DPH for each drive as described above.
        NOTE that DPH's ascend in memory above the NUMDRV byte.


In RAM DPB tables described above -- note they descend in memory
though the number of DPBs  byte is still at bottom of list

each DPB of following layout

        dw      xtran ptr
        db      media byte
        ds      15                      ;normal DRI definition

Actual list of RAM dpb's in following order (descending in memory)

0 -     always externally definable floppy
1 -     RAMDISK (computed at cold boot)

2-15    up to 14 more formats read in from hard disk
        parameter sector

        (future ROM releases may limit number of logical hard disks to 13)

numdpb:         db                      ;number of RAM dpbs in this
                                        ;configuration, the first
                                        ;is always the externally
                                        ;definable floppy

;Hard Disk bad track lists  (if any)

list1:  dw      ...
        dw      ...
        dw      FFFFH

list0:  dw      ...
        dw      ...
        dw      FFFFH

hstbuf: ds      1024                    ;deblocking buffer
                                        ;init code changes to 512
                                        ;bytes if system loaded too high
                                        ;on Kaypro 10 with 512
                                        ;byte sectors

lowest area used in high Ram by ROM

                    ADVENT PRODUCTS ELECTRONIC RAM DISK

The RAM disk is located at ports 88H thru 8BH.

88H     -       data bi-directional
89H     -       sector (6 lo bits only)
8AH     -       track register (7 lo bits per board, hi bit board select)
8BH     -       status register (bit 0,1  00,01,10,11 are 256,512,768,1024K
                        respectively.  Bit 2 is 0 if board is present and
                        otherwise is pulled up.

Status register returns
xxxxx000        = 256k
xxxxx001        = 512k
xxxxx010        = 768k
xxxxx011        =1024k
xxxxx1xx        = ram disk not present

Then we write 8AH with 80H and repeat read of 8BH for second board.

RAMDISK has following DPH

XLT ptr         0000            ;no sector translation
SCRATCH         0000
                0000
                0000
                DIRBUF          ;pointer to directory buffer
                CURDPB          ;always points to DPB current
                0000            ;no directory checksum
                ALVRAM          ;pointer to size dependent area

RAMDISK has following DPB
XTRN:   dw      0000            ;no sector translation
MEDIA:  dw      00              ;128 byte sectors
SPT:    dw      64
BSH:    db      x               ;x = 3 for 256K
                                ;  = 4 for 512K
                                ;  = 5 for 768,1024K
                                ;  = 6 for > 1024K

BLM:    db      2**x - 1
EXM:    db      2**(x-3) - 1
DSM:    dw      2**(6-x).(n+1).2**5 - 1) - 1
DRM:    dw      2**(3+x) - 1
AL0:    db      0C0H
AL1:    db      000H
CKS:    dw      0000
OFF:    dw      0001

Sector 63 of track 0 is initialized with a copy of the first
128 byte of the ROM.  On subsequent resets this is compared and
if a match is detected the directory of the RAM disk is not erased.

                       FLOPPY DISK FORMATS

The Turbo ROM will recognize and can use directly the following floppy
disk formats:-

        83                                      84
     ---------                                ---------
Kaypro SSDD                             Kaypro SSDD
Kaypro DSDD                             Kaypro DSDD
Advent SSDD                             Advent SSDD
Advent DSDD 48                          Advent DSDD 48
Advent DSDD 96                          Advent DSDD 96
Micro Cornucopia 96                     Micro Cornucopia 96

                                        Epson QX-10 DSDD 48 (U.S.)
                                        Osborne SSSD
                                        Xerox 820-1 SSSD

In addition any other CP/M 5.25" soft sector format may be set up using
the TURBOSET program which is available separately as part of the
Plu*Perfect Systems' MULTI-COPY package.

The Advent formats mentioned above have the following description.

1) SSDD

        Physical Sector Length          1024 bytes
        Physical Sector Order           1,4,2,5,3

        Logical Sectors/Track           40
        Number of Cylinders             40

        Reserved Tracks                 3
        CP/M allocation size            1K
        Directory Entries               64
        Reserved Directory Groups       2
        Total size                      185K

        *note that this format is identical to the Osborne SSDD
        except for the physical sector order

2) DSDD 48

        Physical Sector Length          1024 bytes
        Physical Sector Order           1,4,2,5,3       -side 0
                                        11,14,12,15,13  -side 1

        Logical Sectors/Track           40
        Logical Tracks                  80
        Number of Cylinders             40
        Reserved Tracks                 2
        CP/M allocation size            2K
        Directory Entries               256
        Reserved Directory Groups       4
        Total size                      390 K

3) DSDD 96

        Physical Sector Length          1024 bytes
        Physical Sector Order           1,4,2,5,3       -side 0
                                        21,24,22,25,23  -side 1

        Logical Sectors/Track           40
        Number of Cylinders             80
        Number of Logical Tracks        160

        Reserved Tracks                 2
        CP/M allocation size            2K
        Directory Entries               256
        Reserved Directory Groups       4
        Total size                      790 K

                         TURBO ROM VIDEO FEATURES

The Turbo ROM provides a number of new video features compared with the
standard Kaypro.  These differ between the 83 and 84 versions.

Video Blanking:

Both ROM's provide a screen saving video blanking after about ten
minutes of waiting for keyboard input.  However, on 83 machines this
feature requires a modification to the video circuit.  This is optional
and the blanking will not occur unless the change has been made. Because
the ROM has no way of knowing whether the change has been made, the
unblanking keystroke will not be ignored as it is with the 84 ROM.

The 83 video change is made simply by purchasing a replacement character
generator ROM and putting it into the circuit.  Alternatively, people
with electronic circuit experience, can make a small modification to the
main circuit board to achieve the same effect.  Details are available on
request.

Screen Dump:

While not a direct feature of the Turbo ROM, the TURBO BIOS supplied
with the ROM has character (not graphic) screen dump to printer
capability.  The ROM actually provides the support for this feature but
it must be externally activated, for more details see the source code to
the BIOS and the following description of the ROM Entry Points.  The
Screen Dump must be explicitly enabled by using TURBOCFG.

Changes to Video Control Codes and Escape Sequences:

Some changes to the behavior of the video compared to the standard
Kaypro ROM's have been made.  These are generally for consistency or to
correct bugs in the original implementation.

a) Control Characters that are not used by the video are now "swallowed"
rather than generating Greek characters or Fine Line graphics.

b) On 83 machines the underline cursor no longer destroys true underline
characters on the screen when moved through their positions.

c) On 84 machines the ESC G/ESC A sequences are implemented identically
to the 83 machines.  That is the 32 characters (lower case) from the
grave accent (60 Hex) through the DELete (7F Hex) will produce the the
corresponding graphic character in position 0-31 (decimal) in the
character ROM if the video sequence ESC G has been received.  When the
sequence ESC A is received the lower case characters produce themselves.
On the 83 character ROM's this 32 characters are normally greek and
mathematical symbols.  On the 84 character ROM's these characters are
normally the Fine Line graphic set.  On Foreign Language Kaypro's these
characters are selected european characters.

d) On 84 machines the sequences ESC B 7/ESC C 7 have a slightly
different effect.  The standard video defaulted to a 24 line scrolling
window with the 25th line also scrolling.  The Turbo ROM is either a 25
line scrolling display or a 24 line scrolling display with the 25th line
locked.  The difference is minor unless you wish to reconfigure some of
your application programs to make use of the 25 line screen.  Note that
the ROM scrolling is much faster if a 25 line scrolling region is
enabled.  Also, scrolling is much faster if no video attributes have
been used since the last clear screen.

New Features:

a) Hard Tabulations.  The standard video ignored the tabulation
character, "^I".  Both 83 and 84 ROM's expand this to 8 column fixed
tabs.  This is mostly of use to user's of Plu*Perfect Systems NOTEPAD
module of the Backgrounder, as most programs expand tabs in software.

b) Insert and Delete Character.  Two new control codes are now
interpreted to insert and delete characters. "^A" will cause the next
character received to be inserted at the current cursor position.  "^B"
will delete the character currently at the cursor position.  Both of
these controls are limited to the current line, i.e. inserting
characters will move the characters to the right of the cursor but will
not cause any that are displaced past the end of the line to wrap.
These new features are again of interest to users of Plu*Perfect
Systems' NOTEPAD module of the Backgrounder.

c) On 84 machines there is now a method of dynamically modifying the
type of cursor used.  ESC U n will cause a new cursor whose
characteristics are defined by the ascii character "n".  The cursor is
bit encoded into this character and the bit positions have the following
meaning.

        bits 6,5                - blinking
                        00 - no blinking
                        01 - no cursor
                        10 - fast blinking
                        11 - slow blinking

        bits 4,3,2,1,0          - cursor height

                        00000 - full block cursor (16 scan lines)
                        00001 -
                        00010 -

                        .....

                        01110 - thicker underline     (2 scan lines)
                        01111 - thin underline cursor (1 scan line)

d) Disable on screen clock display.  On 84 machines which have either a
built in Kaypro clock or and Advent Products clock, the on screen
display of the time may be temporarily disabled with

        ESC C 8  and re-enabled with ESC B 8

Note that the clock display is automatically disabled if a 25 line
scrolling screen is selected.

e) Switch character generators. On 84 machines which are correctly
wired, an alternate character set may be chosen with the following

        ESC B 9 and the original re-selected with ESC C 9

This additional character set would normally reside in the other half of
a 27644 character ROM.  True 84 machines are actually wired to accept
this chip but unfortunately Kaypro did not test the circuit and a minor
modification is required.  On older Kaypro 10's a small circuit
modification is required, please contact Advent Products if you wish to
make use of this feature of the TURBO ROM.

                      ENTRY POINTS INTO THE TURBOROM

The TURBO ROM in general preserves the standard entry points that have
been used with only small differences by all CP/M Kaypros since the
KAYCOMP. There are naturally some extensions which provide additional
features.  One major addition is the creation of a standard entry
mechanism that can be used regardless of whether an 83 or 84 machine is
being used.

If a utility wishes to call the ROM it should load the page zero address
it wishes to call into the L register and then call 0FFFCH in high
memory.  All the bank and stack switching tasks will be automatically
taken care of.  However, direct calls to the ROM should be avoided in
normal application programs as they severely limit portability of the
program.

Entry Points:
0000    Machine Restart,  cold boot
0003*   Disk Reset
0006    Initialized video driver
0009*   Initialize unit record hardware
000C*   Deactivate Host buffer if not written (HOME)
000F    Select disk for next access
0012    Set Track for next disk access
0015    Set Sector for next disk access
0018    Set DMA address for next disk access
001B    Read Sector
001E    Write Sector
0021*   Sector Translation (dummy, delayed to SETSEC)
0024    Turn on the Floppy drive motor
0027*   Turn off floppy motors, Deselect hard drives, flush Host buffer
002A    Keyboard input status
002D    Keyboard input
0030    Keyboard serial output, use with caution
0033    Serial Data port input status (TTY)
0036    Serial Data port input (TTY)
0039    Serial Data port output (TTY)
003C    Centronics printer output status (LPT)
003F    Centronics printer output (LPT)
0042    Serial Data port output status (TTY)
0045    Video output (CRT)
0048*   Ten millisecond delay
004B#   Serial Printer input status (UL1)       [83=TTY]
004E#   Serial Printer input (UL1)              [83=TTY]
0051#   Serial Printer output (UL1)             [83=TTY]
0054#   Serial Printer output status (UL1)      [83=TTY]
0057#   Reload system
005A#   Get next screen dump character
005D#   Set cursor type
0060#   One millisecond delay
0063#   Initialize DPH -----DO NOT USE
                83 Roms                                 84 Roms
0067#   Hard Disk Seek -----DO NOT USE          0067#   Kaypro Clock
006A#   Hard Disk Setup-----DO NOT USE          006A#   Advent Clock
                                                006D#   Kenmore CLock

Rom Entry Point Specifications:
(* Changes from Original Kaypro)
(# New entry points)

0003    Disk Reset --
                                ENTRY - none,           EXIT - none
                        Simply resets the Host Buffer Active flag and the
                        Unallocated Sector Counter.  This follows exactly the
                        definition in the latest versions of DRI documentation
                        (warm boot). The Kaypro ROM's used this entry point
                        for other internal purposes.

0009    Initialize Hardware --
                                ENTRY -- DE points to list of port,data pairs
                                         A  number of entries in list (len/2)
                                        (see TURBO-BS.PRN for example of use)
                                EXIT  -- none

                        This entry allows the physical devices to be set up
                        with any byte pattern.  The original Kaypro entry
                        point always used its default values.

000C    Home --
                                ENTRY -- none,          EXIT -- none

                        This entry point follows the DRI definition, of
                        reseting the Host Buffer Active flag if the buffer
                        does not have a pending write.  It also calls the
                        set track entry with an argument of zero.  The
                        Kaypro ROM's in many cases also performed a
                        physical seek to track zero.  This is unnecessary.

000F    Select Disk --          ENTRY -- C - desired logical drive 0-15
                                         E - bit 0=0 if this is first select
                                                        else bit 0=1

                                EXIT  -- HL = points to DPH for this drive
                                                if select was successful
                                            = 0000 if either drive does not
                                                exist or the floppy format was
                                                not determinable

                        The main differences from almost all of the Kaypro
                        ROM's is the correct use of the lo order bit of the
                        E register as specified by Digital Research.  This
                        means that any program that correctly uses the BDOS
                        facilities to log in a new drive will have the
                        media correctly determined after a disk change.  On
                        the Kaypro ROM's the only time a change could be
                        made between say single and double sided disks was
                        after a warm boot.  Popular programs like SWEEP
                        could not be used with a mixture of disk formats.
                        (Note that Plu*Perfect Systems' CP/M enhancements
                        included a BDOS patch to correct this, when the
                        TURBOBIOS is installed this patch is overwritten and
                        original contents replaced)

0015    Set Sector --
                                ENTRY -- BC = logical sector for next request

                                EXIT  -- none

                        This routine combines the functions of the old
                        Sector Translation routine.  It must be called
                        after the select disk function has been called, so
                        that the correct sector translation table can be
                        used. This is identical to the BDOS use of the
                        original two separate entry points.

0021    Sector Translation --
                                ENTRY -- BC = logical sector for next request
                                         DE = pointer to translation table

                                EXIT  -- HL = logical sector

                        This routine is a totally dummy routine and for
                        efficiency all of its functions are now performed
                        in the Set Sector Routine.

0027    Motor Off --
                                ENTRY -- none,          EXIT -- none

                        Before performing its major deselect function this
                        entry check the Host Buffer for a pending write and
                        if there is one the buffer will be written to disk.
                        This ensures that whenever the select lights are
                        off that disk accurately reflects the contents of
                        the Host Buffer. It is thus good practice to remove
                        floppy diskettes from the drives only when the select
                        light(s) are off.

                        This entry will then turn off the floppy drive spindle
                        motor, and, if the Advent Personality Decoder board
                        is not present will deselect the floppies so that
                        the select light goes off.  If Hard Disks are
                        present then each drive seeks its innermost
                        cylinder and then non existent drive 0 is selected
                        which will turn off the select lights on the drives.

0048    Ten Millisecond Delay --
                                ENTRY --   A = multiplier for delay

                                EXIT  -- none

                        This entry point provides the correct delay
                        regardless of processor clock speed.  All Kaypro
                        ROM's assume a 4 MHz clock.  In addition, if the
                        keyboard type-ahead is enabled then the keyboard is
                        continually polled during the delay and any
                        keypresses are serviced and placed in the buffer.
                        The accuracy of this timer is within 4%, note that
                        it reflects the effective CPU speed at cold boot
                        and if the speed is changed (as is possible with some
                        speed up modifications) the timing will no longer
                        be accurate.

(# New Entry Points available in TURBO ROM)

004B    Serial Printer input status --
                                ENTRY -- none
                                EXIT  --  A = 00 and Z if no character ready
                                            = FF and NZ if character ready

                        This entry allows use of the extra serial printer port
                        on 84 machines.  On 83 ROMs this entry is double
                        mapped to the serial data port.

004E    Serial Printer port input --
                                ENTRY -- none
                                EXIT  -- A = character received

0051    Serial Printer port output --
                                ENTRY -- C = character to be sent
                                EXIT  -- none

0054    Serial Printer output status --
                                ENTRY -- none
                                EXIT  -- A = 00 and Z if not ready
                                           = FF and NZ if ready for next

0054    Reload System  --
                                ENTRY -- DE = Address to load system tracks
                                         B  = number of sectors to load
                                         C  = starting sector to load
                                         A  = logical drive to load from

                                EXIT -- none,  any errors force cold boot

                        This entry point will reload all or part of the
                        operating system from the system tracks of the
                        specified drive.  The usual conditions of 40
                        sectors/track will cause floppy type load and > 55
                        sectors/track will cause RAMDISK or Hard disk reload.

005A    Next Screen Dump Character --
                                ENTRY -- C = FF if first screen character

                                EXIT  -- A = character (masked with 7FH)
                                         L = column (00 means new line)
                                         Z flag set if end of screen

                        This entry allows external programs to read the
                        screen whether this is an 84 or 83 machine.  The
                        flashing attribute on the 83 machines is removed and
                        on 84 machines all pixel graphics are replaced with
                        blanks.  It is the responsibility of the calling
                        program to insert new line characters if needed.

005D    Set Cursor Type ---
                                ENTRY --  A= cursor definition

                                EXIT  -- none

                        This entry is machine dependent.  On 83 machines the
                        definition is simply the character itself (with or
                        without the hi bit set for flashing).  On 84
                        machines the definition character has the same
                        meaning as the "n" used in the ESC U n cursor
                        setting sequence.

0060    One Millisecond Delay  --
                                ENTRY --  A=delay multiplier
                                EXIT  --  none

                        See description of Ten Millisecond above.

0063-6A on 83 machines are not to be used.  These are used internally by
the ROM initialization code and will have unpredictable results if called
by external routines.

        --  84 machines only ---
All the entry points below have the same parameter interface
                                ENTRY --  none
                                EXIT  --  H = BCD hours
                                          L = BCD minutes

0067    Kaypro Clock --
                        Returns current time from built-in Kaypro clock

006A    Advent Products Clock --
                        Returns current time from Advent clock

006D    Kenmore Z- TIME Clock --
                        Returns current time from Kenmore clock

NOTE: The clock must exist as no internal checking is done, and
unpredictable results are possible if wrong clock is read.