home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / KAYPRO / 84KP256.LBR / RAMDRIVE.MAC < prev   
Text File  |  2000-06-30  |  16KB  |  593 lines

  1.     TITLE    RAMDRIVE.MAC
  2. ;
  3. ;***********************************************************************
  4. ;
  5. ;    RAMDRIVE - A program that permits extended memory to function as
  6. ;    a fast disk drive.  This program does not require modification
  7. ;    of the existing BIOS.
  8. ;
  9. ;    Copyright 1982, by
  10. ;    Herbert B. Shore
  11. ;    Department of Physics
  12. ;    San Diego State University
  13. ;    San Diego, CA 92182
  14. ;    (619) 265-6159
  15. ;
  16. ;    Released to the public domain for non-commercial use.
  17. ;
  18. ;***********************************************************************
  19. ;
  20. ;    RAMDRIVE has been extensively modified by Paul J. Gans.  Changes
  21. ;    are copyright (c) by Paul J. Gans, Department of Chemistry, New
  22. ;    York University, New York, NY  10003 (212) 598-2515
  23. ;
  24. ;    New or modified features include:
  25. ;
  26. ;    For RAMDRIVE5:
  27. ;
  28. ;    1.  Code has been converted to Z80 code throughout.
  29. ;    2.  The target assembler is now Microsoft's M80.
  30. ;    3.  The code is now self-loading.  The original RAMLD program is
  31. ;        no longer required.
  32. ;    4.  It is no longer required to have contiguous memory banks of
  33. ;        the same size.  Available memory is controlled by the
  34. ;        BLEN table described below.
  35. ;    5.  Track size is now a variable multiple of 1K and can be
  36. ;        changed through an equate.
  37. ;    6.  The original ALV parameter has been dropped in favor of
  38. ;        TRAKLEN, the number of kilobytes per track.
  39. ;    7.  The DRAM parameter has been dropped.  Extended (bank)
  40. ;        addresses are now contained in the BLEN table.
  41. ;    8.  The program now uses both the directory buffer and the host
  42. ;        buffer in the local BIOS instead of its own buffer.
  43. ;        This requires that the user know the addresses of both
  44. ;        of these buffers in his or her BIOS.  To accomodate
  45. ;        those who choose not to use the BIOS buffers, two DS
  46. ;        definitions are required a few lines after the label
  47. ;        WBOOT1.  The proper spot is commented in the code
  48. ;        below.
  49. ;
  50. ;***********************************************************************
  51. ;
  52. ;    June 1986 - Minor modifications to RAMDRIVE to facilitate its
  53. ;    use with 83 series Kaypro computers fitted with 256K RAM chips.
  54. ;    These changes (trivial as they are!) are hereby released to
  55. ;    the public domain for non-commercial use.
  56. ;
  57. ;        Dr Michael Liddle,
  58. ;        21 The Frostings,
  59. ;        Grenoside, SHEFFIELD,
  60. ;        England, S30 3NZ.
  61. ;
  62. ;    The main changes in version 6 are as follows :-
  63. ;
  64. ;    1.  Bank switching is carried out by a new routine 'SWAP'. This
  65. ;    makes porting RAMDRIVE to different systems easier by further
  66. ;    isolating hardware dependencies from the main code.
  67. ;
  68. ;    2.  Initially set to install on a pre 84 series Kaypro II with
  69. ;    the 256K RAM modification described by me in MicroCornucopia
  70. ;    issue ??? and the CP/M relocated to 63K using MOVCPM. 
  71. ;
  72. ;    3.  References to the IMSAI Panel have been removed as few
  73. ;    micros today have a hardware front panel!
  74. ;
  75. ;    4.  RAMDRIVE assumes that no interrupts will occur and take
  76. ;    control away - if your system uses interrupts them insert
  77. ;    DI and EI opcodes as needed.
  78. ;
  79. ;***********************************************************************
  80. ;      8/25/86
  81. ;      Configured for '84 Kaypro machines using an overlay NEW PIO
  82. ;      chip on ports 029H and 02BH. If used with the internal PIO,
  83. ;      set ports to 021H and 023H. The ???BUF values are for a
  84. ;      Turbo-Rom 62.75K system, and must be set if different!
  85. ;
  86. ;      Charles McHan - AMY <> BBS Multi-System - (904) 725-7461
  87. ;***********************************************************************
  88. ;
  89. ;    INSTALLATION of RAMDRIVE6:
  90. ;
  91. ;    RAMDRIVE assumes that the user's system has "extra" memory
  92. ;    available beyond the normal 64K maximum directly addressable
  93. ;    in Z80 systems.  This memory may be either "bank select" or
  94. ;    S-100 extended addressing.
  95. ;
  96. ;    RAMDRIVE is installed by setting a number of equates and by
  97. ;    properly configuring the BLEN table located near the end of
  98. ;    the code.  After the proper values have been set by equates and
  99. ;    the BLEN table has been set up, the code should be assembled
  100. ;    using M80.  The commands for so doing are:
  101. ;
  102. ;    >M80 =RAMDRIVE6/L    <== /L optionally produces a .PRN file
  103. ;    >L80 /P:100,RAMDRIVE6,RAMDRIVE6/N/E
  104. ;
  105. ;    The equates for DIRBUF and RAMBUF must be set to reflect the
  106. ;    location of these buffers in the user's BIOS.  If this is not
  107. ;    feasible, see the comments at the label WBOOT1.
  108. ;
  109. ;    Equates that must be set are defined and explained below.
  110. ;
  111. ;    In normal use the user must also configure the BLEN table for
  112. ;    his or her system and recompile.  There is one BLEN table entry
  113. ;    for each bank of memory to be used by RAMDRIVE.  It is assumed
  114. ;    that each of these banks starts at address 0000 and proceeds
  115. ;    upward to some value without any holes.  It is also assumed that
  116. ;    at least the upper 1K of system memory is global, thus no bank
  117. ;    can exceed 63K.
  118. ;
  119. ;    A BLEN table entry consists of two bytes for each bank of memory
  120. ;    to be used by RAMDRIVE.  The first byte is the number of kilo-
  121. ;    bytes available for RAMDRIVE in that bank.  This value is placed
  122. ;    into the BLEN table as the value divided by TRAKLEN.  The actual
  123. ;    number of kilobytes of that bank used by RAMDRIVE is the integral
  124. ;    part of the division.  For instance a 30K bank of memory would
  125. ;    be indicated to the system as 30/TRAKLEN.
  126. ;
  127. ;    The second byte in the BLEN table entry    is the extended (or 
  128. ;    bank) address byte for that bank of memory.  There is one such 
  129. ;    entry pair for each bank.  The table is terminated by a single 
  130. ;    zero byte.
  131. ;
  132. ;    Thus a system with 20K at a bank addressed as 0DEH and 8K at a
  133. ;    bank addressed as 70H could have a BLEN table as:
  134. ;
  135. ;        BLEN:    DB    20/TRAKLN,0DEH
  136. ;            DB    08/TRAKLN,70H
  137. ;            DB    0
  138. ;
  139. ;    while the same system in which the user wanted to reserve 4K on
  140. ;    the board at 0DEH for some other purpose could have a BLEN table
  141. ;    as:
  142. ;
  143. ;        BLEN:    DB    16/TRAKLN,0DEH
  144. ;            DB    08/TRAKLN,70H
  145. ;            DB    0
  146. ;
  147. ;    
  148. ;************************************************************************
  149. ;
  150. ;  The code and tables in this file will reside in high memory, above the
  151. ;  existing BIOS.  The system is self-loading.  Typing RAMDRIVE6 from the
  152. ;  console is sufficient to initiate RAMDRIVE6.
  153. ;
  154.     .Z80
  155. ;
  156. FALSE    EQU    0
  157. TRUE    EQU    NOT FALSE
  158. ;
  159. ;  The following equates are system dependent.
  160. ;
  161. ;  DIRBUF:  This is the address of the CP/M directory buffer in the
  162. ;    user's BIOS.  CP/M 2.x systems are required to have such a buffer
  163. ;    available.  The address will vary in different implementations.
  164. ;
  165. ;  RAMBUF:  This is the address of the CP/M host buffer in the user's
  166. ;    BIOS.  In a normal CP/M 2.x system this buffer will be at least 1K
  167. ;    long.  The address will vary in different implementations.
  168. ;
  169. ;  RAMDRIVE:  Set to a memory location above BIOS.  Less than 1K of
  170. ;    GLOBAL memory is required at this location; i.e. the same block
  171. ;    of memory must be accessible independent of the setting of the ex-
  172. ;    tended address bus or any bank byte.
  173. ;
  174. ;  PRAM:  The extended address of regular program RAM.  Usually this is
  175. ;    00H, but need not be.
  176. ;
  177. ;  DNAME:  The alphabetic designation of the RAM drive.
  178. ;
  179. ;  TRAKLN:  The number of kilobytes per track.  This must be a minimum
  180. ;    of 1K and a maximum no greater than the smallest bank of memory to
  181. ;    be made available to RAMDRIVE.  A good value to use is the greatest
  182. ;    common divisor of each of the memory banks to be used by RAMDRIVE.
  183. ;
  184. ;  DIRECT:  The number of directory entries permitted on the RAM drive.
  185. ;    The number specified must be a multiple of 32.  I used 32 to leave
  186. ;    the maximum space for program files.
  187. ;
  188.     .Z80
  189. ;
  190. DIRBUF    EQU    0FEE5H        ; CP/M BIOS directory buffer address
  191. RAMBUF    EQU    0F5ADH        ; CP/M BIOS host buffer
  192. RAMDRIVE    EQU    0F363H    ;START OF PROGRAM ABOVE BIOS.
  193. PRAM    EQU    07H        ;EXTENDED ADDR. OF MAIN RAM
  194. DNAME    EQU    'D'        ;DRIVE NAME OF RAMDRIVE.
  195. TRAKLN    EQU     4        ; kilobytes per track
  196. DIRECT    EQU    64        ;NO. OF DIRECTORY ENTRIES.
  197. ;
  198. ;  These equates will normally not need to be changed.
  199. ;
  200. BDOS    EQU    5
  201. DELCHR    EQU    0E5H        ;DELETED DIRECTORY ENTRY.
  202. DNUMB    EQU    DNAME - 'A'    ;RAMDRIVE DRIVE NUMBER
  203. CR    EQU    0DH
  204. LF    EQU    0AH
  205. ;
  206. ;
  207. ;  The code below replaces the original loader code, since that
  208. ;  mechanism will not work on a program compiled under M80.  The
  209. ;  M80 .PHASE commands have been used rather than the original
  210. ;  ORG's.
  211. ;
  212.     LD    DE,SIGNON    ; print signon message from loader
  213.     LD    C,9
  214.     CALL    BDOS
  215. ;
  216.     LD    HL,(0001)    ; check to see if BIOS modified
  217.     INC    HL        ; point to jump vector
  218.     LD    E,(HL)
  219.     INC    HL
  220.     LD    D,(HL)
  221.     EX    DE,HL
  222.     LD    DE,RAMDRIVE
  223.     AND    A        ; clear carry
  224.     SBC    HL,DE        ; WBOOT minus RAMDRIVE
  225.     JP    C,CONTIN    ; if carry we are OK
  226.     LD    DE,NOWAY
  227.     LD    C,9
  228.     CALL    BDOS
  229.     JP    0
  230. ;
  231. SIGNON:    DB    'RAMDRIVE Version 6 - Mike Liddle June 1986'
  232.     DB    CR,LF,'$'
  233. NOWAY:    DB    'Cannot load RAMDRIVE',CR,LF
  234.     DB    'Cold boot system and try again'
  235.     DB    CR,LF,'$'
  236. ;
  237. CONTIN:    LD    HL,SETUP
  238.     LD    DE,RAMDRIVE
  239.     LD    BC,ENDRAM-RAMDRIVE        ; 1023
  240.     LDIR
  241.     JP    RAMDRIVE
  242. ;
  243.     .PHASE    RAMDRIVE
  244. ;
  245. ;  ORIGINAL JUMP TABLE FROM BIOS
  246. ;
  247. WBOOT1:    DS    48
  248. WCK:                ;END OF BIOS TABLE.
  249. ;
  250. CSV:    DS    DIRECT/4    ; this should probably be zero since no
  251. ;                    checking is done
  252. ALV:    DS    72        ; this is allocation vector space which
  253. ;                    must have 1 bit available per block.
  254. ;                    this value corresponds to 576 1K
  255. ;                    blocks.
  256. ;
  257. ;  If the user does not wish to (or cannot) use the directory and host
  258. ;  buffers in the system BIOS, the buffers can alternatively be defined
  259. ;  here.  In this case the following lines should be uncommented and the
  260. ;  corresponding equates above commented.
  261. ;
  262. ;DIRBUF: DS    128        ; directory buffer
  263. ;RAMBUF: DS    128        ; bank communication buffer
  264. ;
  265. ENDTBL:                ;END OF DATA TABLES.
  266. ;
  267.     .DEPHASE
  268. ;
  269. ;  The following code is executed once to set up the RAMDRIVE system.  In
  270. ;  order to conserve space it will be overwritten by data buffers during
  271. ;  actual access to RAMDRIVE.
  272. ;
  273. ;
  274. SETUP:    
  275. ;
  276.     .PHASE    RAMDRIVE
  277. ;
  278. ;  Determine the amount of available RAMDRIVE memory
  279. ;
  280.     XOR    A
  281.     LD    C,A
  282.     LD    HL,BLEN        ; RAMDRIVE memory table
  283.     LD    DE,0002        ; table entry increment
  284. BCHEK0:    LD    A,(HL)        ; get bank kilobytes a
  285.     OR    A        ; zero means end of table
  286.     JR    Z,BCHEK1
  287.     ADD    A,C        ; accumulate count
  288.     LD    C,A        ; and save it
  289.     ADD    HL,DE        ; point to next BLEN entry
  290.     JR    BCHEK0
  291. ;
  292. BCHEK1:    CP    C        ; is there any ram available at all?
  293.     JR    NZ,RAMOK    ; jump if there is
  294.     LD    DE,NORAM    ; no ram, tell the user
  295.     LD    C,9
  296.     CALL    BDOS
  297.     RET            ; avoid warm boots!
  298. ;
  299. NORAM:    DB    'Cannot activate RAMDRIVE.  No available RAM.'
  300.     DB    CR,LF,'$'
  301. ;
  302. RAMOK:    XOR    A        ; clear counter
  303.     LD    B,TRAKLN    ; the count must be multiplied
  304. ;                    by TRAKLN to yeild kilobytes
  305. RAMOK1:    ADD    A,C        ; multiply by repeated adding
  306.     DJNZ    RAMOK1
  307. ;
  308.     DEC    A        ; RAMDRIVE kilobytes minus 1
  309.     LD    (DSM),A        ; maximum block number to DPB
  310. ;
  311. ;  MODIFY BIOS JUMP TABLES
  312. ;
  313.     IF    $ LT WCK    ;MAKE SURE THAT WBOOT1 TABLE
  314.     JP    BJUMP        ;WILL NOT OVERWRITE
  315.     ENDIF            ;BJUMP ROUTINE.
  316.     IF    $ LT WCK
  317.     DEFS    WCK - $
  318.     ENDIF    
  319. ;
  320. BJUMP:    LD    HL,(1)        ;GET ADDRESS OF WARM BOOT
  321.     LD    DE,WBOOT1    ;TRANSFER TABLE FROM BIOS UP HERE
  322.     LD    BC,48        ;48 BYTES
  323.     LDIR    
  324.     LD    HL,WBOOT2    ;TRANSFER OUR TABLE TO BIOS
  325.     LD    DE,(0001)
  326.     LD    BC,48
  327.     LDIR    
  328. ;
  329. ;  PRINT MESSAGE AND ASK QUESTION
  330. ;
  331.     LD    DE,QUEST
  332.     LD    C,9        ;PRINT STRING
  333.     CALL    BDOS
  334.     LD    C,1        ;GET CHARACTER
  335.     CALL    BDOS
  336.     RES    5,A        ;CONVERT TO UPPER CASE.
  337.     CP    'Y'
  338.     JP    NZ,QUIT
  339. ;
  340. ;  CLEAR DIRECTORY OF RAMDRIVE
  341. ;
  342.     LD    BC,0000        ; directory on track 0 sector 0
  343.     CALL    MAP
  344.     CALL    SWAP
  345.     EX    DE,HL        ; HL = base location of directory
  346.     LD    DE,32        ;EVERY 32 BYTES
  347.     LD    B,DIRECT    ;NO. OF ENTRIES.
  348.     LD    A,DELCHR
  349. CLEAR:    LD    (HL),A
  350.     ADD    HL,DE
  351.     DJNZ    CLEAR
  352.     LD    A,PRAM        ;RESET EXT. ADDR.
  353.     CALL    SWAP
  354. ;
  355. QUIT:    LD    DE,CRLF
  356.     LD    C,9
  357.     CALL    BDOS
  358.     JP    0        ;BACK TO CP/M.
  359. ;
  360. QUEST:    DB    CR,LF
  361.     DB    'RAMDRIVE active on drive ',DNAME
  362.     DB    CR,LF
  363.     DB    'Should directory of drive ',DNAME
  364.     DB    ' be cleared (Y/N)? $'
  365. CRLF:    DB    CR,LF,'$'
  366. ;
  367. ;  NEW TABLE COPIED INTO BIOS
  368. ;
  369. WBOOT2:    JP    WBOOT
  370.     JP    WBOOT1+3
  371.     JP    WBOOT1+6
  372.     JP    WBOOT1+9
  373.     JP    WBOOT1+12
  374.     JP    WBOOT1+15
  375.     JP    WBOOT1+18
  376.     JP    HOME        ;21
  377.     JP    SELDSK        ;24
  378.     JP    SETTRK        ;27
  379.     JP    SETSEC        ;30
  380.     JP    SETDMA        ;33
  381.     JP    READ        ;36
  382.     JP    WRITE        ;39
  383.     JP    WBOOT1+42
  384.     JP    SECTRN        ;45
  385. ;
  386. ;  IMPLEMENT BIOS FUNCTIONS
  387. ;
  388.     IF    $ LT ENDTBL    ;MAKE SURE THAT BIOS
  389.     DEFS    ENDTBL - $    ; FUNCTIONS BEGIN
  390.     ENDIF            ; AFTER TABLES.
  391. ;
  392. WBOOT:    LD    HL,80H        ;SET INITIAL DMA ADDR.
  393.     LD    (DMAADR),HL
  394.     JP    WBOOT1        ;BACK TO BIOS
  395. ;
  396. ;
  397. HOME:    LD    A,(DISK)    ;CHECK DISK NUMBER.
  398.     CP    DNUMB        ;IS IT THE RAMDRIVE?
  399.     JP    NZ,WBOOT1+21    ;IF NOT, LET BIOS HANDLE IT.
  400.     LD    A,0        ;SET "TRACK" TO 0
  401.     LD    (XTRAK),A
  402.     RET    
  403. ;
  404. ;
  405. SELDSK:    LD    A,C        ;CHECK REQUESTED DISK,
  406.     LD    (DISK),A
  407.     CP    DNUMB
  408.     JP    NZ,WBOOT1+24
  409.     LD    HL,DPH        ;RETURN DISK PAR. HEADER.
  410.     RET    
  411. ;
  412. ;  DISK PARAMETER HEADER FOR RAMDRIVE
  413. ;
  414. DPH:    
  415.     DW    0        ;NO SECTOR TRANSLATION
  416.     DW    0,0,0        ;SCRATCH
  417.     DW    DIRBUF        ;LOC. OF SCRATCHPAD AREA.
  418.     DW    DPB        ;DISK PARAMETER BLOCK
  419.     DW    CSV        ;DIR. CHECK AREA
  420.     DW    ALV        ;ALLOC. VECTOR.
  421. ;
  422. ;  DISK PARAMETER BLOCK
  423. ;
  424. DPB:    
  425.     DW    (1024*TRAKLN)/128    ;SECTORS PER TRACK
  426.     DB    3        ;BSH
  427.     DB    7        ;BLM
  428.     DB    0        ;EXM
  429. DSM:    DW    62        ;MAX BLOCK NO.
  430.     DW    DIRECT-1    ;HIGHEST DIRECT. NO.
  431. ;
  432. AL0    EQU    LOW (0FFH SHL (8-DIRECT/32))
  433. AL1    EQU    0
  434. ;
  435.     DB    AL0,AL1        ;DIRECTORY BLOCKS.
  436. ;
  437. CKS    EQU    0        ;CHECK DIRECT. ENTRIES.
  438. ;
  439.     DW    CKS
  440.     DW    0        ;NO SKIPPED TRACKS.
  441. ;
  442. ;
  443. SETTRK:    LD    A,(DISK)
  444.     CP    DNUMB
  445.     JP    NZ,WBOOT1+27
  446.     LD    A,C        ;TRACK NO.
  447.     LD    (XTRAK),A
  448.     RET    
  449. ;
  450. ;
  451. SETSEC:    LD    A,(DISK)
  452.     CP    DNUMB
  453.     JP    NZ,WBOOT1+30
  454.     LD    (SECTOR),BC
  455.     RET    
  456. ;
  457. ;
  458. SETDMA:    LD    (DMAADR),BC    ;SAVE DMA ADDR. BOTH HERE
  459.     JP    WBOOT1+33    ;AND IN BIOS.
  460. ;
  461. ;
  462. READ:    LD    A,(DISK)
  463.     CP    DNUMB
  464.     JP    NZ,WBOOT1+36
  465.     LD    BC,(SECTOR)    ; but we asssume sector fits in one byte
  466.     LD    A,(XTRAK)    ;SET EXTENDED ADDRESS.
  467.     LD    B,A
  468.     CALL    MAP        ; to compute bank and offset
  469.     CALL    SWAP
  470.     EX    DE,HL
  471.     LD    DE,RAMBUF    ;TEMPORARY BUFFER.
  472.     LD    BC,128        ;SECTOR=128 BYTES.
  473.     LDIR    
  474.     LD    A,PRAM        ;RESET ADDR.
  475.     CALL    SWAP
  476.     LD    HL,RAMBUF    ;MOVE FROM BUFFER
  477.     LD    DE,(DMAADR)    ; back to main ram
  478.     LD    BC,128
  479.     LDIR    
  480.     XOR    A        ; show no errors
  481.     RET    
  482. ;
  483. ;
  484. WRITE:    LD    A,(DISK)
  485.     CP    DNUMB
  486.     JP    NZ,WBOOT1+39
  487.     LD    HL,(DMAADR)    ;DMA --> BUFFER
  488.     LD    DE,RAMBUF
  489.     LD    BC,128
  490.     LDIR    
  491. ;
  492.     LD    BC,(SECTOR)    ; but we assume sector < 256
  493.     LD    A,(XTRAK)
  494.     LD    B,A
  495.     CALL    MAP
  496.     CALL    SWAP
  497.     LD    HL,RAMBUF    ;BUFFER --> RAMDRIVE.
  498.     LD    BC,128
  499.     LDIR
  500. ;
  501.     LD    A,PRAM
  502.     CALL    SWAP
  503.     XOR    A        ; show no error
  504.     RET    
  505. ;
  506. ;
  507. SECTRN:    LD    A,(DISK)
  508.     CP    DNUMB
  509.     JP    NZ,WBOOT1+45
  510.     LD    H,B
  511.     LD    L,C
  512.     RET    
  513. ;
  514. ;
  515. ;  Subroutine to calculate RAM address and bank
  516. ;
  517. ;    called with  B = track number (starts from 0)
  518. ;             C = sector number (starts from 0)
  519. ;
  520. ;    returns with A = extended address byte
  521. ;            DE = offset into bank for start of sector
  522. ;
  523. MAP:    XOR    A        ; clear A
  524.     LD    A,B        ; track number to A
  525.     LD    DE,2        ; increment for BLEN table
  526.     LD    HL,BLEN
  527. ;
  528. MAP1:    SUB    (HL)        ; subtract bank length in K's
  529.     JR    C,MAP2        ; jump if track in this bank
  530.     ADD    HL,DE        ; point to next BLEN entry
  531.     JR    MAP1        ; repeat till done
  532. ;
  533. MAP2:    ADD    A,(HL)        ; A = relative track number in bank
  534.     RLCA            ; multiply by 4K
  535.     RLCA
  536.     RLCA
  537.     RLCA
  538.     LD    E,D        ; clear E
  539.     LD    D,C        ; multiply sector number by 128
  540.     RR    D
  541.     RR    E
  542.     ADD    A,D        ; add to track starting address
  543.     LD    D,A        ; DE = sector start in bank
  544.     INC    HL
  545.     LD    A,(HL)        ; A = extended (bank) address
  546.     RET
  547. ;
  548. ;*******************************************************************
  549. ;
  550. ;    This is where banks are switched.  Register A contains the
  551. ;    bank to be selected.
  552. ;
  553. ;*******************************************************************
  554. ;
  555. PIOData    EQU    029H    ; '84 NEW PIO PORT (DATA)
  556. PIOCtrl    EQU    02BH    ; '84 NEW PIO PORT (CONTROL)
  557. Mode3    EQU    0CFH    ; Mode3    = Control
  558. IOMask    EQU    0F8H    ; Bits 0,1,2 as    output.    Rest as    input.
  559.  
  560. SWAP:    LD    C,A        ; Save bank
  561.     LD    A,Mode3        ; Set up PIO for bank select
  562.     OUT    (PIOCtrl),A    ; Mode 3
  563.     LD    A,IOMask
  564.     OUT    (PIOCtrl),A    ; Bits 0,1,2 are output
  565.     LD    A,C        ; Bank 7 selected for TPA
  566.     OUT    (PIOData),A
  567.     RET
  568.  
  569. ;
  570. ;*******************************************************************
  571. ;
  572. BLEN:
  573.     DB    32/TRAKLN,00H
  574.     DB    32/TRAKLN,01H
  575.     DB    32/TRAKLN,02H
  576.     DB    32/TRAKLN,03H
  577.     DB    32/TRAKLN,04H
  578.     DB    32/TRAKLN,05H
  579.     DB    0        ; end of table
  580. ;
  581. ;  DATA STORAGE AREA
  582. ;
  583. DISK:    DB    0
  584. XTRAK:    DB    0
  585. DMAADR:    DW    80H
  586. SECTOR:    DW    0
  587. ;
  588. ENDRAM    EQU    $
  589. ;
  590.     .DEPHASE
  591. ;
  592.     END    
  593.