Tricks to speed the Vdp up.

Page 1/2
| 2

By Pippo

Hero (521)

Pippo's picture

09-11-2016, 09:24

Hello everyone,
I'm making a text scroll in Screen 5.
Each letter is 32x32 pixels.
I used HMMM command but the scroll isn't smooth.
I need the tricks to speed the Vdp up.
Please, can you kindly help me?
Many thanks in advance. Smile

Login or register to post comments

By Metalion

Paragon (1622)

Metalion's picture

09-11-2016, 10:01

1. Switch to 50Hz (if it's not the case)
2. Reduce to 192 lines (if it's not the case)
3. Disable the sprites
4. Execute the HMMM command after VBLANK

But it might not be enough ...
See here for other infos : http://map.grauw.nl/articles/vdp_commands_speed.php

By Pippo

Hero (521)

Pippo's picture

09-11-2016, 12:36

Thank you for your kind reply.
I tried those, the scroll is a little better but, unfortunately, it isn't smooth yet.
Please, do you know other tricks?

By Metalion

Paragon (1622)

Metalion's picture

09-11-2016, 13:02

I don't think there's other tricks to speed up the VDP commands. If you want a smoother scroll, you might want to consider lowering the frame rate and using double buffering. Or use smaller letters ...

By NYYRIKKI

Enlighted (6016)

NYYRIKKI's picture

09-11-2016, 13:16

Typically text scrollers move the letters only once in every 16 pixels... Rest of the scroll is made by moving the screen instead of letters.

By Pippo

Hero (521)

Pippo's picture

09-11-2016, 15:37

Thanks a lot to both of you.
Please, how can I lower the frame-rate and use the double-buffering?

By syn

Prophet (2113)

syn's picture

09-11-2016, 16:54

Why are you creating a new topic? you could have just asked in your last topic...

anyway your font is 32x32?

if the fonts are 1 color per line you can use magified sprites so they are 32x32 instead of 16x16

32 width x 8 sprites per line max= 256 = exact msx screen width

By Pippo

Hero (521)

Pippo's picture

09-11-2016, 20:17

Excuse me, Syn, about the topic, I didn't think to that, really.
Please, excuse me again. Smile
Your solution is good but, if possible, I would make the scroll with graphics.

---

Dear Metalion,
please, can you answer to my question?
(It was for you). Smile

By hit9918

Prophet (2927)

hit9918's picture

10-11-2016, 00:19

set adjust can multiply the scroll power by factor 16.
the bad news is that changing the adjust register makes the blitter write bad pixels.
the blit workload needs to be divided in snippets that fit in between two changes of adjust.
that's an issue for games but in your case just blit one 32x32 char per frame. into a hidden buffer of doublebuffering.
meanwhile the set adjust moves the already rendered scene of the front buffer.

look
https://www.youtube.com/watch?v=G6IUN9hkVXU

By Pippo

Hero (521)

Pippo's picture

10-11-2016, 08:27

Thank you very much, Hit9918.
You are always very kind.
I would smoothly move a little graphic area only and not the whole screen.

By NYYRIKKI

Enlighted (6016)

NYYRIKKI's picture

10-11-2016, 10:03

Pippo wrote:

Please, how can I lower the frame-rate and use the double-buffering?

This is very simple, but effective technique... Let's say that you have font on VRAM page 2. Then you will need "display page" that is the screen VDP outputs to monitor (let's say VRAM page 0) and "write page" (ie. VRAM page 1). The idea is that you write the scrolled text to "write page" using the multiple VDP commands, then you will wait for next VDP interrupt and swap write page and display page with each other and repeat the process... This way the frame-rate drops, but user will not see graphic tearing or partially miss located fonts even when copy process is slow. You will need to implement this also if you wish to do smooth scroll by adjusting the screen location.

Quote:

I would smoothly move a little graphic area only and not the whole screen.

Indeed very typical problem... Solution is that you need to trace the "screen draw"... VDP draws the picture on screen 50 or 60 times a second. If ie. your text scroller is on top of the screen, you can adjust the screen left/right position immediately after "normal" vertical blanking interrupt. Then you will need to wait until the scrolled text is drawn to screen and return the adjust back to original situation for rest of the screen draw in order to make that part not to move. Naturally you need to repeat this on each screen draw. Luckily MSX2 VDP has possibility to poll the correct line. More advanced method is to set up the correct line in same way, but instead of polling you use line interrupt for same purpose. This means that you can freely exit the interrupt routine after scroll adjust and then you let the VDP to generate another interrupt when it hits the line where you don't want the screen to move anymore. This saves you some valuable CPU time, but is a bit harder to implement accurately. If you want to use BIOS interrupt handler, combination of these two methods is not a bad idea.

Limiting the area in X-direction is a bit harder, but usually sprites are used to mask the area you don't want to show. It is also worth mentioning that MSX2+ has additional scroll registers that make things a bit more easy... Idea is same but while using those you don't need to do double buffering and sprite masks don't need to be moved between frames.

Please note that if you trace the screen draw the double buffer can be also in same graphic page... Instead of displaying correct page, you just use Y-direction scroll to display correct version of the buffer from correct screen offset. Upper part of the screen can be also from different VRAM page than lower part... It can even be in different screen mode... It all depends how you adjust the screen parameters during each screen draw. As long as you do the register changes in same way in same time of each screen draw the screen looks static to the user although it might be constructed in very complex ways.

VDP can not be speeded up a lot, but you can trick it to look much faster than it is when you put some effort & planning in to implementing your vision.

Page 1/2
| 2