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

« back to all changes in this revision

Viewing changes to src/mame/video/cloud9.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:
22
22
 
23
23
        /* allocate second bank of videoram */
24
24
        state->m_videoram = auto_alloc_array(machine, UINT8, 0x8000);
25
 
        memory_set_bankptr(machine, "bank1", state->m_videoram);
 
25
        state->membank("bank1")->set_base(state->m_videoram);
26
26
 
27
27
        /* get pointers to our PROMs */
28
 
        state->m_syncprom = machine.region("proms")->base() + 0x000;
29
 
        state->m_wpprom = machine.region("proms")->base() + 0x200;
30
 
        state->m_priprom = machine.region("proms")->base() + 0x300;
 
28
        state->m_syncprom = machine.root_device().memregion("proms")->base() + 0x000;
 
29
        state->m_wpprom = machine.root_device().memregion("proms")->base() + 0x200;
 
30
        state->m_priprom = machine.root_device().memregion("proms")->base() + 0x300;
31
31
 
32
32
        /* compute the color output resistor weights at startup */
33
33
        compute_resistor_weights(0,     255, -1.0,
52
52
 *
53
53
 *************************************/
54
54
 
55
 
WRITE8_HANDLER( cloud9_video_control_w )
 
55
WRITE8_MEMBER(cloud9_state::cloud9_video_control_w)
56
56
{
57
 
        cloud9_state *state = space->machine().driver_data<cloud9_state>();
58
57
 
59
58
        /* only D7 matters */
60
 
        state->m_video_control[offset] = (data >> 7) & 1;
 
59
        m_video_control[offset] = (data >> 7) & 1;
61
60
}
62
61
 
63
62
 
68
67
 *
69
68
 *************************************/
70
69
 
71
 
WRITE8_HANDLER( cloud9_paletteram_w )
 
70
WRITE8_MEMBER(cloud9_state::cloud9_paletteram_w)
72
71
{
73
 
        cloud9_state *state = space->machine().driver_data<cloud9_state>();
74
72
        int bit0, bit1, bit2;
75
73
        int r, g, b;
76
74
 
83
81
        bit0 = (~r >> 0) & 0x01;
84
82
        bit1 = (~r >> 1) & 0x01;
85
83
        bit2 = (~r >> 2) & 0x01;
86
 
        r = combine_3_weights(state->m_rweights, bit0, bit1, bit2);
 
84
        r = combine_3_weights(m_rweights, bit0, bit1, bit2);
87
85
 
88
86
        /* green component (inverted) */
89
87
        bit0 = (~g >> 0) & 0x01;
90
88
        bit1 = (~g >> 1) & 0x01;
91
89
        bit2 = (~g >> 2) & 0x01;
92
 
        g = combine_3_weights(state->m_gweights, bit0, bit1, bit2);
 
90
        g = combine_3_weights(m_gweights, bit0, bit1, bit2);
93
91
 
94
92
        /* blue component (inverted) */
95
93
        bit0 = (~b >> 0) & 0x01;
96
94
        bit1 = (~b >> 1) & 0x01;
97
95
        bit2 = (~b >> 2) & 0x01;
98
 
        b = combine_3_weights(state->m_bweights, bit0, bit1, bit2);
 
96
        b = combine_3_weights(m_bweights, bit0, bit1, bit2);
99
97
 
100
 
        palette_set_color(space->machine(), offset & 0x3f, MAKE_RGB(r, g, b));
 
98
        palette_set_color(machine(), offset & 0x3f, MAKE_RGB(r, g, b));
101
99
}
102
100
 
103
101
 
180
178
 *
181
179
 *************************************/
182
180
 
183
 
WRITE8_HANDLER( cloud9_videoram_w )
 
181
WRITE8_MEMBER(cloud9_state::cloud9_videoram_w)
184
182
{
185
183
        /* direct writes to VRAM go through the write protect PROM as well */
186
 
        cloud9_write_vram(space->machine(), offset, data, 0, 0);
 
184
        cloud9_write_vram(machine(), offset, data, 0, 0);
187
185
}
188
186
 
189
187
 
194
192
 *
195
193
 *************************************/
196
194
 
197
 
READ8_HANDLER( cloud9_bitmode_r )
 
195
READ8_MEMBER(cloud9_state::cloud9_bitmode_r)
198
196
{
199
 
        cloud9_state *state = space->machine().driver_data<cloud9_state>();
200
197
 
201
198
        /* in bitmode, the address comes from the autoincrement latches */
202
 
        UINT16 addr = (state->m_bitmode_addr[1] << 6) | (state->m_bitmode_addr[0] >> 2);
 
199
        UINT16 addr = (m_bitmode_addr[1] << 6) | (m_bitmode_addr[0] >> 2);
203
200
 
204
201
        /* the appropriate pixel is selected into the upper 4 bits */
205
 
        UINT8 result = state->m_videoram[((~state->m_bitmode_addr[0] & 2) << 13) | addr] << ((state->m_bitmode_addr[0] & 1) * 4);
 
202
        UINT8 result = m_videoram[((~m_bitmode_addr[0] & 2) << 13) | addr] << ((m_bitmode_addr[0] & 1) * 4);
206
203
 
207
204
        /* autoincrement because /BITMD was selected */
208
 
        bitmode_autoinc(space->machine());
 
205
        bitmode_autoinc(machine());
209
206
 
210
207
        /* the upper 4 bits of the data lines are not driven so make them all 1's */
211
208
        return (result >> 4) | 0xf0;
212
209
}
213
210
 
214
211
 
215
 
WRITE8_HANDLER( cloud9_bitmode_w )
 
212
WRITE8_MEMBER(cloud9_state::cloud9_bitmode_w)
216
213
{
217
 
        cloud9_state *state = space->machine().driver_data<cloud9_state>();
218
214
 
219
215
        /* in bitmode, the address comes from the autoincrement latches */
220
 
        UINT16 addr = (state->m_bitmode_addr[1] << 6) | (state->m_bitmode_addr[0] >> 2);
 
216
        UINT16 addr = (m_bitmode_addr[1] << 6) | (m_bitmode_addr[0] >> 2);
221
217
 
222
218
        /* the lower 4 bits of data are replicated to the upper 4 bits */
223
219
        data = (data & 0x0f) | (data << 4);
224
220
 
225
221
        /* write through the generic VRAM routine, passing the low 2 X bits as PIXB/PIXA */
226
 
        cloud9_write_vram(space->machine(), addr, data, 1, state->m_bitmode_addr[0] & 3);
 
222
        cloud9_write_vram(machine(), addr, data, 1, m_bitmode_addr[0] & 3);
227
223
 
228
224
        /* autoincrement because /BITMD was selected */
229
 
        bitmode_autoinc(space->machine());
 
225
        bitmode_autoinc(machine());
230
226
}
231
227
 
232
228
 
233
 
WRITE8_HANDLER( cloud9_bitmode_addr_w )
 
229
WRITE8_MEMBER(cloud9_state::cloud9_bitmode_addr_w)
234
230
{
235
 
        cloud9_state *state = space->machine().driver_data<cloud9_state>();
236
231
 
237
232
        /* write through to video RAM and also to the addressing latches */
238
 
        cloud9_write_vram(space->machine(), offset, data, 0, 0);
239
 
        state->m_bitmode_addr[offset] = data;
 
233
        cloud9_write_vram(machine(), offset, data, 0, 0);
 
234
        m_bitmode_addr[offset] = data;
240
235
}
241
236
 
242
237