Language…
7 users online: Burst Man, Dispace, get_yo_pops, Isikoro, Samn, Scags,  xHF01x - Guests: 147 - Bots: 87
Users: 70,501 (2,452 active)
Latest user: TankerMan64

BRK exception handler

SMW Patches → BRK exception handler

This file is obsolete. The latest version is BRK Exception Handler. For other versions, check the version history.

Submission Details

Name: BRK exception handler
Author: p4plus2
Added:
Version History: View
Tool: Asar
Requires Free Space: Yes
Bug Fix: No
Featured: No
Description: This patch is pretty useful for those of you who are working with ASM in some way. If your code crashes and triggers a BRK (which happens reasonably often of all the potential crashes), this will display a bunch of debug info. The printed debug info is: registers(PC, D, B, A, X, Y, P, S), layer 1-3 positions, powerup status, and a full stack dump. It can also dump special message based on the BRK number. To add custom exception messages (for example for brk #$02) you would need to add the following line to the exception list:
%exception($02, "Something broke", "FIX IT")

Pretty sure this patch is 100% stable, Enjoy!
Tags: brk crash debug lorom needs remoderation
Comments: 2 (jump to comments)
Download 5.77 KiB | 150 downloads

Comments (2)

trillian Link
Slight bug or something: the freeram defines !brk_triggered and !brk_old_stack aren't actually used, but their default values are hardcoded into the code.
Vitor Vilela Link
This patch is pretty useful for whoever is trying to catch a ROM crash but the trace logs aren't showing properly the source of the problem or can't use them at all.

Of course it won't work on all cases, some crashes will soft-lock the CPU (though infinite loop or STP) and other will crash so hard that the BRK handler won't work at all, but it should work with like, 97% of the crashes at average.

I don't really recommend sticking with the patch on a ROM; this is just for testing/debugging purposes and putting the screen won't stop your hack from being rejected or something in case of a obvious game crash.