home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / c64 / rptpat1.asm < prev    next >
Encoding:
Assembly Source File  |  1984-10-03  |  2.8 KB  |  179 lines

  1. ;rptpat1-add automatic key repeat to the
  2. ;C64 BIOS and change the border, screen,
  3. ;and character colors for SOFT80 V.1
  4. ;
  5. ;  29 September 1984
  6. ;
  7. ;  Author:  Ross A. Alford
  8. ;           ...{decvax, akgua, ihnp4}!mcnc!ecsvax!alford
  9. ;           Compuserve 75475,1404
  10. ;
  11. ;           Department of Zoology
  12. ;           Duke University
  13. ;           Durham, NC 27706
  14. ;
  15. ;
  16. ;  This program is hereby licensed for
  17. ;  unlimited noncommercial distribution,
  18. ;  provided this notice remains atached.
  19. ;  Any comercial use requires the written
  20. ;  consent of the author.
  21. ;
  22. ;  This program operates correctly with
  23. ;  my version of C64 CP/M.  Other
  24. ;  versions may exist.  If it appears
  25. ;  not to work with your system, check
  26. ;  the equates against your BIOS.
  27. ;  It occupies the space reserved for
  28. ;  BIOS65 function 7, and so conflicts
  29. ;  with that function
  30. ;
  31. ;  I assume no liability for the operation
  32. ;  of this program, nor for any direct
  33. ;  or consequential damages caused
  34. ;  by it.
  35. ;
  36. ;
  37. ;define true and false
  38. ;
  39. true    equ    0ffh
  40. false    equ    00h
  41. ;
  42. ;
  43. ;assemble for 44k or 48k?
  44. ;
  45. forty8    equ    true
  46. forty4    equ    false
  47. ;
  48. ;
  49. ;conditional equates
  50. ;
  51. ;
  52.     if    forty8
  53. lastky    equ    0ba63h
  54. j9    equ    0bbd5h
  55. const1    equ    0bbd7h
  56. const2    equ    0bbdch
  57.     endif
  58. ;
  59. ;
  60.     if    forty4
  61. lastky    equ    0aa63h
  62. j9    equ    0abd5h
  63. const1    equ    0abd7h
  64. const2    equ    0abdch
  65.     endif
  66. ;
  67. ;
  68. ;global equates
  69. ;
  70. ;
  71. bdos    equ    0005h
  72. esc    equ    01bh
  73. offset    equ    0fc00h
  74. border    equ    0c020h
  75. cr    equ    0dh
  76. lf    equ    0ah
  77. bgcolor    equ    06h    ;background color
  78. ccolor    equ    14h    ;char color
  79. ;
  80. ;
  81. ;routine that sets colors and
  82. ;  relocates the patch 
  83. ;  routines into the
  84. ;  extra 512 bytes at 0fe00h
  85. ;  and patches conout in the
  86. ;  bios to jump to patch
  87. ;
  88.     org    0100h
  89. ;print sign on message, change screen colors
  90.     lxi    d,msg
  91.     mvi    c,09h    ;print string
  92.     call    bdos
  93. ;change border color
  94.     mvi    a,0bh
  95.     sta    border
  96. ;
  97. ;
  98. ;install BIOS patches
  99. ;
  100.     lxi    b,pbegin
  101.     lxi    h,pend-pbegin
  102.     lxi    d,0fe00h
  103.     call    movup
  104.     lxi    b,bpatch
  105.     lxi    d,j9-1
  106.     lxi    h,0003h
  107.     call    movup
  108.     ret
  109. ;
  110. ;
  111. movup:    ldax    b
  112.     stax    d
  113.     inx    b
  114.     inx    d
  115.     dcx    h
  116.     xra    a
  117.     cmp    h
  118.     jnz    movup
  119.     cmp    l
  120.     jnz    movup
  121.     ret
  122. ;
  123. ;
  124. msg    db    esc,'K',bgcolor    ;set background color
  125.     db    esc,'H',ccolor    ;set character color
  126.     db    cr,lf,'RPTPAT v1.0',cr,lf
  127.     db    'Enables auto-repeat keyboard,',cr,lf
  128.     db    'sets character and background colors',cr,lf
  129.     db    cr,lf,'Copyright 1984 by Ross A. Alford',cr,lf
  130.     db    'All commercial rights reserved',cr,lf,'$'
  131. ;
  132. ;
  133. ;patch to jump for keyboard
  134. ;  auto repeat.  inserted into
  135. ;  BIOS80 at j9-1, which should
  136. ;  be CMP M
  137. ;
  138. ;
  139. bpatch: jmp    rptpat+offset
  140. ;
  141. ;
  142. ;rptpat routine: a jump to this
  143. ;  is inserted at j9-1 in the
  144. ;  BIOS.   This repeats any
  145. ;  keypress after a delay
  146. ;
  147. ;
  148.     org    0200h
  149. pbegin:        ;start of patches
  150. ;
  151. ;
  152. rptpat:    mov    b,a
  153.     cpi    040h
  154.     jnz    rpp1+offset
  155.     sta    lastky
  156.     jmp    const1
  157. rpp1:    cmp    m
  158.     jz    rpp2+offset
  159.     mvi    a,080h
  160.     sta    delay+offset
  161.     mov    a,b
  162.     jmp    const2
  163. rpp2:    lxi    h,delay+offset
  164.     dcr    m
  165.     jnz    const1
  166.     mvi    a,018h
  167.     mov    m,a
  168.     mov    a,b
  169.     jmp    const2
  170. ;
  171. ;
  172. ;storage locations
  173. ;
  174. ;
  175. delay:    db    080h
  176. ;
  177. ;
  178. pend:    end
  179.