flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Projects and Ideas > keyboard remapping

Author
Thread Post new topic Reply to topic
alessandro95



Joined: 24 Mar 2013
Posts: 62
keyboard remapping
Hi, I want to write (mainly because I need it) a program to remap some keys on my keyboard to other charachters, more precisely I need to map "shift+è" to "È" and a couple of.others combination.

I have no idea where to start so I'd like some opinions on how feasible is and some docs or suggestions on how to do it.
Thanks in advance!

Alessandro
Post 25 Sep 2013, 05:38
View user's profile Send private message Reply with quote
SeproMan



Joined: 11 Oct 2009
Posts: 52
Location: Belgium
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.
Post 25 Sep 2013, 10:11
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15241
Location: 1I/ʻOumuamua
alessandro95: Perhaps you should mention which OS you are using this on. The post by SeproMan appears to be for DOS.
Post 26 Sep 2013, 07:41
View user's profile Send private message Visit poster's website Reply with quote
alessandro95



Joined: 24 Mar 2013
Posts: 62
I'm using a 64bit version of windows 7
Post 26 Sep 2013, 14:22
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
alessandro95,

Microsoft Keyboard Layout Creator probably could help.
Post 30 Sep 2013, 11:45
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4155
Location: achtétépéhèseu://pasteubineu.comeu/Vw7WXXf4

Quote:
Download: MSKLC.EXE (10.1 MB)


omg, 10 MB just for that... are they crazy?
Post 01 Oct 2013, 08:32
View user's profile Send private message Visit poster's website Reply with quote
alessandro95



Joined: 24 Mar 2013
Posts: 62
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!
Post 01 Oct 2013, 21:03
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.