Short: No more Division by Zero Author: Holger.Hippenstiel AT gmx.de Uploader: Holger Hippenstiel nc-online de Type: util/boot Version: 1.6 Replaces: util/boot/NoMoreDiv0.lha Architecture: m68k-amigaos >= 2.0.0 Distribution: Aminet Kurz: Keine Geteilt Durch Null Abstuerze mehr NoMoreDiv0 V1.6 =============== TL;DR Install NoMoreDiv0 in C:, Call in Startup-Sequence after SetPatch or in User-Startup. Or put NoMoreDiv0 and it's icon in WBStartup. Programs wont crash with "Division by Zero" anymore. ********************************************************************** *** Warning - This is a HACK, to make old/buggy programs working ! *** *** No one should develop programs while this is running, *** *** you should check for division by zero errors in your code ! *** ********************************************************************** 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. This program will 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. If you start it again, the Patch will be removed and Returncode 5 is given. Since V1.4 compatible with the Debug-Version: http://aminet.net/package/dev/debug/NoMoreDiv0_Debug Which means they both can remove the other version. *** Update V1.6: Wasn't really OS2.0 compatible, fixed. Can be started from WB now. Added Icon. *** Rerelease: Div0Test now also works with OS2.0 Supported Modes are now: div?l.l LongAddr.l,dy:dz div?l.l #n,dy:dz div?l.l Addr.w,dy:dz div?l.l Addr(pc),dy:dz div?l.l Addr(pc,dx.z*n),dy:dz div?l.l off(ax,dx.z*n),dy:dz div?l.l off(ax),dy:dz div?l.l dx,dy:dz div?l.l (ax),dy:dz div?l.l (ax)+,dy:dz div?l.l -(ax),dy:dz div? LongAddr.l,dy div? #n,dy div? Addr.w,dy div? Addr(pc),dy div? Addr(pc,dx.z*n),dy div? off(ax,dx.z*n),dy div? off(ax),dy div? dx,dy div? (ax),dy div? (ax)+,dy div? -(ax),dy ? = u or s All div?l.l with or without remainder-register. *** Known Bugs/Limitations: Because the code in the exception has to check code -8 from current PC it could cause enforcer-hits, very very very unlikely - but it can happen. Memory Indirect Modes are not supported, no one should use crap like: div(u/s)(l.l) ([Label1,ax/pc,dx.z*n],Label2),dy:dz ... anyway. :P **************************************************************************** Not supported only means they are not changed, they will still show up in the debugger-version, they are catched and wont crash your machine either. **************************************************************************** Check out my other tools: http://aminet.net/search?readme=%22Holger+Hippenstiel%22&sort=date&ord=DESC DISCLAIMER This software is subject to the "Standard Amiga FD-Software Copyright Note". It is Giftware as defined in paragraph 4g. If you like it and use it regulary, please send me a small gift. For more information please read "AFD-COPYRIGHT". Diese Software unterliegt der "Standard Amiga FD-Software Copyright Note". Sie ist Giftware wie definiert in Absatz 4g. Falls du sie magst und regelmaessig benutzt, sende bitte ein kleines Geschenk. Fuer mehr Informationen lies bitte "AFD-COPYRIGHT". (/pub/aminet/docs/misc/AFD-FilesV-XX.lha V=Version,XX=Languages) AUTHOR Please send comments, bug-reports or small gifts like a Vampire V4 or a now "worthless :P" NVidia RTX 2080 Ti, or Paypal me to: Holger.Hippenstiel AT gmx.de Hauptstr. 38 71229 Leonberg Germany