OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [software/] [emuThor/] [source/] [clsKeyboard.h] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 robfinch
#pragma once
2
class clsKeyboard
3
{
4
        unsigned __int8 buffer[32];
5
        int head;
6
        int tail;
7
public:
8
        volatile unsigned __int8 scancode;
9
        volatile unsigned __int8 status;
10
        clsKeyboard(void);
11
        ~clsKeyboard(void);
12
        bool IsSelected(unsigned int ad) { return ((ad & 0xFFFFFFF0)==0xFFDC0000); };
13
        void Put(unsigned __int8 sc) {
14
                scancode = sc;
15
                buffer[head] = sc;
16
                head++;
17
                head &= 31;
18
        };
19
        unsigned __int8 Get() {
20
                unsigned __int8 sc;
21
 
22
                sc = 0;
23
                if (head != tail) {
24
                        sc = buffer[tail];
25
                        tail++;
26
                        tail &= 31;
27
                }
28
                return sc;
29
        };
30
        unsigned __int8 Peek(int amt) {
31
                unsigned __int8 sc;
32
                int ndx;
33
 
34
                ndx = tail + amt;
35
                ndx &= 31;
36
                sc = buffer[ndx];
37
                return sc;
38
        };
39
        unsigned __int8 GetStatus() {
40
                if (head != tail)
41
                        return 0x80;
42
                else
43
                        return 0x00;
44
        };
45
};
46
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.