~ubuntu-branches/ubuntu/karmic/xmame/karmic

« back to all changes in this revision

Viewing changes to src/vidhrdw/segar.c

  • Committer: Bazaar Package Importer
  • Author(s): Bruno Barrera C.
  • Date: 2007-02-16 10:06:54 UTC
  • mfrom: (2.1.5 edgy)
  • Revision ID: james.westby@ubuntu.com-20070216100654-iztas2cl47k5j039
Tags: 0.106-2
* Added Italian debconf templates translation. (closes: #382672)
* Added German debconf templates translation. (closes: #396610)
* Added Japanese debconf templates translation. (closes: #400011)
* Added Portuguese debconf templates translation. (closes: #409960)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
2
 
3
 
        Sega G-80 raster hardware
 
3
    Sega G-80 raster hardware
4
4
 
5
5
***************************************************************************/
6
6
 
7
7
#include "driver.h"
8
 
#include "vidhrdw/generic.h"
9
8
#include "segar.h"
10
9
 
11
10
 
40
39
        unsigned char backfill;
41
40
        unsigned char fill_background;
42
41
        unsigned int backshift;
43
 
        struct mame_bitmap *horizbackbitmap;
44
 
        struct mame_bitmap *vertbackbitmap;
 
42
        mame_bitmap *horizbackbitmap;
 
43
        mame_bitmap *vertbackbitmap;
45
44
} SEGAR_VID_STRUCT;
46
45
 
47
46
static SEGAR_VID_STRUCT sv;
65
64
        palette_set_color(0,0,0,0);
66
65
 
67
66
        /* Space Odyssey uses a static palette for the background, so
68
 
           our choice of colors isn't exactly arbitrary.  S.O. uses a
69
 
           6-bit color setup, so we make sure that every 0x40 colors
70
 
           gets a nice 6-bit palette.
 
67
       our choice of colors isn't exactly arbitrary.  S.O. uses a
 
68
       6-bit color setup, so we make sure that every 0x40 colors
 
69
       gets a nice 6-bit palette.
71
70
 
72
71
       (All of the other G80 games overwrite the default colors on startup)
73
 
        */
 
72
    */
74
73
        for (i = 0;i < (Machine->drv->total_colors - 1);i++)
75
74
        {
76
75
                int r = color_scale[((i & 0x30) >> 4)];
221
220
This is the refresh code that is common across all the G80 games.  This
222
221
corresponds to the VIDEO I board.
223
222
***************************************************************************/
224
 
static void segar_common_screenrefresh(struct mame_bitmap *bitmap, int sprite_transparency, int copy_transparency)
 
223
static void segar_common_screenrefresh(mame_bitmap *bitmap, int sprite_transparency, int copy_transparency)
225
224
{
226
225
        int offs;
227
226
        int charcode;
230
229
        /* since last time and update it accordingly. */
231
230
        for (offs = videoram_size - 1;offs >= 0;offs--)
232
231
        {
233
 
                if ((sv.char_refresh) && (sv.dirtychar[videoram[offs]]))
 
232
                if ((sv.char_refresh) || (sv.dirtychar[videoram[offs]]))
234
233
                        dirtybuffer[offs]=1;
235
234
 
236
235
                /* Redraw every character if our palette or scene changed */
322
321
 
323
322
 
324
323
/***************************************************************************
325
 
This port controls which background to draw for Space Odyssey.  The temp_scene
 
324
This port controls which background to draw for Space Odyssey.  The temp_scene
326
325
and temp_charset are analogous to control lines used to select the background.
327
326
If the background changed, refresh the screen.
328
327
***************************************************************************/
357
356
}
358
357
 
359
358
/***************************************************************************
360
 
This port controls the Space Odyssey background scrolling.      Each write to
 
359
This port controls the Space Odyssey background scrolling.  Each write to
361
360
this port scrolls the background by one bit.  Faster speeds are achieved
362
361
by the program writing more often to this port.  Oddly enough, the value
363
362
sent to this port also seems to indicate the speed, but the value itself
564
563
        }
565
564
}
566
565
 
 
566
/* for set 2 */
 
567
/* other ports are also used */
 
568
static UINT8 monster2_bbdata;
 
569
static UINT8 monster2_b9data;
 
570
 
 
571
WRITE8_HANDLER( monster2_bb_back_port_w )
 
572
{
 
573
        unsigned int temp_scene, temp_charset;
 
574
 
 
575
        /* maybe */
 
576
        monster2_bbdata=data;
 
577
 
 
578
        temp_scene   = (monster2_b9data & 0x03)|monster2_bbdata<<2;
 
579
        temp_charset = monster2_b9data & 0x03;
 
580
 
 
581
        temp_scene = 0x400*temp_scene;
 
582
 
 
583
        sv.back_scene = temp_scene;
 
584
        sv.refresh=1;
 
585
 
 
586
        sv.back_charset = temp_charset;
 
587
        sv.refresh=1;
 
588
 
 
589
/*  printf("bb_data %02x\n",data); */
 
590
}
 
591
 
 
592
WRITE8_HANDLER( monster2_b9_back_port_w )
 
593
{
 
594
        unsigned int temp_scene, temp_charset;
 
595
 
 
596
        monster2_b9data = data;
 
597
 
 
598
 
 
599
        temp_scene   = (monster2_b9data & 0x03)|monster2_bbdata<<2;
 
600
        temp_charset = monster2_b9data & 0x03;
 
601
 
 
602
        temp_scene = 0x400*temp_scene;
 
603
 
 
604
/*  printf("data %02x\n",data); */
 
605
 
 
606
        if (sv.back_scene != temp_scene)
 
607
        {
 
608
                sv.back_scene = temp_scene;
 
609
                sv.refresh=1;
 
610
        }
 
611
        if (sv.back_charset != temp_charset)
 
612
        {
 
613
                sv.back_charset = temp_charset;
 
614
                sv.refresh=1;
 
615
        }
 
616
 
 
617
        /* This bit turns the background off and on. */
 
618
        if ((data & 0x80) && (sv.background_enable==0))
 
619
        {
 
620
                sv.background_enable=1;
 
621
                sv.refresh=1;
 
622
        }
 
623
        else if (((data & 0x80)==0) && (sv.background_enable==1))
 
624
        {
 
625
                sv.background_enable=0;
 
626
                sv.refresh=1;
 
627
        }
 
628
}
 
629
 
567
630
/***************************************************************************
568
631
Special refresh for Monster Bash, this code refreshes the static background.
569
632
***************************************************************************/
588
651
                /* since last time and update it accordingly. */
589
652
                for (offs = videoram_size - 1;offs >= 0;offs--)
590
653
                {
591
 
                        if ((sv.char_refresh) && (sv.dirtychar[videoram[offs]]))
 
654
                        if ((sv.char_refresh) || (sv.dirtychar[videoram[offs]]))
592
655
                                dirtybuffer[offs]=1;
593
656
 
594
657
                        /* Redraw every background character if our palette or scene changed */
765
828
                /* since last time and update it accordingly. */
766
829
                for (offs = videoram_size - 1;offs >= 0;offs--)
767
830
                {
768
 
                        if ((sv.char_refresh) && (sv.dirtychar[videoram[offs]]))
 
831
                        if ((sv.char_refresh) || (sv.dirtychar[videoram[offs]]))
769
832
                                dirtybuffer[offs]=1;
770
833
 
771
834
                        /* Redraw every background character if our palette or scene changed */