Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N64 tracelog does not show delay slot execution #789

Closed
micro500 opened this issue Jan 30, 2017 · 6 comments
Closed

N64 tracelog does not show delay slot execution #789

micro500 opened this issue Jan 30, 2017 · 6 comments
Labels
Core: Mupen64Plus Nintendo 64 (N64) core

Comments

@micro500
Copy link
Contributor

micro500 commented Jan 30, 2017

Example from MK64:

800D33A0:  lw        t9,20(t1)              at:FFFFFFFF80000000 v0:0000000000000000 v1:0000000000000000 a0:0000000000000000 a1:00000000009FD2A0 a2:FFFFFFFF803C9F90 a3:00000000000005A0 t0:000000000000FF01 t1:FFFFFFFF800EB340 t2:0000000000000001 t3:FFFFFFFF800EB3A0 t4:0000000000000001 t5:FFFFFFFF80197628 t6:0000000000000000 t7:0000000000000001 s0:0000000000000000 s1:0000000000000000 s2:0000000000000000 s3:0000000000000000 s4:0000000000000000 s5:0000000000000000 s6:0000000000000000 s7:0000000000000000 t8:0000000000000000 t9:FFFFFFFF803B6120 k0:FFFFFFFFA430000C k1:0000000000000AAA gp:0000000000000000 sp:FFFFFFFF801963C8 s8:0000000000000000 ra:FFFFFFFF800D3388 LL:00000000 LO:0000000000000001 HI:0000000000000000 FCR0:00000511 FCR31:01000800 f0:000000003F7F68CF f1:000000003BB66B61 f2:000000003CFB5AC5 f3:0000000042FB5AC1 f4:000000000000007D f5:00000000393385FD f6:000000003CFBEF90 f7:00000000457FFFFC f8:000000003F3385FA f9:0000000000000000 f10:0000000000000000 f11:0000000000000000 f12:0000000000000000 f13:0000000000000000 f14:0000000000000000 f15:0000000000000000 f16:0000000000000000 f17:0000000000000000 f18:0000000000000000 f19:0000000000000000 f20:0000000000000000 f21:0000000000000000 f22:0000000000000000 f23:0000000000000000 f24:0000000000000000 f25:0000000000000000 f26:0000000000000000 f27:0000000000000000 f28:0000000000000000 f29:0000000000000000 f30:0000000000000000 f31:0000000000000000
800D33A4:  jalr      t9                     at:FFFFFFFF80000000 v0:0000000000000000 v1:0000000000000000 a0:0000000000000000 a1:00000000009FD2A0 a2:FFFFFFFF803C9F90 a3:00000000000005A0 t0:000000000000FF01 t1:FFFFFFFF800EB340 t2:0000000000000001 t3:FFFFFFFF800EB3A0 t4:0000000000000001 t5:FFFFFFFF80197628 t6:0000000000000000 t7:0000000000000001 s0:0000000000000000 s1:0000000000000000 s2:0000000000000000 s3:0000000000000000 s4:0000000000000000 s5:0000000000000000 s6:0000000000000000 s7:0000000000000000 t8:0000000000000000 t9:FFFFFFFF800D2FB0 k0:FFFFFFFFA430000C k1:0000000000000AAA gp:0000000000000000 sp:FFFFFFFF801963C8 s8:0000000000000000 ra:FFFFFFFF800D3388 LL:00000000 LO:0000000000000001 HI:0000000000000000 FCR0:00000511 FCR31:01000800 f0:000000003F7F68CF f1:000000003BB66B61 f2:000000003CFB5AC5 f3:0000000042FB5AC1 f4:000000000000007D f5:00000000393385FD f6:000000003CFBEF90 f7:00000000457FFFFC f8:000000003F3385FA f9:0000000000000000 f10:0000000000000000 f11:0000000000000000 f12:0000000000000000 f13:0000000000000000 f14:0000000000000000 f15:0000000000000000 f16:0000000000000000 f17:0000000000000000 f18:0000000000000000 f19:0000000000000000 f20:0000000000000000 f21:0000000000000000 f22:0000000000000000 f23:0000000000000000 f24:0000000000000000 f25:0000000000000000 f26:0000000000000000 f27:0000000000000000 f28:0000000000000000 f29:0000000000000000 f30:0000000000000000 f31:0000000000000000
800D2FB0:  addiu     $sp,$sp,-40            at:FFFFFFFF80000000 v0:0000000000000000 v1:0000000000000000 a0:0000000000000000 a1:00000000009FD2A0 a2:FFFFFFFF803C9F90 a3:00000000000005A0 t0:000000000000FF01 t1:FFFFFFFF800EB340 t2:0000000000000001 t3:FFFFFFFF800EB3A0 t4:0000000000000001 t5:FFFFFFFF80197628 t6:0000000000000000 t7:0000000000000001 s0:0000000000000000 s1:0000000000000000 s2:0000000000000000 s3:0000000000000000 s4:0000000000000000 s5:0000000000000000 s6:0000000000000000 s7:0000000000000000 t8:0000000000000000 t9:FFFFFFFF800D2FB0 k0:FFFFFFFFA430000C k1:0000000000000AAA gp:0000000000000000 sp:FFFFFFFF801963C8 s8:0000000000000000 ra:FFFFFFFF800D33AC LL:00000000 LO:0000000000000001 HI:0000000000000000 FCR0:00000511 FCR31:01000800 f0:000000003F7F68CF f1:000000003BB66B61 f2:000000003CFB5AC5 f3:0000000042FB5AC1 f4:000000000000007D f5:00000000393385FD f6:000000003CFBEF90 f7:00000000457FFFFC f8:000000003F3385FA f9:0000000000000000 f10:0000000000000000 f11:0000000000000000 f12:0000000000000000 f13:0000000000000000 f14:0000000000000000 f15:0000000000000000 f16:0000000000000000 f17:0000000000000000 f18:0000000000000000 f19:0000000000000000 f20:0000000000000000 f21:0000000000000000 f22:0000000000000000 f23:0000000000000000 f24:0000000000000000 f25:0000000000000000 f26:0000000000000000 f27:0000000000000000 f28:0000000000000000 f29:0000000000000000 f30:0000000000000000 f31:0000000000000000

