Re: [stella] Rounding with DASM?

Subject: Re: [stella] Rounding with DASM?
From: "Dennis Debro" <dennis@xxxxxxxxxxxxxxx>
Date: Wed, 1 Dec 2004 12:18:52 -0800 (PST)
Hi Rob,

> How about
>
> ([(3 * 256 / 16)* 6] * 2 + 5) / 10
>
> then?

That works for this equation but let me explain more of what I'm trying to
do.

I'm disassembling Berzerk and it uses fractional movements. I'm trying to
make this compile nicely for PAL and NTSC without having a lot of IF
COMPILE_VERSION = NTSC in the code. So I'm trying to set up constants
like...

  IF COMPILE_VERSION = NTSC

DELAY_FACTOR_NUMERATOR   = 1
DELAY_FACTOR_DENOMINATOR = 1

  ELSE

DELAY_FACTOR_NUMERATOR   = 6
DELAY_FACTOR_DENOMINATOR = 5

  ENDIF
.
.
.
ROBOT_MOVE_DELAY_0         = [(1 * 256 / 8) * DELAY_FACTOR_NUMERATOR] /
DELAY_FACTOR_DENOMINATOR
ROBOT_MOVE_DELAY_1         = [(5 * 256 / 32)* DELAY_FACTOR_NUMERATOR] /
DELAY_FACTOR_DENOMINATOR
ROBOT_MOVE_DELAY_2         = [(3 * 256 / 16)* DELAY_FACTOR_NUMERATOR] /
DELAY_FACTOR_DENOMINATOR
ROBOT_MOVE_DELAY_3         = [(7 * 256 / 32)* DELAY_FACTOR_NUMERATOR] /
DELAY_FACTOR_DENOMINATOR
.
.
.

The equations are also there to help clearly understand how many frames
the object moves (i.e. [5 * 256 / 32] = move 5 out of 32 frames)

Take care,
Dennis


Current Thread