Division by Zero Debugger
- Size
- 20K (19,991 bytes)
- Added
- 2026-11-20 02:43
- Downloads
- 2
- Long Description
- NoMoreDiv0_Debug V1.7 ===================== TL;DR Install NoMoreDiv0_Debug in C:, Call in Startup-Sequence after SetPatch or in User-Startup. Programs wont crash with "Division by Zero" anymore. While working on http://aminet.net/package/util/boot/CopyMemAIO i noticed for example "TestIt" from http://aminet.net/package/util/misc/CopyMemQuicker crashes with Division by Zero. The WinUAE-Emulation is so fast that nearly "no time" has passed, which causes "TestIt" to try to divide by Zero (time). And i remembered i had similar problems with other programs aswell, the only solution was to change the speed to "Approximate A500/A1200 or cycle exact" and +500% - but thats to slow for me. :P So my idea was to replace the division by zero, if you think about it smaller divisors means bigger results: 100/5 = 20, 100/2 = 50, 100/1 = 100 and finally 100/0 = Infinite Ok, you cant calculate the other way: Infite * 0 = 100 But imho it is the best approximation. Thats why i wrote http://aminet.net/package/util/boot/NoMoreDiv0 It exactly do that, patch the Division by Zero Exception and change the "faulty" register to 0x7ffffff (Maximum positive Value). In case of div(u/s)l.l with a Register for the Remainder, it will be cleared. But it does this completly quiet just to fix old programs which cant cope with a "4Ghz+ 680x0", thats why i added a "Warning-spoiler", because noone should develop progams with it running. This extended Version is able to show additional infos, where the Division by Zero occured, showing the Programname (with SegTracker), view the registers in the moment of the fault and even disassemble the faulty code. Arguments are: DS=DATA=DATESTAMP/S,SEG=SEGTRACKER/S,REGS=REGISTER/S,DIS=DISASSEM= DISASSEMBLE/S,ALL/S,DEADLY/S,STDIO/S,CON=CONSOLE/S,WIN=WINDOW/K, SER=RAW=RAWIO/S,QUIET/S DATESTAMP print Date & Time of the fault SEGTRACKER shows Owner of the Code-Segment, Hunknumber and Offset REGISTER shows all addres and data-registers while the error occured DISASSEMBLE shows the code with disassembler.library ALL Switches on DATESTAMP, SEGTRACKER, REGISTER & DISASSEMBLE DEADLY sets the "faulty" register to 0 instead of MaxValue - possibly causing more Division by Zero errors STDIO Output Texts to Standard output (default), but only if CONSOLE or RAWIO are not used - can be used at the same time as RAWIO CONSOLE Output Texts in a Default 640/256/AUTO-Consolewindow WINDOW Define your own Window to use RAWIO Output Texts to Serial Port, can be used together with STDIO, CONSOLE or WINDOW QUIET Dont output anything at all If you start it again, the Patch will be removed and Returncode 5 is given. The output with ALL will look like this: 08-Aug-20 14:28:59 *** Div0 occured at Addr: 0x94D71EA *** SegTracker-> Name: "Div0Test" Hunk #0 Offset $142 Addr: 094D7314 094D7334 094FBC2C 00000010 00000000 080128EC 0800089C 08002304 Data: D0D0D0D0 D1D1D1D1 D2D2D2D2 D3D3D3D3 D4D4D4D4 D5D5D5D5 D6D6D6D6 00000000 ******************************** DISASSEMBLED ******************************** 094d71e4 : 47f8 0010 lea.l $10.w,a3 094d71e8 : 7e00 moveq.l #$0,d7 094d71ea : *4c71 7007 7404 divu.l $4(a1,d7.w*4),d7 ;extended opcode 094d71f0 : 6150 bsr.s $94d7242 094d71f2 : 663e bne.s $94d7232 You can create a Debug-Script or put something like this in your Startup-Sequence (Description of the tools and where to get them below) : MuProtectModules >NIL: IF NOT WARN Run >NIL: MuGuardianAngel WAITFORMUFORCE TOMUFORCE AREGCHECK DREGCHECK + SHOWHUNK SHOWPC NAMETAG DISPC DATESTAMP LED 0 INTRO="*N*** GuardianAngel hit" Run >NIL: MuForce STACKCHECK AREGCHECK DREGCHECK DISPC DATESTAMP RAWIO LED 0 + INTRO="*N*** MuForce hit" Run >NIL: NoMoreDiv0_Debug ALL RAWIO Run >NIL: Sashimi CONSOLE WINDOW="CON:0/0/640/256/Something wrong ! + CTRL-E=Empty CTRL-F=File/AUTO/CLOSE/WAIT/IN