Jump to content
Sign in to follow this  

About sprite positioning and video mode

Recommended Posts

Orion_    1

I remember that positioning sprites on the Jaguar screen seemed a bit awkward.

Looking at my old code I had "X/YRELATIVE" variables that I added to each sprite coordinates.

X/YRELATIVE was the 0,0 of my screen, but is there any logic about those values ?

From the test I did yesterday, it seems that the values are not the same when in RGB16 or RGB24 !

And not the same again on emulators...


Are those values in any way related to the video init code ? (which seems to be the same for everyone ?)


I saw that HMSRaptor looks good and screen centered on both TV and emulators, I'm curious about how you guys achieved that ? :D



Also I found in the video init code that the VDE value was computed, but not used ?!

move.w d6,a_vde

move.w a_vdb,VDB

move.w #$FFFF,VDE


Can I use this instead ?

move.w a_vde,VDE


I don't remember how I started jag dev, but I think I will dig a bit in the original Jaguar SDK sources because there might be some interesting stuff. (correct init, blitter example, etc...)

Share this post

Link to post
Share on other sites
SCPCD    0

for the OP :

X position is relative to HDB1/2

Y position is absolute, you can make relative value in your homemade OP List by computing YPos+VDB.


the visible screen is inside the scare [HDB1/2 to HDE] and [VDB to VDE].

If VDE is greater than VBB, then the visible screen will cut at VBB.



The correct method to center a screen is using HDB1/2, HDE, VDB and VDE. All those values are computed depending the screen mode (NTSC/PAL)


Values should be the same in all color mode (RGB16, CRY, RGB24)

Share this post

Link to post
Share on other sites
Orion_    1

Just for the record, here is what I use for the video init function

I took the formula from Cybermorph's sources and triggered them a bit.

It compute the value from a screen width/height ! (don't know if it still works if you modify the values :D)

But it looks centered on both PAL & NTSC on Virtual Jaguar Emulator and on my on my PAL TV.

No need to add some funky value to sprite coordinates anymore !


ScreenWidth        equ    320
ScreenHeight    equ    240

V_PAL_HDB        equ    843-((ScreenWidth*4)/2)+4
V_PAL_HDE        equ    (((ScreenWidth*4)/2)-1)+$400
V_PAL_VDB        equ    80
V_PAL_VDE        equ    (V_PAL_VDB+(ScreenHeight*2))

V_NTSC_HDB        equ 843-((ScreenWidth*4)/2)+4
V_NTSC_HDE        equ    (((ScreenWidth*4)/2)-1)+$400
V_NTSC_VDB        equ    32
V_NTSC_VDE        equ    (V_NTSC_VDB+(ScreenHeight*2))

    movem.l    d0/a0,-(a7)

    lea        VideoPal,a0
    move.w    CONFIG,d0
    andi.w    #VIDTYPE,d0; 0 = PAL, 1 = NTSC
    beq.s    .putVideo
    lea        VideoNtsc,a0

    move.w    (a0)+,d0
    move.w    d0,HDB1
    move.w    d0,HDB2
    move.w    (a0)+,HDE
    move.w    (a0)+,d0
    move.w    d0,VDB
    move.w    d0,a_vdb
    move.w    (a0)+,d0
    move.w    d0,VDE
    move.w    d0,a_vde

    move.l    #0,BORD1
    move.w    #0,BG

    movem.l    (a7)+,d0/a0


VideoPal:    dc.w    V_PAL_HDB,V_PAL_HDE,V_PAL_VDB,V_PAL_VDE


a_vdb:    ds.w    1
a_vde:    ds.w    1



Share this post

Link to post
Share on other sites
Orion_    1

C'est ce que j'avais dans mon ancienne lib, mais j'avais malgrès tout besoin de rajouter un décalage a mes sprites :)

La plus besoin ^^


Share this post

Link to post
Share on other sites
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this