Previous 15994 Revisions Next

r1784 Friday 29th February, 2008 at 01:13:48 UTC by Dirk Best
[INTV] Updated to remove video start generic and dependency on deprecat.h
[src/mess/drivers]intv.c
[src/mess/includes]intv.h
[src/mess/machine]intv.c
[src/mess/video]intv.c

src/mess/includes/intv.h
r1783r1784
1515extern VIDEO_START( intvkbd );
1616extern VIDEO_UPDATE( intvkbd );
1717
18void stic_screenrefresh(void);
18void stic_screenrefresh(running_machine *machine);
1919
2020READ8_HANDLER ( intvkbd_tms9927_r );
2121WRITE8_HANDLER ( intvkbd_tms9927_w );
src/mess/video/intv.c
r1783r1784
11#include "driver.h"
2#include "deprecat.h"
32#include "includes/intv.h"
43#include "video/stic.h"
5#include "mslegacy.h"
64
5
76#define FOREGROUND_BIT 0x0010
87
98INLINE void intv_plot_pixel(bitmap_t *bitmap, int x, int y, UINT32 color)
r1783r1784
205204    }
206205}
207206
208static void render_line(mame_bitmap *bitmap, UINT8 nextByte, UINT16 x, UINT16 y,
209        UINT8 fgcolor, UINT8 bgcolor)
207static void render_line(running_machine *machine, mame_bitmap *bitmap,
208   UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor)
210209{
211    UINT32 color = (nextByte & 0x80 ? Machine->pens[fgcolor]
212            : Machine->pens[bgcolor]);
210    UINT32 color = (nextByte & 0x80 ? machine->pens[fgcolor]
211            : machine->pens[bgcolor]);
213212    intv_plot_pixel(bitmap, x, y, color);
214213    intv_plot_pixel(bitmap, x+1, y, color);
215214    intv_plot_pixel(bitmap, x, y+1, color);
216215    intv_plot_pixel(bitmap, x+1, y+1, color);
217216
218    color = (nextByte & 0x40 ? Machine->pens[fgcolor]
219            : Machine->pens[bgcolor]);
217    color = (nextByte & 0x40 ? machine->pens[fgcolor]
218            : machine->pens[bgcolor]);
220219    intv_plot_pixel(bitmap, x+2, y, color);
221220    intv_plot_pixel(bitmap, x+3, y, color);
222221    intv_plot_pixel(bitmap, x+2, y+1, color);
223222    intv_plot_pixel(bitmap, x+3, y+1, color);
224223
225    color = (nextByte & 0x20 ? Machine->pens[fgcolor]
226            : Machine->pens[bgcolor]);
224    color = (nextByte & 0x20 ? machine->pens[fgcolor]
225            : machine->pens[bgcolor]);
227226    intv_plot_pixel(bitmap, x+4, y, color);
228227    intv_plot_pixel(bitmap, x+5, y, color);
229228    intv_plot_pixel(bitmap, x+4, y+1, color);
230229    intv_plot_pixel(bitmap, x+5, y+1, color);
231230
232    color = (nextByte & 0x10 ? Machine->pens[fgcolor]
233            : Machine->pens[bgcolor]);
231    color = (nextByte & 0x10 ? machine->pens[fgcolor]
232            : machine->pens[bgcolor]);
234233    intv_plot_pixel(bitmap, x+6, y, color);
235234    intv_plot_pixel(bitmap, x+7, y, color);
236235    intv_plot_pixel(bitmap, x+6, y+1, color);
237236    intv_plot_pixel(bitmap, x+7, y+1, color);
238237
239    color = (nextByte & 0x08 ? Machine->pens[fgcolor]
240            : Machine->pens[bgcolor]);
238    color = (nextByte & 0x08 ? machine->pens[fgcolor]
239            : machine->pens[bgcolor]);
241240    intv_plot_pixel(bitmap, x+8, y, color);
242241    intv_plot_pixel(bitmap, x+9, y, color);
243242    intv_plot_pixel(bitmap, x+8, y+1, color);
244243    intv_plot_pixel(bitmap, x+9, y+1, color);
245244
246    color = (nextByte & 0x04 ? Machine->pens[fgcolor]
247            : Machine->pens[bgcolor]);
245    color = (nextByte & 0x04 ? machine->pens[fgcolor]
246            : machine->pens[bgcolor]);
248247    intv_plot_pixel(bitmap, x+10, y, color);
249248    intv_plot_pixel(bitmap, x+11, y, color);
250249    intv_plot_pixel(bitmap, x+10, y+1, color);
251250    intv_plot_pixel(bitmap, x+11, y+1, color);
252251
253    color = (nextByte & 0x02 ? Machine->pens[fgcolor]
254            : Machine->pens[bgcolor]);
252    color = (nextByte & 0x02 ? machine->pens[fgcolor]
253            : machine->pens[bgcolor]);
255254    intv_plot_pixel(bitmap, x+12, y, color);
256255    intv_plot_pixel(bitmap, x+13, y, color);
257256    intv_plot_pixel(bitmap, x+12, y+1, color);
258257    intv_plot_pixel(bitmap, x+13, y+1, color);
259258
260    color = (nextByte & 0x01 ? Machine->pens[fgcolor]
261            : Machine->pens[bgcolor]);
259    color = (nextByte & 0x01 ? machine->pens[fgcolor]
260            : machine->pens[bgcolor]);
262261    intv_plot_pixel(bitmap, x+14, y, color);
263262    intv_plot_pixel(bitmap, x+15, y, color);
264263    intv_plot_pixel(bitmap, x+14, y+1, color);
265264    intv_plot_pixel(bitmap, x+15, y+1, color);
266265}
267266
268static void render_colored_squares(mame_bitmap *bitmap, UINT16 x, UINT16 y,
269        UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3)
267static void render_colored_squares(running_machine *machine, mame_bitmap *bitmap,
268   UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3)
270269{
271    plot_box(bitmap, x, y, 8, 8, Machine->pens[color0]);
272    plot_box(bitmap, x+8, y, 8, 8, Machine->pens[color1]);
273    plot_box(bitmap, x, y+8, 8, 8, Machine->pens[color2]);
274    plot_box(bitmap, x+8, y+8, 8, 8, Machine->pens[color3]);
270    plot_box(bitmap, x, y, 8, 8, machine->pens[color0]);
271    plot_box(bitmap, x+8, y, 8, 8, machine->pens[color1]);
272    plot_box(bitmap, x, y+8, 8, 8, machine->pens[color2]);
273    plot_box(bitmap, x+8, y+8, 8, 8, machine->pens[color3]);
275274}
276275
277static void render_color_stack_mode(mame_bitmap *bitmap)
276static void render_color_stack_mode(running_machine *machine, mame_bitmap *bitmap)
278277{
279278    UINT8 h, csPtr = 0, nexty = 0;
280279    UINT16 nextCard, nextx = 0;
r1783r1784
289288            UINT8 color2 = (nextCard & 0x01C0) >> 6;
290289            UINT8 color3 = ((nextCard & 0x2000) >> 11) |
291290                    ((nextCard & 0x0600) >> 9);
292            render_colored_squares(bitmap, nextx, nexty,
291            render_colored_squares(machine, bitmap, nextx, nexty,
293292                    (color0 == 7 ? csColor : (color0 | FOREGROUND_BIT)),
294293                    (color1 == 7 ? csColor : (color1 | FOREGROUND_BIT)),
295294                    (color2 == 7 ? csColor : (color2 | FOREGROUND_BIT)),
r1783r1784
314313                memoryLocation = 0x3000 + (nextCard & 0x07F8);
315314                memory = memory_region(REGION_CPU1);
316315                for (j = 0; j < 16; j+=2)
317                    render_line(bitmap, memory[(memoryLocation<<1)+j],
316                    render_line(machine, bitmap, memory[(memoryLocation<<1)+j],
318317                            nextx, nexty+j, fgcolor, bgcolor);
319318            }
320319            else {
321320                memoryLocation = (nextCard & 0x01F8);
322321                memory = intv_gram;
323322                for (j = 0; j < 16; j+=2)
324                    render_line(bitmap, memory[memoryLocation+(j>>1)],
323                    render_line(machine, bitmap, memory[memoryLocation+(j>>1)],
325324                            nextx, nexty+j, fgcolor, bgcolor);
326325            }
327326        }
r1783r1784
333332    }
334333}
335334
336static void render_fg_bg_mode(mame_bitmap *bitmap)
335static void render_fg_bg_mode(running_machine *machine, mame_bitmap *bitmap)
337336{
338337    UINT8 i, j, isGrom, fgcolor, bgcolor, nexty = 0;
339338    UINT16 nextCard, memoryLocation, nextx = 0;
r1783r1784
350349            memoryLocation = 0x3000 + (nextCard & 0x01F8);
351350            memory = memory_region(REGION_CPU1);
352351            for (j = 0; j < 16; j+=2)
353                render_line(bitmap, memory[(memoryLocation<<1)+j],
352                render_line(machine, bitmap, memory[(memoryLocation<<1)+j],
354353                        nextx, nexty+j, fgcolor, bgcolor);
355354        }
356355        else {
357356            memoryLocation = (nextCard & 0x01F8);
358357            memory = intv_gram;
359358            for (j = 0; j < 16; j+=2)
360                render_line(bitmap, memory[memoryLocation+(j>>1)],
359                render_line(machine, bitmap, memory[memoryLocation+(j>>1)],
361360                        nextx, nexty+j, fgcolor, bgcolor);
362361        }
363362
r1783r1784
369368    }
370369}
371370
372static void copy_sprites_to_background(mame_bitmap *bitmap)
371static void copy_sprites_to_background(running_machine *machine, mame_bitmap *bitmap)
373372{
374373    UINT8 width, currentPixel;
375374    UINT8 borderCollision, foregroundCollision;
r1783r1784
419418                }
420419
421420                if (s->visible) {
422                    intv_plot_pixel(bitmap, nextX, nextY, Machine->pens[s->color] |
421                    intv_plot_pixel(bitmap, nextX, nextY, machine->pens[s->color] |
423422                            (currentPixel & FOREGROUND_BIT));
424                    intv_plot_pixel(bitmap, nextX+1, nextY, Machine->pens[s->color] |
423                    intv_plot_pixel(bitmap, nextX+1, nextY, machine->pens[s->color] |
425424                            (currentPixel & FOREGROUND_BIT));
426425                }
427426            }
r1783r1784
438437    }
439438}
440439
441static void render_background(mame_bitmap *bitmap)
440static void render_background(running_machine *machine, mame_bitmap *bitmap)
442441{
443442   if (intv_color_stack_mode)
444        render_color_stack_mode(bitmap);
443        render_color_stack_mode(machine, bitmap);
445444    else
446        render_fg_bg_mode(bitmap);
445        render_fg_bg_mode(machine, bitmap);
447446}
448447
449448/*
r1783r1784
700699}
701700*/
702701
703static void draw_borders(mame_bitmap *bm)
702static void draw_borders(running_machine *machine, mame_bitmap *bm)
704703{
705704   if (intv_left_edge_inhibit)
706705   {
707      plot_box(bm,0,0,16-intv_col_delay*2,16*12,Machine->pens[intv_border_color]);
706      plot_box(bm, 0, 0, 16-intv_col_delay*2, 16*12,
707            machine->pens[intv_border_color]);
708708   }
709709   if (intv_top_edge_inhibit)
710710   {
711      plot_box(bm,0,0,16*20,16-intv_row_delay*2,Machine->pens[intv_border_color]);
711      plot_box(bm, 0, 0, 16*20, 16-intv_row_delay*2,
712            machine->pens[intv_border_color]);
712713   }
713714}
714715
715716static int col_delay = 0;
716717static int row_delay = 0;
717718
718void stic_screenrefresh()
719void stic_screenrefresh(running_machine *machine)
719720{
720721    int i;
721722
r1783r1784
723724   {
724725      intv_stic_handshake = 0;
725726      // Render the background
726      render_background(tmpbitmap);
727      render_background(machine, tmpbitmap);
727728      // Render the sprites into their buffers
728729        render_sprites();
729730        for (i = 0; i < 8; i++)
730731            intv_sprite[i].collision = 0;
731732        // Copy the sprites to the background
732        copy_sprites_to_background(tmpbitmap);
733        copy_sprites_to_background(machine, tmpbitmap);
733734        determine_sprite_collisions();
734735        for (i = 0; i < 8; i++)
735736            intv_collision_registers[i] |= intv_sprite[i].collision;
736737      /* draw the screen borders if enabled */
737      draw_borders(tmpbitmap);
738      draw_borders(machine, tmpbitmap);
738739   }
739740   else
740741   {
741742      /* STIC disabled, just fill with border color */
742      fillbitmap(tmpbitmap,Machine->pens[intv_border_color],&Machine->screen[0].visarea);
743      fillbitmap(tmpbitmap, machine->pens[intv_border_color], &machine->screen[0].visarea);
743744   }
744745   col_delay = intv_col_delay;
745746   row_delay = intv_row_delay;
746747}
747748
748VIDEO_UPDATE( intv )
749{
750   copybitmap(bitmap,tmpbitmap,0,0,
751              col_delay*2,row_delay*2,
752            cliprect);
753   return 0;
754}
755749
756750VIDEO_START( intvkbd )
757751{
758    VIDEO_START_CALL(generic);
759   video_start_intv(machine);
752    VIDEO_START_CALL(generic_bitmapped);
753   VIDEO_START_CALL(intv);
760754}
761755
756
762757/* very rudimentary support for the tms9927 character generator IC */
763758
764759static UINT8 tms9927_cursor_col;
r1783r1784
819814//   char c;
820815
821816   /* Draw the underlying INTV screen first */
822   VIDEO_UPDATE_CALL(intv);
817   VIDEO_UPDATE_CALL(generic_bitmapped);
823818
824819   /* if the intvkbd text is not blanked, overlay it */
825820   if (!intvkbd_text_blanked)
src/mess/machine/intv.c
r1783r1784
437437   cpunum_set_input_line(machine, 0, CP1610_INT_INTRM, ASSERT_LINE);
438438   sr1_int_pending = 1;
439439   timer_set(ATTOTIME_IN_CYCLES(3791, 0), NULL, 0, intv_interrupt_complete);
440   stic_screenrefresh();
440   stic_screenrefresh(machine);
441441}
442442
443443static const UINT8 controller_table[] =
src/mess/drivers/intv.c
r1783r1784
342342   MDRV_PALETTE_INIT( intv )
343343
344344   MDRV_VIDEO_START( intv )
345   MDRV_VIDEO_UPDATE( intv )
345   MDRV_VIDEO_UPDATE( generic_bitmapped )
346346
347347   /* sound hardware */
348348   MDRV_SPEAKER_STANDARD_MONO("mono")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team