In this example I would have expected to see address 800D33A8 executed in the log as well.

@micro500 micro500 added the Core: Mupen64Plus Nintendo 64 (N64) core label Jan 30, 2017
@vadosnaprimer
Copy link
Contributor

Does the core disasm itself do it right?

@vadosnaprimer
Copy link
Contributor

@pjgat09 hello?

@micro500
Copy link
Contributor Author

Do you mean if m64p's debugger correctly shows delay slot execution? I would need to check.

I did take a quick look around how you implemented the tracelogger for N64. If I understood correctly you just disassemble the current address whenever you get a callback to do so, so that points to a problem with bizhawk. For this to work we need to disassemble 2 instructions under certain conditions. Unfortunately those conditions are based on if the branch is taken or not, so we would need to know at the time of disassembly if the branch will be taken or not. I'm not sure how easy that would be to do. Another option is to wait until the branch is taken or not and then decide if we should go back and disassemble the delay slot instruction.

This is all unless m64p has support already for doing this correctly. I'm going to look into that next.

@vadosnaprimer
Copy link
Contributor

vadosnaprimer commented Sep 14, 2017

Either way I don't feel capable of fixing it if it's that tricky. @Wyst3r what do you think?

@micro500
Copy link
Contributor Author

micro500 commented Sep 14, 2017

That's fair, this is a tricky problem.

I didn't see anything in the m64p source that seemed to indicate they had planned for delay slot decoding, but it seems as though their debugger is very simplistic and they left it up to someone else to implement and use it in their own application.

I'm now looking into if it is possible to move when the callback is triggered so that it would call our bizhawk function on delay slots too.

@micro500
Copy link
Contributor Author

Turned out to be a relatively simple fix: we just needed to hook a few more spots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core: Mupen64Plus Nintendo 64 (N64) core
Projects
None yet
Development

No branches or pull requests

2 participants