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

« back to all changes in this revision

Viewing changes to mess/src/mess/drivers/sdk85.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 
3
 
        Intel SDK-85
4
 
 
5
 
        09/12/2009 Skeleton driver.
6
 
 
7
 
        22/06/2011 Working [Robbbert]
8
 
 
9
 
This is an evaluation kit for the 8085 cpu.
10
 
 
11
 
There is no speaker or storage facility in the standard kit.
12
 
 
13
 
Download the User Manual to get the operating procedures.
14
 
 
15
 
An example is Press SUBST key, enter an address, press NEXT key, enter data,
16
 
then press NEXT to increment the address.
17
 
 
18
 
ToDo:
19
 
- Artwork
20
 
- Proper emulation of the 8279 chip (there's only just enough to get this
21
 
  driver to work atm)
22
 
 
23
 
****************************************************************************/
24
 
#define ADDRESS_MAP_MODERN
25
 
 
26
 
#include "emu.h"
27
 
#include "cpu/i8085/i8085.h"
28
 
#include "sdk85.lh"
29
 
 
30
 
#define MACHINE_RESET_MEMBER(name) void name::machine_reset()
31
 
 
32
 
class sdk85_state : public driver_device
33
 
{
34
 
public:
35
 
        sdk85_state(const machine_config &mconfig, device_type type, const char *tag)
36
 
                : driver_device(mconfig, type, tag) { }
37
 
 
38
 
        DECLARE_READ8_MEMBER(keyboard_r);
39
 
        DECLARE_READ8_MEMBER(status_r);
40
 
        DECLARE_WRITE8_MEMBER(command_w);
41
 
        DECLARE_WRITE8_MEMBER(data_w);
42
 
        UINT8 m_digit; // next digit to display
43
 
        UINT8 m_kbd; // keyscan code being returned
44
 
        UINT8 m_keytemp; // to see when key gets released
45
 
        bool m_kbd_ready; // get ready to return keyscan code
46
 
        virtual void machine_reset();
47
 
};
48
 
 
49
 
READ8_MEMBER( sdk85_state::keyboard_r )
50
 
{
51
 
        if (m_kbd_ready)
52
 
        {
53
 
                UINT8 ret = m_kbd;
54
 
                m_kbd_ready = FALSE;
55
 
                m_kbd = 0xff;
56
 
                return ret;
57
 
        }
58
 
        else
59
 
                return 0;
60
 
}
61
 
 
62
 
READ8_MEMBER( sdk85_state::status_r )
63
 
{
64
 
        return 0;
65
 
}
66
 
 
67
 
WRITE8_MEMBER( sdk85_state::command_w )
68
 
{
69
 
        if ((data & 0x90)==0x90)
70
 
                m_digit = data & 7;
71
 
        else
72
 
        if (data==0x40)
73
 
                m_kbd_ready = TRUE;
74
 
}
75
 
 
76
 
WRITE8_MEMBER( sdk85_state::data_w )
77
 
{
78
 
        if (m_digit < 6)
79
 
        {
80
 
                output_set_digit_value(m_digit, BITSWAP8(data, 3, 2, 1, 0, 7, 6, 5, 4)^0xff);
81
 
                m_digit++;
82
 
        }
83
 
        else
84
 
                m_digit = 15;
85
 
}
86
 
 
87
 
 
88
 
static ADDRESS_MAP_START(sdk85_mem, AS_PROGRAM, 8, sdk85_state)
89
 
        ADDRESS_MAP_UNMAP_HIGH
90
 
        AM_RANGE(0x0000, 0x07ff) AM_ROM // Monitor rom (A14)
91
 
        AM_RANGE(0x0800, 0x0fff) AM_ROM // Expansion rom (A15)
92
 
        AM_RANGE(0x1800, 0x1800) AM_READWRITE(keyboard_r,data_w)
93
 
        AM_RANGE(0x1900, 0x1900) AM_READWRITE(status_r,command_w)
94
 
        //AM_RANGE(0x1800, 0x1fff) AM_RAM // i8279 (A13)
95
 
        AM_RANGE(0x2000, 0x27ff) AM_RAM // i8155 (A16)
96
 
        AM_RANGE(0x2800, 0x2fff) AM_RAM // i8155 (A17)
97
 
ADDRESS_MAP_END
98
 
 
99
 
static ADDRESS_MAP_START(sdk85_io, AS_IO, 8, sdk85_state)
100
 
        ADDRESS_MAP_UNMAP_HIGH
101
 
ADDRESS_MAP_END
102
 
 
103
 
/* Input ports */
104
 
static INPUT_PORTS_START( sdk85 )
105
 
        PORT_START("X0")
106
 
        PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0')
107
 
        PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1')
108
 
        PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2')
109
 
        PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3')
110
 
        PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4')
111
 
        PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5')
112
 
        PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6')
