home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / kaypro / advent2.ark / ROM.DOC < prev    next >
Text File  |  1986-09-20  |  38KB  |  1,154 lines

  1.             TURBO ROM
  2.  
  3.             Theory of Operation
  4.  
  5.  
  6. The TURBO ROM for Kaypro computers interfaces the CP/M operating
  7. system to the actual hardware such as video display and disk drives.
  8. It allows the addition of expansion hardware such as high capacity floppy
  9. disks, multiple hard disks and Advent Products RAM disks.  It automatically
  10. senses the presence of this hardware and provides the appropriate drivers
  11. to allow the operating system to fully use these new devices.
  12.  
  13.  
  14. The following notes may be useful to those wishing to understand the
  15. operation of the ROM.
  16.  
  17.  
  18. COLD BOOT
  19. When power is applied, or the reset button is pressed, the following sequence
  20. of events is followed.  
  21.     1/ A delay of 100 ms to allow for some of the peripheral chips to
  22.     achieve equilibrium.  (MOSTEK parts are much slower than Zilog)
  23.  
  24.     2/ The peripheral devices are programmed with default values such
  25.     as baud rate etc.
  26.  
  27.     3/ The video driver is initialized and the screen cleared.
  28.  
  29.     4/ The sign-on message is printed.
  30.  
  31.         5/ The presence of the WD1002 hard disk controller is detected, by
  32.         seeing if it comes not busy within 3 seconds.  If so, drive one is   
  33.         tested for ready.  We wait up to 20 seconds for it to come up to
  34.         speed.  (Note Drive One is connected to J2 of controller)
  35.  
  36.     When ready we issue a restore command and wait up to 25 seconds for
  37.     the completion.  (If any of these tests fail then we have no hard
  38.     disk)
  39.  
  40.     7/ An attempt is then made to read a 1024 byte sector (8) from the
  41.     first cylinder of the disk.  If this is successful then we check to
  42.     see if the sector is a valid parameter sector.  On 83 machines the
  43.     main part of the hard disk initialization code is contained on the
  44.         second half of the sector.  The first 512 bytes of this parameter
  45.         sector contain the characteristics of the drives and the bad track
  46.         mappings.
  47.  
  48.     *84 Machines Only
  49.         If this read fails we attempt to read a 512 byte sector (16) from
  50.         the same cylinder. If this is successful we check for valid
  51.         parameter sector.
  52.  
  53.     If we have a succesful 512 byte sector read but an invalid sector then
  54.         we assume 512 byte sectors of standard Kaypro layout.
  55.  
  56.     8/ *83 Machines Only
  57.         The code read from the parameter sector is used to check for the
  58.     presence  of a second Hard disk.  Parameter tabels for these drives
  59.     are set up in memory along with bad track maps.
  60.  
  61.     9/ The lowest (in terms of select logic 0,1,2,3) floppy drive is
  62.     examined for the presence of a spinning diskette.  If detected the
  63.     logical drive ordering is as follows:
  64.         A -> V  = Floppy Drives
  65.         X -> Y    = Hard Drives        (if present)
  66.         Z    = Ram Disk        (if present)
  67.  
  68.     If no floppy detected the logical drive ordering is:
  69.         A -> V    = Hard Drives        (if present)
  70.         X -> Y    = Floppy Drives
  71.         Z    = Ram Disk        (if present)
  72.  
  73.  
  74.     10/ An attempt is then made to read the first sector of
  75.     logical drive "A".  This parameter sector conforms with the
  76.     standard Kaypro layout, having the load address, execution address
  77.     and the number of sectors to be loaded.  If we are running on a
  78.     Kaypro  10 with a 512 byte/sector hard disk a check is done to see
  79.     if the system to be loaded will over-write the Host Buffer area
  80.     (see memory layout for explanation), and if this occurs (generally
  81.     only with a 63K system) the Host buffer is shortened to 512 bytes and
  82.     floppy disk formats with > 512 bytes/sector are flagged as illegal.
  83.  
  84.     11/ The system is then read into memory and control is tranferred
  85.     to this system at the specified address.  If the supplied
  86.     TURBO-BIOS is used (highly recommended) then further initialization is
  87.     performed.  The nature of this initialization can be modified by
  88.     the supplied configuration program TURBOCFG.
  89.  
  90.  
  91. WARM BOOT
  92. On a Warm Boot an attempt is made to read from the logical "A" drive a
  93. fresh copy of the Command Processor and Basic Disk Operating System (BDOS).
  94. The configuration program TURBOCFG can be used to change the default drive
  95. for this operation.  We recommend using this advanced option only if you
  96. really know what you are doing.  An example may be to warm boot from the
  97. RAM disk without making it drive A. However, it must be SYSGENed before the
  98. first warm boot takes place.
  99.  
  100. DISK SELECT (and Deselect)
  101. Floppy drives have removable media while Hard Disks and Ram Disks have fixed
  102. media.  Drives with removable media are treated differently at select time.
  103. If this is the first select since a disk reset then we re-determine the
  104. format of the diskette in the drive.  (This operation can be inhibited
  105. under special circumstances).  If the format cannot be determined a BDOS
  106. Select error will occur, unlike most BIOS's which would generate a bad
  107. sector error.  Naturally a select error will also occur if an attempt is
  108. made to access a non-existent drive.
  109.  
  110. A period of time after the last disk operation, a deselect process occurs.
  111. This first makes sure the contents of the De-Blocking buffer are written
  112. back to the disk if required.  Then the floppy motor is turned off and if
  113. needed both floppy drives are deselected (lights turned off).  If Hard
  114. disks are present then each drive seeks the innermost formatted cylinder
  115. and then non-existent drive zero is selected.  This final step deselects
  116. the actual hard drives.
  117.  
  118.  
  119.  
  120.  
  121.            DEFINITION OF TABLES USED BY THE ROM
  122.  
  123.  
  124. DATA PARAMETER HEADERS (Commonly alled DPH's)
  125.  
  126. The DPH for each logical drive is extended by 2 bytes compared to the
  127. standard DRI definition (see CP/M manual if you are not familiar with
  128. this).  These 2 bytes preceed the normal 16 bytes.
  129.  
  130. The first byte contains information on the logical/physical mapping of the
  131. drives. 
  132. ------------------------------------------------------------
  133. Byte0    -    logical/physical drive mapping
  134.  
  135. physical:
  136.     bit 7        -- reserved for future use by Plu*Perfect Systems
  137.     bit 6,5,4
  138.             000  = Advent Products RAM disk (up to 2 MBytes)
  139.             001  = reserved for future use
  140.             010  = Physical Hard Drive 0    (up to 56 MBytes)
  141.             011  = Physical Hard Drive 1    ( "   "   "     )
  142.  
  143.             100  = Physical floppy 1    (48 or 96 TPI)
  144.             101  = Physical floppy 2
  145.             110  = Physical floppy 3
  146.             111  = Physical floppy 4
  147.  
  148.  
  149.  
  150. logical:
  151.     bit 3-0        logical drive A-P
  152.             0000    =    A
  153.             0001    =    B
  154.             0010    =    C
  155.               .             .
  156.               .        .
  157.               .        .
  158.             1111    =    P
  159.  
  160. ______________________________________
  161. In the second byte, some physical charactistics of the Drive are
  162. coded.
  163.  
  164. Byte1    -    drive characteristics byte defined as follows:-
  165. ****************FLOPPY DRIVE
  166.  
  167.     bit 7    -    0  = if drive is 48 tpi
  168.             1  =   "   "     96 tpi
  169.  
  170.  
  171.     bit 6    -    0  = redetermine media on fresh select(normal)
  172.             1  = don't redetermine media on fresh select
  173.                 (used when externally set disk format)
  174.  
  175.  
  176.     bit 5    -    unused
  177.  
  178. *****************HARD DRIVE
  179.     Advent Format -
  180.     bit 7,6,5    number of heads (minus one)
  181.  
  182.  
  183.     Kaypro 512 byte/sector format-
  184.     bit 7        0 = platter A (heads 0,1)
  185.             1 = platter B (heads 2,3)
  186.  
  187.     bit 6,5        unused
  188.  
  189. *****************RAM DRIVE
  190.  
  191.     bit 7,6,5    unused
  192.  
  193. ***********
  194. All drive types
  195.  
  196.     bit 4    0  = Use ROM DPB tables
  197.         1  = Use RAM DPB tables
  198.  
  199.     bits 3,2,1,0    Use DPB 0-15 from rom or ram table
  200.  
  201.  
  202. Bytes
  203. 2 - 18    -    Standard DRI data parameter header. 
  204.  
  205.  
  206.  
  207. DATA PARAMETER BLOCK (DPB's)
  208.  
  209.  
  210. The DPB's used by the ROM are 3 bytes longer than the standard definition
  211. given by DRI (see CP/M manual if you are not familiar with this).  These 3
  212. extra bytes precede the normal 15 bytes.
  213.  
  214. There is a word which points to a sector translation table address.  This
  215. may be zero,  a ROM address which is not accessable to external programs
  216. without bank switching, or an externally loaded table in high RAM.
  217.  
  218. There is then a Byte which characterizes the type of format associated with
  219. this DPB. The bits in this byte are interpreted as follows:
  220.  
  221.  
  222. 1/ For Floppy Drives: (Media)
  223.  
  224.     bit 7    -    0  = disk is in 48 tpi format
  225.             1  = disk is in 96 tpi format
  226.  
  227.     bit 6    -    0  = standard data sense
  228.             1  = inverted data bus (only available on 84 ROM)
  229.                 (used only on machines that used chips
  230.                 like 1771/91 without inverters)
  231.  
  232.     bit 5    -    1  = single density
  233.             0  = double density
  234.  
  235.     bit 4,3,2   -    Use algorithm 0-7 to compute physical
  236.             cylinder, track, sector and side. 
  237.             Note algorithm 7 is reserved for external
  238.             code, which the user may load.  See later for
  239.             definition and how to load this code.
  240.  
  241.         Predefined Algorithms
  242.         -----------------------------------------------
  243.         000    - for 512 byte Kaypro hard disk format
  244.                         (see below)
  245.         -----------------------------------------------
  246.         001    - for 512/1024 byte Advent hard disk formats
  247.                         (see below)
  248.         -----------------------------------------------
  249.         010    - single sided floppy
  250.             phy.cylinder    =track
  251.             phy.track    =track
  252.             phy.sector    =sector
  253.             phy.head(side)    =0
  254.         -----------------------------------------------
  255.         011    - double sided Kaypro/Advent floppy
  256.             bias        =10
  257.             phy.cylinder    =int(track/2)
  258.             phy.track    =phy.cylinder
  259.             phy.head(side)    =mod(track,2)
  260.             phy.sector    =sector + side*bias
  261.         -----------------------------------------------
  262.         100    - Micro Cornucopia/Advent 96 tpi,
  263.             Same as Kaypro except
  264.             bias        =20
  265.         -----------------------------------------------
  266.         101    - double sided (single long track)
  267.             Note that zero based sector numbering assumed,
  268.             fits Legacy formats
  269.  
  270.             phy.cylinder    =track
  271.             phy.track    =track
  272.             phy.sector    =sector
  273.             phy.head(side)    =0 if sector < phy_sect/side
  274.                     =1 if sector >=  phy_sect/side
  275.         -----------------------------------------------
  276.         110    - double sided (odd tracks on back but no sector skew)
  277.             Same as Kaypro except
  278.             bias        =0
  279.         -----------------------------------------------
  280.         111    - External routine, parameters
  281.               in registers on call and return.
  282.  
  283.             ENTRY                EXIT
  284.     HL    none                physical cylinder to seek
  285.     DE    HSTTRK                physical track for floppy ctrl
  286.     B    HSTDRV (dph byte 1)        physical head (side)
  287.     C    HSTSEC                physical sector
  288.  
  289.         ------------------------------------------------
  290.  
  291.     bit 1,0    -    00 = 128 physical sector length
  292.             01 = 256
  293.             10 = 512
  294.             11 = 1024
  295.  
  296. -------------------------------------
  297. 2/ For Hard Disk Drives:
  298.  
  299.  
  300.  
  301.     bit 7,6,5        unused
  302.  
  303.  
  304.             (These bytes compatible with floppy use)
  305.     bit 4,3,2    000    -Kaypro 10 original format
  306.                512 byte  sectors (algorithm for track sector)
  307.                 phy.cylinder    = (track + offset)/2
  308.                 offset = 0        if track < 4
  309.                 offset = track - 4     if 3 < track < 8
  310.                 offset = 4        if track > 7
  311.  
  312.                 phy.track    = n/a
  313.                 phy.sector    = sector
  314.                 phy.head    = mod(track+offset,2)
  315.                              + drvbyt(7)*2
  316.                 drvbyt(7) is bit 7 of byte 1 of DPH
  317.  
  318.             (note we abandon trying to maintain
  319.             duplicate directory on back of platter,
  320.             if problems, then reformat with our new
  321.             format)
  322.  
  323.             001    -Advent Hard disk format
  324.                 512/1024 byte sectors
  325.                 phy.cylinder    = trackx/#heads
  326.                 phy.track    = n/a
  327.                 phy.sector    = sector
  328.                 phy.head    = mod(trackx,#heads)
  329.  
  330.             (Note trackx = badfnc(track).  This corrects
  331.             desired track for bad tracks.  The bad track
  332.             function is performed by the following algorithm.
  333.  
  334.             I:=0
  335.             TRACKX:=TRACK
  336.             DO WHILE(BADTRK(I) >= TRACK)
  337.                 TRACKX:=TRACKX +1
  338.                 I:=I + 1
  339.             END
  340.  
  341.  
  342.             Where badtrk(i) is a list of bad physical
  343.             tracks which is terminated with FFFFH entry.
  344.             We support a maximum of 126 bad tracks per physical
  345.             drive.)
  346.  
  347.     bit 1,0    -    00 = not supported
  348.             01 = not supported
  349.             10 = 512 byte sectors (only available on 84 ROMs)
  350.             11 = 1024 byte sectors
  351.  
  352. ------------------------------------------------
  353. 3/ Advent Ram Disk Drive:
  354.  
  355.     bit 7,6,5,4,3,2    unused
  356.  
  357.  
  358.     bit 1,0    -    00 = 128 byte sectors
  359.             01 = not supported
  360.             10 =    "    "
  361.             11 =    "    "
  362.  
  363. -------------------------------------------------
  364.  
  365. In ROM we have a maximum of 16 DPB's
  366. DPB#
  367.  
  368. 0    Standard Kaypro SS (512 byte sectors)                floppy
  369. 1    Standard Kaypro DS (512 byte sectors)                floppy
  370. 2    Advent SSDD 448 tpi(1024 byte sectors) ( handles Osborne SSDD)    floppy
  371. 3    Advent DSDD 48tpi (1024 byte sectors)                floppy
  372. 4    Advent DSDD 96tpi (1024 byte sectors)                floppy
  373. 5    Micro C DSDD 96tpi (512 byte sectors)                floppy
  374. 6*    Xerox 820 SSSD    (128 byte sectors)                floppy
  375. 7*    Osborne SSSD (256 byte sectors)                    floppy
  376. 8*    Epsom QX-10 (U.S. format - not European)            floppy
  377. 9*    Kaypro 10 (original hard disk format)                hard
  378. 10*
  379. 11*
  380. 12*
  381. 13*        reserved for future expanison
  382. 14*
  383. 15*
  384.  
  385. * only available on 84 ROMS
  386.  
  387.  
  388. In high memory we store the DPB's who have to be dynamically changed/added.
  389. The first DPB is a reserved entry for use by external programs who wish
  390. to set up a foreign floppy format for the ROM to work with.
  391.  
  392. The second is always the RAM disk if it exists.  Following this are the
  393. various Hard disks (Advent Format only) which are actually read in from the
  394. parameter sector of the hard disk.  These DPB's are stored in descending
  395. memory order (unlike DPH's above).
  396.  
  397.  
  398.  
  399.  
  400.               HIGH MEMORY ARRANGEMENT
  401.  
  402. The ROM uses the very top of the Kaypro RAM for its working storage.  The
  403. amount of memory used depends on the physical configuration, but in all
  404. cases, memory is dynamically allocated at cold boot time so that the amount
  405. of memory available to user programs is maximized.  The very top of memory
  406. is of fixed layout (which varies slightly between 83 and 84 ROMs) and this
  407. is useable by programs which need to find out about the current environment.
  408.  
  409.  
  410. topmem        equ    0FFFFH
  411. ;*************************
  412. ;ROMID is 8 byte string of following layout
  413. ;        db    checksum    ;zero sum of top 8 bytes in memory
  414. ;        jmp    romentry    ;general ROM entry point
  415. ;        db    version        ; BCD ver.rev, (hi bit set '84)
  416. ;        db    'PPS'
  417. ;*************************
  418. ;fixed pointers and storage which are guarranteed to be preserved in
  419. ;future releases of the ROM
  420.  
  421. dphptr:    dw    numdrv        ;pointer to start of DPH table
  422. dpbptr:    dw    numdpb        ;pointer to start of RAM DPB's
  423. hstptr:    dw    hstbuf        ;pointer to Host buffer
  424.                 ;This is the lowest area used by ROM
  425. intptr:    dw    intvec        ;pointer to start of interrupt vector
  426. extptr:    dw    tsalgr        ;pointer to external trk/sctor code
  427. hrdptr:    dw    badtr0        ;pointer to hard/floppy disk parameters
  428.  
  429. ;fixed storage that varies between 83 and 84 machines
  430.     83                    84
  431.      --------                      ---------
  432. safptr:    dw    safcod                dw    x    ;reserved
  433. cursor:    dw    x            cursor:    dw    x    ;video cursor
  434.                     clkent:    dw    clkdrv    ;routine to
  435.                                 ;clock
  436.                     curmin:    db    minutes    ;current time
  437.                         db    hours
  438. ;***********************
  439.     Interrupt vector for all devices.
  440.     83                84
  441.      --------                 --------
  442.                     pioBvc    ;modem dialer
  443.                     pioAvc    ;RTC interface
  444.  
  445.                     sioCv3    ;serial printer
  446.                     sioCv2
  447.                     sioCv1
  448.                     sioCv0
  449.  
  450.     pioDvc    ;unused            sioDv3    ;Modem or Unused serial
  451.     pioCvc    ;printer        sioDv2
  452.     pioBvc    ;unused            sioDv1
  453.     pioAvc    ;system port        sioDv0    ;
  454.  
  455.     sioAv3                sioAv3    ;serial data char rec.(error)
  456.     sioAv2                sioAv2    ;serial data char rec.
  457.     sioAv1                sioAv1    ;serial data ext. status
  458.     sioAv0                sioAv0    ;serial data Tx buffer
  459.  
  460.     sioBv3                sioBv3    ;keyboard char rec. (error)
  461.     sioBv2                sioBv2    ;keyboard char rec.
  462.     sioBv1                sioBv1    ;keyboard ext. status
  463.     sioBv0                sioBv0    ;keyboard Tx buffer
  464.  
  465. intvec:                        ;start of vectors aligned on 
  466.                         ;16 byte boundary
  467.  
  468. ;*********************
  469.     Stack space for interrupt handlers and ROM
  470.  
  471. ;********************
  472.     Code, DIRBUF and other variables
  473. ;********************
  474.     Area for externally defined floppy drive
  475.     information
  476.  
  477.  
  478. xtran:    ds    36        ;36 bytes of physical translation table
  479.  
  480.     ds    55        ;SPACE for code referred by labels
  481.                 ; invmap and mapit
  482.  
  483.     db    fmt                ;current format number
  484.     jmpr    invmap                ;inverse trk/sector/side
  485. tsalgr:    jmpr    mapit                ;cylinder/sector/head
  486. ;********************
  487. Miscellaneous disk/video/and other variables
  488. which may change with future ROMS implementation.
  489.  
  490.         -----------
  491. However the following structure will remain intact though
  492. it will doubtless move.
  493.  
  494. disblk:    db    ..    ;84 machine video blanking disable (00/FF)
  495.                             (not currently used)
  496.  
  497. smflag:    db    ..    ;84 machine retricted to 512 byte sectors
  498.  
  499. stldly:    db    z    ;current floppy head settling delay (ms)
  500. hldly:    db    y    ;current floppy head load delay(ms)
  501. fstprt:    db    x    ;current floppy step rate (ms)
  502.  
  503. ftime4:    db    x,y,z    ;array of floppy time constants for each drive
  504. ftime3:    db    x,y,z
  505. ftime2:    db    x,y,z
  506. ftime1:    db    x,y,z
  507.  
  508. muxflg:    db    ..    ;flag for presence of Advent decoder board
  509. fstat:    db    ..    ;current floppy arrangement
  510.             ;7 - Drive 4 96 tpi
  511.             ;6 - Drive 4 exists
  512.             ;5 - Drive 3 96 tpi
  513.             ;4 - Drive 3 exists
  514.             ;3 - Drive 2 96 tpi
  515.             ;2 - Drive 2 exists
  516.             ;1 - Drive 1 96 tpi
  517.             ;0 - Drive 1 exists (always true)
  518.  
  519. wdflag:    db    ..    ;7 - if parameter sector successfully read
  520.             ;0 - WD 1002 controller detected
  521.  
  522. sltmsk:    db    ..    ;floppy select mask
  523.             ; 00000011B    ;normal 2 lines
  524.             ; 00000001B    ;Kaypro 10 hard disk connected
  525.  
  526. precp1:    db    ..    ;Hard Drive 2 precomp cylinder(coded)
  527. step1:    db    ..    ; "     "   " step rate (coded)
  528. mxcyl1:    dw    ...    ; "     "   " maximum formatted cylinder
  529. badtr1:    dw    list1    ; "     "   " pointer to start of bad track table
  530.  
  531. precp0:    db    ..    ;as above for drive 1
  532. step0:    db    ..
  533. mxcyl0:    dw    ...
  534. badtr0:    dw    list0    ;POINTED TO BY HRDPTR AT TOP OF MEMORY
  535.  
  536.  
  537. polflg:    db    ..    ;set to 00 if type-ahead keyboard (else FF)
  538. belchr:    db    ..    ;bell character for keyboard, may have click bit
  539.             ---------------
  540.  
  541. ********************************
  542.  
  543.         **************************************
  544.         *  Run time determined storage areas *
  545.         **************************************
  546.  
  547.  
  548.  
  549. Actual list of n*18 drive descriptor bytes where n is logical number of
  550. drives.  These are arranged as described above.
  551.  
  552. numdrv:        db    n        ;logical number of drives
  553.                     ;pointed to by dphptr
  554.  
  555.  
  556.     Followed by DPH for each drive as described above.
  557.     NOTE that DPH's ascend in memory above the NUMDRV byte.
  558.  
  559.  
  560. ************************************************************
  561. In RAM DPB tables decribed above -- note they descend in memory
  562. though the number of DPBs  byte is still at bottom of list
  563.  
  564. each DPB of following layout
  565.  
  566.     dw    xtran ptr
  567.     db    media byte
  568.     ds    15            ;normal DRI definition
  569.  
  570. Actual list of RAM dpb's in following order (descending in memory)
  571.  
  572. 0 -    always externally definable floppy
  573. 1 -    RAMDISK (computed at cold boot)
  574.  
  575. 2-15    up to 14 more formats read in from hard disk
  576.     parameter sector
  577.  
  578.     (future ROM releases may limit number of logical hard disks to 13)
  579.  
  580. numdpb:        db            ;number of RAM dpbs in this
  581.                     ;configuration, the first
  582.                     ;is always the externally
  583.                     ;definable floppy
  584.  
  585. ;***********************
  586. ;Hard Disk bad track lists  (if any)
  587.  
  588. list1:    dw    ...
  589.     dw    ...
  590.     dw    FFFFH
  591.  
  592. list0:    dw    ...
  593.     dw    ...
  594.     dw    FFFFH
  595. ************************
  596. hstbuf:    ds    1024            ;deblocking buffer
  597.                     ;init code changes to 512
  598.                     ;bytes if system loaded too high
  599.                     ;on Kaypro 10 with 512
  600.                     ;byte sectors
  601.  
  602. ************************
  603.  
  604. lowest area used in high Ram by ROM
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.             ADVENT PRODUCTS ELECTRONIC RAM DISK
  612.  
  613. The RAM disk is located at ports 88H thru 8BH.
  614.  
  615.  
  616. 88H    -    data bi-directional
  617. 89H    -    sector (6 lo bits only)
  618. 8AH    -    track register (7 lo bits per board, hi bit board select)
  619. 8BH    -    status register    (bit 0,1  00,01,10,11 are 256,512,768,1024K
  620.             respectively.  Bit 2 is 0 if board is present and
  621.             otherwise is pulled up.
  622.  
  623.  
  624. Status register returns
  625. xxxxx000    = 256k
  626. xxxxx001    = 512k
  627. xxxxx010    = 768k
  628. xxxxx011    =1024k
  629. xxxxx1xx    = ram disk not present
  630.  
  631. Then we write 8AH with 80H and repeat read of 8BH for second board.
  632.  
  633.  
  634. RAMDISK has following DPH
  635.  
  636. XLT ptr        0000        ;no sector translation
  637. SCRATCH        0000
  638.         0000
  639.         0000
  640.         DIRBUF        ;pointer to directory buffer
  641.         CURDPB        ;always points to DPB current
  642.         0000        ;no directory checksum
  643.         ALVRAM        ;pointer to size dependent area
  644.  
  645.  
  646. RAMDISK has following DPB
  647. XTRN:    dw    0000        ;no sector translation
  648. MEDIA:    dw    00        ;128 byte sectors
  649. SPT:    dw    64
  650. BSH:    db    x        ;x = 3 for 256K
  651.                 ;  = 4 for 512K
  652.                 ;  = 5 for 768,1024K
  653.                 ;  = 6 for > 1024K
  654.  
  655. BLM:    db    2**x - 1
  656. EXM:    db    2**(x-3) - 1
  657. DSM:    dw    2**(6-x).(n+1).2**5 - 1) - 1
  658. DRM:    dw    2**(3+x) - 1
  659. AL0:    db    0C0H
  660. AL1:    db    000H
  661. CKS:    dw    0000
  662. OFF:    dw    0001
  663.  
  664.  
  665.  
  666. Sector 63 of track 0 is initialized with a copy of the first
  667. 128 byte of the ROM.  On subsequent resets this is compared and
  668. if a match is detected the directory of the RAM disk is not erased.
  669. *************************************************
  670.  
  671.  
  672.  
  673.  
  674.                FLOPPY DISK FORMATS
  675.  
  676. The Turbo ROM will recognize and can use directly the following floppy disk
  677. formats:- 
  678.  
  679.     83                    84
  680.      ---------                      ---------
  681. Kaypro SSDD                Kaypro SSDD
  682. Kaypro DSDD                Kaypro DSDD
  683. Advent SSDD                Advent SSDD
  684. Advent DSDD 48                Advent DSDD 48
  685. Advent DSDD 96                Advent DSDD 96
  686. Micro Cornucopia 96            Micro Cornucopia 96
  687.  
  688.                     Epson QX-10 DSDD 48 (U.S.)
  689.                     Osborne SSSD
  690.                     Xerox 820-1 SSSD
  691.  
  692.  
  693. In addition any other CP/M 5.25" soft sector format may be set up using the
  694. TURBOSET program which is available separately as part of the Plu*Perfect
  695. Systems' MULTI-COPY package.
  696.  
  697.  
  698. The Advent formats mentioned above have the following description.
  699.  
  700. 1) SSDD
  701.  
  702.     Physical Sector Length        1024 bytes
  703.     Physical Sector Order        1,4,2,5,3
  704.  
  705.     Logical Sectors/Track        40
  706.     Number of Cylinders        40
  707.     
  708.     Reserved Tracks            3
  709.     CP/M allocation size        1K
  710.     Directory Entries        64
  711.     Reserved Directory Groups    2
  712.     Total size            185K
  713.  
  714.     *note that this format is identical to the Osborne SSDD
  715.     except for the physical sector order
  716.  
  717. 2) DSDD 48
  718.  
  719.     Physical Sector Length        1024 bytes
  720.     Physical Sector Order        1,4,2,5,3    -side 0
  721.                     11,14,12,15,13    -side 1
  722.  
  723.     Logical Sectors/Track        40
  724.     Logical Tracks            80
  725.     Number of Cylinders        40
  726.     Reserved Tracks            2
  727.     CP/M allocation size        2K
  728.     Directory Entries        256
  729.     Reserved Directory Groups    4
  730.     Total size            390 K
  731.  
  732.  
  733. 3) DSDD 96
  734.  
  735.         Physical Sector Length        1024 bytes
  736.     Physical Sector Order        1,4,2,5,3    -side 0
  737.                     21,24,22,25,23    -side 1
  738.  
  739.     Logical Sectors/Track        40
  740.     Number of Cylinders        80
  741.     Number of Logical Tracks    160
  742.  
  743.     Reserved Tracks            2
  744.     CP/M allocation size        2K
  745.     Directory Entries        256
  746.     Reserved Directory Groups    4
  747.     Total size            790 K
  748.  
  749.  
  750.  
  751.  
  752.              TURBO ROM VIDEO FEATURES
  753.  
  754.  
  755. The Turbo ROM provides a number of new video features compared with the
  756. standard Kaypro.  These differ between the 83 and 84 versions.
  757.  
  758. Video Blanking:
  759.  
  760. Both ROM's provide a screen saving video blanking after about ten minutes
  761. of waiting for keyboard input.  However, on 83 machines this feature
  762. requires a modification to the video circuit.  This is optional and the
  763. blanking will not occur unless the change has been made.  Because the ROM
  764. has no way of knowing whether the change has been made, the unblanking
  765. keystroke will not be ignored as it is with the 84 ROM.
  766.  
  767. The 83 video change is made simply by purchasing a replacement character
  768. generator ROM and putting it into the circuit.  Alternatively, people with
  769. electronic circuit experience, can make a small modification to the main
  770. circuit board to achieve the same effect.  Details are available on request.
  771.  
  772. Screen Dump:
  773.  
  774. While not a direct feature of the Turbo ROM, the TURBO BIOS supplied with
  775. the ROM has character (not graphic) screen dump to printer capability.  The
  776. ROM actually provides the support for this feature but it must be
  777. externally activated, for more details see the source code to the BIOS and
  778. the following description of the ROM Entry Points.  The Screen Dump must be
  779. explicitly enabled by using TURBOCFG.
  780.  
  781.  
  782. Changes to Video Control Codes and Escape Sequences:
  783.  
  784. Some changes to the behaviour of the video compared to the standard Kaypro
  785. ROM's have been made.  These are generally for consistency or to correct
  786. bugs in the original implementation.
  787.  
  788. a) Control Characters that are not used by the video are now "swallowed"
  789. rather than generating Greek characters or Fine Line graphics.
  790.  
  791. b) On 83 machines the underline cursor no longer destroys true underline
  792. characters on the screen when moved through their positions.
  793.  
  794. c) On 84 machines the ESC G/ESC A sequences are implemented identically to
  795. the 83 machines.  That is the 32 characters (lower case) from the grave
  796. accent (60 Hex) through the DELete (7F Hex) will produce the the
  797. corresponding graphic character in position 0-31 (decimal) in the character
  798. ROM if the video sequence ESC G has been recieved.  When the sequence ESC A
  799. is recieved the lower case characters produce themselves.  On the 83
  800. character ROM's thes 32 characters are normally greek and mathematical
  801. symbols.  On the 84 character ROM's these characters are normally the Fine
  802. Line graphic set.  On Foreign Language Kaypro's these characters are
  803. selected european characters.
  804.  
  805. d) On 84 machines the sequences ESC B 7/ESC C 7 have a slightly different
  806. effect.  The standard video defaulted to a 24 line scrolling window with
  807. the 25th line also scrolling.  The Turbo ROM is either a 25 line scrolling
  808. display or a 24 line scrolling display with the 25th line locked.  The
  809. difference is minor unless you wish to reconfigure some of your application
  810. programs to make use of the 25 line screen.  Note that the ROM scrolling is
  811. much faster if a 25 line scrolling region is enabled.  Also, scrolling is
  812. much faster if no video attributes have been used since the last clear screen.
  813.  
  814. New Features:
  815.  
  816. a) Hard Tabulations.  The standard video ignored the tabulation character,
  817. "^I".  Both 83 and 84 ROM's expand this to 8 column fixed tabs.  This is
  818. mostly of use to user's of Plu*Perfect Systems NOTEPAD module of the
  819. Backgrounder, as most programs expand tabs in software.
  820.  
  821. b) Insert and Delete Character.  Two new control codes are now interpreted
  822. to insert and delete characters. "^A" will cause the next character
  823. recieved to be inserted at the current cursor position.  "^B" will delete the
  824. character currently at the cursor position.  Both of these controls are
  825. limited to the current line, i.e. inserting characters will move the
  826. characters to the right of the cursor but will not cause any that are
  827. displaced past the end of the line to wrap.  These new features are again
  828. of interest to users of Plu*Perfect Systems' NOTEPAD module of the
  829. Backgrounder.
  830.  
  831. c) On 84 machines there is now a method of dynamically modifying the type
  832. of cursor used.  ESC U n will cause a new cursor whose characteristics are
  833. defined by the ascii character "n".  The cursor is bit encoded into this
  834. character and the bit positions have the following meaning.
  835.  
  836.     bits 6,5        - blinking
  837.             00 - no blinking
  838.             01 - no cursor
  839.             10 - fast blinking
  840.             11 - slow blinking
  841.    
  842.     bits 4,3,2,1,0        - cursor height
  843.  
  844.             00000 - full block cursor (16 scan lines)
  845.             00001 -
  846.             00010 -
  847.  
  848.             .....
  849.  
  850.             01110 - thicker underline     (2 scan lines)
  851.             01111 - thin underline cursor (1 scan line)
  852.  
  853. d) Disable on screen clock display.  On 84 machines which have either a
  854. built in Kaypro clock or and Advent Products clock, the on screen display
  855. of the time may be temporarily disabled with
  856.  
  857.     ESC C 8  and re-enabled with ESC B 8
  858.  
  859. Note that the clock display is automatically disabled if a 25 line
  860. scrolling screen is selected.
  861.  
  862. e) Switch character generators. On 84 machines which are correctly wired,
  863. an altenate character set may be chosen with the following
  864.  
  865.     ESC B 9 and the original re-selected with ESC C 9
  866.  
  867. This additional character set would normally reside in the other half of a
  868. 27644 character ROM.  True 84 machines are actually wired to accept this
  869. chip but unfortunately Kaypro did not test the circuit and a minor
  870. modification is required.  On older Kaypro 10's a small circuit
  871. modification is required, please contact Advent Products if you wish to
  872. make use of this feature of the TURBO ROM.
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.               ENTRY POINTS INTO THE TURBOROM
  880.  
  881. The TURBO ROM in general preserves the standard entry points that have been
  882. used with only small differences by all CP/M Kaypros since the KAYCOMP.
  883. There are naturally some extensions which provide additional features.  One
  884. major addition is the creation of a standard entry mechanism that can be
  885. used regardles of whether an 83 or 84 machine is being used.
  886.  
  887. If a utility wishes to call the ROM it should load the page zero address it
  888. wishes to call into the L register and then call 0FFFCH in high memory. 
  889. All the bank and stack switching tasks will be automatically taken care of. 
  890. However, direct calls to the ROM should be avoided in normal application
  891. programs as they severely limit portability of the program.
  892.  
  893. Entry Points:
  894. 0000    Machine Restart,  cold boot
  895. 0003*    Disk Reset
  896. 0006    Initialized video driver
  897. 0009*    Initialize unit record hardware    
  898. 000C*    Deactivate Host buffer if not written (HOME)
  899. 000F    Select disk for next access
  900. 0012    Set Track for next disk access
  901. 0015    Set Sector for next disk access
  902. 0018    Set DMA address for next disk access
  903. 001B    Read Sector
  904. 001E    Write Sector
  905. 0021*    Sector Translation (dummy, delayed to SETSEC)
  906. 0024    Turn on the Floppy drive motor
  907. 0027*    Turn off floppy motors, Deselect hard drives, flush Host buffer
  908. 002A    Keyboard input status
  909. 002D    Keyboard input
  910. 0030    Keyboard serial output, use with caution
  911. 0033    Serial Data port input status (TTY)
  912. 0036    Serial Data port input (TTY)
  913. 0039    Serial Data port output (TTY)
  914. 003C    Centronics printer output status (LPT)
  915. 003F    Centronics printer output (LPT)
  916. 0042    Serial Data port output status (TTY)
  917. 0045    Video output (CRT)
  918. 0048*    Ten millesecond delay
  919. 004B#    Serial Printer input status (UL1)    [83=TTY]
  920. 004E#    Serial Printer input (UL1)        [83=TTY]
  921. 0051#    Serial Printer output (UL1)        [83=TTY]
  922. 0054#    Serial Printer output status (UL1)    [83=TTY]
  923. 0057#    Reload system
  924. 005A#    Get next screen dump character
  925. 005D#    Set cursor type
  926. 0060#    One millesecond delay
  927. 0063#    Initialize DPH -----DO NOT USE
  928.         83 Roms                    84 Roms
  929. 0067#    Hard Disk Seek -----DO NOT USE        0067#    Kaypro Clock
  930. 006A#    Hard Disk Setup-----DO NOT USE        006A#    Advent Clock
  931.                         006D#    Kenmore CLock
  932.  
  933.  
  934.  
  935.  
  936.  
  937. Rom Entry Point Specifications:
  938. (* Changes from Original Kaypro)
  939. (# New entry points)
  940.  
  941. 0003    Disk Reset --
  942.                 ENTRY - none,        EXIT - none
  943.             Simply resets the Host Buffer Active flag and the
  944.             Unallocated Sector Counter.  This follows exactly the
  945.             definition in the latest versions of DRI documentation
  946.             (warm boot). The Kaypro ROM's used this entry point
  947.             for other internal purposes.
  948.  
  949. 0009    Initialize Hardware --
  950.                 ENTRY -- DE points to list of port,data pairs
  951.                      A  number of entries in list (len/2)
  952.                     (see TURBO-BS.PRN for example of use)
  953.                 EXIT  -- none
  954.  
  955.             This entry allows the physical devices to be set up
  956.             with any byte pattern.  The original Kaypro entry
  957.             point always used its default values.
  958.  
  959.  
  960. 000C    Home --
  961.                 ENTRY -- none,        EXIT -- none
  962.  
  963.             This entry point follows the DRI definition, of
  964.             reseting the Host Buffer Active flag if the buffer
  965.             does not have a pending write.  It also calls the
  966.             set track entry with an argument of zero.  The
  967.             Kaypro ROM's in many cases also performed a
  968.             physical seek to track zero.  This is unnecessary.
  969.  
  970. 000F    Select Disk --        ENTRY -- C - desired logical drive 0-15
  971.                      E - bit 0=0 if this is first select
  972.                             else bit 0=1
  973.  
  974.                 EXIT  -- HL = points to DPH for this drive
  975.                         if select was successful
  976.                         = 0000 if either drive does not
  977.                         exist or the floppy format was
  978.                         not determinable
  979.  
  980.             The main differences from almost all of the Kaypro
  981.             ROM's is the correct use of the lo order bit of the
  982.             E register as specified by Digital Research.  This
  983.             means that any program that correctly uses the BDOS
  984.             facilities to log in a new drive will have the
  985.             media correctly determined after a disk change.  On
  986.             the Kaypro ROM's the only time a change could be
  987.             made between say single and double sided disks was
  988.             after a warm boot.  Popular programs like SWEEP
  989.             could not be used with a mixture of disk formats.
  990.             (Note that Plu*Perfect Systems' CP/M enhancements
  991.             included a BDOS patch to correct this, when the
  992.             TURBOBIOS is installed this patch is overwritten and
  993.             original contents replaced)
  994.  
  995. 0015    Set Sector --
  996.                 ENTRY -- BC = logical sector for next request
  997.  
  998.                 EXIT  -- none
  999.  
  1000.             This routine combines the functions of the old
  1001.             Sector Translation routine.  It must be called
  1002.             after the select disk function has been called, so
  1003.             that the correct sector translation table can be
  1004.             used. This is identical to the BDOS use of the
  1005.             original two separate entry points.
  1006.  
  1007.  
  1008. 0021    Sector Translation --
  1009.                 ENTRY -- BC = logical sector for next request
  1010.                      DE = pointer to translation table
  1011.  
  1012.                 EXIT  -- HL = logical sector
  1013.  
  1014.             This routine is a totally dummy routine and for
  1015.             efficiency all of its functions are now performed
  1016.             in the Set Sector Routine.
  1017.  
  1018.  
  1019. 0027    Motor Off --
  1020.                 ENTRY -- none,        EXIT -- none
  1021.  
  1022.             Before performing its major deselect function this
  1023.             entry check the Host Buffer for a pending write and
  1024.             if there is one the buffer will be written to disk.
  1025.             This ensures that whenever the select lights are
  1026.             off that disk accurately reflects the contents of
  1027.             the Host Buffer. It is thus good practice to remove
  1028.             floppy diskettes from the drives only when the select
  1029.             light(s) are off.
  1030.  
  1031.             This entry will then turn off the floppy drive spindle
  1032.             motor, and, if the Advent Personality Decoder board
  1033.             is not present will deselect the floppies so that
  1034.             the select light goes off.  If Hard Disks are
  1035.             present then each drive seeks its innermost
  1036.             cylinder and then non existant drive 0 is selected
  1037.             which will turn off the select lights on the drives.
  1038.             
  1039. 0048    Ten Millesecond Delay --
  1040.                 ENTRY --   A = multiplier for delay
  1041.  
  1042.                 EXIT  -- none
  1043.  
  1044.             This entry point provides the correct delay
  1045.             regardless of processor clock speed.  All Kaypro
  1046.             ROM's assume a 4 MHz clock.  In addition, if the
  1047.             keyboard type-ahead is enabled then the keyboard is
  1048.             continually polled during the delay and any
  1049.             keypresses are serviced and placed in the buffer.
  1050.             The accuracy of this timer is within 4%, note that
  1051.             it reflects the effective CPU speed at cold boot
  1052.             and if the speed is changed (as is possible with some
  1053.             speed up modifications) the timing will no longer
  1054.             be accurate.
  1055.  
  1056. (# New Entry Points available in TURBO ROM)
  1057.  
  1058. 004B    Serial Printer input status --
  1059.                 ENTRY -- none
  1060.                 EXIT  --  A = 00 and Z if no character ready
  1061.                         = FF and NZ if character ready
  1062.  
  1063.             This entry allows use of the extra serial printer port
  1064.             on 84 machines.  On 83 ROMs this entry is double
  1065.             mapped to the serial data port.
  1066.  
  1067. 004E    Serial Printer port input --
  1068.                 ENTRY -- none
  1069.                 EXIT  -- A = character recieved
  1070.  
  1071.  
  1072. 0051    Serial Printer port output --
  1073.                 ENTRY -- C = character to be sent
  1074.                 EXIT  -- none
  1075.  
  1076. 0054    Serial Printer output status --
  1077.                 ENTRY -- none
  1078.                 EXIT  -- A = 00 and Z if not ready
  1079.                        = FF and NZ if ready for next
  1080.  
  1081. 0054    Reload System  --
  1082.                 ENTRY -- DE = Address to load system tracks
  1083.                      B  = number of sectors to load
  1084.                      C  = starting sector to load
  1085.                      A  = logical drive to load from
  1086.  
  1087.                 EXIT -- none,  any errors force cold boot
  1088.  
  1089.             This entry point will reload all or part of the
  1090.             operating system from the system tracks of the
  1091.             specified drive.  The usual conditions of 40
  1092.             sectors/track will cause floppy type load and > 55
  1093.             sectors/track will cause RAMDISK or Hard disk reload.
  1094.  
  1095. 005A    Next Screen Dump Character --
  1096.                 ENTRY -- C = FF if first screen character
  1097.  
  1098.                 EXIT  -- A = character (masked with 7FH)
  1099.                      L = column (00 means new line)
  1100.                      Z flag set if end of screen
  1101.  
  1102.             This entry allows external programs to read the
  1103.             screen whether this is an 84 or 83 machine.  The
  1104.             flashing attirbute on the 83 machines is removed and
  1105.             on 84 machines all pixel graphics are replaced with
  1106.             blanks.  It is the responsibilty of the calling
  1107.             program to insert new line characters if needed.
  1108.  
  1109. 005D    Set Cursor Type ---
  1110.                 ENTRY --  A= cursor definition
  1111.  
  1112.                 EXIT  -- none
  1113.  
  1114.             This entry is machine dependent.  On 83 mahines the
  1115.             definition is simply the character itself (with or
  1116.             without the hi bit set for flashing).  On 84
  1117.             machines the definition character has the same
  1118.             meaning as the "n" used in the ESC U n cursor
  1119.             setting sequence.
  1120.  
  1121. 0060    One Millesecond Delay  --
  1122.                 ENTRY --  A=delay multiplier
  1123.                 EXIT  --  none
  1124.  
  1125.             See description of Ten Millesecond above.
  1126.  
  1127. 0063-6A on 83 machines are not to be used.  These are used internally by
  1128. the ROM initialization code and will have unpredictable results if called
  1129. by external routines.
  1130.  
  1131.     --  84 machines only ---
  1132. All the entry points below have the same parameter interface
  1133.                 ENTRY --  none
  1134.                 EXIT  --  H = BCD hours
  1135.                       L = BCD minutes
  1136.  
  1137.  
  1138. 0067    Kaypro Clock --
  1139.             Returns current time from built-in Kaypro clock
  1140.  
  1141. 006A    Advent Products Clock --
  1142.             Returns current time from Advent clock
  1143.  
  1144. 006D    Kenmore Z- TIME Clock --
  1145.             Returns current time from Kenmore clock
  1146.  
  1147.  
  1148. NOTE: Clock must exist as no internal checking is done, and unpredictable
  1149. results are possible if wrong clock is read.
  1150.  
  1151. r itself (with or
  1152.             without the hi bit set for flashing).  On 84
  1153.             machines the definition character has the same
  1154.             meani