-machine/genpc.h: Connect iochrdy properly. Also don't forward the same thing more than once - it could be std::move'd out the first time.

-Miscellaneous cleanup:
 * emu/rendersw.hxx: Made cosine table constexpr, got rid of lambda and loop.
 * igs/spoker.cpp: DIP switches are a switch matrix.
 * merit/merit.cpp: Made the video control bits a bit clearer.
 * Some other trivial tidying.
This commit is contained in:
Vas Crabb 2024-07-04 06:50:55 +10:00
parent 08b07fc1e2
commit ab2451cb8d
7 changed files with 33 additions and 36 deletions

View File

@ -442,7 +442,7 @@ void am9513_device::set_counter_mode(int c, u16 data)
else if (source >= 6 && source <= 10)
LOGMASKED(LOG_MODE, "Counter %d: Count on %s edge of GATE %d\n", c + 1, BIT(data, 12) ? "falling" : "rising", source - 5);
else if (source == 0)
LOGMASKED(LOG_MODE, "Counter %d: Count on %s edge of TC%d\n", c + 1, BIT(data, 12) ? "falling" : "rising", c );
LOGMASKED(LOG_MODE, "Counter %d: Count on %s edge of TC%d\n", c + 1, BIT(data, 12) ? "falling" : "rising", c);
else
LOGMASKED(LOG_MODE, "Counter %d: Count on %s edge of SRC %d\n", c + 1, BIT(data, 12) ? "falling" : "rising", source);
}

View File

@ -33,8 +33,9 @@ public:
template <typename T> void set_cputag(T &&tag)
{
m_maincpu.set_tag(std::forward<T>(tag));
m_isabus.lookup()->set_memspace(std::forward<T>(tag), AS_PROGRAM);
m_isabus.lookup()->set_iospace(std::forward<T>(tag), AS_IO);
m_isabus.lookup()->set_memspace(m_maincpu, AS_PROGRAM);
m_isabus.lookup()->set_iospace(m_maincpu, AS_IO);
m_isabus.lookup()->iochrdy_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
}
auto int_callback() { return m_int_callback.bind(); }

View File

