home *** CD-ROM | disk | FTP | other *** search
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; WSKEYPAD.ASM Copyright 1989 by Dale H. Cook ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; * * ;
- ; ^ ** ** ;
- ; ^^^ * * * * *** * * ;
- ; ^^^^^ * * * * * * ;
- ; ^^^^^^^ * * * * * ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * * * * * ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^ * * *** *** *** ;
- ; ^^^^^^^^^^^^^^^^^^^^^ ;
- ; ^^^^^^^^^^^^^^^ * * ;
- ; ^^^^^^^^^^^^^^^^^ ** ** ;
- ; ^^^^^^^^^^^^^^^^^^^ * * * * ***** * * ;
- ; ^^^^^^^^^^ ^^^^^^^^^^ * * * * ** * ;
- ; ^^^^^^^ ^^^^^^^ * * * * * * ;
- ; ^^^^ ^^^^ * * * * ** ;
- ; ^ ^ * * * * * * ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; Mill Mountain Software ;
- ; ;
- ; This program may be freely distributed provided that it is dis- ;
- ; tributed in whole with no alteration or modification in form or ;
- ; content, that all copyright notices remain intact, and that no ;
- ; charge is made other than a nominal distribution fee. Sale or ;
- ; commercial use of this program in part or in whole without the ;
- ; express written consent of the author is strictly prohibited. ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; The author may be reached at: ;
- ; CompuServe 71370,2635 ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; Title: WordStar 4.0 Keypad Patch, 8080 Version (WSKEYPAD.ASM) ;
- ; ;
- ; Author: Dale H. Cook ;
- ; ;
- ; Description: Patches WordStar 4.0 to let the user program the ;
- ; cursor keys and keypad. When WordStar is run the ;
- ; original cursor and keypad values are stored in ;
- ; memory and the user's values are substituted in ;
- ; the Kaypro CBIOS. When the user exits WordStar the ;
- ; original values are restored. (This version is ;
- ; written in Intel mnemonics for use with the DRI ;
- ; ASM assembler) ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; Revision History: Written 03Nov88 DHC ;
- ; Revised for distribution 03Jul89 DHC ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;
- ;
- ;
- ; EQUATES
- ;
- ;
- ; These ASCII control character equates must include any control
- ; characters used in SMNEW and BIGNEW
- ;
- NUL EQU 00H
- CTRLC EQU 03H
- CTRLD EQU 04H
- CTRLE EQU 05H
- CTRLK EQU 0BH
- CTRLN EQU 0EH
- CTRLQ EQU 11H
- CTRLR EQU 12H
- CTRLS EQU 13H
- CTRLX EQU 18H
- CTRLY EQU 19H
- ;
- ; The next five equates are locations in the WordStar code that are
- ; used by this patch
- ;
- INISUB EQU 03BBH ; Jump to initialization routine
- UNISUB EQU 03BEH ; Jump to un-initialization routine
- MORPAT EQU 045BH ; Start of user patch area
- RAM1ST EQU 0894H ; Pointer to first free byte in
- ; extra patch area
- EXTRA EQU 0896H ; Address of first free byte in
- ; extra patch area (data at RAM1ST)
- ;
- ; The next six equates contain the instructions at INISUB and UNISUB,
- ; as found in the installed copy of WS.COM
- ;
- INI1 EQU NUL ; NOP
- INI2 EQU NUL ; NOP
- INI3 EQU 0C9H ; RET
- ;
- UNI1 EQU NUL ; NOP
- UNI2 EQU NUL ; NOP
- UNI3 EQU 0C9H ; RET
- ;
- ; The next equates contain the locations of the small and large
- ; key tables in the Kaypro CBIOS
- ;
- SMKEY EQU 0F635H ; Start of the small key table from CBIOS
- OFFSET EQU 2CH ; Offset to large key table from CBIOS
- BIGKEY EQU SMKEY+OFFSET ; Calculated start of large key table
- ;
- ;
- ; JUMPS FOR PATCH
- ;
- ;
- ORG INISUB ; Jumps to keypad setup routine when
- JMP MYINI ; WordStar is run
- ;
- ORG UNISUB ; Jumps to keypad restoration routine
- JMP MYUNI ; when exiting WordStar
- ;
- ;
- ; KEYPAD SWAP ROUTINES
- ;
- ;
- ORG MORPAT ; Routines are located in user patch area
- ;
- MYINI: CALL SWAP ; Swap in new key values
- DB INI1,INI2,INI3 ; And resume execution
- ;
- MYUNI: CALL SWAP ; Restore original key values
- DB UNI1,UNI2,UNI3 ; And resume execution
- ;
- ; This routine is used by both MYINI and MYUNI
- ;
- SWAP: LXI H,SMNEW ; Set up to swap key values
- LXI D,SMKEY ; for the small key table
- MVI B,18 ; 18 keys in the table
- CALL SWAP1 ; And swap
- ;
- LXI H,BIGNEW ; Set up to swap key values
- LXI D,BIGKEY ; for the large key table
- MVI B,72 ; 72 values (four per key)
- CALL SWAP1 ; And swap
- ;
- RET
- ;
- SWAP1: MOV C,M ; New value goes in C
- LDAX D ; Old value goes in A
- MOV M,A ; Save old value
- MOV A,C ; Put new value in A
- STAX D ; and store in CBIOS key table
- INX H ; Increment pointers
- INX D ;
- DCR B ; Decrement counter
- JNZ SWAP1 ; Loop until all values are swapped
- ;
- RET
- ;
- ;
- ; KEY TABLE STORAGE
- ;
- ;
- ORG EXTRA ; Values are stored in extra patch area
- ;
- ; New values for the small key table
- ;
- SMNEW: DB CTRLE ; Up cursor
- DB CTRLX ; Down cursor
- DB CTRLS ; Left cursor
- DB CTRLD ; Right cursor
- DB CTRLY ; 0
- DB NUL ; 1
- DB NUL ; 2
- DB NUL ; 3
- DB CTRLR ; 4
- DB NUL ; 5
- DB NUL ; 6
- DB CTRLC ; 7
- DB NUL ; 8
- DB NUL ; 9
- DB NUL ; -
- DB NUL ; ,
- DB CTRLN ; Enter
- DB NUL ; .
- ;
- ; New values for the large key table
- ;
- BIGNEW: DB NUL,NUL,NUL,NUL ; Up cursor
- DB NUL,NUL,NUL,NUL ; Down cursor
- DB NUL,NUL,NUL,NUL ; Left cursor
- DB NUL,NUL,NUL,NUL ; Right cursor
- DB NUL,NUL,NUL,NUL ; 0
- DB CTRLK,'D',NUL,NUL ; 1
- DB CTRLK,'Q',NUL,NUL ; 2
- DB CTRLK,'S',NUL,NUL ; 3
- DB NUL,NUL,NUL,NUL ; 4
- DB CTRLK,'K',NUL,NUL ; 5
- DB CTRLQ,'R',NUL,NUL ; 6
- DB NUL,NUL,NUL,NUL ; 7
- DB CTRLK,'B',NUL,NUL ; 8
- DB CTRLQ,'C',NUL,NUL ; 9
- DB CTRLK,'V',NUL,NUL ; -
- DB CTRLK,'C',NUL,NUL ; ,
- DB NUL,NUL,NUL,NUL ; Enter
- DB CTRLK,'Y',NUL,NUL ; .
- ;
- RAMNEW EQU $ ; PC now holds the new first free
- ORG RAM1ST ; byte in the extra patch area, set
- DW RAMNEW ; RAM1ST to that value
- ;
- END