So I got IRQ1 working correctly but it turns out that it prints the scan code read from port 0x60. I know I have to convert these to the actual characters but I can't seem to get my head around it. I am trying to do this in nasm. I know I can use key maps but it raises questions about make or break codes (which should I use and what should I do with the other?). Is there no mathematical formula to convert them to ASCII? I already read a lot about it online but it didn't help much. Any help as to how convert scan codes to character in nasm is appreciated.
Convert Scancodes to ASCII
3.9k Views Asked by Klaus Maria At
1
There are 1 best solutions below
Related Questions in X86
- How to call a C language function from x86 assembly code?
- the difference between two style of inline ASM
- Understanding the differences between mov and lea instructions in x86 assembly
- ARM Assembly code is not executing in Vitis IDE
- x86 - compare numbers and push the result onto the stack
- Seeking for the the method for adding the DL (data register) value to DX register
- link.exe unresolved external symbol _mainCRTStartup
- x86 Wrote a boot loader that prints a message to the screen but the characters are completely different to what I expected
- How does CPU tell between MMIO(Memory Mapped IO) and normal memory access in x86 architecture
- Why do register arg values need to be re-assigned in NASM after an int 0x80 system call?
- Why does LLVM-MCA measure an execution stall?
- Why does shr eax, 32 not do anything?
- Evaluating this in Assembly (A % B) % (C % D)
- Understanding throughput of simd sum implementation x86
- Making portable execution errors
Related Questions in KEYBOARD
- On iOS, the keyboard does not offer a 6-character SMS code
- Using javaFx, how to distinguish between return-key and enter-key on the numpad?
- Way to adding emoji to textarea with keyboard, other than copy/paste
- Win32api send message and Pydirectinput and Powertoy (Keyboard Manager ) Not working when open the application
- Keyboard not appearing when connecting smart card reader to iPhones with type-c port. i.e. iPhone 15/ 15 pro
- Xamarin android emulate usb PC Keyboard
- Pygame response to superfast human key presses?
- Why am I getting keyboard letter repeats with Chrome and not Firefox?
- python keyboard libary problem with writhing too many characters
- Wordpress keyboard navigation
- is on keyboard one side alt is more prominent than other side while using them in shortcut keys
- Preserving TextField Input After Keyboard Dismissal in Flutter
- combine KeyCode pressed and modifiers to get final KeyCode
- Shadcn Drawer component with Inputs on mobile, keyboard hides inputs or shows a blank space hiding them
- Create an onscreen swipe keyboard for Mac
Related Questions in NASM
- Is there some way to use printf to print a horizontal list of decrementing hex digits in NASM assembly on Linux
- scanf in x64 NASM results in segfault
- Seeking for the the method for adding the DL (data register) value to DX register
- Unable to run get .exe file from assembly NASM
- link.exe unresolved external symbol _mainCRTStartup
- x86 Wrote a boot loader that prints a message to the screen but the characters are completely different to what I expected
- Why do register arg values need to be re-assigned in NASM after an int 0x80 system call?
- Why does shr eax, 32 not do anything?
- Behavior of the adress 0x7e00 in different sectors and their alternatives
- No BIOS output from sector 1
- kernel.asm:60: error: comma, colon, decorator or end of line expected after operand
- New to Assembly, trying to get a loop working
- x86 BIOS stage 1 boot code halting after loop from interrupt
- Calling CreateWindowEx from x64 assembly
- Setting up Segment Registers, x86
Related Questions in OSDEV
- Seeking for the the method for adding the DL (data register) value to DX register
- "Config.guess failed to determine the host type" when trying build binutils-2.7 with Cygwin
- LLVM code generation causes problems with pointer arithmetic
- Maximum CPU Voltage reading
- Purpose of stack register(s) in holding 0x7c00
- Behavior of the adress 0x7e00 in different sectors and their alternatives
- General Protection Fault encountered when executing SYSRET
- Bootloader are really in sector 0?
- Is heap memory in Linux contiguous?
- How to define different [global_allocator]s for a monolithic os kernel and its applications
- QEMU: address of grub module has zeros if not referenced directly in the code
- Assembly draw line function
- "Cannot find bounds of current function" error in GDB while debugging bootloader code
- Confusion regarding CS and DS segment registers during bootloading process
- Rust tell the compiler to not trust the registers?
Related Questions in SCANCODES
- PS/2 keyboard doesn't respond properly to "Get scancode set" command
- Certain keys on built-in keyboard do not generate scancodes
- What is stored in the keyboardbuffer and in which format?
- c++ keyboards kbd.h need more information about processing the state of the modifier keys
- Example for scancode vs virtual scancode vs keycode vs virtual keycode vs virtual key
- Keyboard input returns weird symbols || Own Kernel
- How to generate a keyboard interrupt in assembly 8086
- How to get special keys with BIOS interrupts
- How does 4 byte scancode get mapped to keycodes in Linux?
- how do I extend virtual key codes in the windows API (Win32)?
- How do I use 1x scancodes as argument in SendInput
- How to convert between keyboard scan code and USB keyboard usage index?
- Is there a method to use Sendkeys with Xinput?
- Why do winapi functions need scan code although there is a keyboard driver?
- Retrieving keyboard-layout-independent typed characters from scancodes in Rust
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
There is no such mathematical formula. In fact, the mapping differs a bit between keyboard layouts. This is a pretty hard problem. Usually you'd provide a way for users to select their keyboard layout and load a map based on that. So to answer your question: I'd suggest you to make an array mapping each scancode to the correct character. I assume you run it in qemu or another emulator, and the keymap in that is pretty constant for all intents and purposes. Then once your kernel gets farther in development, you provide multiple of these keymapping arrays that can be swapped out by the user. Though I'd put that pretty low on the list of tasks that need to be implemented in your os.
An example of such an array (for a standard US keyboard layout like you get in qemu):
Please note that this map is not entirely complete, won't work for all keyboards, and you might want to redefine the mapping for modifier keys like control, alt and shift. You will need to do some testing for that.