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

« back to all changes in this revision

Viewing changes to mess/src/mess/video/nes.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/nes.c
4
 
 
5
 
  Routines to control the unique NES video hardware/PPU.
6
 
 
7
 
***************************************************************************/
8
 
 
9
 
#include "emu.h"
10
 
#include "video/ppu2c0x.h"
11
 
#include "includes/nes.h"
12
 
#include "machine/nes_mmc.h"
13
 
 
14
 
static void nes_vh_reset( running_machine &machine )
15
 
{
16
 
        nes_state *state = machine.driver_data<nes_state>();
17
 
        ppu2c0x_set_vidaccess_callback(machine.device("ppu"), nes_ppu_vidaccess);
18
 
 
19
 
        if (state->m_four_screen_vram)
20
 
                set_nt_mirroring(machine, PPU_MIRROR_4SCREEN);
21
 
        else
22
 
        {
23
 
                switch (state->m_hard_mirroring)
24
 
                {
25
 
                        case PPU_MIRROR_HORZ:
26
 
                        case PPU_MIRROR_VERT:
27
 
                        case PPU_MIRROR_HIGH:
28
 
                        case PPU_MIRROR_LOW:
29
 
                                set_nt_mirroring(machine, state->m_hard_mirroring);
30
 
                                break;
31
 
                        default:
32
 
                                set_nt_mirroring(machine, PPU_MIRROR_NONE);
33
 
                                break;
34
 
                }
35
 
        }
36
 
}
37
 
 
38
 
VIDEO_START( nes )
39
 
{
40
 
        nes_state *state = machine.driver_data<nes_state>();
41
 
 
42
 
        state->m_last_frame_flip =  0;
43
 
 
44
 
        machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(nes_vh_reset),&machine));
45
 
}
46
 
 
47
 
PALETTE_INIT( nes )
48
 
{
49
 
        ppu2c0x_init_palette(machine, 0);
50
 
}
51
 
 
52
 
 
53
 
/***************************************************************************
54
 
 
55
 
  Display refresh
56
 
 
57
 
***************************************************************************/
58
 
 
59
 
SCREEN_UPDATE( nes )
60
 
{
61
 
        nes_state *state = screen->machine().driver_data<nes_state>();
62
 
 
63
 
        /* render the ppu */
64
 
        ppu2c0x_render(state->m_ppu, bitmap, 0, 0, 0, 0);
65
 
 
66
 
        /* if this is a disk system game, check for the flip-disk key */
67
 
        if (state->m_disk_expansion && state->m_pcb_id == NO_BOARD)
68
 
        {
69
 
                // latch this input so it doesn't go at warp speed
70
 
                if ((input_port_read(screen->machine(), "FLIPDISK") & 0x01) && (!state->m_last_frame_flip))
71
 
                {
72
 
                        state->m_last_frame_flip = 1;
73
 
                        state->m_fds_current_side++;
74
 
                        if (state->m_fds_current_side > state->m_fds_sides)
75
 
                                state->m_fds_current_side = 0;
76
 
 
77
 
                        if (state->m_fds_current_side == 0)
78
 
                                popmessage("No disk inserted.");
79
 
                        else
80
 
                                popmessage("Disk set to side %d", state->m_fds_current_side);
81
 
                }
82
 
 
83
 
                if (!(input_port_read(screen->machine(), "FLIPDISK") & 0x01))
84
 
                        state->m_last_frame_flip = 0;
85
 
        }
86
 
        return 0;
87
 
}