flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > keyboard remapping |
Author |
|
SeproMan 25 Sep 2013, 10:11
alessandro95,
Here's an example I posted some years ago. I think it provides the basic steps to change any key you like. Code: ; Modified Keyboard Entry - 13/10/2009 ORG 256 mov ax,cs mov ss,ax mov sp,MyStack+64*2 mov ds,ax mov es,ax ; Some arbitrary modification mov byte [Table+"a"],"z" mov byte [Table+"z"],"a" ; Save existing Keyboard Interrupt Vector push es mov ax,3509h int 21h ;DOS 'Get Interrupt Vector' mov [Old_09h],bx mov [Old_09h+2],es pop es ; Setup new Keyboard Interrupt Vector mov dx,New_09h mov ax,2509h int 21h ;DOS 'Set Interrupt Vector' ; Prompt user action mov dx,Msg1 mov ah,09h int 21h ;DOS 'Display String' MainLoop: mov ah,01h int 21h ;DOS 'Keyboard Input & Echo' cmp al,27 ;<ESC> ? jne MainLoop ; Restore old Keyboard Interrupt Vector push ds lds dx,[Old_09h] mov ax,2509h int 21h ;DOS 'Set Interrupt Vector' pop ds ; Terminate mov dx,Msg2 mov ah,09h int 21h ;DOS 'Display String' mov ax,4C00h int 21h ;DOS 'Terminate/ReturnCode' ; ---------------------------------------------- New_09h: push ax bx si ds mov ax,40h ;BIOS_DataSegment mov ds,ax mov si,[001Ch] ;BIOS_KeyboardBufferTailPointer ; Let BIOS take care of the hardware pushf call far dword [cs:Old_09h] cmp si,[001Ch] ;BIOS_KeyboardBufferTailPointer je .t1 ;No new key in buffer mov al,[si] ;ASCII (SCAN in [si+1]) mov bx,Table xlat [cs:bx] mov [si],al ;Updated ASCII .t1: pop ds si bx ax iret ; ---------------------------------------------- ALIGN 4 Old_09h: dd 0 Table: times 256 db %-1 MyStack: dw 64 dup (0) Msg1: db 'Watch <a> and <z> being swapped...',13,10 db 'Please press some keys. <ESC> exits!',13,10,'$' Msg2: db "-- That's all folks",13,10,'$' ; ----------------------------------------------- _________________ Real Address Mode. |
|||
25 Sep 2013, 10:11 |
|
revolution 26 Sep 2013, 07:41
alessandro95: Perhaps you should mention which OS you are using this on. The post by SeproMan appears to be for DOS.
|
|||
26 Sep 2013, 07:41 |
|
alessandro95 26 Sep 2013, 14:22
I'm using a 64bit version of windows 7
|
|||
26 Sep 2013, 14:22 |
|
baldr 30 Sep 2013, 11:45
|
|||
30 Sep 2013, 11:45 |
|
edfed 01 Oct 2013, 08:32
Quote: Download: MSKLC.EXE (10.1 MB) omg, 10 MB just for that... are they crazy? |
|||
01 Oct 2013, 08:32 |
|
alessandro95 01 Oct 2013, 21:03
That seems to solve my problem (i didn't try it yet), but I'm still curious to know how can I do it by myself!
|
|||
01 Oct 2013, 21:03 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.