Category : Communication (modem) tools and utilities
Archive   : PR12HP40.ZIP
Filename : KEYLIB.ASM

 
Output of file : KEYLIB.ASM contained in archive : PR12HP40.ZIP

PAGE 60,132
TITLE KEYLIB - C INTERFACE ROUTINES FOR DKEY

COMMENT !

ret = dk_reset(); clear entire macro table
ret = dk_disable(); disable translation
ret = dk_enable(); enable translation
ret = dk_set(keycode,def); install or alter key definition
ret = dk_get(keycode,def); retrieve definition by keycode
kc = dk_gnum(num,def); retrieve definition by sequence #
bytes = dk_size(); retrieve size of macro table

int ret; return value. 0 = success
-1 = DK not resident
1 = other failure

int keycode; BIOS keycode. Key scan code in upper 8 bits
char *def; string for definition. Length of destination
NOT checked for dk_get() and dk_gnum()
int kc; keycode returned from dk_gnum()
-1 = DK not resident
-2 = requested definition not found
otherwise is BIOS keycode
unsigned num; sequence number for definition. 0 = lowest
unsigned bytes; length of macro table.
65535 = DK not resident

The assembly language routines in DKEY are 'allowed' to (but might not)
trash the the following registers:

AX,BX,CX,DX,DI,SI,ES

!

INCLUDE DOS.MAC
INCLUDE STRUCT.MAC

DKEY MACRO func
MOV AH,&0func&H
INT 16H
ENDM

save macro
push si
push di
endm

unsave macro
pop di
pop si
endm

_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT


PROCEDURE _dk_reset

save
CALL _dk_resident
JNZ END1
DKEY 80
END1: unsave
RET

_dk_reset ENDP



PROCEDURE _dk_disable

save
CALL _dk_resident
JNZ END4
DKEY 81
END4: unsave
RET

_dk_disable ENDP



PROCEDURE _dk_enable

save
CALL _dk_resident
JNZ END5
DKEY 82
END5: unsave
RET

_dk_enable ENDP



PROCEDURE _dk_set

ENTER
PASSW KEYCODE
PASSA DEF

save
CALL _dk_resident
JNZ END6
PUSH DS
MOV CX,KEYCODE
IF LDATA
LES DI,DEF
ELSE
MOV DI,DS
MOV ES,DI
MOV DI,DEF
ENDIF
DKEY 83
POP DS
END6: unsave
RETURN

_dk_set ENDP



PROCEDURE _dk_get

ENTER
PASSW KEYCODE
PASSA DEF

save
CALL _dk_resident
JNZ END7
PUSH DS
MOV CX,KEYCODE
IF LDATA
LES DI,DEF
ELSE
MOV DI,DS
MOV ES,DI
MOV DI,DEF
ENDIF
DKEY 84
POP DS
END7: unsave
RETURN

_dk_get ENDP



PROCEDURE _dk_gnum

ENTER
PASSW NUM
PASSA DEF

save
CALL _dk_resident
JNZ END8
PUSH DS
MOV CX,NUM
IF LDATA
LES DI,DEF
ELSE
MOV DI,DS
MOV ES,DI
MOV DI,DEF
ENDIF
DKEY 85
POP DS
END8: unsave
RETURN

_dk_gnum ENDP



PROCEDURE _dk_size

save
CALL _dk_resident
JNZ END9
DKEY 86
END9: unsave
RET

_dk_size ENDP



PUBLIC _dk_resident
_dk_resident PROC

DKEY 87
CMP AX,'JW' ;ZERO SET IF DKEY resident
MOV AX,0FFFFH ;JUST IN CASE
RET

_dk_resident ENDP

_TEXT ENDS
END


  3 Responses to “Category : Communication (modem) tools and utilities
Archive   : PR12HP40.ZIP
Filename : KEYLIB.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/