Ich häng mal noch meinen aktuellen Code an:
void scanf () // Aufruf durch "scanf();"
{
volatile int scancode;
int z;
int i;
char string[80];
static unsigned scantable[1024] = { // Scancodetabelle
[0x02] = '1',
[0x03] = '2',
[0x04] = '3',
[0x05] = '4',
[0x06] = '5',
[0x07] = '6',
[0x08] = '7',
[0x09] = '8',
[0x0a] = '9',
[0x0b] = '0',
[0x0c] = '?',
[0x0d] = '`',
[0x0e] = '^',
[0x0f] = '^',
[0x10] = 'q',
[0x11] = 'w',
[0x12] = 'e',
[0x13] = 'r',
[0x14] = 't',
[0x15] = 'z',
[0x16] = 'u',
[0x17] = 'i',
[0x18] = 'o',
[0x19] = 'p',
[0x1a] = '^',
[0x1b] = '*',
[0x1c] = '\n', // Enter
[0x1d] = '^',
[0x1e] = 'a',
[0x1f] = 's',
[0x20] = 'd',
[0x21] = 'f',
[0x22] = 'g',
[0x23] = 'h',
[0x24] = 'j',
[0x25] = 'k',
[0x26] = 'l',
[0x27] = '^',
[0x28] = '^',
[0x29] = '<',
[0x2a] = '^',
[0x2b] = '#',
[0x2c] = 'y',
[0x2d] = 'x',
[0x2e] = 'c',
[0x2f] = 'v',
[0x30] = 'b',
[0x31] = 'n',
[0x32] = 'm',
[0x33] = ',',
[0x34] = '.',
[0x35] = '_',
[0x36] = '^',
[0x37] = '^',
[0x38] = '^',
[0x39] = ' ',
[0x3a] = '^',
[0x3b] = '^',
[0x3c] = '^',
[0x3d] = '^',
[0x3e] = '^',
[0x3f] = '^',
[0x40] = '^',
[0x41] = '^',
[0x42] = '^',
[0x43] = '^',
[0x44] = '^',
[0x45] = '^',
[0x46] = '^',
[0x47] = '^',
[0x48] = '^',
[0x49] = '^',
[0x4a] = '-',
[0x4b] = '^',
[0x4c] = '^',
[0x4d] = '^',
[0x4e] = '+',
[0x4f] = '^',
[0x50] = '^',
[0x51] = '^',
[0x52] = '^',
[0x53] = '^',
[0x54] = '^',
[0xd9] = '^',
[0xda] = '^',
};
for (z=0; z<79; z++)
{
// Solange warten, wie der Input Buffer leer ist
while ((inb(0x64) & 1) == 0) {}
// Scancode auslesen (dadurch wird die Taste aus dem Input Buffer entfernt)
scancode = inb(0x60);
string[z] = scantable[scancode];
if(string[z] == '\n')
{
z++;
break;
}
}
string[z] = '\0'; // String abschließen
i = 1;
while(string[i] != '\0') // Byteweises kopieren (string --> string)
{
key[i] = string[i]; // key --> globale "char*"-Variable
i++;
}
}