gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Extended Rotation: Start below top left corner?

#99847 - bjoerngiesler - Thu Aug 24, 2006 6:59 am

Hi,

I'm trying to use an extended rotation background that starts scaled down to 0 in y direction, then slowly grows across the screen (YDY going from INF to 1). That works very well in principle, but I want it to happen from the BOTTOM of the screen! I.e. the ERB should start its life at screen y=192 and go up to screen y=0.

Is that possible? CY only takes positive values and shifts the ERB in negative screen y, i.e. up.

Help is much appreciated!
_________________
DSFTP homepage

#99880 - tepples - Thu Aug 24, 2006 2:43 pm

Careful manipulation of the origin fields of the matrix should give you this effect. Just subtract 191 * pb from x_origin and 191 * pd from y_origin.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#99895 - bjoerngiesler - Thu Aug 24, 2006 5:02 pm

tepples wrote:
Careful manipulation of the origin fields of the matrix should give you this effect. Just subtract 191 * pb from x_origin and 191 * pd from y_origin.


Do you have a link to the matrix representation you're describing and how it maps to the control registers? (I know rotation/scaling matrices, just so we have the same terminology.) Also, pb is the x offset and pd the y offset?

Thanks!
_________________
DSFTP homepage

#99899 - tepples - Thu Aug 24, 2006 5:55 pm

bjoerngiesler wrote:
tepples wrote:
Careful manipulation of the origin fields of the matrix should give you this effect. Just subtract 191 * pb from x_origin and 191 * pd from y_origin.


Do you have a link to the matrix representation you're describing and how it maps to the control registers?

See TONC: the affine transformation matrix and TONC: affine backgrounds. My use of "origin" corresponds to TONC's "displacement vector".
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#99931 - bjoerngiesler - Thu Aug 24, 2006 7:45 pm

Thanks for your help. Turned out I actually had a fixed-point problem -- I took 8.8 fixed to mean always-positive numbers, since they have no sign bit. The TONC pages helped me a lot with that.

Thanks again!
_________________
DSFTP homepage

#99947 - Cearn - Thu Aug 24, 2006 9:37 pm

bjoerngiesler wrote:
Turned out I actually had a fixed-point problem -- I took 8.8 fixed to mean always-positive numbers, since they have no sign bit.

Thanks again!

Unlike floating point number, signed integers (and hence fixed point numbers) never have a sign bit, not in the truest sense of the word. For example, The 16bit representation of -1 is 0xFFFF, not 0x8001, which it would be with a real signbit. Two's complement integers interpret the top half of their range as negative numbers, 'wrapped around' at 0:

Code:
0x8000 ... 0xFFFE 0xFFFF 0x0000 0x0001 0x0002 ... 0x7FFF
-2^15  ...   -2     -1     0      1      2    ... +2^15-1

Yes, this does mean that the most significant bit tells you whether the number is negative or not, but that is merely incidental to the whole scheme; for smaller negative numbers, later bits will indicate the sign just as well.