Skip to content

Commit

Permalink
sega/megadriv_acbl.cpp, skeleton/zorbakbd.cpp: Sorted DIP switch opti…
Browse files Browse the repository at this point in the history
…ons.

Order coinage options from least to most generous, put off to the left
of on.
  • Loading branch information
cuavas committed Sep 25, 2024
1 parent bdc96c8 commit fd22eae
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 38 deletions.
8 changes: 2 additions & 6 deletions src/devices/cpu/arm7/arm7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1460,12 +1460,10 @@ void arm7_cpu_device::execute_run()
/* handle Thumb instructions if active */
if (T_IS_SET(m_r[eCPSR]))
{
offs_t raddr;

pc = m_r[eR15];

// "In Thumb state, bit [0] is undefined and must be ignored. Bits [31:1] contain the PC."
raddr = pc & (~1);
offs_t const raddr = pc & ~uint32_t(1);

if (!insn_fetch_thumb(raddr, insn))
{
Expand All @@ -1477,12 +1475,10 @@ void arm7_cpu_device::execute_run()
}
else
{
offs_t raddr;

/* load 32 bit instruction */

// "In ARM state, bits [1:0] of r15 are undefined and must be ignored. Bits [31:2] contain the PC."
raddr = pc & (~3);
offs_t const raddr = pc & ~uint32_t(3);

if (!insn_fetch_arm(raddr, insn))
{
Expand Down
12 changes: 6 additions & 6 deletions src/mame/igs/pgmcrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@
#define IGS27_CRYPT1_ALT \
if ((i & 0x040080) != 0x000080) x ^= 0x0001;
#define IGS27_CRYPT1_ALT2 \
if ((i & 0x0480) != 0x0080) x ^= 0x0001;
if ((i & 0x000480) != 0x000080) x ^= 0x0001;
#define IGS27_CRYPT2 \
if ((i & 0x104008) == 0x104008) x ^= 0x0002;
#define IGS27_CRYPT2_ALT \
if ((i & 0x004008) == 0x004008) x ^= 0x0002;
#define IGS27_CRYPT2_ALT2 \
if((i & 0x004008) == 0x004008 && (i & 0x180000) != 0x000000) x ^= 0x0002;
if ((i & 0x004008) == 0x004008 && (i & 0x180000) != 0x000000) x ^= 0x0002;
#define IGS27_CRYPT2_ALT3 \
if((i & 0x84008) == 0x84008) x ^= 0x0002;
if ((i & 0x084008) == 0x084008) x ^= 0x0002;
#define IGS27_CRYPT3 \
if ((i & 0x080030) == 0x080010) x ^= 0x0004;
#define IGS27_CRYPT3_ALT \
if((i & 0x000030) == 0x000010 && (i & 0x180000) != 0x080000) x ^= 0x0004;
if ((i & 0x000030) == 0x000010 && (i & 0x180000) != 0x080000) x ^= 0x0004;
#define IGS27_CRYPT3_ALT2 \
if ((i & 0x000030) == 0x000010) x ^= 0x0004;
// ket - due to address starting at 0 and not 100000/2!
Expand All @@ -55,15 +55,15 @@
#define IGS27_CRYPT5 \
if ((i & 0x008100) == 0x008000) x ^= 0x0010;
#define IGS27_CRYPT5_ALT \
if ((i & 0x48100) == 0x48000) x ^= 0x0010;
if ((i & 0x048100) == 0x048000) x ^= 0x0010;
#define IGS27_CRYPT6 \
if ((i & 0x002004) != 0x000004) x ^= 0x0020;
#define IGS27_CRYPT6_ALT \
if ((i & 0x022004) != 0x000004) x ^= 0x0020;
#define IGS27_CRYPT7 \
if ((i & 0x011800) != 0x010000) x ^= 0x0040;
#define IGS27_CRYPT7_ALT \
if ((i & 0x01800) != 0x00000) x ^= 0x0040;
if ((i & 0x001800) != 0x000000) x ^= 0x0040;
#define IGS27_CRYPT8 \
if ((i & 0x004820) == 0x004820) x ^= 0x0080;
#define IGS27_CRYPT8_ALT \
Expand Down
30 changes: 15 additions & 15 deletions src/mame/sega/megadriv_acbl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ INPUT_PORTS_START( srmdb )
PORT_DIPSETTING( 0x00, "6" )
INPUT_PORTS_END

INPUT_PORTS_START( barekch ) // TODO: identify dips. PCB has 3 x 8-dip banks, but probably most unused
INPUT_PORTS_START( barekch ) // TODO: identify DIP switches. PCB has 3 x 8-switch banks, but probably most unused
PORT_INCLUDE( md_common )

PORT_MODIFY("PAD1")
Expand Down Expand Up @@ -806,24 +806,24 @@ INPUT_PORTS_END
INPUT_PORTS_START( barek2 )
PORT_INCLUDE( md_common )

PORT_START("dsw")
PORT_START("DSW")
PORT_DIPNAME(0x0f, 0x0f, DEF_STR( Coinage ))
PORT_DIPSETTING( 0x05, DEF_STR( 6C_1C ))
PORT_DIPSETTING( 0x06, DEF_STR( 5C_1C ))
PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ))
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ))
PORT_DIPSETTING( 0x01, DEF_STR( 8C_3C ))
PORT_DIPSETTING( 0x09, DEF_STR( 2C_1C ))
PORT_DIPSETTING( 0x02, DEF_STR( 5C_3C ))
PORT_DIPSETTING( 0x03, DEF_STR( 3C_2C ))
PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ))
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C )) // duplicate
PORT_DIPSETTING( 0x04, DEF_STR( 2C_3C ))
PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ))
PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ))
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ))
PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ))
PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ))
PORT_DIPSETTING( 0x09, DEF_STR( 2C_1C ))
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ))
PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ))
PORT_DIPSETTING( 0x06, DEF_STR( 5C_1C ))
PORT_DIPSETTING( 0x05, DEF_STR( 6C_1C ))
PORT_DIPSETTING( 0x04, DEF_STR( 2C_3C ))
PORT_DIPSETTING( 0x03, DEF_STR( 3C_2C ))
PORT_DIPSETTING( 0x02, DEF_STR( 5C_3C ))
PORT_DIPSETTING( 0x01, DEF_STR( 8C_3C ))
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C )) // duplicate
PORT_DIPNAME(0x30, 0x30, DEF_STR( Lives ))
PORT_DIPSETTING( 0x30, "1" )
PORT_DIPSETTING( 0x20, "2" )
Expand All @@ -835,7 +835,7 @@ INPUT_PORTS_START( barek2 )
PORT_DIPSETTING( 0x40, DEF_STR( Hard ))
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ))

