Weird Characters....

Programming, for all ages and all languages.
Post Reply
User avatar
ChosenOreo
Member
Member
Posts: 25
Joined: Sun May 29, 2011 5:16 pm
Location: Inside A Computer
Contact:

Weird Characters....

Post 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
User avatar
xenos
Member
Member
Posts: 1118
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Weird Characters....

Post 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
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
Post Reply