So, I got this strange piece of code.
Just from trying a few examples, it looks like it is effectively doing an 8-bit by 8-bit multiplication.
I'm guessing should just go ahead with that assumption?
$40/41 the multipliers, $42/43 the little-endian result.
(looking at the formula for determining enemy damage to the player.
$40 = (enemy attack - player defense)>>4
$41 = random value 0-6
since 42 is going to be overwritten by 8 bits anyways, it would seem it's initial value is undefined and unimportant