VDP routine for MSX1


Rookie (21)

TBC's picture

07-09-2015, 01:56

Hi, I was wondering if there's a standard technique for doing what I want to do.
In a fast game, where the screen should be updated every frame, is it common to collect all VDP commands in a memory buffer and then send them to the VDP during the start of the blanking period?
I came up with was this: I use the stack to push all commands I want to do into memory (saving and restoring the SP before jumping/returning ofcourse).
I use the instruction PUSH AF and the carry flag to indicate which port (#98 or #99).

Login or register to post comments

By flyguille

Prophet (3028)

flyguille's picture

07-09-2015, 04:17

vdp commands in MSX1?, oh I see..

The problem is that PUSH AF is 16bits, for pushing just useful register A, and IIRC the "PUSH" instruction needs more cpu time, than just the OUT instruction.

It will lose time doing all those PUSHes, then POPs, and remenber that POPs are in reverse order!, totally a bad idea.

why you will do that? it is quita a lot of overhead.

Normally If you do a game that needs SPEED, but it is quite complex to draw, you draw IT first in RAM, and then dump the RAM to VRAM in a single action like OTIR or faster, a serie of OUTI.

By gdx

Enlighted (4642)

gdx's picture

07-09-2015, 11:55

Be careful, the MSX1 VDP needs Waiting in certain situations.
For example, put at least three NOP between the indication of the address in the VRAM and writing the data in VRAM. Then avoid OTIR and INIR to write/read the data in VRAM.
The faster method to acces to MSX1 VDP depends on your program but in general it's faster to put directly the port numbers at OUT and IN instructions.
The I/O ports have become standard VDP since the MSX2. (Meanwhile all MSX1 use too #98 & #99.)


Rookie (21)

TBC's picture

07-09-2015, 12:28

PUSH AF and OUT (98),A both takes 11 cycles, and of course I won't use POP when I write everything to the VDP.
I thought about keeping a copy of the name table in RAM and dump everything to VRAM, but that's 6144 bytes to copy every frame.

By Lord_Zett

Paladin (807)

Lord_Zett's picture

07-09-2015, 16:11

just use basic + kunbasic Big smile