home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / uploads / ws4kpd.ark / WSKEYPAD.ASM < prev    next >
Encoding:
Assembly Source File  |  1988-07-03  |  6.3 KB  |  209 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;          WSKEYPAD.ASM  Copyright 1989 by Dale H. Cook        ;
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. ;                                    ;
  5. ;                       *     *            ;
  6. ;            ^               **   **            ;
  7. ;           ^^^               * * * *   ***   *     *    ;
  8. ;          ^^^^^               *  *  *    *    *     *    ;
  9. ;         ^^^^^^^           *     *    *    *     *    ;
  10. ;   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^       *     *    *    *     *    ;
  11. ;      ^^^^^^^^^^^^^^^^^^^^^^^^^^^       *     *   ***   ***   ***    ;
  12. ;      ^^^^^^^^^^^^^^^^^^^^^                        ;
  13. ;         ^^^^^^^^^^^^^^^           *     *            ;
  14. ;        ^^^^^^^^^^^^^^^^^           **   **            ;
  15. ;       ^^^^^^^^^^^^^^^^^^^           * * * *   *****   *   *    ;
  16. ;      ^^^^^^^^^^ ^^^^^^^^^^           *  *  *     *     **  *    ;
  17. ;     ^^^^^^^     ^^^^^^^       *     *     *     * * *    ;
  18. ;       ^^^^             ^^^^       *     *     *     *  **    ;
  19. ;      ^             ^       *     *     *     *   *  *    ;
  20. ;                                    ;
  21. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  22. ;                                    ;
  23. ;             Mill Mountain Software                ;
  24. ;                                    ;
  25. ;   This program  may be freely distributed  provided that it is dis-    ;
  26. ;   tributed in whole  with no alteration or modification  in form or    ;
  27. ;   content,  that all copyright  notices remain intact,  and that no    ;
  28. ;   charge is made  other than a nominal  distribution fee.   Sale or    ;
  29. ;   commercial use  of this program  in part or in whole  without the    ;
  30. ;   express written consent of the author is strictly prohibited.    ;
  31. ;                                    ;
  32. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  33. ;                                    ;
  34. ;            The author may be reached at:            ;
  35. ;            CompuServe 71370,2635                ;
  36. ;                                    ;
  37. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  38. ;                                    ;
  39. ;   Title: WordStar 4.0 Keypad Patch, 8080 Version (WSKEYPAD.ASM)    ;
  40. ;                                    ;
  41. ;   Author: Dale H. Cook                        ;
  42. ;                                    ;
  43. ;   Description: Patches WordStar 4.0 to let the user program the    ;
  44. ;         cursor keys and keypad. When WordStar is run the    ;
  45. ;         original cursor and keypad values are stored in    ;
  46. ;         memory and the user's values are substituted in    ;
  47. ;         the Kaypro CBIOS. When the user exits WordStar the    ;
  48. ;         original values are restored. (This version is        ;
  49. ;         written in Intel mnemonics for use with the DRI    ;
  50. ;         ASM assembler)                        ;
  51. ;                                    ;
  52. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  53. ;                                    ;
  54. ;   Revision History: Written 03Nov88 DHC                ;
  55. ;              Revised for distribution 03Jul89 DHC        ;
  56. ;                                    ;
  57. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  58.                 ; 
  59.                 ; 
  60. ;
  61. ;    EQUATES
  62. ;
  63.                 ; 
  64. ;    These ASCII control character equates must include any control
  65. ;    characters used in SMNEW and BIGNEW
  66.                 ; 
  67. NUL    EQU    00H
  68. CTRLC    EQU    03H
  69. CTRLD    EQU    04H
  70. CTRLE    EQU    05H
  71. CTRLK    EQU    0BH
  72. CTRLN    EQU    0EH
  73. CTRLQ    EQU    11H
  74. CTRLR    EQU    12H
  75. CTRLS    EQU    13H
  76. CTRLX    EQU    18H
  77. CTRLY    EQU    19H
  78.                 ; 
  79. ;    The next five equates are locations in the WordStar code that are
  80. ;    used by this patch
  81.                 ; 
  82. INISUB    EQU    03BBH        ; Jump to initialization routine
  83. UNISUB    EQU    03BEH        ; Jump to un-initialization routine
  84. MORPAT    EQU    045BH        ; Start of user patch area
  85. RAM1ST    EQU    0894H        ; Pointer to first free byte in
  86.                 ;  extra patch area
  87. EXTRA    EQU    0896H        ; Address of first free byte in
  88.                 ;  extra patch area (data at RAM1ST)
  89.                 ; 
  90. ;    The next six equates contain the instructions at INISUB and UNISUB,
  91. ;    as found in the installed copy of WS.COM
  92.                 ; 
  93. INI1    EQU    NUL        ; NOP
  94. INI2    EQU    NUL        ; NOP
  95. INI3    EQU    0C9H        ; RET
  96.                 ; 
  97. UNI1    EQU    NUL        ; NOP
  98. UNI2    EQU    NUL        ; NOP
  99. UNI3    EQU    0C9H        ; RET
  100.                 ; 
  101. ;    The next equates contain the locations of the small and large
  102. ;    key tables in the Kaypro CBIOS
  103.                 ; 
  104. SMKEY    EQU    0F635H        ; Start of the small key table from CBIOS
  105. OFFSET    EQU    2CH        ; Offset to large key table from CBIOS
  106. BIGKEY    EQU    SMKEY+OFFSET    ; Calculated start of large key table
  107.                 ; 
  108. ;
  109. ;    JUMPS FOR PATCH
  110. ;
  111.                 ; 
  112.     ORG    INISUB        ; Jumps to keypad setup routine when
  113.     JMP    MYINI        ;  WordStar is run
  114.                 ; 
  115.     ORG    UNISUB        ; Jumps to keypad restoration routine
  116.     JMP    MYUNI        ;  when exiting WordStar
  117.                 ; 
  118. ;
  119. ;    KEYPAD SWAP ROUTINES
  120. ;
  121.                 ; 
  122.     ORG    MORPAT        ; Routines are located in user patch area
  123.                 ; 
  124. MYINI:    CALL    SWAP        ; Swap in new key values
  125.     DB    INI1,INI2,INI3    ; And resume execution
  126.                 ; 
  127. MYUNI:    CALL    SWAP        ; Restore original key values
  128.     DB    UNI1,UNI2,UNI3    ; And resume execution
  129.                 ; 
  130. ;    This routine is used by both MYINI and MYUNI
  131.                 ; 
  132. SWAP:    LXI    H,SMNEW        ; Set up to swap key values
  133.     LXI    D,SMKEY        ;  for the small key table
  134.     MVI    B,18        ; 18 keys in the table
  135.     CALL    SWAP1        ; And swap
  136.                 ; 
  137.     LXI    H,BIGNEW    ; Set up to swap key values
  138.     LXI    D,BIGKEY    ;  for the large key table
  139.     MVI    B,72        ; 72 values (four per key)
  140.     CALL    SWAP1        ; And swap
  141.                 ; 
  142.     RET
  143.                 ; 
  144. SWAP1:    MOV    C,M        ; New value goes in C
  145.     LDAX    D        ; Old value goes in A
  146.     MOV    M,A        ; Save old value
  147.     MOV    A,C        ; Put new value in A
  148.     STAX    D        ;  and store in CBIOS key table
  149.     INX    H        ; Increment pointers
  150.     INX    D        ; 
  151.     DCR    B        ; Decrement counter
  152.     JNZ    SWAP1        ; Loop until all values are swapped
  153.                 ; 
  154.     RET
  155.                 ; 
  156. ;
  157. ;    KEY TABLE STORAGE
  158. ;
  159.                 ; 
  160.     ORG    EXTRA        ; Values are stored in extra patch area
  161.                 ; 
  162. ;    New values for the small key table
  163.                 ; 
  164. SMNEW:    DB    CTRLE        ; Up cursor
  165.     DB    CTRLX        ; Down cursor
  166.     DB    CTRLS        ; Left cursor
  167.     DB    CTRLD        ; Right cursor
  168.     DB    CTRLY        ; 0
  169.     DB    NUL        ; 1
  170.     DB    NUL        ; 2
  171.     DB    NUL        ; 3
  172.     DB    CTRLR        ; 4
  173.     DB    NUL        ; 5
  174.     DB    NUL        ; 6
  175.     DB    CTRLC        ; 7
  176.     DB    NUL        ; 8
  177.     DB    NUL        ; 9
  178.     DB    NUL        ; -
  179.     DB    NUL        ; ,
  180.     DB    CTRLN        ; Enter
  181.     DB    NUL        ; .
  182.                 ; 
  183. ;    New values for the large key table
  184.                 ; 
  185. BIGNEW:    DB    NUL,NUL,NUL,NUL    ; Up cursor
  186.     DB    NUL,NUL,NUL,NUL    ; Down cursor
  187.     DB    NUL,NUL,NUL,NUL    ; Left cursor
  188.     DB    NUL,NUL,NUL,NUL    ; Right cursor
  189.     DB    NUL,NUL,NUL,NUL    ; 0
  190.     DB    CTRLK,'D',NUL,NUL ; 1
  191.     DB    CTRLK,'Q',NUL,NUL ; 2
  192.     DB    CTRLK,'S',NUL,NUL ; 3
  193.     DB    NUL,NUL,NUL,NUL    ; 4
  194.     DB    CTRLK,'K',NUL,NUL ; 5
  195.     DB    CTRLQ,'R',NUL,NUL ; 6
  196.     DB    NUL,NUL,NUL,NUL    ; 7
  197.     DB    CTRLK,'B',NUL,NUL ; 8
  198.     DB    CTRLQ,'C',NUL,NUL ; 9
  199.     DB    CTRLK,'V',NUL,NUL ; -
  200.     DB    CTRLK,'C',NUL,NUL ; ,
  201.     DB    NUL,NUL,NUL,NUL    ; Enter
  202.     DB    CTRLK,'Y',NUL,NUL ; .
  203.                 ; 
  204. RAMNEW    EQU    $        ; PC now holds the new first free
  205.     ORG    RAM1ST        ;  byte in the extra patch area, set
  206.     DW    RAMNEW        ;  RAM1ST to that value
  207.                 ; 
  208.     END
  209.