caveman (pinball) - simple code to draw the video screen (nw)

This commit is contained in:
mamehaze 2015-01-05 18:05:03 +00:00
parent f67e16a24a
commit 3c8124c88d
3 changed files with 214 additions and 3 deletions

View File

@ -15,6 +15,7 @@
#include "audio/gottlieb.h"
#include "cpu/i86/i86.h"
#include "gts80a.lh"
#include "gts80a_caveman.lh"
class gts80a_state : public genpin_class
{
@ -384,25 +385,75 @@ public:
caveman_state(const machine_config &mconfig, device_type type, const char *tag)
: gts80a_state(mconfig, type, tag)
, m_videocpu(*this, "video_cpu")
, m_vram(*this, "vram")
{ }
UINT32 screen_update_caveman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
private:
required_device<cpu_device> m_videocpu;
required_shared_ptr<UINT8> m_vram;
};
UINT32 caveman_state::screen_update_caveman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int count = 0;
for (int y = 0; y < 256; y++)
{
for (int x = 0; x < 256; x += 4)
{
UINT8 pix = m_vram[count];
bitmap.pix16(y, x+0) = (pix >> 6)&0x3;
bitmap.pix16(y, x+1) = (pix >> 4)&0x3;
bitmap.pix16(y, x+2) = (pix >> 2)&0x3;
bitmap.pix16(y, x+3) = (pix >> 0)&0x3;
count++;
}
}
return 0;
}
static ADDRESS_MAP_START( video_map, AS_PROGRAM, 8, caveman_state )
ADDRESS_MAP_GLOBAL_MASK(0xffff)
AM_RANGE(0x0000, 0x5fff) AM_RAM
AM_RANGE(0x0000, 0x07ff) AM_RAM
AM_RANGE(0x2000, 0x5fff) AM_RAM AM_SHARE("vram")
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START( video_io_map, AS_IO, 8, caveman_state )
// AM_RANGE(0x000, 0x002) AM_READWRITE() // 8259 irq controller
// AM_RANGE(0x100, 0x102) AM_READWRITE() // HD46505
// AM_RANGE(0x200, 0x200) AM_READWRITE() // 8212 in, ?? out
// AM_RANGE(0x300, 0x300) AM_READWRITE() // soundlatch (command?) in, ?? out
// AM_RANGE(0x400, 0x400) AM_READ() // joystick inputs
// AM_RANGE(0x500, 0x506) AM_WRITE() // palette
ADDRESS_MAP_END
static MACHINE_CONFIG_DERIVED( caveman, gts80a_ss )
static MACHINE_CONFIG_DERIVED_CLASS( caveman, gts80a_ss, caveman_state )
MCFG_CPU_ADD("video_cpu", I8088, 5000000)
MCFG_CPU_PROGRAM_MAP(video_map)
MCFG_CPU_IO_MAP(video_io_map)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 248-1)
MCFG_SCREEN_UPDATE_DRIVER(caveman_state, screen_update_caveman)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 16)
MCFG_DEFAULT_LAYOUT(layout_gts80a_caveman)
MACHINE_CONFIG_END
static INPUT_PORTS_START( caveman )

View File

