~ubuntu-branches/ubuntu/raring/mame/raring-proposed

« back to all changes in this revision

Viewing changes to mess/src/mess/video/stic.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
 
#include "emu.h"
2
 
#include "video/stic.h"
3
 
#include "includes/intv.h"
4
 
 
5
 
/* STIC variables */
6
 
 
7
 
READ16_HANDLER( intv_stic_r )
8
 
{
9
 
        intv_state *state = space->machine().driver_data<intv_state>();
10
 
        //logerror("%x = stic_r(%x)\n",0,offset);
11
 
        switch (offset)
12
 
        {
13
 
                case STIC_MXR + STIC_MOB0:
14
 
                case STIC_MXR + STIC_MOB1:
15
 
                case STIC_MXR + STIC_MOB2:
16
 
                case STIC_MXR + STIC_MOB3:
17
 
                case STIC_MXR + STIC_MOB4:
18
 
                case STIC_MXR + STIC_MOB5:
19
 
                case STIC_MXR + STIC_MOB6:
20
 
                case STIC_MXR + STIC_MOB7:
21
 
                        return 0x3800 | (state->m_stic_registers[offset] & 0x07FF);
22
 
                case STIC_MYR + STIC_MOB0:
23
 
                case STIC_MYR + STIC_MOB1:
24
 
                case STIC_MYR + STIC_MOB2:
25
 
                case STIC_MYR + STIC_MOB3:
26
 
                case STIC_MYR + STIC_MOB4:
27
 
                case STIC_MYR + STIC_MOB5:
28
 
                case STIC_MYR + STIC_MOB6:
29
 
                case STIC_MYR + STIC_MOB7:
30
 
                        return 0x3000 | (state->m_stic_registers[offset] & 0x0FFF);
31
 
                case STIC_MAR + STIC_MOB0:
32
 
                case STIC_MAR + STIC_MOB1:
33
 
                case STIC_MAR + STIC_MOB2:
34
 
                case STIC_MAR + STIC_MOB3:
35
 
                case STIC_MAR + STIC_MOB4:
36
 
                case STIC_MAR + STIC_MOB5:
37
 
                case STIC_MAR + STIC_MOB6:
38
 
                case STIC_MAR + STIC_MOB7:
39
 
                        return state->m_stic_registers[offset] & 0x3FFF;
40
 
                case STIC_MCR + STIC_MOB0:
41
 
                case STIC_MCR + STIC_MOB1:
42
 
                case STIC_MCR + STIC_MOB2:
43
 
                case STIC_MCR + STIC_MOB3:
44
 
                case STIC_MCR + STIC_MOB4:
45
 
                case STIC_MCR + STIC_MOB5:
46
 
                case STIC_MCR + STIC_MOB6:
47
 
                case STIC_MCR + STIC_MOB7:
48
 
                        return 0x3C00 | (state->m_stic_registers[offset] & 0x03FF);
49
 
                case STIC_GMR:
50
 
                        state->m_color_stack_mode = 1;
51
 
                        //logerror("Setting color stack mode\n");
52
 
                        /*** fall through ***/
53
 
                case STIC_DER:
54
 
                        return 0x3FFF;
55
 
                        break;
56
 
                case STIC_CSR + STIC_CSR0:
57
 
                case STIC_CSR + STIC_CSR1:
58
 
                case STIC_CSR + STIC_CSR2:
59
 
                case STIC_CSR + STIC_CSR3:
60
 
                case STIC_BCR:
61
 
                        return 0x3FF0 | (state->m_stic_registers[offset] & 0x000F);
62
 
                case STIC_HDR:
63
 
                case STIC_VDR:
64
 
                        return 0x3FF8 | (state->m_stic_registers[offset] & 0x0007);
65
 
                case STIC_CBR:
66
 
                        return 0x3FFC | (state->m_stic_registers[offset] & 0x0003);
67
 
                default:
68
 
                        //logerror("unmapped read from STIC register %02X\n", offset);
69
 
                        return 0x3FFF;
70
 
        }
71
 
}
72
 
 
73
 
WRITE16_HANDLER( intv_stic_w )
74
 
