From 7b8c93c126e56940727b1ef6f42d5ac63d8d4c72 Mon Sep 17 00:00:00 2001 From: Myself086 Date: Sun, 29 Aug 2021 11:51:38 -0400 Subject: [PATCH] Add option to disable safe TSX --- Assembly/Project/Recompiler.asm | 11 ++++++++--- Assembly/Project/RomInfo.asm | 8 ++++++++ CHANGELOG.txt | 1 + Project Nested/Project_Nested.smc | Bin 196608 -> 196608 bytes 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Assembly/Project/Recompiler.asm b/Assembly/Project/Recompiler.asm index b6b9f52..51985cd 100644 --- a/Assembly/Project/Recompiler.asm +++ b/Assembly/Project/Recompiler.asm @@ -492,9 +492,14 @@ b_loop: jmp $_Recompiler__Build_loop1_loop_next Recompiler__Build_loop1_loop_switch_Tsx: - // Flag as pulling return - lda #_Opcode_F_PullReturn - tsb $.recompileFlags + // Safe TSX? + lda $=RomInfo_StackEmulation + and #_RomInfo_StackEmu_SafeTsx + beq $+b_1 + // Flag as pulling return + lda #_Opcode_F_PullReturn + tsb $.recompileFlags +b_1: jmp $_Recompiler__Build_loop1_loop_next diff --git a/Assembly/Project/RomInfo.asm b/Assembly/Project/RomInfo.asm index 3c17f8b..253ce95 100644 --- a/Assembly/Project/RomInfo.asm +++ b/Assembly/Project/RomInfo.asm @@ -117,6 +117,7 @@ RomInfo_StackEmulation: .def RomInfo_StackEmu_LazyDoubleReturn 0x0001 .def RomInfo_StackEmu_StackUnderflow 0x0002 .def RomInfo_StackEmu_NativeReturn 0x0004 + .def RomInfo_StackEmu_SafeTsx 0x0008 .def RomInfo_StackEmu_NativeReturnInterrupt 0x0100 .def RomInfo_StackEmu_NATIVE_MASK 0xff00 @@ -339,6 +340,13 @@ RomInfo_Description: RomInfo_SummaryMac "This option is ignored when 'Native return address' is turned off." RomInfo_DefineMac "public bool StackEmulation.StackUnderflow : Stack emulation, Stack underflow detection", RomInfo_StackEmulation, RomInfo_StackEmu_StackUnderflow + RomInfo_SummaryMac "Treats TSX as needing a non-native return address." + RomInfo_SummaryMac "" + RomInfo_SummaryMac "Has no effect on performance but may make or break games." + RomInfo_SummaryMac "" + RomInfo_SummaryMac "This option is ignored when 'Native return address' is turned off." + RomInfo_DefineMac "public bool StackEmulation.SafeTsx : Stack emulation, Safe TSX", RomInfo_StackEmulation, RomInfo_StackEmu_SafeTsx + RomInfo_SummaryMac "Ignores waiting for interrupt to end when stack pointer is set by TXS to a range specified here." RomInfo_SummaryMac "" RomInfo_SummaryMac "Only active when the lowest number is on the left side." diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1f803d2..2a35a6c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ v1.4.1 - Fixed some patch-only opcodes - Fixed checksum - Fixed using patch-only opcodes in WRAM/SRAM +- Added option to disable safe TSX v1.4 - Fixed CHR pattern swapping for mapper 4 (again) diff --git a/Project Nested/Project_Nested.smc b/Project Nested/Project_Nested.smc index 155ee17b44ad747502f599cbddf5c808749f6d35..23042010bd458fdf84c3a66b4aedf65bcb17f340 100644 GIT binary patch delta 9250 zcmc&(30zahx<8YI0D&S1NW=>qQcxDLxZH}?1x4H%`)pNOTeLv|6G2cG#ib@ug91g- zQymv7Atr$Yfe5y_b*YG@PihN+0dF;A`%kgV(_r=@VJQhc*0?%Y)n{W#M1aAd@8;qA#8ON9U73<6JTw-DQ~n-VyGZSdfaH z4uWI_EB4ZYR3+(*AQ{HkYZjye=~lC41!2W$p%WOw(_!4(tMcDwm5tMTOU9|Z+5@hS z!$qqlZ>lg{GFFC}Nt46z>eVtEGx?i%8`Y4>@>M+EK7Mu|?OpSilJKt`?l+^o*I%s^!<2y{2Aagn z+GyS5*XLEBbfmLN!oj?gemFhXFyF(NJ=UB(v> zcLE5AqkLy(fuJO`TR@!Q`&o1gvM@(XB_QtdCjlSALomVmf1-BMRZ%578JwuK#45oX zU>R{hFq)=74uZrPm*&u0aNhIfc9@-2eq=bH!3 zCmFkFV)fc$+R12w9d(3ev5qK?`jFPOju;l*PFog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