News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

convert keyboard scancodes to characters

Started by travism, October 14, 2008, 09:36:05 AM

Previous topic - Next topic

travism

I searched around quiet awhile for this but I still haven't found an answer so Im sorry if this was answered before so Ill get to it So say we have 23 which is in ecx i want to be able to print it out to the screen as the character or scancode it is.. I thought it would be something with print uhex$() or something along those lines? but it doesnt seem to be printing.. THanks!

travism

Well I guess I could always use wsprintf... is there anything more efficient I could do?

MichaelW

Multiple things. This must be built as a console app.

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
    .code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    mov ebx, 23h
    print ustr$(ebx),13,10
    print uhex$(ebx),"h",13,10
    invoke crt_putchar, ebx
    print chr$(13,10)
    invoke crt_printf, chr$("%d%c%Xh%c%c%c"), ebx, 10, ebx, 10, ebx, 10

    inkey "Press any key to exit..."
    exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start


35
00000023h
#
35
23h
#


eschew obfuscation

MichaelW

Regarding the keyboard scancode to character conversion, a scancode identifies a keyboard key, and while most keys do have a corresponding character, many do not (for example: function keys, cursor control keys, shift keys, etc).
eschew obfuscation

travism

Thanks alot! I went with crt_putchar works great!