Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
09307 Documentation Major Always 5 days ago 4 days ago
Tester VasiliyFamiliya View Status Public Platform MAME (Official Binary)
Assigned To Resolution Open OS Windows (x64)
Status [?] Acknowledged Driver
Version 0.282 Fixed in Version Build x64
Fixed in Git Commit Github Pull Request #
Summary 09307: taitojc src: Looks like the comment to taitojc_state::main_to_dsp_7ff_w function author is right.
Description 0 movement as #imm to any memory map entry really sets a Z flag in a whole M68k family. A small ASM programm (buildable using the ASMX by Bruce Tomlin) is attached below. The default task platfom is Double Point (Min Corp.) hardware, but through the minor changes in the header.s, hardware_register.s and constant_table.s files you can re-adapt it to any M68k-based platform.
Steps To Reproduce Build the test program (asmx -e -w -b -C 68000 -- main.asm), split the binary you got if M68k-based system you chose MAME driver requires it (the best tool IMHO is Tile Mixer: https://www.romhacking.net/utilities/1707/ ), replace with a new smaller binaries a :maincpu roms in the any unpacked romset for this system folder, launch a fake romset with debugger, and see how right after 0 movement SR value changes from $2700 to $2704.
Additional Information
Github Commit
Flags
Regression Version
Affected Sets / Systems taitojc src
Attached Files
zip file icon M68k test.zip (1,526 bytes) 5 days ago Uploaded by VasiliyFamiliya
Relationships
There are no relationship linked to this issue.
Notes
3
User avatar
No.23843
VasiliyFamiliya
Tester
5 days ago
Suspicion area in m68k_in.lst file:

3000 f1f8 move w . 01:4 7:7 234fc:2
u32 res = MASK_OUT_ABOVE_16(DY());
u32* r_dst = &DX();

*r_dst = MASK_OUT_BELOW_16(*r_dst) | res;

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3008 f1f8 move w . 01:4 7:7 234fc:2
u32 res = MASK_OUT_ABOVE_16(AY());
u32* r_dst = &DX();

*r_dst = MASK_OUT_BELOW_16(*r_dst) | res;

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3000 f1c0 move w A+-DXWLdxI 01:4 7:7 234fc:2
u32 res = M68KMAKE_GET_OPER_AY_16;
u32* r_dst = &DX();

*r_dst = MASK_OUT_BELOW_16(*r_dst) | res;

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3080 f1f8 move w . 01:8 7:11 234fc:4
u32 res = MASK_OUT_ABOVE_16(DY());
u32 ea = EA_AX_AI_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3088 f1f8 move w . 01:8 7:11 234fc:4
u32 res = MASK_OUT_ABOVE_16(AY());
u32 ea = EA_AX_AI_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3080 f1c0 move w A+-DXWLdxI 01:8 7:11 234fc:4
u32 res = M68KMAKE_GET_OPER_AY_16;
u32 ea = EA_AX_AI_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


30c0 f1f8 move w . 01:8 7:11 234fc:4
u32 res = MASK_OUT_ABOVE_16(DY());
u32 ea = EA_AX_PI_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


30c8 f1f8 move w . 01:8 7:11 234fc:4
u32 res = MASK_OUT_ABOVE_16(AY());
u32 ea = EA_AX_PI_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


30c0 f1c0 move w A+-DXWLdxI 01:8 7:11 234fc:4
u32 res = M68KMAKE_GET_OPER_AY_16;
u32 ea = EA_AX_PI_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3100 f1f8 move w . 01:8 7:14 234fc:5
u32 res = MASK_OUT_ABOVE_16(DY());
u32 ea = EA_AX_PD_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3108 f1f8 move w . 01:8 7:14 234fc:5
u32 res = MASK_OUT_ABOVE_16(AY());
u32 ea = EA_AX_PD_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3100 f1c0 move w A+-DXWLdxI 01:8 7:14 234fc:5
u32 res = M68KMAKE_GET_OPER_AY_16;
u32 ea = EA_AX_PD_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3140 f1f8 move w . 01:12 7:18 234fc:5
u32 res = MASK_OUT_ABOVE_16(DY());
u32 ea = EA_AX_DI_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3148 f1f8 move w . 01:12 7:18 234fc:5
u32 res = MASK_OUT_ABOVE_16(AY());
u32 ea = EA_AX_DI_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3140 f1c0 move w A+-DXWLdxI 01:12 7:18 234fc:5
u32 res = M68KMAKE_GET_OPER_AY_16;
u32 ea = EA_AX_DI_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3180 f1f8 move w . 01:14 7:21 234fc:7
u32 res = MASK_OUT_ABOVE_16(DY());
u32 ea = EA_AX_IX_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3188 f1f8 move w . 01:14 7:21 234fc:7
u32 res = MASK_OUT_ABOVE_16(AY());
u32 ea = EA_AX_IX_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


3180 f1c0 move w A+-DXWLdxI 01:14 7:21 234fc:7
u32 res = M68KMAKE_GET_OPER_AY_16;
u32 ea = EA_AX_IX_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


31c0 fff8 move w . 01:12 7:15 234fc:4
u32 res = MASK_OUT_ABOVE_16(DY());
u32 ea = EA_AW_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


31c8 fff8 move w . 01:12 7:15 234fc:4
u32 res = MASK_OUT_ABOVE_16(AY());
u32 ea = EA_AW_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


31c0 ffc0 move w A+-DXWLdxI 01:12 7:15 234fc:4
u32 res = M68KMAKE_GET_OPER_AY_16;
u32 ea = EA_AW_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


33c0 fff8 move w . 01:16 7:19 234fc:6
u32 res = MASK_OUT_ABOVE_16(DY());
u32 ea = EA_AL_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


33c8 fff8 move w . 01:16 7:19 234fc:6
u32 res = MASK_OUT_ABOVE_16(AY());
u32 ea = EA_AL_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;


33c0 ffc0 move w A+-DXWLdxI 01:16 7:19 234fc:6
u32 res = M68KMAKE_GET_OPER_AY_16;
u32 ea = EA_AL_16();

m68ki_write_16(ea, res);

m_n_flag = NFLAG_16(res);
m_not_z_flag = res;
m_v_flag = VFLAG_CLEAR;
m_c_flag = CFLAG_CLEAR;

<...>


42c0 fff8 move w . 1234fc:4
DY() = MASK_OUT_BELOW_16(DY()) | m68ki_get_ccr();


42c0 ffc0 move w A+-DXWL 1:8 234fc:4
m68ki_write_16(M68KMAKE_GET_EA_AY_16, m68ki_get_ccr());


44c0 fff8 move w . 01:12 7:10 234fc:4
m68ki_set_ccr(DY());


44c0 ffc0 move w A+-DXWLdxI 01:12 7:10 234fc:4
m68ki_set_ccr(M68KMAKE_GET_OPER_AY_16);


40c0 fff8 move w . 0:6 7:7
DY() = MASK_OUT_BELOW_16(DY()) | m68ki_get_sr();


40c0 fff8 move w . 1:4p 234fc:8p
if(m_s_flag) { /* NS990408 */
DY() = MASK_OUT_BELOW_16(DY()) | m68ki_get_sr();
} else {
m68ki_exception_privilege_violation();
}


40c0 ffc0 move w A+-DXWL 0:8 7:11
u32 ea = M68KMAKE_GET_EA_AY_16;
m68ki_write_16(ea, m68ki_get_sr());


40c0 ffc0 move w A+-DXWL 1234fc:8p
if(m_s_flag) { /* NS990408 */
u32 ea = M68KMAKE_GET_EA_AY_16;
m68ki_write_16(ea, m68ki_get_sr());
} else {
m68ki_exception_privilege_violation();
}


46c0 fff8 move w . 01:12p 7:10p 234fc:8p
if(m_s_flag) {
m68ki_set_sr(DY());
} else {
m68ki_exception_privilege_violation();
}


46c0 ffc0 move w A+-DXWLdxI 01:12p 7:10p 234fc:8p
if(m_s_flag) {
u32 new_sr = M68KMAKE_GET_OPER_AY_16;
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
m68ki_set_sr(new_sr);

} else {
m68ki_exception_privilege_violation();
}
User avatar
No.23844
Kale
Developer
4 days ago
The context is:
regarding m_has_dsp_hack:
All games minus Dangerous Curves tests if the DSP is alive with this code snippet:

0008C370: 4A79 1000 1FC0 tst.w $10001fc0.l
0008C376: 33FC 0000 0660 0000 move.w #$0, $6600000.l
0008C37E: 66F0 bne $8c370

Problem is: that move.w in the middle makes the SR to always return a zero flag result,
hence it never branches like it should. CPU bug?
Now: being this a 68040 it's quite possible that is relying on cache here ...
User avatar
No.23846
VasiliyFamiliya
Tester
4 days ago
Is the CPUs caching feature emulated for now?