How to recover hw sprites data on SCREEN5

صفحة 1/2
| 2

بواسطة OrazioLC

Rookie (29)

صورة OrazioLC

02-12-2022, 16:56

Good evening everyone.
First I apologize for my bad English.
Using vertical scroll with VDP(24) and using hardware sprites I know there are problems, because when you erase the bottom part of the screen that is not visible (from 212 to 255) the data of the sprites that are saved in that part are deleted of the graphic page. But I read somewhere that the data of the sprites are saved in all 4 graphics pages (if you have 128kRam). My question is how do I recover that data, and what are the addresses where it is saved?
I should add that I'm using Basic and if it's a thing that can be done without asm.
THANK YOU

Login أوregister لوضع تعليقاتك

بواسطة PingPong

Enlighted (4138)

صورة PingPong

02-12-2022, 17:20

Sprites data can be relocated in VRAM anywhere, AFAIK at steps of 1K of granularity for SAT and i do not remember for SPT.
So if you need to clear the bottom part of the screen (212-255) simply move sprite data outside this area.
AFAIK, sprites data are not store in multiple places.

بواسطة OrazioLC

Rookie (29)

صورة OrazioLC

02-12-2022, 17:53

That is, you say that I can insert sprite data outside the Sprite Shapes table which starts at address &H7600. Since I'm using a multicolor sprite, there are 3 overlapping sprites and I'm using the color table to color them, how do I do this?

بواسطة PingPong

Enlighted (4138)

صورة PingPong

02-12-2022, 18:16

the color table is always placed at the SAT Table Address minus 512 (bytes)

بواسطة OrazioLC

Rookie (29)

صورة OrazioLC

02-12-2022, 18:50

Is there any book or manual that explains these things in detail, it's the first time I use this programming system. I've always used sprite$() and putsprite. Thanks

بواسطة aoineko

Paladin (1004)

صورة aoineko

02-12-2022, 23:20

The MSX 2 VDP documentation is available here: http://rs.gr8bit.ru/Documentation/V9938-programmers-guide.pdf

I also have created a summary table of all the specifics of setting the VDP according to the screen modes:

And if you search information about MSX-Basic, you wan start with the MRC wiki: https://www.msx.org/wiki/Category:MSX-BASIC_Instructions

بواسطة OrazioLC

Rookie (29)

صورة OrazioLC

02-12-2022, 23:29

Thnk you very much. I will study the data you have given me very carefully.

بواسطة Sandy Brand

Champion (301)

صورة Sandy Brand

03-12-2022, 00:58

Hmm, there seems to be no 'clean' way to do this in BASIC, but you can trick it in doing what you would need.

As PingPong, and the others already explained, the VDP hardware provides a lot more freedom to where you can put your sprite attributes table than what BASIC provides for. But, BASIC also gives access to the VDP registers, so you can use that to get a setup that might work for you.

I wrote a little test program:

10 SCREEN 5,2:COLOR 15,1,1
20 SET PAGE 1,1:CLS:LINE(0,0)-(255,7),12,BF:LINE(0,100)-(255,107),8,BF:VDP(24)=100
30 SET PAGE 1:V=VDP(2):SET PAGE 0,0:VDP(2)=V
40 P$="":FORA=0TO31:P$=P$+CHR$(255):NEXT A:SPRITE$(0)=P$
50 C$="":FORA=0TO15:C$=C$+CHR$(A):NEXT A:COLOR SPRITE$(0)=C$
100 X=X+1:IFX>255THENX=0
110 PUT SPRITE 0,(X,100),,0
120 IF STRIG(0)=0THEN100

The trick is in line 30. First we ask BASIC to display page 1, then we store the contents of VDP register 2 which controls the base 'address' of the visible page in VRAM, we then switch back to page 0 and tell BASIC to make it the 'working' page, and finally modify VDP register 2 to make it show page 1 again.

With this setup you can display page 1, but have all your sprite patterns, colors and attributes in page 0.

Downside of this trick though is that some other VDP commands might not work (e.g.: LINE) because you can't explicitly define the destination page there. COPY commands should still work though.

If you do need these BASIC commands, then it becomes a bit more tricky. One option could be to do a similar trick but instead fetch and set the VDP registers that define the sprite pattern and attribute base addresses. You can then set the 'work' page using SET PAGE, but would have to then manually VPOKE into the sprite attribute tables to update sprite locations and such on the actual page where the reside.

Hope this information helps a bit Smile

بواسطة sd_snatcher

Prophet (3659)

صورة sd_snatcher

03-12-2022, 15:49

aoineko wrote:

I also have created a summary table of all the specifics of setting the VDP according to the screen modes:
(snipped image)

Thank you so much for this cheat sheet! I always used the online "MSX portar" doc for this, but they vanished some time ago.

بواسطة OrazioLC

Rookie (29)

صورة OrazioLC

04-12-2022, 11:14

Thank you, your help has been very valuable. As I said above, it's the first time I've tried sprites using registers and addresses. I've always done things with the Basic commands (sprite$ and Putsprite), since I've never used the R#23 (VDP24) vertical scroll. I'll do some testing and let you know how it turns out. Thank you again

بواسطة Grauw

Ascended (10768)

صورة Grauw

04-12-2022, 11:36

It's not possible to use BASE to change the sprite table addresses?

صفحة 1/2
| 2