The LeapYear
#10
Arithmetic ops by powers of 2 can be done a bit faster by not using *, \ or MOD (likely you know of 2 them). For example:
X * 4 can be SHIFT LEFT X, 2
X \ 4 can be SHIFT RIGHT X, 2
X MOD 4 can be X AND 3

Those can be done in BASIC code so difference between BASIC and ASM timing may be made smaller.

MOD is a divide with the remainder returned instead of the quotient.
Your BASIC code can be quicker with MOD 100 and MOD 400 than 2 divides by 100 and 2 divides by 400.

In ASM the DIV instruction returns both quotient and remainder. 100 is not a power 0f 2, so had to divide by 100. The remainder used as MOD 100 and quotient used with X AND as MOD 400.

The 1,15 times faster for 1204 and 1201 shows how small the difference is between MOD and AND.

------------------------------------------------------

I think my ASM can be speeded up a tiny bit by removing 3 PUSHes and 3 POPs. (iJahr should stay in the stack, not be made a register variable.)
If PBDOS had $REGISTER NONE I'd have used it just to make sure. Also, "make it work first", then try reversible changes.
Reply


Messages In This Thread
The LeapYear - by Andy Dee - 07.03.2025, 05:09 PM
RE: The LeapYear - by Dale Yarker - 08.03.2025, 12:49 AM
RE: The LeapYear - by Andy Dee - 08.03.2025, 02:00 AM
RE: The LeapYear - by Dale Yarker - 08.03.2025, 09:50 AM
RE: The LeapYear - by Andy Dee - 08.03.2025, 12:57 PM
RE: The LeapYear - by Dale Yarker - 08.03.2025, 01:06 PM
RE: The LeapYear - by Andy Dee - 08.03.2025, 04:05 PM
RE: The LeapYear - by Andy Dee - 08.03.2025, 09:34 PM
RE: The LeapYear - by Andy Dee - 09.03.2025, 01:41 AM
RE: The LeapYear - by Dale Yarker - 09.03.2025, 06:30 AM
RE: The LeapYear - by Andy Dee - 09.03.2025, 06:01 PM
RE: The LeapYear - by Dale Yarker - 09.03.2025, 10:18 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)