Previous 15994 Revisions Next

r12043 Friday 24th June, 2011 at 08:52:19 UTC by Miodrag Milanović
- intv: Implemented scrolling [Huygens]
Implemented reading from stic registers other than collision
Bug 167 - Diagnostic cartridge fixed
[src/mess/drivers]intv.c
[src/mess/includes]intv.h
[src/mess/video]intv.c stic.c

src/mess/includes/intv.h
r12042r12043
3737   intv_sprite_type m_sprite[8];
3838   UINT8 m_sprite_buffers[8][16][128];
3939   int m_color_stack_mode;
40   UINT16 m_x_registers[8];
41   UINT16 m_y_registers[8];
42   UINT16 m_a_registers[8];
4043   int m_collision_registers[8];
4144   int m_color_stack_offset;
4245   int m_color_stack[4];
src/mess/video/stic.c
r12042r12043
1010   //logerror("%x = stic_r(%x)\n",0,offset);
1111   switch (offset)
1212   {
13      case 0x00:
14      case 0x01:
15      case 0x02:
16      case 0x03:
17      case 0x04:
18      case 0x05:
19      case 0x06:
20      case 0x07:
21         return 0x3800 | state->m_x_registers[offset & 0x07];
22      case 0x08:
23      case 0x09:
24      case 0x0a:
25      case 0x0b:
26      case 0x0c:
27      case 0x0d:
28      case 0x0e:
29      case 0x0f:
30         return 0x3000 | state->m_y_registers[offset & 0x07];
31      case 0x10:
32      case 0x11:
33      case 0x12:
34      case 0x13:
35      case 0x14:
36      case 0x15:
37      case 0x16:
38      case 0x17:
39         return state->m_a_registers[offset & 0x07];
1340      case 0x18:
1441      case 0x19:
1542      case 0x1a:
r12042r12043
1845      case 0x1d:
1946      case 0x1e:
2047      case 0x1f:
21            return state->m_collision_registers[offset & 0x07];
48            return 0x3C00 | state->m_collision_registers[offset & 0x07];
49      case 0x20:
50         return 0;
2251      case 0x21:
2352         state->m_color_stack_mode = 1;
2453         //logerror("Setting color stack mode\n");
2554         break;
55      case 0x28:
56      case 0x29:
57      case 0x2A:
58      case 0x2B:
59         return 0x3FF0 | state->m_color_stack[offset&0x3];
60      case 0x2C:
61         return 0x3FF0 | state->m_border_color;
62      case 0x30:
63         return 0x3FF8 | state->m_col_delay;
64      case 0x31:
65         return 0x3FF8 | state->m_row_delay;
66      case 0x32:
67         return 0x3FFC | state->m_top_edge_inhibit<<1 | state->m_left_edge_inhibit;
2668   }
2769   return 0;
2870}
r12042r12043
4991         s->visible = !!(data & 0x0200);
5092         s->coll = !!(data & 0x0100);
5193         s->xpos = (data & 0xFF);
94         state->m_x_registers[offset & 0x07] = data & 0x07FF;
5295         break;
5396      /* Y Positions */
5497      case 0x08:
r12042r12043
66109         s->doubley = !!(data & 0x0100);
67110         s->doubleyres = !!(data & 0x0080);
68111         s->ypos = (data & 0x7F);
112         state->m_y_registers[offset & 0x07] = data & 0x0FFF;
69113         break;
70114      /* Attributes */
71115      case 0x10:
r12042r12043
81125            s->grom = !(data & 0x0800);
82126         s->card = ((data >> 3) & 0xFF);
83127         s->color = ((data >> 9) & 0x08) | (data & 0x7);
128         state->m_a_registers[offset & 0x07] = data&0x3FFF;
84129         break;
85130      /* Collision Detection - TBD */
86131      case 0x18:
src/mess/video/intv.c
r12042r12043
6767
6868static int sprites_collide(intv_state *state, int spriteNum0, int spriteNum1) {
6969    INT16 x1, x2, y1, y2, w1, w2, h1, h2, x0, y0, r0y, r1y,
70          width, height, x, y;
70          width, height, x, y, x_offset,y_offset;
7171
7272    intv_sprite_type* s1 = &state->m_sprite[spriteNum0];
7373    intv_sprite_type* s2 = &state->m_sprite[spriteNum1];
7474
75    x1 = s1->xpos-8; x2 = s2->xpos-8;
76    y1 = (s1->ypos-8)<<1; y2 = (s2->ypos-8)<<1;
75    x_offset = state->m_col_delay - 8;
76    y_offset = state->m_row_delay - 8;
77    x1 = s1->xpos+x_offset; x2 = s2->xpos+x_offset;
78    y1 = (s1->ypos+y_offset)<<1; y2 = (s2->ypos+y_offset)<<1;
7779    w1 = (s1->doublex ? 2 : 1)<<3;
7880    w2 = (s2->doublex ? 2 : 1)<<3;
7981    h1 = (s1->quady ? 4 : 1) * (s1->doubley ? 2 : 1) * (s1->doubleyres ? 2 : 1)<<3;
r12042r12043
133135    INT32 nextX;
134136    INT32 nextY;
135137    INT32 xInc;
136    INT32 i, j;
138    INT32 i, j, k;
137139
138140    UINT8* memory = machine.region("maincpu")->base();
139141
r12042r12043
159161            nextX = (s->xflip ? (s->doublex ? 15 : 7) : 0);
160162            nextY = (s->yflip ? (spritePixelHeight - j - 1) : j);
161163            xInc = (s->xflip ? -1: 1);
162            state->m_sprite_buffers[i][nextX][nextY] = ((nextData & 0x0080) != 0);
163            state->m_sprite_buffers[i][nextX + xInc][nextY] = (s->doublex
164                    ? ((nextData & 0x0080) != 0)
165                    : ((nextData & 0x0040) != 0));
166            state->m_sprite_buffers[i][nextX + (2*xInc)][nextY] = (s->doublex
167                    ? ((nextData & 0x0040) != 0)
168                    : ((nextData & 0x0020) != 0));
169            state->m_sprite_buffers[i][nextX + (3*xInc)][nextY] = (s->doublex
170                    ? ((nextData & 0x0040) != 0)
171                    : ((nextData & 0x0010) != 0));
172            state->m_sprite_buffers[i][nextX + (4*xInc)][nextY] = (s->doublex
173                    ? ((nextData & 0x0020) != 0)
174                    : ((nextData & 0x0008) != 0));
175            state->m_sprite_buffers[i][nextX + (5*xInc)][nextY] = (s->doublex
176                    ? ((nextData & 0x0020) != 0)
177                    : ((nextData & 0x0004) != 0));
178            state->m_sprite_buffers[i][nextX + (6*xInc)][nextY] = (s->doublex
179                    ? ((nextData & 0x0010) != 0)
180                    : ((nextData & 0x0002) != 0));
181            state->m_sprite_buffers[i][nextX + (7*xInc)][nextY] = (s->doublex
182                    ? ((nextData & 0x0010) != 0)
183                    : ((nextData & 0x0001) != 0));
184            if (!s->doublex)
185                continue;
186
187            state->m_sprite_buffers[i][nextX + (8*xInc)][nextY] =
188                    ((nextData & 0x0008) != 0);
189            state->m_sprite_buffers[i][nextX + (9*xInc)][nextY] =
190                    ((nextData & 0x0008) != 0);
191            state->m_sprite_buffers[i][nextX + (10*xInc)][nextY] =
192                    ((nextData & 0x0004) != 0);
193            state->m_sprite_buffers[i][nextX + (11*xInc)][nextY] =
194                    ((nextData & 0x0004) != 0);
195            state->m_sprite_buffers[i][nextX + (12*xInc)][nextY] =
196                    ((nextData & 0x0002) != 0);
197            state->m_sprite_buffers[i][nextX + (13*xInc)][nextY] =
198                    ((nextData & 0x0002) != 0);
199            state->m_sprite_buffers[i][nextX + (14*xInc)][nextY] =
200                    ((nextData & 0x0001) != 0);
201            state->m_sprite_buffers[i][nextX + (15*xInc)][nextY] =
202                    ((nextData & 0x0001) != 0);
164           
165            for (k=0;k < 8*(1+s->doublex);k++)
166            {
167               state->m_sprite_buffers[i][nextX + k*xInc][nextY] = (nextData & (1<<(7 - k/(1 + s->doublex)))) != 0;
168            }
203169        }
204170
205171    }
r12042r12043
208174static void render_line(running_machine &machine, bitmap_t *bitmap,
209175   UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor)
210176{
211    UINT32 color = (nextByte & 0x80 ? fgcolor : bgcolor);
212    intv_plot_pixel(bitmap, x, y, color);
213    intv_plot_pixel(bitmap, x+1, y, color);
214    intv_plot_pixel(bitmap, x, y+1, color);
215    intv_plot_pixel(bitmap, x+1, y+1, color);
216
217    color = (nextByte & 0x40 ? fgcolor : bgcolor);
218    intv_plot_pixel(bitmap, x+2, y, color);
219    intv_plot_pixel(bitmap, x+3, y, color);
220    intv_plot_pixel(bitmap, x+2, y+1, color);
221    intv_plot_pixel(bitmap, x+3, y+1, color);
222
223    color = (nextByte & 0x20 ? fgcolor : bgcolor);
224    intv_plot_pixel(bitmap, x+4, y, color);
225    intv_plot_pixel(bitmap, x+5, y, color);
226    intv_plot_pixel(bitmap, x+4, y+1, color);
227    intv_plot_pixel(bitmap, x+5, y+1, color);
228
229    color = (nextByte & 0x10 ? fgcolor : bgcolor);
230    intv_plot_pixel(bitmap, x+6, y, color);
231    intv_plot_pixel(bitmap, x+7, y, color);
232    intv_plot_pixel(bitmap, x+6, y+1, color);
233    intv_plot_pixel(bitmap, x+7, y+1, color);
234
235    color = (nextByte & 0x08 ? fgcolor : bgcolor);
236    intv_plot_pixel(bitmap, x+8, y, color);
237    intv_plot_pixel(bitmap, x+9, y, color);
238    intv_plot_pixel(bitmap, x+8, y+1, color);
239    intv_plot_pixel(bitmap, x+9, y+1, color);
240
241    color = (nextByte & 0x04 ? fgcolor : bgcolor);
242    intv_plot_pixel(bitmap, x+10, y, color);
243    intv_plot_pixel(bitmap, x+11, y, color);
244    intv_plot_pixel(bitmap, x+10, y+1, color);
245    intv_plot_pixel(bitmap, x+11, y+1, color);
246
247    color = (nextByte & 0x02 ? fgcolor : bgcolor);
248    intv_plot_pixel(bitmap, x+12, y, color);
249    intv_plot_pixel(bitmap, x+13, y, color);
250    intv_plot_pixel(bitmap, x+12, y+1, color);
251    intv_plot_pixel(bitmap, x+13, y+1, color);
252
253    color = (nextByte & 0x01 ? fgcolor : bgcolor);
254    intv_plot_pixel(bitmap, x+14, y, color);
255    intv_plot_pixel(bitmap, x+15, y, color);
256    intv_plot_pixel(bitmap, x+14, y+1, color);
257    intv_plot_pixel(bitmap, x+15, y+1, color);
177    UINT32 color;
178    UINT8 i;
179    for (i=0; i<8; i++)
180    {
181       color = (nextByte & (1<<(7-i)) ? fgcolor : bgcolor);
182       intv_plot_pixel(bitmap, x+2*i, y, color);
183       intv_plot_pixel(bitmap, x+2*i+1, y, color);
184       intv_plot_pixel(bitmap, x+2*i, y+1, color);
185       intv_plot_pixel(bitmap, x+2*i+1, y+1, color);
186    }
258187}
259188
260189static void render_colored_squares(running_machine &machine, bitmap_t *bitmap,
r12042r12043
269198static void render_color_stack_mode(running_machine &machine, bitmap_t *bitmap)
270199{
271200   intv_state *state = machine.driver_data<intv_state>();
272    UINT8 h, csPtr = 0, nexty = 0;
273    UINT16 nextCard, nextx = 0;
201    UINT8 h, csPtr = 0, nexty = 2*state->m_row_delay;
202    UINT16 nextCard, nextx = 2*state->m_col_delay;
274203    UINT8 *ram = machine.region("maincpu")->base();
275204
276205    for (h = 0; h < 240; h++) {
r12042r12043
321250            }
322251        }
323252        nextx += 16;
324        if (nextx == 320) {
325            nextx = 0;
253        if (nextx >= 320) {
254            nextx = 2*state->m_col_delay;
326255            nexty += 16;
327256        }
328257    }
r12042r12043
331260static void render_fg_bg_mode(running_machine &machine, bitmap_t *bitmap)
332261{
333262   intv_state *state = machine.driver_data<intv_state>();
334    UINT8 i, j, isGrom, fgcolor, bgcolor, nexty = 0;
335    UINT16 nextCard, memoryLocation, nextx = 0;
263    UINT8 i, j, isGrom, fgcolor, bgcolor, nexty = 2*state->m_row_delay;
264    UINT16 nextCard, memoryLocation, nextx = 2*state->m_col_delay;
336265    UINT8* memory;
337266    UINT8* ram = machine.region("maincpu")->base();
338267
r12042r12043
359288        }
360289
361290        nextx += 16;
362        if (nextx == 320) {
363            nextx = 0;
291        if (nextx >= 320) {
292            nextx = 2*state->m_col_delay;
364293            nexty += 16;
365294        }
366295    }
r12042r12043
388317                (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1)<<3;
389318        width = (s->doublex ? 2 : 1)<<3;
390319
391        leftX = (s->xpos-8)<<1;
392        nextY = (s->ypos-8)<<1;
320        leftX = (s->xpos-8+state->m_col_delay)<<1;
321        nextY = (s->ypos-8+state->m_row_delay)<<1;
393322
394323        for (y = 0; y < spritePixelHeight; y++) {
395324            for (x = 0; x < width; x++) {
r12042r12043
400329                nextX = leftX + (x<<1);
401330                //if the next pixel location is on the border, then we
402331                //have a border collision and we can ignore painting it
403                if (nextX < (state->m_row_delay ? 8 : 0) || nextX > 317 ||
404                        nextY < (state->m_col_delay ? 16 : 0) || nextY > 191)
332                if (nextX < (state->m_left_edge_inhibit ? 16 : 0) || nextX > 317 ||
333                       nextY < (state->m_top_edge_inhibit ? 16: 0) || nextY > 191)
405334                {
406335                    borderCollision = TRUE;
407336                    continue;
r12042r12043
697626{
698627   intv_state *state = machine.driver_data<intv_state>();
699628   if (state->m_left_edge_inhibit)
700      plot_box(bm, 0, 0, 16-state->m_col_delay*2, 16*12, (state->m_border_color<<1)+1);
629      plot_box(bm, 0, 0, 16, 16*12, (state->m_border_color<<1)+1);
630   else if (state->m_col_delay)
631      plot_box(bm, 0, 0, state->m_col_delay*2, 16*12, (state->m_border_color<<1)+1);
701632
702633   if (state->m_top_edge_inhibit)
703      plot_box(bm, 0, 0, 16*20, 16-state->m_row_delay*2, (state->m_border_color<<1)+1);
634      plot_box(bm, 0, 0, 16*20, 16, (state->m_border_color<<1)+1);
635   else if (state->m_row_delay)
636      plot_box(bm, 0, 0, 16*20, state->m_row_delay*2, (state->m_border_color<<1)+1);
704637}
705638
706639void intv_stic_screenrefresh(running_machine &machine)
src/mess/drivers/intv.c
r12042r12043
391391   AM_RANGE(0x3000, 0x37ff) AM_ROM   AM_REGION("maincpu", 0x3000<<1)   /* GROM,     8-bits wide */
392392   AM_RANGE(0x3800, 0x39ff) AM_READWRITE( intv_gram_r, intv_gram_w )      /* GRAM,     8-bits wide */
393393   AM_RANGE(0x4800, 0x7fff) AM_ROM      /* Cartridges? */
394   AM_RANGE(0x8000, 0xBfff) AM_ROM      /* Cartridges? */
395   AM_RANGE(0xD000, 0xFfff) AM_ROM      /* Cartridges? */
394396ADDRESS_MAP_END
395397
396398static ADDRESS_MAP_START( intvkbd_mem , AS_PROGRAM, 16)
r12042r12043
443445   MCFG_SCREEN_REFRESH_RATE(59.92)
444446   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
445447   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
446   MCFG_SCREEN_SIZE(40*8, 24*8)
448   MCFG_SCREEN_SIZE(41*8, 25*8)
447449   MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 24*8-1)
448450   MCFG_SCREEN_UPDATE( generic_bitmapped )
449451

Previous 15994 Revisions Next


© 1998-2018 The MESS Team