V9958 horizontal position

By M2X_E1

Rookie (30)

M2X_E1's picture

01-04-2023, 13:17

Hello All,
I've been working on programming the v9958 and i have an issue where the sprites appear to be too far to the left by two pixels, relative to the top left position on the screen (for example sprite at location 100, but appears at 98 relative to the screen's leftmost edge). I thought that the screen scroll position might have something to do with it but i have these set to zero (i think).

below are the values i have set in the registers R#0 onwards:

        0x06, 0x62, 0x1F, 0x80, 0x00, 0xEF, 0x0F, 0x00, 
	0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x07, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        

I dont want any scrolling. i think by setting these to zero should be ok?

Thanks in advance.
Smile

Login or register to post comments

By aoineko

Paladin (1001)

aoineko's picture

01-04-2023, 13:50

Vertically, there is a 1 pixel shift on all MSX VDPs since TMS9918. A sprite at position 0,0 will appear on the 1st pixel of the 2nd line.
You have to reduce the Y by 1 to get the right position.
It's a mystery to me why the engineers made this choice.

That doesn't explain your problem though. ^^

There is also a flag in the sprite attributes to display a sprite 32 pixels to the left of its position. This is necessary to make a sprite disappear cleanly on the left side of the screen. But this too probably doesn't explain your problem.

To reset V9958 horizontal scrolling, you have to set R#26 and R#27 to 0.

By M2X_E1

Rookie (30)

M2X_E1's picture

01-04-2023, 14:17

Thank you aoineko! that pixel shift does look very much like the issue. In fact now that you mention it, i did notice the sprites could have been vertically out of alignment a little, but i couldnt be certain as it is less obvious to me (given the aspect ratio of my tv, the image isn't perfectly square). I'll try adjusting the program and see if i can bring it into alignment.
I'd also made an emulator, which seemingly was working fine, but it doesn't consider the pixel shift 'feature', hence my confusion.

Much appreciate your quick response, thank you again!
Regards
Ed

By TomH

Champion (361)

TomH's picture

01-04-2023, 18:45

aoineko wrote:

Vertically, there is a 1 pixel shift on all MSX VDPs since TMS9918. A sprite at position 0,0 will appear on the 1st pixel of the 2nd line.
You have to reduce the Y by 1 to get the right position.
It's a mystery to me why the engineers made this choice.

That doesn't explain your problem though. ^^

There is also a flag in the sprite attributes to display a sprite 32 pixels to the left of its position. This is necessary to make a sprite disappear cleanly on the left side of the screen. But this too probably doesn't explain your problem.

To reset V9958 horizontal scrolling, you have to set R#26 and R#27 to 0.

During line N, the VDP is fetching and evaluating sprite Y positions that will determine which are drawn on line N+1. So it’ll be something to do with the cost of including an additional offset by 1 in that calculation.