PORT_START("in0")
PORT_START("IN0")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_COIN1)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN)
Expand Down Expand Up @@ -966,9 +966,9 @@ void md_boot_mcu_state::md_boot_mcu(machine_config &config)

m_maincpu->set_addrmap(AS_PROGRAM, &md_boot_mcu_state::md_boot_mcu_map);

PIC16C57(config, m_mcu, 4000000); // unknown clock
PIC16C57(config, m_mcu, 4'000'000); // unknown clock
m_mcu->write_a().set(FUNC(md_boot_mcu_state::mcu_porta_w));
m_mcu->read_b().set_ioport("in0");
m_mcu->read_b().set_ioport("IN0");
m_mcu->write_b().set(FUNC(md_boot_mcu_state::mcu_portb_w));
m_mcu->read_c().set(FUNC(md_boot_mcu_state::mcu_portc_r));
m_mcu->write_c().set(FUNC(md_boot_mcu_state::mcu_portc_w));
Expand Down
16 changes: 8 additions & 8 deletions src/mame/sega/megadriv_acbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ class md_boot_state : public md_ctrl_state
int m_aladmdb_mcu_port = 0;
};

// for games with emulated pic mcu
// for games with emulated PIC microcontroller
class md_boot_mcu_state : public md_boot_state
{
public:
md_boot_mcu_state(const machine_config &mconfig, device_type type, const char *tag) :
md_boot_state(mconfig, type, tag),
m_mcu(*this, "mcu"),
m_dsw(*this, "dsw")
m_dsw(*this, "DSW")
{ }

void md_boot_mcu(machine_config &config);
Expand All @@ -71,12 +71,12 @@ class md_boot_mcu_state : public md_boot_state
required_device<pic16c57_device> m_mcu;
required_ioport m_dsw;

uint8_t m_mcu_porta;
uint8_t m_mcu_portc;
uint8_t m_mcu_in_latch_msb;
uint8_t m_mcu_in_latch_lsb;
uint8_t m_mcu_out_latch_msb;
uint8_t m_mcu_out_latch_lsb;
uint8_t m_mcu_porta = 0;
uint8_t m_mcu_portc = 0;
uint8_t m_mcu_in_latch_msb = 0;
uint8_t m_mcu_in_latch_lsb = 0;
uint8_t m_mcu_out_latch_msb = 0;
uint8_t m_mcu_out_latch_lsb = 0;
};

class md_sonic3bl_state : public md_boot_state
Expand Down
6 changes: 3 additions & 3 deletions src/mame/skeleton/zorbakbd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ INPUT_PORTS_START(zorba_keyboard)
PORT_DIPSETTING( 0x01, "6 (Normal)" )
PORT_DIPSETTING( 0x00, "7 (Dump Tables)" )
PORT_DIPNAME( 0x08, 0x08, "Key Repeat" ) PORT_DIPLOCATION("DIP:4")
PORT_DIPSETTING( 0x08, DEF_STR(On) )
PORT_DIPSETTING( 0x00, DEF_STR(Off) )
PORT_DIPSETTING( 0x08, DEF_STR(On) )
PORT_DIPNAME( 0x10, 0x10, "Baud Rate" ) PORT_DIPLOCATION("DIP:5")
PORT_DIPSETTING( 0x10, "1200" )
PORT_DIPSETTING( 0x00, "300" )
PORT_DIPSETTING( 0x10, "1200" )
PORT_DIPNAME( 0x20, 0x20, "Key Click" ) PORT_DIPLOCATION("DIP:6")
PORT_DIPSETTING( 0x20, DEF_STR(On) )
PORT_DIPSETTING( 0x00, DEF_STR(Off) )
PORT_DIPSETTING( 0x20, DEF_STR(On) )
PORT_DIPNAME( 0x40, 0x40, "Synchronous Output" ) PORT_DIPLOCATION("DIP:7")
PORT_DIPSETTING( 0x40, DEF_STR(Off) )
PORT_DIPSETTING( 0x00, DEF_STR(On) )
Expand Down

0 comments on commit fd22eae

Please sign in to comment.