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

« back to all changes in this revision

Viewing changes to src/mame/drivers/pcat_nit.c

  • 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:
96
96
{
97
97
public:
98
98
        pcat_nit_state(const machine_config &mconfig, device_type type, const char *tag)
99
 
                : driver_device(mconfig, type, tag) { }
 
99
                : driver_device(mconfig, type, tag),
 
100
                  m_uart(*this, "ns16450_0"),
 
101
                  m_microtouch(*this, "microtouch")
 
102
                { }
100
103
 
101
104
        UINT8 *m_banked_nvram;
102
 
};
103
 
 
104
 
 
105
 
static void pcat_nit_microtouch_tx_callback(running_machine &machine, UINT8 data)
106
 
{
107
 
        ins8250_receive(machine.device("ns16450_0"), data);
108
 
};
109
 
 
110
 
static INS8250_TRANSMIT( pcat_nit_com_transmit )
111
 
{
112
 
        UINT8 data8 = data;
113
 
        microtouch_rx(1, &data8);
 
105
        required_device<ns16450_device> m_uart;
 
106
        required_device<microtouch_serial_device> m_microtouch;
 
107
 
 
108
        DECLARE_WRITE_LINE_MEMBER(microtouch_out);
 
109
        DECLARE_WRITE_LINE_MEMBER(microtouch_in);
 
110
        DECLARE_WRITE8_MEMBER(pcat_nit_rombank_w);
 
111
        DECLARE_READ8_MEMBER(pcat_nit_io_r);
 
112
};
 
113
 
 
114
WRITE_LINE_MEMBER(pcat_nit_state::microtouch_out)
 
115
{
 
116
        m_microtouch->rx(state);
 
117
}
 
118
 
 
119
WRITE_LINE_MEMBER(pcat_nit_state::microtouch_in)
 
120
{
 
121
        m_uart->rx_w(state);
114
122
}
115
123
 
116
124
static WRITE_LINE_DEVICE_HANDLER( at_com_interrupt_1 )
120
128
 
121
129
static const ins8250_interface pcat_nit_com0_interface =
122
130
{
123
 
        1843200,
 
131
        DEVCB_DRIVER_LINE_MEMBER(pcat_nit_state, microtouch_out),
 
132
        DEVCB_NULL,
 
133
        DEVCB_NULL,
124
134
        DEVCB_LINE(at_com_interrupt_1),
125
 
        pcat_nit_com_transmit,
126
 
        NULL,
127
 
        NULL
 
135
        DEVCB_NULL,
 
136
        DEVCB_NULL
 
137
};
 
138
 
 
139
static const microtouch_serial_interface pcat_nit_microtouch_interface =
 
140
{
 
141
        DEVCB_DRIVER_LINE_MEMBER(pcat_nit_state, microtouch_in)
128
142
};
129
143
 
130
144
/*************************************
133
147
 *
134
148
 *************************************/
135
149
 
136
 
static WRITE8_HANDLER(pcat_nit_rombank_w)
 
150
WRITE8_MEMBER(pcat_nit_state::pcat_nit_rombank_w)
137
151
{
138
 
        pcat_nit_state *state = space->machine().driver_data<pcat_nit_state>();
139
 
        logerror( "rom bank #%02x at PC=%08X\n", data, cpu_get_pc(&space->device()) );
 
152
        logerror( "rom bank #%02x at PC=%08X\n", data, cpu_get_pc(&space.device()) );
140
153
        if ( data & 0x40 )
141
154
        {
142
155
                // rom bank
143
 
                space->install_read_bank(0x000d8000, 0x000dffff, "rombank" );
144
 
                space->unmap_write(0x000d8000, 0x000dffff);
 
156
                space.install_read_bank(0x000d8000, 0x000dffff, "rombank" );
 
157
                space.unmap_write(0x000d8000, 0x000dffff);
145
158
 
146
159
                if ( data & 0x80 )
147
160
                {
148
 
                        memory_set_bank(space->machine(), "rombank", (data & 0x3f) | 0x40 );
 
161
                        membank("rombank")->set_entry((data & 0x3f) | 0x40 );
149
162
                }
150
163
                else
151
164
                {
152
 
                        memory_set_bank(space->machine(), "rombank", data & 0x3f );
 
165
                        membank("rombank")->set_entry(data & 0x3f );
153
166
                }
154
167
        }
155
168
        else
156
169
        {
157
170
                // nvram bank
158
 
                space->unmap_readwrite(0x000d8000, 0x000dffff);
159
 
 
160
 
                space->install_readwrite_bank(0x000d8000, 0x000d9fff, "nvrambank" );
161
 
 
162
 
                memory_set_bankptr(space->machine(), "nvrambank", state->m_banked_nvram);
 
171
                space.unmap_readwrite(0x000d8000, 0x000dffff);
 
172
 
 
173
                space.install_readwrite_bank(0x000d8000, 0x000d9fff, "nvrambank" );
 
174
 
 
175
                membank("nvrambank")->set_base(m_banked_nvram);
163
176
 
164
177
        }
165
178
}
166
179
 