@ -30,10 +30,12 @@ private:
};
// internal helpers
template <int... Values>
static constexpr auto make_cosine_table(std::integer_sequence<int, Values...>) { return std::array{ u32((1.0 / cos(atan(double(Values) / double(sizeof...(Values) - 1)))) * 0x10000000 + 0.5)... }; }
static constexpr bool is_opaque(float alpha) { return (alpha >= (NoDestRead ? 0.5f : 1.0f)); }
static constexpr bool is_transparent(float alpha) { return (alpha < (NoDestRead ? 0.5f : 0.0001f)); }
static inline rgb_t apply_intensity(int intensity, rgb_t color) { return color.scale8(intensity); }
static inline float round_nearest(float f) { return floor(f + 0.5f); }
static rgb_t apply_intensity(int intensity, rgb_t color) { return color.scale8(intensity); }
static float round_nearest(float f) { return floor(f + 0.5f); }
// destination pixels are written based on the values of the template parameters
static constexpr PixelType dest_assemble_rgb(u32 r, u32 g, u32 b) { return (r << DstShiftR) | (g << DstShiftG) | (b << DstShiftB); }
@ -427,15 +429,8 @@ private:
static void draw_line(render_primitive const &prim, PixelType *dstdata, s32 width, s32 height, u32 pitch)
{
// internal cosine table generated at compile-time
static const auto s_cosine_table = []() {
std::array<u32, 2049> result{};
for (int entry = 0; entry <= 2048; entry++)
result[entry] = int(double(1.0 / cos(atan(double(entry) / 2048.0))) * 0x10000000 + 0.5);
return static_cast<const std::array<u32, 2049>>(result);
}();
// internal cosine table generated at compile time
static constexpr auto s_cosine_table = make_cosine_table(std::make_integer_sequence<int, 2049>());
// compute the start/end coordinates
int x1 = int(prim.bounds.x0 * 65536.0f);

View File

@ -225,10 +225,10 @@ void spoker_state::nmi_and_coins_w(uint8_t data)
// popmessage("%02x", data);
}
machine().bookkeeping().coin_counter_w(0, data & 0x01); // coin_a
machine().bookkeeping().coin_counter_w(1, data & 0x04); // coin_c
machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in
machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin out mech
machine().bookkeeping().coin_counter_w(0, BIT(data, 0)); // coin_a
machine().bookkeeping().coin_counter_w(1, BIT(data, 2)); // coin_c
machine().bookkeeping().coin_counter_w(2, BIT(data, 3)); // key in
machine().bookkeeping().coin_counter_w(3, BIT(data, 4)); // coin out mech
m_leds[6] = BIT(data, 6); // led for coin out / hopper active
@ -318,13 +318,15 @@ uint8_t spoker_state::magic_r()
switch (m_igs_magic[0])
{
case 0x00:
if (!(m_igs_magic[1] & 0x01)) return m_dsw[0]->read();
if (!(m_igs_magic[1] & 0x02)) return m_dsw[1]->read();
if (!(m_igs_magic[1] & 0x04)) return m_dsw[2]->read();
if (!(m_igs_magic[1] & 0x08)) return m_dsw[3]->read();
if (!(m_igs_magic[1] & 0x10)) return m_dsw[4]->read();
logerror("%06x: warning, reading dsw with igs_magic[1] = %02x\n", m_maincpu->pc(), m_igs_magic[1]);
break;
{
uint8_t result = 0xff;
if (BIT(~m_igs_magic[1], 0)) result &= m_dsw[0]->read();
if (BIT(~m_igs_magic[1], 1)) result &= m_dsw[1]->read();
if (BIT(~m_igs_magic[1], 2)) result &= m_dsw[2]->read();
if (BIT(~m_igs_magic[1], 3)) result &= m_dsw[3]->read();
if (BIT(~m_igs_magic[1], 4)) result &= m_dsw[4]->read();
return result;
}
default:
logerror("%06x: warning, reading with igs_magic = %02x\n", m_maincpu->pc(), m_igs_magic[0]);

View File

@ -164,7 +164,7 @@ private:
pen_t m_pens[NUM_PENS];
uint8_t m_lscnblk = 0;
uint16_t m_extra_video_bank_bit[2]{};
uint16_t m_extra_video_bank_bit = 0;
void hsync_changed(int state);
void led1_w(uint8_t data);
@ -383,8 +383,8 @@ MC6845_UPDATE_ROW(merit_state::crtc_update_row)
for (uint8_t cx = 0; cx < x_count; cx++)
{
int const attr = m_ram_attr[ma & 0x7ff];
int const region = (attr & 0x40) >> 6;
int addr = ((m_ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (m_extra_video_bank_bit[0] | m_extra_video_bank_bit[1])) << 4) | (ra & 0x0f);
int const region = BIT(attr, 6);
int addr = ((m_ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | m_extra_video_bank_bit) << 4) | (ra & 0x0f);
int const colour = (attr & 0x7f) << 3;
addr &= (rlen - 1);
@ -474,10 +474,9 @@ void merit_state::led2_w(uint8_t data)
void merit_state::misc_w(uint8_t data)
{
flip_screen_set(~data & 0x10);
m_extra_video_bank_bit[0] = (data & 2) << 8;
m_extra_video_bank_bit[1] = (data & 1) << 10;
m_lscnblk = (data >> 3) & 1;
flip_screen_set(BIT(~data, 4));
m_extra_video_bank_bit = bitswap<2>(data, 0, 1) << 9;
m_lscnblk = BIT(data, 3);
// other bits unknown
}

View File

@ -48,11 +48,11 @@ void aim65_state::mem_map(address_map &map)
map(0x1000, 0x3fff).noprw(); // User available expansions
map(0x4000, 0x7fff).rom(); // 4 ROM sockets in 16K PROM/ROM module
map(0x8000, 0x9fff).noprw(); // User available expansions
map(0xa000, 0xa00f).mirror(0x3f0).m(m_via1, FUNC(via6522_device::map)); // user via
map(0xa000, 0xa00f).mirror(0x3f0).m(m_via1, FUNC(via6522_device::map)); // user VIA
map(0xa400, 0xa47f).m(m_riot, FUNC(mos6532_device::ram_map));
map(0xa480, 0xa497).m(m_riot, FUNC(mos6532_device::io_map));
map(0xa498, 0xa7ff).noprw(); // Not available
map(0xa800, 0xa80f).mirror(0x3f0).m(m_via0, FUNC(via6522_device::map)); // system via
map(0xa800, 0xa80f).mirror(0x3f0).m(m_via0, FUNC(via6522_device::map)); // system VIA
map(0xac00, 0xac03).rw(m_pia, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
map(0xac04, 0xac43).ram(); // PIA RAM
map(0xac44, 0xafff).noprw(); // Not available

View File

@ -142,7 +142,7 @@ uint32_t goori_state::screen_update(screen_device& screen, bitmap_ind16& bitmap,
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
gfx_element *gfx = m_gfxdecode->gfx(0);
gfx_element &gfx = *m_gfxdecode->gfx(0);
// is this sprite format a clone of anything? (looks VERY similar to snowbros but this hardware also has a higer resolution, a tile layer and 8bpp)
for (int i = 0; i < 0x2000 / 2; i += 8)
{
@ -169,7 +169,7 @@ uint32_t goori_state::screen_update(screen_device& screen, bitmap_ind16& bitmap,
if (realx >= 0x3e0)
realx -= 0x400;
gfx->transpen(bitmap, cliprect, tile, colour, flipx, 0, realx, y, 0xff);
gfx.transpen(bitmap, cliprect, tile, colour, flipx, 0, realx, y, 0xff);
}
return 0;