9
9
*********************************************************************/
10
10
11
11
#include " emu.h"
12
+
12
13
#include " bus/rs232/rs232.h"
13
14
#include " cpu/i86/i86.h"
14
15
#include " machine/ins8250.h"
15
16
#include " machine/pit8253.h"
16
17
#include " machine/pic8259.h"
17
18
#include " machine/timekpr.h"
18
19
#include " video/mc6845.h"
20
+
19
21
#include " emupal.h"
20
22
#include " screen.h"
21
23
@@ -31,6 +33,8 @@ class freeway_state : public driver_device
31
33
, m_pic(*this , " pic" )
32
34
, m_charram(*this , " charram" )
33
35
, m_colorram(*this , " colorram" )
36
+ , m_gfx_rom(*this , " gfx" )
37
+ , m_color_rom(*this , " cor" )
34
38
, m_lamps(*this , " lamp%u" , 1U )
35
39
{
36
40
}
@@ -56,6 +60,9 @@ class freeway_state : public driver_device
56
60
required_shared_ptr<u8> m_charram;
57
61
required_shared_ptr<u8> m_colorram;
58
62
63
+ required_region_ptr<u8> m_gfx_rom;
64
+ required_region_ptr<u8> m_color_rom;
65
+
59
66
output_finder<3 > m_lamps;
60
67
};
61
68
@@ -64,8 +71,32 @@ void freeway_state::machine_start()
64
71
m_lamps.resolve ();
65
72
}
66
73
74
+ // TODO: just the minimum to show errors on screen
67
75
MC6845_UPDATE_ROW (freeway_state::update_row)
68
76
{
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
+ }
69
100
}
70
101
71
102
void freeway_state::lamps_w (u8 data)
@@ -83,8 +114,8 @@ void freeway_state::mem_map(address_map &map)
83
114
{
84
115
map (0x00000 , 0x07fff ).ram ();
85
116
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 );
88
119
map (0xf0000 , 0xfffff ).rom ().region (" program" , 0 );
89
120
}
90
121
@@ -95,6 +126,7 @@ void freeway_state::io_map(address_map &map)
95
126
map (0x0040 , 0x0047 ).rw (" uart" , FUNC (ns16450_device::ins8250_r), FUNC (ns16450_device::ins8250_w));
96
127
map (0x00a3 , 0x00a3 ).w (FUNC (freeway_state::lamps_w));
97
128
map (0x00d0 , 0x00d0 ).portr (" CONFIG" );
129
+ map (0x00d1 , 0x00d1 ).portr (" INPUTS" );
98
130
map (0x03d0 , 0x03d0 ).w (" crtc" , FUNC (mc6845_device::address_w));
99
131
map (0x03d1 , 0x03d1 ).w (" crtc" , FUNC (mc6845_device::register_w));
100
132
}
@@ -107,6 +139,30 @@ static INPUT_PORTS_START(freeway)
107
139
PORT_BIT(0x08 , 0x08 , IPT_UNKNOWN)
108
140
PORT_BIT(0xf6 , 0xf6 , IPT_UNKNOWN) // probably unused
109
141
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
+
110
166
PORT_START(" RESET" )
111
167
PORT_BIT(0x01 , IP_ACTIVE_HIGH, IPT_MEMORY_RESET) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, freeway_state, nmi_w)
112
168
INPUT_PORTS_END
0 commit comments