Page 1 of 1

Difficulties displaying characters typed on the screen

Posted: Fri Aug 07, 2026 1:53 pm
by hitlp
I'm having an issue with my operating system that I've been trying to diagnose for over a week.

At this stage of development, I've implemented an interrupt handling routine, including one for the keyboard. My current goal is to press a key and have the corresponding character appear on the VGA screen.

The problem is that some characters simply don't work. For example, when I press the 'o' key (the vowel 'o'), an uppercase 'Q' is printed on the screen. I've run several tests but just can't seem to find the source of the problem.

The oddest part is that it works correctly in QEMU but not in Bochs.

The keyboard configuration in Bochs is set up as follows:

Code: Select all

keyboard: type=mf, keymap=/usr/share/bochs/keymaps/sdl2-pc-us.map
Here are some of the functions I wrote:

Keyboard Handler:

Code: Select all

void keyboard_handler(void)
{
	unsigned int scancode = _in_b(0x60); 

	if (!(scancode & 0x80)) {
		_sys_print_char(scan_code_table[scancode]); 
	}
}
sys_print_char:

Code: Select all

_sys_print_char:
mov bx, ax
mov ax, 3                                   ; SYS_PRINT_CHAR = 3
int 0x60
ret
Does anyone have any ideas for debugging steps I could take to identify the problem?

Thanks!

Re: Difficulties displaying characters typed on the screen

Posted: Fri Aug 07, 2026 4:12 pm
by Octocontrabass
hitlp wrote: ↑Fri Aug 07, 2026 1:53 pm

Code: Select all

_sys_print_char:
mov bx, ax
mov ax, 3                                   ; SYS_PRINT_CHAR = 3
int 0x60
ret
This is some strange code. We might need to see the rest of your code to be able to help you.
hitlp wrote: ↑Fri Aug 07, 2026 1:53 pmDoes anyone have any ideas for debugging steps I could take to identify the problem?
Have you tried using a debugger?

Re: Difficulties displaying characters typed on the screen

Posted: Fri Aug 07, 2026 4:28 pm
by ashy5000
Hi,

What calling convention are you wanting to use for _sys_print_char? Why are there 16-bit registers involved? Why are you triggering an interrupt inside of it, and can we see the corresponding ISR? Any information you can give about this function would be helpful.

Re: Difficulties displaying characters typed on the screen

Posted: Mon Aug 17, 2026 8:13 am
by dragonzapedu
Post your interrupt handler for 0x60 so we can see the rest of the code, take a look at the ASCII table and make sure it aligns with your character pixel map if you are not in text mode.