igs/pgm.cpp: one new set and another promoted to working#14981
igs/pgm.cpp: one new set and another promoted to working#14981Osso13 wants to merge 3 commits intomamedev:masterfrom
Conversation
------------------ Zhan Shen Chuan Shuo 2 Tebie Ban (bootleg of Knights of Valour Super Heroes Plus, V201CN, May 17 2010 10:43:09) [eziochiu, Mr.Qin] Clones promoted to working -------------------------- Gaishi Yingxiong Jiaqiang Ban (bootleg of Knights of Valour Super Heroes Plus, V302CN, Dec 29 2010 16:31:32) [eziochiu, Mr.Qin]
| uint32_t lpc2132_vic_device::read_vector_address() | ||
| { | ||
| uint32_t irq_pending = m_vic_int_enable & m_vic_raw_intr & ~m_vic_int_select; | ||
|
|
||
| if (irq_pending == 0) | ||
| { | ||
| m_vic_vect_addr_cur = m_vic_def_vect_addr; | ||
| return m_vic_vect_addr_cur; | ||
| } | ||
|
|
||
| // Iterate through 16 vector slots to find matching interrupt | ||
| for (int i = 0; i < 16; i++) | ||
| { | ||
| if (m_vic_vect_cntl[i] & 0x20) // Check enable bit | ||
| { | ||
| uint32_t irq_source = m_vic_vect_cntl[i] & 0x1f; | ||
|
|
||
| if (irq_pending & (1 << irq_source)) | ||
| { | ||
| m_vic_vect_addr_cur = m_vic_vect_addr[i]; | ||
| return m_vic_vect_addr_cur; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // No matching vectored interrupt, return default address | ||
| m_vic_vect_addr_cur = m_vic_def_vect_addr; | ||
| return m_vic_vect_addr_cur; | ||
| } |
There was a problem hiding this comment.
Should this have side effect checks?
scripts/src/machine.lua
Outdated
|
|
||
| --------------------------------------------------- | ||
|
|
||
| -- | ||
| --@src/devices/machine/lpc2132_vic.h,MACHINES["LPC2132_VIC"] = true | ||
| --------------------------------------------------- | ||
|
|
||
| if (MACHINES["LPC2132_VIC"]~=null) then | ||
| files { | ||
| MAME_DIR .. "src/devices/machine/lpc2132_vic.cpp", | ||
| MAME_DIR .. "src/devices/machine/lpc2132_vic.h", | ||
| } | ||
| end |
There was a problem hiding this comment.
Can you try to find a sensible place for this and not add a random number of blank lines at the end of the file?
| for (int i = 0; i < 0x400000; i+=2) { | ||
| src[i + 0x000001] = src[i + 0x800000]; | ||
| src[i + 0x400001] = src[i + 0xc00000]; | ||
| } |
There was a problem hiding this comment.
This is an Allman-formatted file, isn’t it?
| for (int i = 0; i < 0x400000 / 2; i++) | ||
| { | ||
| int j = bitswap<24>((i & 0x7ffff) | ((((i >> 19) + 1) & 3) << 19), 23, 22, 21, 20, 19, 18, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17, 14, 12, 10, 8, 6, 4, 0, 2); |
There was a problem hiding this comment.
Can’t you simplify (i & 0x7ffff) | ((((i >> 19) + 1) & 3) to ((i + 0x80000) & 0x1fffff)
| for (int i = 0; i < 0x400000 / 2; i++) | ||
| { | ||
| int j = bitswap<24>((i & 0x7ffff) | ((((i >> 19) + 1) & 3) << 19), 23, 22, 21, 20, 19, 2, 1, 18, 17, 16, 15, 14, 13, 12, 11, 10, 0, 3, 4, 5, 6, 7, 8, 9); |
There was a problem hiding this comment.
Same here - the manipulation looks overly complicated.
| void pgm_arm_type1_state::kovgsyx_asic27a_write_word(offs_t offset, u16 data) | ||
| { | ||
| machine().scheduler().synchronize(); | ||
| if (offset & 1) | ||
| { | ||
| m_kovgsyx_highlatch_68k_w = data; | ||
| m_lpc2132_vic->set_irq(16, ASSERT_LINE); | ||
| m_kovgsyx_lowlatch_arm_w = 0; | ||
| } | ||
| else | ||
| { | ||
| m_kovgsyx_lowlatch_68k_w = data; | ||
| m_kovgsyx_highlatch_arm_w = 0; | ||
| } | ||
| } |
There was a problem hiding this comment.
It’s no use putting a machine().scheduler().synchronize(); there and then doing whatever it is immediately – you’ll still have the effect visible immediately. You need to pass a callback to synchronize to make the effects visible after the CPUs have caught up with each other.
| u16 pgm_arm_type1_state::kovgsyx_asic27a_read_word(offs_t offset) | ||
| { | ||
| if (!machine().side_effects_disabled()) | ||
| machine().scheduler().synchronize(); | ||
|
|
||
| if (offset & 1) | ||
| return m_kovgsyx_highlatch_arm_w; | ||
| else | ||
| return m_kovgsyx_lowlatch_arm_w; | ||
| } |
There was a problem hiding this comment.
Same here – the machine().scheduler().synchronize(); isn’t doing what you want. It’s effectively going to happen after the read, so it’s no use.
| u32 pgm_arm_type1_state::kovgsyx_lpc2132_read_long(offs_t offset) | ||
| { | ||
| if ((offset & 0x3fffc0) == 0x7f000) { | ||
| switch (offset & 0x3f) | ||
| { | ||
| case 0x20: | ||
| return m_kovgsyx_pll_enabled; | ||
|
|
||
| case 0x21: | ||
| return m_kovgsyx_pll_config; | ||
|
|
||
| case 0x22: | ||
| { | ||
| u32 status = 0; | ||
|
|
||
| if (m_kovgsyx_pll_enabled) { | ||
| m_kovgsyx_pll_lock_timer++; | ||
|
|
||
| if (m_kovgsyx_pll_lock_timer > 10) { | ||
| status |= 0x0400; | ||
| } | ||
| } | ||
|
|
||
| status |= (m_kovgsyx_pll_enabled & 0x03) << 8; | ||
| status |= (m_kovgsyx_pll_config & 0x1f); | ||
|
|
||
| return status; | ||
| } | ||
|
|
||
| case 0x23: | ||
| return 0; | ||
| } | ||
| } |
There was a problem hiding this comment.
More mixed Allman and K&R in this function. Also in the one below.
| m_kovgsyx_highlatch_arm_w = 0; | ||
| m_kovgsyx_lowlatch_arm_w = 0; | ||
| m_kovgsyx_highlatch_68k_w = 0; | ||
| m_kovgsyx_lowlatch_68k_w = 0; | ||
| m_kovgsyx_pll_lock_timer = 0; | ||
| m_kovgsyx_pll_enabled = 0; | ||
| m_kovgsyx_pll_config = 0; | ||
| m_kovgsyx_i2c1sclh = 0; | ||
| m_kovgsyx_i2c1conset = 0; | ||
| m_kovgsyx_i2c1dat = 0; | ||
| m_kovgsyx_i2c1_status = 0x08; | ||
| m_kovgsyx_handshake_done = 0; | ||
|
|
||
| save_item(NAME(m_kovgsyx_highlatch_arm_w)); | ||
| save_item(NAME(m_kovgsyx_lowlatch_arm_w)); | ||
| save_item(NAME(m_kovgsyx_highlatch_68k_w)); | ||
| save_item(NAME(m_kovgsyx_lowlatch_68k_w)); | ||
| save_item(NAME(m_kovgsyx_pll_lock_timer)); | ||
| save_item(NAME(m_kovgsyx_pll_enabled)); | ||
| save_item(NAME(m_kovgsyx_pll_config)); | ||
| save_item(NAME(m_kovgsyx_i2c1sclh)); | ||
| save_item(NAME(m_kovgsyx_i2c1conset)); | ||
| save_item(NAME(m_kovgsyx_i2c1dat)); | ||
| save_item(NAME(m_kovgsyx_i2c1_status)); | ||
| save_item(NAME(m_kovgsyx_handshake_done)); |
There was a problem hiding this comment.
You’ve got multiple copy/pastes of this. Are you sure it shouldn’t be in a derived class?
New working clones
Zhan Shen Chuan Shuo 2 Tebie Ban (bootleg of Knights of Valour Super Heroes Plus, V201CN, May 17 2010 10:43:09) [eziochiu, Mr.Qin]
Clones promoted to working
Gaishi Yingxiong Jiaqiang Ban (bootleg of Knights of Valour Super Heroes Plus, V302CN, Dec 29 2010 16:31:32) [eziochiu, Mr.Qin]