@ -0,0 +1,159 @@
<!-- GTS80A copied from gts80.lay -->
<!-- 2014-10-10: Initial version. [Robbbert] -->
<mamelayout version="2">
<element name="digit" defstate="0">
<led14seg>
<color red="0.0" green="0.75" blue="1.0" />
</led14seg>
</element>
<element name="digit7" defstate="0">
<led7seg>
<color red="0.0" green="0.75" blue="1.0" />
</led7seg>
</element>
<element name="red_led">
<disk><color red="1.0" green="0.0" blue="0.0" /></disk>
</element>
<element name="background">
<rect>
<bounds left="0" top="0" right="1" bottom="1" />
<color red="0.0" green="0.0" blue="0.0" />
</rect>
</element>
<element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P3"><text string="Player 1"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P4"><text string="Player 2"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<view name="Default Layout">
<!-- Background -->
<backdrop element="background">
<bounds left="0" top="20" right="318" bottom="394" />
</backdrop>
<!-- LEDs -->
<!-- Player 1 Score -->
<bezel name="digit15" element="digit">
<bounds left="10" top="45" right="44" bottom="84" />
</bezel>
<bezel name="digit5" element="digit">
<bounds left="54" top="45" right="88" bottom="84" />
</bezel>
<bezel name="digit4" element="digit">
<bounds left="98" top="45" right="132" bottom="84" />
</bezel>
<bezel name="digit3" element="digit">
<bounds left="142" top="45" right="176" bottom="84" />
</bezel>
<bezel name="digit2" element="digit">
<bounds left="186" top="45" right="220" bottom="84" />
</bezel>
<bezel name="digit1" element="digit">
<bounds left="230" top="45" right="264" bottom="84" />
</bezel>
<bezel name="digit0" element="digit">
<bounds left="274" top="45" right="308" bottom="84" />
</bezel>
<!-- Player 2 Score -->
<bezel name="digit12" element="digit">
<bounds left="10" top="105" right="44" bottom="144" />
</bezel>
<bezel name="digit11" element="digit">
<bounds left="54" top="105" right="88" bottom="144" />
</bezel>
<bezel name="digit10" element="digit">
<bounds left="98" top="105" right="132" bottom="144" />
</bezel>
<bezel name="digit9" element="digit">
<bounds left="142" top="105" right="176" bottom="144" />
</bezel>
<bezel name="digit8" element="digit">
<bounds left="186" top="105" right="220" bottom="144" />
</bezel>
<bezel name="digit7" element="digit">
<bounds left="230" top="105" right="264" bottom="144" />
</bezel>
<bezel name="digit6" element="digit">
<bounds left="274" top="105" right="308" bottom="144" />
</bezel>
<!-- Player 3 Score -->
<bezel name="digit35" element="digit">
<bounds left="10" top="165" right="44" bottom="204" />
</bezel>
<bezel name="digit25" element="digit">
<bounds left="54" top="165" right="88" bottom="204" />
</bezel>
<bezel name="digit24" element="digit">
<bounds left="98" top="165" right="132" bottom="204" />
</bezel>
<bezel name="digit23" element="digit">
<bounds left="142" top="165" right="176" bottom="204" />
</bezel>
<bezel name="digit22" element="digit">
<bounds left="186" top="165" right="220" bottom="204" />
</bezel>
<bezel name="digit21" element="digit">
<bounds left="230" top="165" right="264" bottom="204" />
</bezel>
<bezel name="digit20" element="digit">
<bounds left="274" top="165" right="308" bottom="204" />
</bezel>
<!-- Player 4 Score -->
<bezel name="digit32" element="digit">
<bounds left="10" top="225" right="44" bottom="264" />
</bezel>
<bezel name="digit31" element="digit">
<bounds left="54" top="225" right="88" bottom="264" />
</bezel>
<bezel name="digit30" element="digit">
<bounds left="98" top="225" right="132" bottom="264" />
</bezel>
<bezel name="digit29" element="digit">
<bounds left="142" top="225" right="176" bottom="264" />
</bezel>
<bezel name="digit28" element="digit">
<bounds left="186" top="225" right="220" bottom="264" />
</bezel>
<bezel name="digit27" element="digit">
<bounds left="230" top="225" right="264" bottom="264" />
</bezel>
<bezel name="digit26" element="digit">
<bounds left="274" top="225" right="308" bottom="264" />
</bezel>
<!-- Credits and Balls -->
<bezel name="digit55" element="digit7">
<bounds left="30" top="345" right="64" bottom="384" />
</bezel>
<bezel name="digit54" element="digit7">
<bounds left="69" top="345" right="103" bottom="384" />
</bezel>
<bezel name="digit53" element="digit7">
<bounds left="171" top="345" right="205" bottom="384" />
</bezel>
<bezel name="digit52" element="digit7">
<bounds left="210" top="345" right="244" bottom="384" />
</bezel>
<bezel element="P0"><bounds left="200" right="258" top="330" bottom="342" /></bezel>
<bezel element="P1"><bounds left="50" right="108" top="330" bottom="342" /></bezel>
<bezel name="text3" element="P3"><bounds left="100" right="180" top="30" bottom="42" /></bezel>
<bezel name="text2" element="P4"><bounds left="100" right="180" top="90" bottom="102" /></bezel>
<bezel name="text1" element="P5"><bounds left="100" right="180" top="150" bottom="162" /></bezel>
<bezel name="text0" element="P6"><bounds left="100" right="180" top="210" bottom="222" /></bezel>
<screen index="0">
<bounds x="320" y="0" width="320" height="240" />
</screen>
</view>
</mamelayout>

View File

@ -2661,7 +2661,8 @@ $(DRIVERS)/goldnpkr.o: $(LAYOUT)/goldnpkr.lh \
$(DRIVERS)/gts1.o: $(LAYOUT)/gts1.lh
$(DRIVERS)/gts3.o: $(LAYOUT)/gts3.lh
$(DRIVERS)/gts80.o: $(LAYOUT)/gts80.lh
$(DRIVERS)/gts80a.o: $(LAYOUT)/gts80a.lh
$(DRIVERS)/gts80a.o: $(LAYOUT)/gts80a.lh \
$(LAYOUT)/gts80a_caveman.lh
$(DRIVERS)/gts80b.o: $(LAYOUT)/gts80b.lh
$(DRIVERS)/lbeach.o: $(LAYOUT)/lbeach.lh