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

Subversion Repositories thor

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

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

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

powered by: WebSVN 2.1.0

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