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

« back to all changes in this revision

Viewing changes to mess/src/mess/video/advision.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
 
  video/advision.c
4
 
 
5
 
  Routines to control the Adventurevision video hardware
6
 
 
7
 
  Video hardware is composed of a vertical array of 40 LEDs which is
8
 
  reflected off a spinning mirror, to give a resolution of 150 x 40 at 15 FPS.
9
 
 
10
 
***************************************************************************/
11
 
 
12
 
#include "emu.h"
13
 
#include "includes/advision.h"
14
 
 
15
 
/***************************************************************************
16
 
 
17
 
  Start the video hardware emulation.
18
 
 
19
 
***************************************************************************/
20
 
 
21
 
void advision_state::video_start()
22
 
{
23
 
        m_video_hpos = 0;
24
 
        m_display = auto_alloc_array(machine(), UINT8, 8 * 8 * 256);
25
 
        memset(m_display, 0, 8 * 8 * 256);
26
 
}
27
 
 
28
 
/***************************************************************************
29
 
 
30
 
  Initialise the palette.
31
 
 
32
 
***************************************************************************/
33
 
 
34
 
PALETTE_INIT( advision )
35
 
{
36
 
        int i;
37
 
 
38
 
        for( i = 0; i < 8; i++ )
39
 
        {
40
 
                /* 8 shades of RED */
41
 
                palette_set_color_rgb(machine, i, i * 0x22, 0x00, 0x00);
42
 
        }
43
 
}
44
 
 
45
 
/***************************************************************************
46
 
 
47
 
  Update the display data.
48
 
 
49
 
***************************************************************************/
50
 
 
51
 
void advision_state::vh_write(int data)
52
 
{
53
 
        if (m_video_bank >= 1 && m_video_bank <=5)
54
 
        {
55
 
                m_led_latch[m_video_bank] = data;
56
 
        }
57
 
}
58
 
 
59
 
void advision_state::vh_update(int x)
60
 
{
61
 
        UINT8 *dst = &m_display[x];
62
 
        int y;
63
 
 
64
 
        for( y = 0; y < 8; y++ )
65
 
        {
66
 
                UINT8 data = m_led_latch[7-y];
67
 
 
68
 
                if( (data & 0x80) == 0 ) dst[0 * 256] = 8;
69
 
                if( (data & 0x40) == 0 ) dst[1 * 256] = 8;
70
 
                if( (data & 0x20) == 0 ) dst[2 * 256] = 8;
71
 
                if( (data & 0x10) == 0 ) dst[3 * 256] = 8;
72
 
                if( (data & 0x08) == 0 ) dst[4 * 256] = 8;
73
 
                if( (data & 0x04) == 0 ) dst[5 * 256] = 8;
74
 
                if( (data & 0x02) == 0 ) dst[6 * 256] = 8;
75
 
                if( (data & 0x01) == 0 ) dst[7 * 256] = 8;
76
 
 
77
 
                m_led_latch[7-y] = 0xff;
78
 
 
79
 
                dst += 8 * 256;
80
 
        }
81
 
}
82
 
 
83
 
 
84
 
/***************************************************************************
85
 
 
86
 
  Refresh the video screen
87
 
 
88
 
***************************************************************************/
89
 
 
90
 
bool advision_state::screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect)
91
 
{
92
 
        int x, y;
93
 
 
94
 
        if( (m_frame_count++ % 4) == 0 )
95
 
        {
96
 
                m_frame_start = 1;
97
 
                m_video_hpos = 0;
98
 
        }
99
 
 
100
 
        for (x = 0; x < 150; x++)
101
 
        {
102
 
                UINT8 *led = &m_display[x];
103
 
 
104
 
                for( y = 0; y < 128; y+=2 )
105
 
                {
106
 
                        if( *led > 0 )
107
 
                                *BITMAP_ADDR16(&bitmap, 30 + y, 85 + x) = --(*led);
108
 
                        else
109
 
                                *BITMAP_ADDR16(&bitmap, 30 + y, 85 + x) = 0;
110
 
 
111
 
                        led += 256;
112
 
                }
113
 
        }
114
 
        return 0;
115
 
}