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

« back to all changes in this revision

Viewing changes to mess/src/mame/video/psikyo4.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
 
/*
2
 
 
3
 
Psikyo PS6807 (PS4):
4
 
See src/drivers/psikyo4.c for more info
5
 
 
6
 
Each sprite has a flag denoting the screen to which it should be drawn.
7
 
 
8
 
*/
9
 
 
10
 
/*
11
 
Vid Regs:
12
 
 
13
 
0x3003fe4 -- ??xx???? vblank? 86??0000 always?
14
 
0x3003fe8 -- c0c0???? flipscreen for screen 1 and 2 resp.
15
 
             ????8080 Screen size select
16
 
0x3003fec -- a0000xxx always? is in two working games. 0x00000fff is bank select for gfx test
17
 
0x3003ff0 -- 000000ff brightness for screen 1, ffffff00 are probably seperate rgb brightness (not used)
18
 
0x3003ff4 -- ffffff00 screen 1 clear colour
19
 
0x3003ff8 -- 000000ff brightness for screen 2, ffffff00 are probably seperate rgb brightness (not used)
20
 
0x3003ffc -- ffffff00 screen 2 clear colour
21
 
 
22
 
HotDebut: 86010000 00009998 80000000 Small Screen
23
 
LodeRnDF: 86010000 00009998 a0000000 Small Screen
24
 
 
25
 
HotGmck:  86010000 1f201918 a0000000 Large Screen
26
 
HgKairak: 86010000 1f201918 a0000000 Large Screen
27
 
*/
28
 
 
29
 
#include "emu.h"
30
 
#include "includes/psikyo4.h"
31
 
 
32
 
 
33
 
/* --- SPRITES --- */
34
 
static void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 scr )
35
 
{
36
 
        /*- Sprite Format 0x0000 - 0x2bff -**
37
 
 
38
 
    0 hhhh --yy yyyy yyyy | wwww --xx xxxx xxxx  1  Ffpp pppp ---- -nnn | nnnn nnnn nnnn nnnn
39
 
 
40
 
    y = ypos
41
 
    x = xpos
42
 
 
43
 
    h = height
44
 
    w = width
45
 
 
46
 
    f = flip (x)
47
 
    F = flip (y) Unused?
48
 
 
49
 
    n = tile number
50
 
 
51
 
    p = palette
52
 
 
53
 
    **- End Sprite Format -*/
54
 
 
55
 
        psikyo4_state *state = machine.driver_data<psikyo4_state>();
56
 
        const gfx_element *gfx = machine.gfx[0];
57
 
        UINT32 *source = state->m_spriteram;
58
 
        UINT16 *list = (UINT16 *)state->m_spriteram + 0x2c00/2 + 0x04/2; /* 0x2c00/0x2c02 what are these for, pointers? one for each screen */
59
 
        UINT16 listlen = (0xc00/2 - 0x04/2), listcntr = 0;
60
 
        int flipscreen1, flipscreen2;
61
 
 
62
 
        flipscreen1 = (((state->m_vidregs[1] >> 30) & 2) == 2) ? 1 : 0;
63
 
        flipscreen2 = (((state->m_vidregs[1] >> 22) & 2) == 2) ? 1 : 0;
64
 
 
65
 
        while (listcntr < listlen)
66
 
        {
67
 
                UINT16 listdat, sprnum, thisscreen;
68
 
 
69
 
                listdat = list[BYTE_XOR_BE(listcntr)];
70
 
                sprnum = (listdat & 0x03ff) * 2;
71
 
 
72
 
                thisscreen = 0;
73
 
                if ((listdat & 0x2000) == scr) thisscreen = 1;
74
 
 
75
 
                /* start drawing */
76
 
                if (!(listdat & 0x8000) && thisscreen) /* draw only selected screen */
77
 
                {
78
 
                        int loopnum = 0, i, j;
79
 
                        UINT32 xpos, ypos, tnum, wide, high, colr, flipx, flipy;
80
 
                        int xstart, ystart, xend, yend, xinc, yinc;
81
 
 
82
 
                        ypos = (source[sprnum + 0] & 0x03ff0000) >> 16;
83
 
                        xpos = (source[sprnum + 0] & 0x000003ff) >> 00;
84
 
 
85
 
                        high = ((source[sprnum + 0] & 0xf0000000) >> (12 + 16)) + 1;
86
 
                        wide = ((source[sprnum + 0] & 0x0000f000) >> 12) + 1;
87
 
 
88
 
                        tnum = (source[sprnum + 1] & 0x0007ffff) >> 00;
89
 
 
90
 
                        colr = (source[sprnum + 1] & 0x3f000000) >> 24;
91
 
                        if (scr)
92
 
                                colr += 0x40; /* Use second copy of palette which is dimmed appropriately */
93
 
 
94
 
                        flipx = (source[sprnum + 1] & 0x40000000);
95
 
                        flipy = (source[sprnum + 1] & 0x80000000); /* Guess */
96
 
 
97
 
                        if (ypos & 0x200) ypos -= 0x400;
98
 
                        if (xpos & 0x200) xpos -= 0x400;
99
 
 
100
 
                        if ((!scr && flipscreen1) || (scr && flipscreen2))
101
 
                        {
102
 
                                ypos = machine.primary_screen->visible_area().max_y + 1 - ypos - high * 16; /* Screen Height depends on game */
103
 
                                xpos = 40 * 8 - xpos - wide * 16;
104
 
                                flipx = !flipx;
105
 
                                flipy = !flipy;
106
 
                        }
107
 
 
108
 
                        if (flipx)      { xstart = wide - 1;  xend = -1;    xinc = -1; }
109
 
                        else            { xstart = 0;         xend = wide;  xinc = +1; }
110
 
 
111
 
                        if (flipy)      { ystart = high - 1;  yend = -1;     yinc = -1; }
112
 
                        else            { ystart = 0;         yend = high;   yinc = +1; }
113
 
 
114
 
                        for (j = ystart; j != yend; j += yinc)
115
 
                        {
116
 
                                for (i = xstart; i != xend; i += xinc)
117
 
                                {
118
 
                                        drawgfx_transpen(bitmap, cliprect, gfx, tnum + loopnum, colr, flipx, flipy, xpos + 16 * i, ypos + 16 * j, 0);
119
 
                                        loopnum++;
120
 
                                }
121
 
                        }
122
 
                }
123
 
                /* end drawing */
124
 
                listcntr++;
125
 
                if (listdat & 0x4000)
126
 
                        break;
127
 
        }
128
 
}
129
 
 
130
 
SCREEN_UPDATE( psikyo4 )
131
 
{
132
 
        device_t *left_screen  = screen->machine().device("lscreen");
133
 
        device_t *right_screen = screen->machine().device("rscreen");
134
 
 
135
 
        if (screen == left_screen)
136
 
        {
137
 
                bitmap_fill(bitmap, cliprect, 0x1000);
138
 
                draw_sprites(screen->machine(), bitmap, cliprect, 0x0000);
139
 
        }
140
 
        if (screen == right_screen)
141
 
        {
142
 
                bitmap_fill(bitmap, cliprect, 0x1001);
143
 
                draw_sprites(screen->machine(), bitmap, cliprect, 0x2000);
144
 
        }
145
 
        return 0;
146
 
}
147
 
 
148
 
VIDEO_START( psikyo4 )
149
 
{
150
 
        machine.gfx[0]->color_granularity = 32; /* 256 colour sprites with palette selectable on 32 colour boundaries */
151
 
}