{
75
 
        intv_state *state = space->machine().driver_data<intv_state>();
76
 
        intv_sprite_type *s;
77
 
 
78
 
        //logerror("stic_w(%x) = %x\n",offset,data);
79
 
        switch (offset)
80
 
        {
81
 
                /* X Positions */
82
 
                case STIC_MXR + STIC_MOB0:
83
 
                case STIC_MXR + STIC_MOB1:
84
 
                case STIC_MXR + STIC_MOB2:
85
 
                case STIC_MXR + STIC_MOB3:
86
 
                case STIC_MXR + STIC_MOB4:
87
 
                case STIC_MXR + STIC_MOB5:
88
 
                case STIC_MXR + STIC_MOB6:
89
 
                case STIC_MXR + STIC_MOB7:
90
 
                        s =  &state->m_sprite[offset & (STIC_MOBS - 1)];
91
 
                        s->doublex = !!(data & STIC_MXR_XSIZE);
92
 
                        s->visible = !!(data & STIC_MXR_VIS);
93
 
                        s->coll = !!(data & STIC_MXR_COL);
94
 
                        s->xpos = (data & STIC_MXR_X);
95
 
                        break;
96
 
                /* Y Positions */
97
 
                case STIC_MYR + STIC_MOB0:
98
 
                case STIC_MYR + STIC_MOB1:
99
 
                case STIC_MYR + STIC_MOB2:
100
 
                case STIC_MYR + STIC_MOB3:
101
 
                case STIC_MYR + STIC_MOB4:
102
 
                case STIC_MYR + STIC_MOB5:
103
 
                case STIC_MYR + STIC_MOB6:
104
 
                case STIC_MYR + STIC_MOB7:
105
 
                        s =  &state->m_sprite[offset & (STIC_MOBS - 1)];
106
 
                        s->yflip = !!(data & STIC_MYR_YFLIP);
107
 
                        s->xflip = !!(data & STIC_MYR_XFLIP);
108
 
                        s->quady = !!(data & STIC_MYR_YSIZE);
109
 
                        s->doubley = !!(data & STIC_MYR_YFULL);
110
 
                        s->doubleyres = !!(data & STIC_MYR_YRES);
111
 
                        s->ypos = (data & STIC_MYR_Y);
112
 
                        break;
113
 
                /* Attributes */
114
 
                case STIC_MAR + STIC_MOB0:
115
 
                case STIC_MAR + STIC_MOB1:
116
 
                case STIC_MAR + STIC_MOB2:
117
 
                case STIC_MAR + STIC_MOB3:
118
 
                case STIC_MAR + STIC_MOB4:
119
 
                case STIC_MAR + STIC_MOB5:
120
 
                case STIC_MAR + STIC_MOB6:
121
 
                case STIC_MAR + STIC_MOB7:
122
 
                        s =  &state->m_sprite[offset & (STIC_MOBS - 1)];
123
 
                        s->behind_foreground = !!(data & STIC_MAR_PRI);
124
 
                        s->grom = !(data & STIC_MAR_SEL);
125
 
                        s->card = ((data & STIC_MAR_C) >> 3);
126
 
                        s->color = ((data & STIC_MAR_FG3) >> 9) | (data & STIC_MAR_FG20);
127
 
                        break;
128
 
                /* Collision Detection - TBD */
129
 
                case STIC_MCR + STIC_MOB0:
130
 
                case STIC_MCR + STIC_MOB1:
131
 
                case STIC_MCR + STIC_MOB2:
132
 
                case STIC_MCR + STIC_MOB3:
133
 
                case STIC_MCR + STIC_MOB4:
134
 
                case STIC_MCR + STIC_MOB5:
135
 
                case STIC_MCR + STIC_MOB6:
136
 
                case STIC_MCR + STIC_MOB7:
137
 
                        // a MOB's own collision bit is *always* zero, even if a
138
 
                        // one is poked into it
139
 
                        data &= ~(1 << (offset & (STIC_MOBS - 1)));
140
 
                        break;
141
 
                /* Display enable */
142
 
                case STIC_DER:
143
 
                        //logerror("***Writing a %x to the STIC handshake\n",data);
144
 
                        state->m_stic_handshake = 1;
145
 
                        break;
146
 
                /* Graphics Mode */
147
 
                case STIC_GMR:
148
 
                        state->m_color_stack_mode = 0;
149
 
                        break;
150
 
                /* Color Stack */
151
 
                case STIC_CSR + STIC_CSR0:
152
 
                case STIC_CSR + STIC_CSR1:
153
 
                case STIC_CSR + STIC_CSR2:
154
 
                case STIC_CSR + STIC_CSR3:
155
 
                        logerror("Setting color_stack[%x] = %x (%x)\n", offset & (STIC_CSRS - 1),data & STIC_CSR_BG, cpu_get_pc(&space->device()));
156
 
                        break;
157
 
                /* Border Color */
158
 
                case STIC_BCR:
159
 
                        //logerror("***Writing a %x to the border color\n",data);
160
 
                        state->m_border_color = data & STIC_BCR_BC;
161
 
                        break;
162
 
                /* Framing */
163
 
                case STIC_HDR:
164
 
                        state->m_col_delay = data & STIC_HDR_DEL;
165
 
                        break;
166
 
                case STIC_VDR:
167
 
                        state->m_row_delay = data & STIC_VDR_DEL;
168
 
                        break;
169
 
                case STIC_CBR:
170
 
                        state->m_left_edge_inhibit = (data & STIC_CBR_COL);
171
 
                        state->m_top_edge_inhibit = (data & STIC_CBR_ROW) >> 1;
172
 
                        break;
173
 
                default:
174
 
                        //logerror("unmapped write to STIC register %02X: %04X\n", offset, data);
175
 
                        break;
176
 
        }
177
 
 
178
 
        if (offset < sizeof(state->m_stic_registers) / sizeof(state->m_stic_registers[0]))
179
 
                state->m_stic_registers[offset] = data;
180
 
}