Amiga is just an Atari clone :-P

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38925 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2010-10-10 12:42:18 +00:00
parent acb1d6c8e0
commit 6ed98199f1
2 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,67 @@
/*
** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#include "keyboard.h"
#include "toscalls.h"
#include <boot/platform.h>
static uint32
check_for_key(void)
{
union key k;
if (Bconstat(DEV_CON) == 0)
return 0;
k.d0 = Bconin(DEV_CON);
return k.d0;
}
extern "C" void
clear_key_buffer(void)
{
while (check_for_key() != 0)
;
}
extern "C" union key
wait_for_key(void)
{
union key key;
key.d0 = Bconin(DEV_CON);
return key;
}
extern "C" uint32
check_for_boot_keys(void)
{
union key key;
uint32 options = 0;
while ((key.d0 = check_for_key()) != 0) {
switch (key.code.ascii) {
case ' ':
options |= BOOT_OPTION_MENU;
break;
case 0x1b: // escape
options |= BOOT_OPTION_DEBUG_OUTPUT;
break;
case 0:
// evaluate BIOS scan codes
// ...
break;
}
}
dprintf("options = %ld\n", options);
return options;
}

View File

@ -0,0 +1,40 @@
#ifndef KEYBOARD_H
#define KEYBOARD_H
#include <SupportDefs.h>
union key {
uint32 d0;
struct {
uint8 modifiers; // not always present!
uint8 bios; // scan code
uint8 dummy;
uint8 ascii;
} code;
};
#define BIOS_KEY_UP 0x48
#define BIOS_KEY_DOWN 0x50
#define BIOS_KEY_LEFT 0x4b
#define BIOS_KEY_RIGHT 0x4d
// XXX: FIXME
#define BIOS_KEY_HOME 0x47
#define BIOS_KEY_END 0x4f
#define BIOS_KEY_PAGE_UP 0x49
#define BIOS_KEY_PAGE_DOWN 0x51
#ifdef __cplusplus
extern "C" {
#endif
extern void clear_key_buffer(void);
extern union key wait_for_key(void);
extern uint32 check_for_boot_keys(void);
#ifdef __cplusplus
}
#endif
#endif /* KEYBOARD_H */