Can I vertically hardware-scroll with BASIC "set scroll" statemen, using sprites together?

ページ 1/3
| 2 | 3

By msxdaisuki

Rookie (18)

msxdaisuki さんの画像

26-11-2021, 07:56

When I vertically hardware-scroll using "set scroll" statement in BASIC, I realized VRAM sprites regions are overtaken by image data. So is it possible that I vertically hardware-scroll with "set scroll" statement in BASIC and simultaneously use sprites? for example, I can horizontally hardware-scroll with "set scroll" statement in BASIC, using sprites, because horizontal hardware-scroll doesn't affect VRAM sprite regions.

ログイン/登録して投稿

By Metalion

Paragon (1625)

Metalion さんの画像

26-11-2021, 08:06

Yes you can, you only need to displace the sprite area outside of the current display page in VRAM.
So for example, if the display page is 0 (the first page) in SCREEN5, you need to put the sprite area after &h8000.

By msxdaisuki

Rookie (18)

msxdaisuki さんの画像

26-11-2021, 11:41

thank you so much. but, can you tell me more? You said I need to put the sprite area after &H8000. Just using vpoke statement is no problem, but how can the msx recognize the change of address of sprite area, please? for example, I am using screen5 and page 0 for display.

By ARTRAG

Enlighted (6935)

ARTRAG さんの画像

26-11-2021, 12:05

You have to set the vdp registers by the VDP(n) command in basic
you can find their meaning an values here

http://rs.gr8bit.ru/Documentation/V9938-programmers-guide.pdf

look at page 49

By Mumbly

Expert (116)

Mumbly さんの画像

26-11-2021, 12:06

Actually, if I'm not mistaking here, you have to change some VDP control registers, in which you can set-up the target address of the sprite pattern, color ... tables, which are located by default in the low part of page 0
as well as changing those address into the VDP register copy in RAM.

see
https://www.msx.org/wiki/VDP_Table_Base_Address_Registers

By msxdaisuki

Rookie (18)

msxdaisuki さんの画像

26-11-2021, 14:52

thank you, but I couldn't understand. could you show me some sample basic code of Screen 5, page 0, please?

By Dolphin101546015

Champion (336)

Dolphin101546015 さんの画像

26-11-2021, 21:54

10 SCREEN 5,2:SET PAGE 0,0
20 VDP(37)=0  :VDP(38)=0:VDP(39)=0:VDP(40)=0        ' Set X,Y
30 VDP(41)=0  :VDP(42)=1:VDP(43)=0:VDP(44)=4        ' Set DX=256,DY=1024
40 VDP(45)=0  :VDP(46)=0:VDP(47)=&B11000000         ' Clear Whole VRAM
50 LINE(0,0)-(255,212),15:SET PAGE 2,2
60 VDP(6) =&B00100000                               ' Sprite SPT in &h10000
70 VDP(12)=&B00000010: VDP(5)=&B00011111            ' Sprite SAT in &h10E00
80 VDP(15)=4:OUT&H99,0:OUT&H99,64                   ' Set VRAM Addr &h10000
90 FOR I=0 TO 2047:OUT&H98,RND(1)*256:NEXT I        ' Fill SPT
100 VDP(15)=4:OUT&H99,0:OUT&H99,64+12               ' Set VRAM Addr &h10C00
110 FOR I=0 TO 511:OUT&H98,((I\16)MOD14)+2:NEXT I   ' Fill SCT & SAT
120 FOR I=0 TO 31:OUT&H98,(I\8)*16+48               ' Set Y
130 OUT&H98,(I*16)AND127                            ' Set X
140 OUT&H98,0:OUT&H98,I*4:NEXT I                    ' Set Spr Num
150 I=(I+1)AND 255:VDP(24)=I
160 IF STRIG(0) THEN VDP(2)=&B01011111 ELSE VDP(2)=&B00011111
170 GOTO 150

If you using SET PAGE after write VDP registers for SAT & SPT, remember: they will be redefined by BASIC. Tongue

By msxdaisuki

Rookie (18)

msxdaisuki さんの画像

27-11-2021, 00:45

thank you so much for your sample code with comment! I think I can search the meaning of the codes with the help of the comments. thans again!

By msxdaisuki

Rookie (18)

msxdaisuki さんの画像

27-11-2021, 00:46

thank you for your help!

By Dolphin101546015

Champion (336)

Dolphin101546015 さんの画像

27-11-2021, 02:40

Mistake with order in SAT Sprite Pattern Numbers:
Its have 3rd byte, but not 4th. Just swap it with zero byte before it Wink

By hit9918

Prophet (2932)

hit9918 さんの画像

27-11-2021, 20:23

One can't use OUT &h99 in BASIC! The reason is that disabled interrupts are needed around those two OUTs to &h99.
Now I wondered, maybe the MSX2 BASIC has some syncronization after VDP(15), but after a while the code hits random VDP registers! (the port &h99 got reset by IN &h99 code in the interrupt)

10 screen 5
20 i = i and 255
30 vdp(15) = 0 : out &h99,i : out &h99,135
40 i=i+1:goto 20
ページ 1/3
| 2 | 3