Previous 15994 Revisions Next

r7071 Tuesday 19th January, 2010 at 21:27:38 UTC by Wilbert Pol
[PV1000] Added some basic drawing stuff.
[src/mess/drivers]pv1000.c

src/mess/drivers/pv1000.c
r7070r7071
1010
1111
1212static UINT8 *pv1000_ram;
13static UINT8 pv1000_io_regs[8];
1314
1415
16static WRITE8_HANDLER( pv1000_io_w );
17static READ8_HANDLER( pv1000_io_r );
18
1519static ADDRESS_MAP_START( pv1000, ADDRESS_SPACE_PROGRAM, 8 )
1620   AM_RANGE( 0x0000, 0x3fff ) AM_MIRROR( 0x4000 ) AM_ROM AM_REGION( "cart", 0 )
17   AM_RANGE( 0xb800, 0xbfff ) AM_RAM AM_BASE( &pv1000_ram )
21   AM_RANGE( 0xb800, 0xbbff ) AM_RAM AM_BASE( &pv1000_ram )
22   AM_RANGE( 0xbc00, 0xbfff ) AM_RAM AM_REGION( "gfxram", 0 )
1823ADDRESS_MAP_END
1924
2025
2126static ADDRESS_MAP_START( pv1000_io, ADDRESS_SPACE_IO, 8 )
2227   ADDRESS_MAP_GLOBAL_MASK( 0xff )
23   AM_RANGE( 0xf8, 0xf8 ) AM_RAM   /* R?/W */
24   AM_RANGE( 0xf9, 0xf9 ) AM_RAM   /* R?/W */
25   AM_RANGE( 0xfa, 0xfa ) AM_RAM   /* R?/W */
26   AM_RANGE( 0xfb, 0xfb ) AM_RAM   /* R?/W */
27   AM_RANGE( 0xfc, 0xfc ) AM_RAM   /* R?/W */
28   AM_RANGE( 0xfd, 0xfd ) AM_RAM   /* R/W */
29   AM_RANGE( 0xfe, 0xfe ) AM_RAM   /* R?/W */
30   AM_RANGE( 0xff, 0xff ) AM_RAM   /* R?/W */
28   AM_RANGE( 0xf8, 0xff ) AM_READWRITE( pv1000_io_r, pv1000_io_w )
3129ADDRESS_MAP_END
3230
3331
32static WRITE8_HANDLER( pv1000_io_w )
33{
34   pv1000_io_regs[offset] = data;
35}
36
37
38static READ8_HANDLER( pv1000_io_r )
39{
40   UINT8 data = pv1000_io_regs[offset];
41
42   return data;
43}
44
45
3446static INPUT_PORTS_START( pv1000 )
3547INPUT_PORTS_END
3648
3749
50static PALETTE_INIT( pv1000 )
51{
52   palette_set_color_rgb( machine,  0,   0,   0,   0 );
53   palette_set_color_rgb( machine,  1, 255,   0,   0 );
54   palette_set_color_rgb( machine,  2,   0, 255,   0 );
55   palette_set_color_rgb( machine,  3, 255, 255,   0 );
56   palette_set_color_rgb( machine,  4,   0,   0, 255 );
57   palette_set_color_rgb( machine,  5, 255,   0, 255 );
58   palette_set_color_rgb( machine,  6,   0, 255, 255 );
59   palette_set_color_rgb( machine,  7, 255, 255, 255 );
60}
61
62
3863static DEVICE_IMAGE_LOAD( pv1000_cart )
3964{
4065   UINT8 *cart = memory_region( image->machine, "cart" );
r7070r7071
6287}
6388
6489
90static VIDEO_UPDATE( pv1000 )
91{
92   int x, y;
93
94   for ( y = 0; y < 24; y++ )
95   {
96      for ( x = 0; x < 32; x++ )
97      {
98         UINT16 tile = pv1000_ram[ y * 32 + x ];
99
100         if ( tile < 0xe0 )
101         {
102            tile += ( pv1000_io_regs[7] * 8 );
103            drawgfx_opaque( bitmap, cliprect, screen->machine->gfx[0], tile, 0, 0, 0, x*8, y*8 );
104         }
105         else
106         {
107            tile -= 0xe0;
108            drawgfx_opaque( bitmap, cliprect, screen->machine->gfx[1], tile, 0, 0, 0, x*8, y*8 );
109         }
110      }
111   }
112
113   return 0;
114}
115
116
117static const gfx_layout pv1000_3bpp_gfx =
118{
119   8, 8,         /* 8x8 characters */
120   RGN_FRAC(1,1),
121   3,
122   { 0, 8*8, 16*8 },
123   { 0, 1, 2, 3, 4, 5, 6, 7 },
124   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
125   8*8*4
126};
127
128
129static GFXDECODE_START( pv1000 )
130   GFXDECODE_ENTRY( "cart", 8, pv1000_3bpp_gfx, 0, 8 )
131   GFXDECODE_ENTRY( "gfxram", 8, pv1000_3bpp_gfx, 0, 8 )
132GFXDECODE_END
133
134
65135static MACHINE_DRIVER_START( pv1000 )
66136   MDRV_CPU_ADD( "maincpu", Z80, 17897725/5 )
67137   MDRV_CPU_PROGRAM_MAP( pv1000 )
r7070r7071
73143   MDRV_SCREEN_SIZE(256, 192)
74144   MDRV_SCREEN_VISIBLE_AREA( 0, 255, 0, 191 )
75145
76   MDRV_PALETTE_LENGTH( 16 )
146   MDRV_PALETTE_LENGTH( 8 )
147   MDRV_PALETTE_INIT( pv1000 )
148   MDRV_GFXDECODE( pv1000 )
77149
78150   /* D65010G031 - Video & sound chip */
151   MDRV_VIDEO_UPDATE( pv1000 )
79152
80153   /* Cartridge slot */
81154   MDRV_CARTSLOT_ADD( "cart" )
r7070r7071
87160
88161ROM_START( pv1000 )
89162   ROM_REGION( 0x4000, "cart", ROMREGION_ERASE00 )
163   ROM_REGION( 0x400, "gfxram", ROMREGION_ERASE00 )
90164ROM_END
91165
92166

Previous 15994 Revisions Next


© 1998-2018 The MESS Team