summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/misc/unkpoker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/misc/unkpoker.cpp')
-rw-r--r--src/mame/misc/unkpoker.cpp86
1 files changed, 45 insertions, 41 deletions
diff --git a/src/mame/misc/unkpoker.cpp b/src/mame/misc/unkpoker.cpp
index 67ac0a1e946..67dc9346cad 100644
--- a/src/mame/misc/unkpoker.cpp
+++ b/src/mame/misc/unkpoker.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:
+
/****************************************************************************************
Unknown Color Poker Game
@@ -31,12 +32,14 @@ TODO: stuck if it isn't immediately coined up at boot.
*******************************************************************************************/
#include "emu.h"
+
#include "cpu/i8085/i8085.h"
#include "machine/nvram.h"
#include "screen.h"
#include "emupal.h"
#include "speaker.h"
+#include "tilemap.h"
namespace {
@@ -47,52 +50,53 @@ public:
unkpoker_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this,"maincpu"),
- m_videoram(*this, "videoram"),
- m_chargen(*this, "gfx1")
+ m_gfxdecode(*this, "gfxdecode"),
+ m_videoram(*this, "videoram")
{ }
- void unkpoker(machine_config &config);
+ void unkpoker(machine_config &config) ATTR_COLD;
+
+protected:
+ virtual void video_start() override ATTR_COLD;
private:
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+
+ required_shared_ptr<uint8_t> m_videoram;
+
+ tilemap_t *m_tilemap = nullptr;
+
+ void videoram_w(offs_t offset, uint8_t data);
+ TILE_GET_INFO_MEMBER(get_tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void mem_map(address_map &map) ATTR_COLD;
void io_map(address_map &map) ATTR_COLD;
-
- required_device<cpu_device> m_maincpu;
- required_shared_ptr<uint8_t> m_videoram;
- required_region_ptr<u8> m_chargen;
};
-uint32_t unkpoker_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) // taken from video21.cpp
+void unkpoker_state::video_start()
{
- uint16_t sy = 0, ma = 0;
-
- for (uint8_t y = 0; y < 28; y++)
- {
- for (uint8_t ra = 0; ra < 8; ra++)
- {
- uint16_t *p = &bitmap.pix(sy++);
-
- for (uint16_t x = 0; x < 32; x++)
- {
- uint8_t chr = m_videoram[x + ma] & 0x7f;
- uint8_t gfx = m_chargen[(chr << 3) | ra];
-
- // Display a scanline of a character
- *p++ = BIT(gfx, 7);
- *p++ = BIT(gfx, 6);
- *p++ = BIT(gfx, 5);
- *p++ = BIT(gfx, 4);
- *p++ = BIT(gfx, 3);
- *p++ = BIT(gfx, 2);
- *p++ = BIT(gfx, 1);
- *p++ = BIT(gfx, 0);
- }
- }
- ma += 32;
- }
+ m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(unkpoker_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+}
+
+void unkpoker_state::videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data & 0x7f;
+ m_tilemap->mark_tile_dirty(offset);
+}
+
+TILE_GET_INFO_MEMBER(unkpoker_state::get_tile_info)
+{
+ int const code = m_videoram[tile_index];
+ tileinfo.set(0, code, 0, 0);
+}
+
+uint32_t unkpoker_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+
return 0;
}
@@ -101,7 +105,7 @@ void unkpoker_state::mem_map(address_map &map)
{
map(0x0000,0x0fff).rom();
map(0x1000,0x1fff).ram();
- map(0x8000,0x83ff).ram().share(m_videoram);
+ map(0x8000,0x83ff).ram().w(FUNC(unkpoker_state::videoram_w)).share(m_videoram);
}
void unkpoker_state::io_map(address_map &map)
@@ -142,20 +146,20 @@ INPUT_PORTS_END
static GFXDECODE_START( gfx_unkpoker )
- GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x1, 0, 1 )
+ GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x1, 0, 1 )
GFXDECODE_END
void unkpoker_state::unkpoker(machine_config &config)
{
- /* basic machine hardware */
- I8080A(config, m_maincpu, 2000000); // guessed
+ // basic machine hardware
+ I8080A(config, m_maincpu, 2'000'000); // guessed
m_maincpu->set_addrmap(AS_PROGRAM, &unkpoker_state::mem_map);
m_maincpu->set_addrmap(AS_IO, &unkpoker_state::io_map);
//NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
- /* video hardware */
+ // video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
@@ -167,7 +171,7 @@ void unkpoker_state::unkpoker(machine_config &config)
GFXDECODE(config, "gfxdecode", "palette", gfx_unkpoker);
PALETTE(config, "palette", palette_device::RGB_3BIT);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
}
@@ -177,7 +181,7 @@ ROM_START( unkpoker )
ROM_LOAD( "cdpat.13b", 0x0000, 0x0800, CRC(c3f3040f) SHA1(ed1916bcd9e1e80502fcff5ddd599c101a226e7c) )
ROM_LOAD( "cdpat.11b", 0x0800, 0x0800, CRC(16a97398) SHA1(737192dd0e1b3083f1facd327a83d98a0b7f4d66) )
- ROM_REGION( 0x1000, "gfx1", 0 )
+ ROM_REGION( 0x1000, "tiles", 0 )
ROM_LOAD( "cd.3b", 0x0000, 0x0800, CRC(e3997d7d) SHA1(6c595c70afedc7aef024215d153fe31b418adc25) )
ROM_LOAD( "cd.3c", 0x0800, 0x0800, CRC(b61adb76) SHA1(9805593fc6d9b01e4a63bfc35e5442c4c547c103) )
ROM_END