Skip to content

Commit a2c7805

Browse files
committed
misc/freeway.cpp: added very preliminary drawing
1 parent a98f483 commit a2c7805

File tree

1 file changed

+58
-2
lines changed

1 file changed

+58
-2
lines changed

src/mame/misc/freeway.cpp

+58-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
*********************************************************************/
1010

1111
#include "emu.h"
12+
1213
#include "bus/rs232/rs232.h"
1314
#include "cpu/i86/i86.h"
1415
#include "machine/ins8250.h"
1516
#include "machine/pit8253.h"
1617
#include "machine/pic8259.h"
1718
#include "machine/timekpr.h"
1819
#include "video/mc6845.h"
20+
1921
#include "emupal.h"
2022
#include "screen.h"
2123

@@ -31,6 +33,8 @@ class freeway_state : public driver_device
3133
, m_pic(*this, "pic")
3234
, m_charram(*this, "charram")
3335
, m_colorram(*this, "colorram")
36+
, m_gfx_rom(*this, "gfx")
37+
, m_color_rom(*this, "cor")
3438
, m_lamps(*this, "lamp%u", 1U)
3539
{
3640
}
@@ -56,6 +60,9 @@ class freeway_state : public driver_device
5660
required_shared_ptr<u8> m_charram;
5761
required_shared_ptr<u8> m_colorram;
5862

63+
required_region_ptr<u8> m_gfx_rom;
64+
required_region_ptr<u8> m_color_rom;
65+
5966
output_finder<3> m_lamps;
6067
};
6168

@@ -64,8 +71,32 @@ void freeway_state::machine_start()
6471
m_lamps.resolve();
6572
}
6673

74+
// TODO: just the minimum to show errors on screen
6775
MC6845_UPDATE_ROW(freeway_state::update_row)
6876
{
77+
uint16_t x = 0;
78+
79+
for (uint8_t cx = 0; cx < x_count; cx++)
80+
{
81+
int const attr = m_colorram[ma & 0xfff];
82+
int addr = ((m_charram[ma & 0xfff] | ((attr & 0x10) << 5)) << 3) | (ra & 0x07);
83+
84+
uint8_t const *const data = m_gfx_rom;
85+
86+
for (int i = 7; i >= 0; i--)
87+
{
88+
int col = 0;
89+
col |= (BIT(data[0x0000 | addr], i) << 2);
90+
col |= (BIT(data[0x8000 | addr], i) << 1);
91+
col |= (BIT(data[0x10000 | addr], i) << 0);
92+
93+
const u32 pen = (BIT(col, 2) ? 0xff : 0) | (BIT(col, 1) ? 0xff00 : 0) | (BIT(col, 0) ? 0xff0000 : 0);
94+
bitmap.pix(y, x) = pen;
95+
96+
x++;
97+
}
98+
ma++;
99+
}
69100
}
70101

71102
void freeway_state::lamps_w(u8 data)
@@ -83,8 +114,8 @@ void freeway_state::mem_map(address_map &map)
83114
{
84115
map(0x00000, 0x07fff).ram();
85116
map(0x08000, 0x09fff).rw("timekpr", FUNC(timekeeper_device::read), FUNC(timekeeper_device::write));
86-
map(0xa0000, 0xa0fff).ram().share("charram");
87-
map(0xa4000, 0xa4fff).ram().share("colorram");
117+
map(0xa0000, 0xa0fff).ram().share(m_charram);
118+
map(0xa4000, 0xa4fff).ram().share(m_colorram);
88119
map(0xf0000, 0xfffff).rom().region("program", 0);
89120
}
90121

@@ -95,6 +126,7 @@ void freeway_state::io_map(address_map &map)
95126
map(0x0040, 0x0047).rw("uart", FUNC(ns16450_device::ins8250_r), FUNC(ns16450_device::ins8250_w));
96127
map(0x00a3, 0x00a3).w(FUNC(freeway_state::lamps_w));
97128
map(0x00d0, 0x00d0).portr("CONFIG");
129+
map(0x00d1, 0x00d1).portr("INPUTS");
98130
map(0x03d0, 0x03d0).w("crtc", FUNC(mc6845_device::address_w));
99131
map(0x03d1, 0x03d1).w("crtc", FUNC(mc6845_device::register_w));
100132
}
@@ -107,6 +139,30 @@ static INPUT_PORTS_START(freeway)
107139
PORT_BIT(0x08, 0x08, IPT_UNKNOWN)
108140
PORT_BIT(0xf6, 0xf6, IPT_UNKNOWN) // probably unused
109141

142+
PORT_START("INPUTS")
143+
PORT_DIPNAME( 0x01, 0x01, "IN0.1" )
144+
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
145+
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
146+
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) // brings up the 'auditoria' screen in freeway
147+
PORT_DIPNAME( 0x04, 0x04, "IN0.3" )
148+
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
149+
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
150+
PORT_DIPNAME( 0x08, 0x08, "IN0.4" )
151+
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
152+
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
153+
PORT_DIPNAME( 0x10, 0x10, "IN0.5" ) // increases the 'num dias' value in freeway
154+
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
155+
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
156+
PORT_DIPNAME( 0x20, 0x20, "IN0.6" )
157+
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
158+
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
159+
PORT_DIPNAME( 0x40, 0x40, "IN0.7" )
160+
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
161+
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
162+
PORT_DIPNAME( 0x80, 0x80, "IN0.8" )
163+
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
164+
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
165+
110166
PORT_START("RESET")
111167
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_MEMORY_RESET) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, freeway_state, nmi_w)
112168
INPUT_PORTS_END

0 commit comments

Comments
 (0)