Page 1 of 1

Weird Characters....

Posted: Sat Jun 18, 2011 11:16 pm
by ChosenOreo
When I boot my kernel/bootloader (currently only doing input/output), it loads, but when I type letters, I get keys from the extended ascii set and a few of the letters from the normal ascii set. I don't know what I'm doing wrong. Here is my code:

Code: Select all

; main_oldest.asm -- Main Kernel/Boot File... For now...
; WiseMen OS version 0.00.01
; View the page at https://sourceforge.net/projects/wisemen/
[BITS 16]
org	0x7c00

CLI

XOR 	AX, AX
PUSH	AX
POP		DS

MOV WORD[DS:(9*4)  ], keyboard_handler
MOV WORD[DS:(9*4)+2],	0

STI

JMP $

bios.writechar:
	PUSHA
	MOV	ah,	0x0E
	INT	0x10
	POPA
	
keyboard_handler:
	PUSHA
	
	.spin:
		IN	al, 0x64
		AND	AL, 0x01
		JZ	.spin
		
		IN	AL, 0x60
		
		CALL bios.writechar
		
		MOV AL, 0x20
		OUT	0x20, AL
		
		POPA
	IRET
TIMES 510 - ($ - $$) db 0
dw 0xAA55
I'm using NASM 2.09.08 on Windows 7
I am compiling it with

Code: Select all

nasm main_oldest.asm -f bin -o boot.img
I have had it print strings with the same compile code.

I think it has to do with the keymap.

Each input character becomes 2 different characters.

Image

Thanks!
- ChosenOreo

Re: Weird Characters....

Posted: Sun Jun 19, 2011 1:04 am
by xenos
It seems that you are directly printing the scancode ("make" code for key down and "break" code for key up) as it it was an ASCII character:

http://wiki.osdev.org/PS2_Keyboard