167
 
static ADDRESS_MAP_START( pcat_map, AS_PROGRAM, 32 )
 
180
static ADDRESS_MAP_START( pcat_map, AS_PROGRAM, 32, pcat_nit_state )
168
181
        AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
169
182
        AM_RANGE(0x000a0000, 0x000bffff) AM_RAM
170
183
        AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0) AM_WRITENOP
175
188
        AM_RANGE(0xffff0000, 0xffffffff) AM_ROM AM_REGION("bios", 0 )
176
189
ADDRESS_MAP_END
177
190
 
178
 
static READ8_HANDLER(pcat_nit_io_r)
 
191
READ8_MEMBER(pcat_nit_state::pcat_nit_io_r)
179
192
{
180
193
        switch(offset)
181
194
        {
182
195
                case 0: /* 278 */
183
196
                        return 0xff;
184
197
                case 1: /* 279 */
185
 
                        return input_port_read(space->machine(), "IN0");
 
198
                        return ioport("IN0")->read();
186
199
                case 7: /* 27f dips */
187
200
                        return 0xff;
188
201
                default:
190
203
        }
191
204
}
192
205
 
193
 
static ADDRESS_MAP_START( pcat_nit_io, AS_IO, 32 )
 
206
static ADDRESS_MAP_START( pcat_nit_io, AS_IO, 32, pcat_nit_state )
194
207
        AM_IMPORT_FROM(pcat32_io_common)
195
208
        AM_RANGE(0x0278, 0x027f) AM_READ8(pcat_nit_io_r, 0xffffffff) AM_WRITENOP
196
209
        AM_RANGE(0x0280, 0x0283) AM_READNOP
197
 
        AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ns16450_0", ins8250_r, ins8250_w, 0xffffffff)
 
210
        AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ns16450_0", ns16450_device, ins8250_r, ins8250_w, 0xffffffff)
198
211
ADDRESS_MAP_END
199
212
 
200
213
static INPUT_PORTS_START( pcat_nit )
201
 
        PORT_INCLUDE(microtouch)
202
 
 
203
214
        PORT_START("IN0")
204
215
        PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Clear") PORT_CODE(KEYCODE_C)
205
216
        PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_SERVICE)
221
232
 
222
233
        init_pc_common(machine, PCCOMMON_KEYBOARD_AT, streetg2_set_keyb_int);
223
234
 
224
 
        memory_configure_bank(machine, "rombank", 0, 0x80, machine.region("game_prg")->base(), 0x8000 );
225
 
        memory_set_bank(machine, "rombank", 0);
 
235
        machine.root_device().membank("rombank")->configure_entries(0, 0x80, machine.root_device().memregion("game_prg")->base(), 0x8000 );
 
236
        machine.root_device().membank("rombank")->set_entry(0);
226
237
 
227
 
        microtouch_init(machine, pcat_nit_microtouch_tx_callback, NULL);
 
238
        //microtouch_init(machine, pcat_nit_microtouch_tx_callback, NULL);
228
239
}
229
240
 
230
241
static MACHINE_CONFIG_START( pcat_nit, pcat_nit_state )
245
256
 
246
257
//  MCFG_FRAGMENT_ADD( at_kbdc8042 )
247
258
        MCFG_FRAGMENT_ADD( pcat_common )
248
 
        MCFG_NS16450_ADD( "ns16450_0", pcat_nit_com0_interface )
 
259
        MCFG_NS16450_ADD( "ns16450_0", pcat_nit_com0_interface, XTAL_1_8432MHz )
 
260
        MCFG_MICROTOUCH_SERIAL_ADD( "microtouch", pcat_nit_microtouch_interface, 9600 ) // rate?
249
261
 
250
262
        MCFG_NVRAM_ADD_0FILL("nvram")
251
263