misc/freeway.cpp: added very preliminary drawing

This commit is contained in:
Ivan Vangelista 2024-07-01 16:44:22 +02:00
parent a98f483318
commit a2c780588c

View File

@ -9,6 +9,7 @@
*********************************************************************/
#include "emu.h"
#include "bus/rs232/rs232.h"
#include "cpu/i86/i86.h"
#include "machine/ins8250.h"
@ -16,6 +17,7 @@
#include "machine/pic8259.h"
#include "machine/timekpr.h"
#include "video/mc6845.h"
#include "emupal.h"
#include "screen.h"
@ -31,6 +33,8 @@ public:
, m_pic(*this, "pic")
, m_charram(*this, "charram")
, m_colorram(*this, "colorram")
, m_gfx_rom(*this, "gfx")
, m_color_rom(*this, "cor")
, m_lamps(*this, "lamp%u", 1U)
{
}
@ -56,6 +60,9 @@ private:
required_shared_ptr<u8> m_charram;
required_shared_ptr<u8> m_colorram;
required_region_ptr<u8> m_gfx_rom;
required_region_ptr<u8> m_color_rom;
output_finder<3> m_lamps;
};
@ -64,8 +71,32 @@ void freeway_state::machine_start()
m_lamps.resolve();
}
// TODO: just the minimum to show errors on screen
MC6845_UPDATE_ROW(freeway_state::update_row)
{
uint16_t x = 0;
for (uint8_t cx = 0; cx < x_count; cx++)
{
int const attr = m_colorram[ma & 0xfff];
int addr = ((m_charram[ma & 0xfff] | ((attr & 0x10) << 5)) << 3) | (ra & 0x07);
uint8_t const *const data = m_gfx_rom;
for (int i = 7; i >= 0; i--)
{
int col = 0;
col |= (BIT(data[0x0000 | addr], i) << 2);
col |= (BIT(data[0x8000 | addr], i) << 1);
col |= (BIT(data[0x10000 | addr], i) << 0);
const u32 pen = (BIT(col, 2) ? 0xff : 0) | (BIT(col, 1) ? 0xff00 : 0) | (BIT(col, 0) ? 0xff0000 : 0);
bitmap.pix(y, x) = pen;
x++;
}
ma++;
}
}
void freeway_state::lamps_w(u8 data)
@ -83,8 +114,8 @@ void freeway_state::mem_map(address_map &map)
{
map(0x00000, 0x07fff).ram();
map(0x08000, 0x09fff).rw("timekpr", FUNC(timekeeper_device::read), FUNC(timekeeper_device::write));
map(0xa0000, 0xa0fff).ram().share("charram");
map(0xa4000, 0xa4fff).ram().share("colorram");
map(0xa0000, 0xa0fff).ram().share(m_charram);
map(0xa4000, 0xa4fff).ram().share(m_colorram);
map(0xf0000, 0xfffff).rom().region("program", 0);
}
@ -95,6 +126,7 @@ void freeway_state::io_map(address_map &map)
map(0x0040, 0x0047).rw("uart", FUNC(ns16450_device::ins8250_r), FUNC(ns16450_device::ins8250_w));
map(0x00a3, 0x00a3).w(FUNC(freeway_state::lamps_w));
map(0x00d0, 0x00d0).portr("CONFIG");
map(0x00d1, 0x00d1).portr("INPUTS");
map(0x03d0, 0x03d0).w("crtc", FUNC(mc6845_device::address_w));
map(0x03d1, 0x03d1).w("crtc", FUNC(mc6845_device::register_w));
}
@ -107,6 +139,30 @@ static INPUT_PORTS_START(freeway)
PORT_BIT(0x08, 0x08, IPT_UNKNOWN)
PORT_BIT(0xf6, 0xf6, IPT_UNKNOWN) // probably unused
PORT_START("INPUTS")
PORT_DIPNAME( 0x01, 0x01, "IN0.1" )
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) // brings up the 'auditoria' screen in freeway
PORT_DIPNAME( 0x04, 0x04, "IN0.3" )
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x08, "IN0.4" )
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x10, 0x10, "IN0.5" ) // increases the 'num dias' value in freeway
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x20, "IN0.6" )
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x40, 0x40, "IN0.7" )
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x80, "IN0.8" )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("RESET")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_MEMORY_RESET) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, freeway_state, nmi_w)
INPUT_PORTS_END