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:
parent
acb1d6c8e0
commit
6ed98199f1
67
src/system/boot/platform/amiga_m68k/keyboard.cpp
Normal file
67
src/system/boot/platform/amiga_m68k/keyboard.cpp
Normal 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;
|
||||
}
|
||||
|
40
src/system/boot/platform/amiga_m68k/keyboard.h
Normal file
40
src/system/boot/platform/amiga_m68k/keyboard.h
Normal 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 */
|
Loading…
x
Reference in New Issue
Block a user