AminetAminet
Search:
83214 packages online
About
Recent
Browse
Search
Upload
Setup
Services

util/boot/NoMoreDiv0.lha

Mirror:Random
Showing:ppc-warpupgeneric
No screenshot available
Short:No more Division by Zero
Author:Holger.Hippenstiel AT gmx.de
Uploader:Holger Hippenstiel nc-online de
Type:util/boot
Version:1.5
Replaces:util/boot/NoMoreDiv0.lha
Architecture:m68k-amigaos >= 2.0.0
Distribution:Aminet
Kurz:Keine Geteilt Durch Null Abstuerze mehr
Date:2020-09-27
Download:http://aminet.net/util/boot/NoMoreDiv0.lha - View contents
Readme:http://aminet.net/util/boot/NoMoreDiv0.readme
Downloads:300
NoMoreDiv0 V1.5
===============

TL;DR Install NoMoreDiv0 in C:, Call in Startup-Sequence after SetPatch or
in User-Startup. 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.

*** Update V1.3:
Whoops, forgot "div? Addr(pc,dx.z*n),dy" in V1.2.
But due some optimitations it's even 68 bytes smaller than V1.2. :D
*** Update V1.4:
Small changes to make it compatible with the Debug-Version:
http://aminet.net/package/dev/debug/NoMoreDiv0_Debug
*** Update V1.5:
Source included

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 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

    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


Contents of util/boot/NoMoreDiv0.lha
PERMISSION  UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP     NAME
---------- ----------- ------- ------- ------ ---------- ------------ ----------
[unknown]                 2898    7381  39.3% -lh5- d49c Sep 28 02:23 afd-copyright
[unknown]                  841    1611  52.2% -lh5- b804 Sep 28 02:23 AFD-COPYRIGHT.info
[unknown]                  616     832  74.0% -lh5- b8bd Sep 28 02:53 Div0Test
[unknown]                  438     512  85.5% -lh5- 015f Sep 28 02:47 NoMoreDiv0
[unknown]                 1738    3599  48.3% -lh5- 82b9 Sep 28 02:58 NoMoreDiv0.txt
[unknown]                 1566    5031  31.1% -lh5- 1713 Sep 28 02:52 source/Div0Test.s
[unknown]                 1299    3675  35.3% -lh5- b243 Sep 28 02:26 source/M68k_exceptions.s
[unknown]                 1608    4165  38.6% -lh5- ec56 Sep 28 02:47 source/NoMoreDiv0.s
---------- ----------- ------- ------- ------ ---------- ------------ ----------
 Total         8 files   11004   26806  41.1%            Sep 28 04:36

Aminet © 1992-2020 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>