~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to src/emu/machine/i8279.h

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 
 
3
    Intel 8279 Programmable Keyboard/Display Interface emulation
 
4
 
 
5
    Copyright the MESS Team 2012.
 
6
    Visit http://mamedev.org for licensing and usage restrictions.
 
7
 
 
8
****************************************************************************
 
9
                            _____   _____
 
10
                   RL2   1 |*    \_/     | 40  Vcc
 
11
                   RL3   2 |             | 39  RL1
 
12
                   CLK   3 |             | 38  RL0
 
13
                   IRQ   4 |             | 37  CNTL/STB
 
14
                   RL4   5 |             | 36  SHIFT
 
15
                   RL5   6 |             | 35  SL3
 
16
                   RL6   7 |             | 34  SL2
 
17
                   RL7   8 |             | 33  SL1
 
18
                 RESET   9 |             | 32  SL0
 
19
                   /RD  10 |     8279    | 31  B0
 
20
                   /WR  11 |             | 30  B1
 
21
                   DB0  12 |             | 29  B2
 
22
                   DB1  13 |             | 28  B3
 
23
                   DB2  14 |             | 27  A0
 
24
                   DB3  15 |             | 26  A1
 
25
                   DB4  16 |             | 25  A2
 
26
                   DB5  17 |             | 24  A3
 
27
                   DB6  18 |             | 23  /BD
 
28
                   DB7  19 |             | 22  /CS
 
29
                   Vss  20 |_____________| 21  CTRL/DATA
 
30
 
 
31
 
 
32
***************************************************************************/
 
33
 
 
34
#pragma once
 
35
 
 
36
#ifndef __I8279__
 
37
#define __I8279__
 
38
 
 
39
#include "emu.h"
 
40
 
 
41
 
 
42
 
 
43
/***************************************************************************
 
44
    DEVICE CONFIGURATION MACROS
 
45
***************************************************************************/
 
46
 
 
47
#define MCFG_I8279_ADD(_tag, _clock, _config) \
 
48
        MCFG_DEVICE_ADD(_tag, I8279, _clock) \
 
49
        MCFG_DEVICE_CONFIG(_config)
 
50
 
 
51
#define I8279_INTERFACE(_name) \
 
52
        const i8279_interface (_name) =
 
53
 
 
54
 
 
55
/***************************************************************************
 
56
    TYPE DEFINITIONS
 
57
***************************************************************************/
 
58
 
 
59
 
 
60
// ======================> i8279_interface
 
61
 
 
62
struct i8279_interface
 
63
{
 
64
        devcb_write_line        m_out_irq_cb;           // IRQ
 
65
        devcb_write8            m_out_sl_cb;            // Scanlines SL0-3
 
66
        devcb_write8            m_out_disp_cb;          // B0-3,A0-3
 
67
        devcb_write_line        m_out_bd_cb;            // BD
 
68
        devcb_read8             m_in_rl_cb;             // kbd readlines RL0-7
 
69
        devcb_read_line         m_in_shift_cb;          // Shift key
 
70
        devcb_read_line         m_in_ctrl_cb;           // Ctrl-Strobe line
 
71
};
 
72
 
 
73
 
 
74
 
 
75
// ======================> i8279_device
 
76
 
 
77
class i8279_device :  public device_t, public i8279_interface
 
78
{
 
79
public:
 
80
        // construction/destruction
 
81
        i8279_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
 
82
 
 
83
        // read & write handlers
 
84
        DECLARE_READ8_MEMBER(status_r);
 
85
        DECLARE_READ8_MEMBER(data_r);
 
86
        DECLARE_WRITE8_MEMBER(cmd_w);
 
87
        DECLARE_WRITE8_MEMBER(data_w);
 
88
        void timer_mainloop();
 
89
 
 
90
protected:
 
91
        // device-level overrides
 
92
        virtual void device_config_complete();
 
93
        virtual void device_start();
 
94
        virtual void device_reset();
 
95
        virtual void device_post_load() { }
 
96
        virtual void device_clock_changed() { }
 
97
 
 
98
        static TIMER_CALLBACK( timerproc_callback );
 
99
 
 
100
private:
 
101
 
 
102
        void timer_adjust();
 
103
        void clear_display();
 
104
        void new_key(UINT8 data, bool skey, bool ckey);
 
105
        void new_fifo(UINT8 data);
 
106
        UINT8 get_segments();
 
107
        void set_irq(bool state);
 
108
        void set_display_mode(UINT8 data);
 
109
 
 
110
        devcb_resolved_write_line       m_out_irq_func;
 
111
        devcb_resolved_write8           m_out_sl_func;
 
112
        devcb_resolved_write8           m_out_disp_func;
 
113
        devcb_resolved_write_line       m_out_bd_func;
 
114
        devcb_resolved_read8            m_in_rl_func;
 
115
        devcb_resolved_read_line        m_in_shift_func;
 
116
        devcb_resolved_read_line        m_in_ctrl_func;
 
117
 
 
118
        emu_timer *m_timer;
 
119
 
 
120
        UINT8 m_d_ram[16];              // display ram
 
121
        UINT8 m_d_ram_ptr;
 
122
        UINT8 m_s_ram[8]; // might be same as fifo ram
 
123
        UINT8 m_s_ram_ptr;
 
124
        UINT8 m_fifo[8];    // queued keystrokes
 
125
        UINT8 m_cmd[8];   // Device settings
 
126
        UINT8 m_status;     // Returned via status_r
 
127
        UINT32 m_clock;     // Internal scan clock
 
128
        UINT8 m_scanner;    // next output on SL lines
 
129
 
 
130
        bool m_autoinc;     // auto-increment flag
 
131
        bool m_read_flag;   // read from where
 
132
        bool m_ctrl_key;    // previous state of strobe input
 
133
        UINT16 m_key_down;
 
134
};
 
135
 
 
136
 
 
137
// device type definition
 
138
extern const device_type I8279;
 
139
 
 
140
 
 
141
 
 
142
#endif