113
 
        PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7')
114
 
 
115
 
        PORT_START("X1")
116
 
        PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8')
117
 
        PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9')
118
 
        PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A')
119
 
        PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B')
120
 
        PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C')
121
 
        PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D')
122
 
        PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E')
123
 
        PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F')
124
 
 
125
 
        PORT_START("X2")
126
 
        PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXEC") PORT_CODE(KEYCODE_Q)
127
 
        PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_W)
128
 
        PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_R)
129
 
        PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SUBST") PORT_CODE(KEYCODE_T)
130
 
        PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXAM") PORT_CODE(KEYCODE_Y)
131
 
        PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SINGLE") PORT_CODE(KEYCODE_U)
132
 
        PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED)
133
 
INPUT_PORTS_END
134
 
 
135
 
 
136
 
MACHINE_RESET_MEMBER( sdk85_state )
137
 
{
138
 
        m_digit = 15;
139
 
        m_kbd_ready = FALSE;
140
 
        m_kbd = 0xff;
141
 
        m_keytemp = 0xfe;
142
 
}
143
 
 
144
 
// This is an internal function of the 8279 chip
145
 
static TIMER_DEVICE_CALLBACK( sdk85_keyscan )
146
 
{
147
 
        sdk85_state *state = timer.machine().driver_data<sdk85_state>();
148
 
        UINT8 keyscan, keytemp = 0xff,i;
149
 
        keyscan = input_port_read(timer.machine(), "X0");
150
 
        if (keyscan < 0xff)
151
 
        {
152
 
                for (i = 0; i < 8; i++)
153
 
                {
154
 
                        if (!BIT(keyscan, i))
155
 
                        {
156
 
                                keytemp = i;
157
 
                                i = 9;
158
 
                        }
159
 
                }
160
 
        }
161
 
        else
162
 
        {
163
 
                keyscan = input_port_read(timer.machine(), "X1");
164
 
                if (keyscan < 0xff)
165
 
                {
166
 
                        for (i = 0; i < 8; i++)
167
 
                        {
168
 
                                if (!BIT(keyscan, i))
169
 
                                {
170
 
                                        keytemp = i+8;
171
 
                                        i = 9;
172
 
                                }
173
 
                        }
174
 
                }
175
 
                else
176
 
                {
177
 
                        keyscan = input_port_read(timer.machine(), "X2");
178
 
                        if (keyscan < 0xff)
179
 
                        {
180
 
                                for (i = 0; i < 6; i++)
181
 
                                {
182
 
                                        if (!BIT(keyscan, i))
183
 
                                        {
184
 
                                                keytemp = i+16;
185
 
                                                i = 9;
186
 
                                        }
187
 
                                }
188
 
                        }
189
 
                }
190
 
        }
191
 
 
192
 
        device_t *cpu = timer.machine().device( "maincpu" );
193
 
 
194
 
        if ((state->m_kbd == 0xff) && (keytemp < 0xff) && (keytemp != state->m_keytemp))
195
 
        {
196
 
                state->m_kbd = keytemp;
197
 
                state->m_keytemp = keytemp;
198
 
                device_set_input_line(cpu, I8085_RST55_LINE, HOLD_LINE);
199
 
        }
200
 
        else
201
 
        if (keytemp==0xff)
202
 
        {
203
 
                state->m_keytemp = 0xfe;
204
 
                device_set_input_line(cpu, I8085_RST55_LINE, CLEAR_LINE);
205
 
        }
206
 
}
207
 
 
208
 
 
209
 
static MACHINE_CONFIG_START( sdk85, sdk85_state )
210
 
        /* basic machine hardware */
211
 
        MCFG_CPU_ADD("maincpu", I8085A, XTAL_2MHz)
212
 
        MCFG_CPU_PROGRAM_MAP(sdk85_mem)
213
 
        MCFG_CPU_IO_MAP(sdk85_io)
214
 
 
215
 
        /* video hardware */
216
 
        MCFG_DEFAULT_LAYOUT(layout_sdk85)
217
 
 
218
 
        MCFG_TIMER_ADD_PERIODIC("keyscan", sdk85_keyscan, attotime::from_hz(15))
219
 
MACHINE_CONFIG_END
220
 
 
221
 
/* ROM definition */
222
 
ROM_START( sdk85 )
223
 
        ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
224
 
        ROM_LOAD( "sdk85.a14", 0x0000, 0x0800, CRC(9d5a983f) SHA1(54e218560fbec009ac3de5cfb64b920241ef2eeb))
225
 
ROM_END
226
 
 
227
 
/* Driver */
228
 
 
229
 
/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT   COMPANY   FULLNAME       FLAGS */
230
 
COMP( 1977, sdk85,  0,       0,      sdk85,     sdk85,     0,  "Intel",   "SDK-85", GAME_NO_SOUND_HW)
231