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

« back to all changes in this revision

Viewing changes to src/mame/video/vectrex.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:
107
107
 
108
108
*********************************************************************/
109
109
 
110
 
READ8_HANDLER(vectrex_via_r)
 
110
READ8_MEMBER(vectrex_state::vectrex_via_r)
111
111
{
112
 
        via6522_device *via = space->machine().device<via6522_device>("via6522_0");
113
 
        return via->read(*space, offset);
 
112
        via6522_device *via = machine().device<via6522_device>("via6522_0");
 
113
        return via->read(space, offset);
114
114
}
115
115
 
116
 
WRITE8_HANDLER(vectrex_via_w)
 
116
WRITE8_MEMBER(vectrex_state::vectrex_via_w)
117
117
{
118
 
        vectrex_state *state = space->machine().driver_data<vectrex_state>();
119
 
        via6522_device *via = space->machine().device<via6522_device>("via6522_0");
 
118
        via6522_device *via = machine().device<via6522_device>("via6522_0");
120
119
        attotime period;
121
120
 
122
121
        switch (offset)
123
122
        {
124
123
        case 8:
125
 
                state->m_via_timer2 = (state->m_via_timer2 & 0xff00) | data;
 
124
                m_via_timer2 = (m_via_timer2 & 0xff00) | data;
126
125
                break;
127
126
 
128
127
        case 9:
129
 
                state->m_via_timer2 = (state->m_via_timer2 & 0x00ff) | (data << 8);
130
 
 
131
 
                period = (attotime::from_hz(space->machine().device("maincpu")->unscaled_clock()) * state->m_via_timer2);
132
 
 
133
 
                if (state->m_reset_refresh)
134
 
                        state->m_refresh->adjust(period, 0, period);
 
128
                m_via_timer2 = (m_via_timer2 & 0x00ff) | (data << 8);
 
129
 
 
130
                period = (attotime::from_hz(machine().device("maincpu")->unscaled_clock()) * m_via_timer2);
 
131
 
 
132
                if (m_reset_refresh)
 
133
                        m_refresh->adjust(period, 0, period);
135
134
                else
136
 
                        state->m_refresh->adjust(
137
 
                                                                  min(period, state->m_refresh->remaining()),
 
135
                        m_refresh->adjust(
 
136
                                                                  min(period, m_refresh->remaining()),
138
137
                                                                  0,
139
138
                                                                  period);
140
139
                break;
141
140
        }
142
 
        via->write(*space, offset, data);
 
141
        via->write(space, offset, data);
143
142
}
144
143
 
145
144
 
387
386
                }
388
387
        }
389
388
 
 
389
        /* Cartridge bank-switching */
 
390
        if (state->m_64k_cart && ((data ^ state->m_via_out[PORTB]) & 0x40))
 
391
        {
 
392
                device_t &root_device = device->machine().root_device();
 
393
 
 
394
                root_device.membank("bank1")->set_base(root_device.memregion("maincpu")->base() + ((data & 0x40) ? 0x10000 : 0x0000));
 
395
        }
 
396
 
390
397
        /* Sound */
391
398
        if (data & 0x10)
392
399
        {
436
443
                /* Check lightpen */
437
444
                if (state->m_lightpen_port != 0)
438
445
                {
439
 
                        state->m_lightpen_down = input_port_read(device->machine(), "LPENCONF") & 0x10;
 
446
                        state->m_lightpen_down = state->ioport("LPENCONF")->read() & 0x10;
440
447
 
441
448
                        if (state->m_lightpen_down)
442
449
                        {
443
 
                                state->m_pen_x = input_port_read(device->machine(), "LPENX") * (state->m_x_max / 0xff);
444
 
                                state->m_pen_y = input_port_read(device->machine(), "LPENY") * (state->m_y_max / 0xff);
 
450
                                state->m_pen_x = state->ioport("LPENX")->read() * (state->m_x_max / 0xff);
 
451
                                state->m_pen_y = state->ioport("LPENY")->read() * (state->m_y_max / 0xff);
445
452
 
446
453
                                dx = abs(state->m_pen_x - state->m_x_int);
447
454
                                dy = abs(state->m_pen_y - state->m_y_int);
470
477
};
471
478
 
472
479
 
473
 
WRITE8_HANDLER(raaspec_led_w)
 
480
WRITE8_MEMBER(vectrex_state::raaspec_led_w)
474
481
{
475
482
        logerror("Spectrum I+ LED: %i%i%i%i%i%i%i%i\n",
476
483
                         (data>>7)&0x1, (data>>6)&0x1, (data>>5)&0x1, (data>>4)&0x1,