mirror of
https://github.com/mlaux/gb6.git
synced 2026-04-21 16:16:56 +00:00
c0a30de0b2
The GB inc/dec instructions must preserve the carry flag and only modify Z. The JIT was capturing both Z and C from the 68k CCR, causing dec to incorrectly set carry on borrow (e.g. 0-1=FF). This broke Pokemon Crystal's xor_a_dec_a helper which returns with C=0 to signal "no action". The corrupted C=1 caused the scrolling menu to exit prematurely when pressing down past CANCEL, showing phantom items and garbage prices. Fix compile_set_z_flag to merge new Z with old C, and compile_set_c_flag to merge new C with old Z. Move and/or/xor immediates to compile_set_zc_flags since they should clear C.
1.5 KiB
1.5 KiB