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

« back to all changes in this revision

Viewing changes to mess/src/mame/video/archimds.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
 
    Acorn Archimedes VIDC (VIDeo Controller) emulation
4
 
 
5
 
***************************************************************************/
6
 
 
7
 
#include "emu.h"
8
 
#include "includes/archimds.h"
9
 
 
10
 
VIDEO_START( archimds_vidc )
11
 
{
12
 
}
13
 
 
14
 
SCREEN_UPDATE( archimds_vidc )
15
 
{
16
 
        int xstart,ystart,xend,yend;
17
 
        int res_x,res_y;
18
 
        int xsize,ysize;
19
 
        int calc_dxs = 0,calc_dxe = 0;
20
 
        const UINT8 x_step[4] = { 5, 7, 11, 19 };
21
 
 
22
 
        /* border color */
23
 
        bitmap_fill(bitmap, cliprect, screen->machine().pens[0x10]);
24
 
 
25
 
        /* define X display area thru BPP mode register */
26
 
        calc_dxs = (vidc_regs[VIDC_HDSR]*2)+x_step[vidc_bpp_mode & 3];
27
 
        calc_dxe = (vidc_regs[VIDC_HDER]*2)+x_step[vidc_bpp_mode & 3];
28
 
 
29
 
        /* now calculate display clip rectangle start/end areas */
30
 
        xstart = (calc_dxs)-vidc_regs[VIDC_HBSR];
31
 
        ystart = (vidc_regs[VIDC_VDSR])-vidc_regs[VIDC_VBSR];
32
 
        xend = (calc_dxe)+xstart;
33
 
        yend = vidc_regs[VIDC_VDER]+ystart;
34
 
 
35
 
        /* disable the screen if display params are invalid */
36
 
        if(xstart > xend || ystart > yend)
37
 
                return 0;
38
 
 
39
 
        xsize = calc_dxe-calc_dxs;
40
 
        ysize = vidc_regs[VIDC_VDER]-vidc_regs[VIDC_VDSR];
41
 
 
42
 
        {
43
 
                int count;
44
 
                int x,y,xi;
45
 
                UINT8 pen;
46
 
                static UINT8 *vram = screen->machine().region("vram")->base();
47
 
 
48
 
                count = (0);
49
 
 
50
 
                switch(vidc_bpp_mode)
51
 
                {
52
 
                        case 0: //1 bpp
53
 
                        {
54
 
                                for(y=0;y<ysize;y++)
55
 
                                {
56
 
                                        for(x=0;x<xsize;x+=8)
57
 
                                        {
58
 
                                                pen = vram[count];
59
 
 
60
 
                                                for(xi=0;xi<8;xi++)
61
 
                                                {
62
 
                                                        res_x = x+xi+xstart;
63
 
                                                        res_y = (y+ystart)*(vidc_interlace+1);
64
 
 
65
 
                                                        if(vidc_interlace)
66
 
                                                        {
67
 
                                                                if ((res_x) >= 0 &&
68
 
                                                                        (res_y) >= 0 &&
69
 
                                                                        (res_x) <= screen->visible_area().max_x && (res_y) <= screen->visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
70
 
                                                                        *BITMAP_ADDR32(bitmap, res_y, res_x) = screen->machine().pens[(pen>>(xi))&0x1];
71
 
                                                                if ((res_x) >= 0 &&
72
 
                                                                        (res_y) >= 0 &&
73
 
                                                                        (res_x) <= screen->visible_area().max_x && (res_y+1) <= screen->visible_area().max_y && (res_x) <= xend && (res_y+1) <= yend)
74
 
                                                                        *BITMAP_ADDR32(bitmap, res_y+1, res_x) = screen->machine().pens[(pen>>(xi))&0x1];
75
 
                                                        }
76
 
                                                        else
77
 
                                                        {
78
 
                                                                if ((res_x) >= 0 &&
79
 
                                                                        (res_y) >= 0 &&
80
 
                                                                        (res_x) <= screen->visible_area().max_x && (res_y) <= screen->visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
81
 
                                                                        *BITMAP_ADDR32(bitmap, res_y, res_x) = screen->machine().pens[(pen>>(xi))&0x1];
82
 
                                                        }
83
 
                                                }
84
 
 
85
 
                                                count++;
86
 
                                        }
87
 
                                }
88
 
                        }
89
 
                        break;
90
 
                        case 3: //8 bpp
91
 
                        {
92
 
                                for(y=0;y<ysize;y++)
93
 
                                {
94
 
                                        for(x=0;x<xsize;x++)
95
 
                                        {
96
 
                                                pen = vram[count];
97
 
 
98
 
                                                res_x = x+xstart;
99
 
                                                res_y = (y+ystart)*(vidc_interlace+1);
100
 
 
101
 
                                                if(vidc_interlace)
102
 
                                                {
103
 
                                                        if ((res_x) >= 0 &&
104
 
                                                                (res_y) >= 0 &&
105
 
                                                                (res_x) <= screen->visible_area().max_x && (res_y) <= screen->visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
106
 
                                                                *BITMAP_ADDR32(bitmap, res_y, res_x) = screen->machine().pens[(pen&0xff)+0x100];
107
 
                                                        if ((res_x) >= 0 &&
108
 
                                                                (res_y) >= 0 &&
109
 
                                                                (res_x) <= screen->visible_area().max_x && (res_y+1) <= screen->visible_area().max_y && (res_x) <= xend && (res_y+1) <= yend)
110
 
                                                                *BITMAP_ADDR32(bitmap, res_y+1, res_x) = screen->machine().pens[(pen&0xff)+0x100];
111
 
                                                }
112
 
                                                else
113
 
                                                {
114
 
                                                        if ((res_x) >= 0 &&
115
 
                                                                (res_y) >= 0 &&
116
 
                                                                (res_x) <= screen->visible_area().max_x && (res_y) <= screen->visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
117
 
                                                                *BITMAP_ADDR32(bitmap, res_y, res_x) = screen->machine().pens[(pen&0xff)+0x100];
118
 
                                                }
119
 
 
120
 
                                                count++;
121
 
                                        }
122
 
                                }
123
 
                        }
124
 
                        break;
125
 
                }
126
 
        }
127
 
 
128
 
        return 0;
129
 
}