Language…
3 users online: Astrerize, Bullymario, Fernand1527 - Guests: 75 - Bots: 126
Users: 67,562 (2,002 active)
Latest user: Dilshacking

Unsigned 16x16 Multiplication Optimisation

SMW Patches → Unsigned 16x16 Multiplication Optimisation

Submission Details

Name: Unsigned 16x16 Multiplication Optimisation
Author: MarioFanGamer
Added:
Tool: Asar
Requires Free Space: No
Bug Fix: No
Featured: No
Description: SMW features fairly unoptimised codes particularly in the matter of trigonometry i.e. circular movements; one of which is the unsigned 16x16 multiplication used by Iggy and Larry's platform and the brown chained platform and is a just horrible routine.

This patch optimises said routine with better cycle counting (waiting for multiplicaion) and 16-bit mode, therefore halving its calculation footprint by roughly half of it (resulting in an optimisation from roughly 1.5 to 0.75 scanlines when not using FastROM) and also freeing up 30 bytes in bank $01.
Optimisation could be further improved with using both index register but I wanted the patch to be index register agnostic.

This patch is only valid when not using SA-1 Pack due being replaced by a different code to take advantage of SA-1.
Tags: lorom optimisation
Comments: 3 (jump to comments)
Download 412 bytes | 96 downloads

Comments (3)

Amomario123w Link
if you already are using FastROM, this patch still improves something?
 MarioFanGamer Author Link
It sill does, I just haven't made the calculation with FastROM.
 Maarfy Link
This probably isn't destined to become a hugely popular patch, but I like that it exists just the same. The patch can be further optimized by another 2 bytes / 4 cycles by turning the second and third REP #$20 commands into REP #$21, and eliminating the following CLCs - with the CLCs gone the intervening cycle count is still exactly large enough to let the multiplication finish.

Tested with Asar 1.81, Lunar Magic 3.40, Snes9x 1.62.3, BSNES Accuracy 0.7.1.