Skip to content

Commit

Permalink
Add option to disable safe TSX
Browse files Browse the repository at this point in the history
  • Loading branch information
Myself086 committed Aug 29, 2021
1 parent 986cb1d commit 7b8c93c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Assembly/Project/Recompiler.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
8 changes: 8 additions & 0 deletions Assembly/Project/RomInfo.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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."
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file modified Project Nested/Project_Nested.smc
Binary file not shown.

0 comments on commit 7b8c93c

Please sign in to comment.