Difficulties displaying characters typed on the screen

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
hitlp
Posts: 1
Joined: Fri Aug 07, 2026 11:45 am

Difficulties displaying characters typed on the screen

Post 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!
Octocontrabass
Member
Member
Posts: 6275
Joined: Mon Mar 25, 2013 7:01 pm

Re: Difficulties displaying characters typed on the screen

Post 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?
ashy5000
Posts: 8
Joined: Tue Jun 09, 2026 12:48 am

Re: Difficulties displaying characters typed on the screen

Post 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.
- Ashy5000
https://github.com/Ashy5000/muse

Live long and prosper!
dragonzapedu
Posts: 11
Joined: Mon Aug 17, 2026 4:09 am
Location: United Kingdom
GitHub: https://github.com/nibblebits
Contact:

Re: Difficulties displaying characters typed on the screen

Post 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.
Post Reply