Fastest way to clear VRAM page?

Page 1/2
| 2

By AxelStone

Prophet (3189)

AxelStone's picture

19-02-2016, 07:50

Simple question: what's the fastest way to do it?

Thanks Smile

Login or register to post comments

By ARTRAG

Enlighted (6923)

ARTRAG's picture

19-02-2016, 08:25

In which video mode?
Fastest for what ? For the z80 or for the video?

By AxelStone

Prophet (3189)

AxelStone's picture

19-02-2016, 08:45

In SC5, I don't mind to use Z80 or VDP. Put 0's in all VRAM positions? Make copys? Some instruction to make clear?

Thanks.

By Daemos

Paragon (2044)

Daemos's picture

19-02-2016, 08:46

HMMV? start at Y = 0 end at Y = 212

Look it up in the VDP programmers guide. In the meanwhile let your cpu do some other work.

By ARTRAG

Enlighted (6923)

ARTRAG's picture

19-02-2016, 09:40

AxelStone wrote:

In SC5, I don't mind to use Z80 or VDP. Put 0's in all VRAM positions? Make copys? Some instruction to make clear?

Thanks.

In this case, if you are a fanatic, the fastest way is to use both.
Send an HMMV command to fill from 0,0 to 255,127 and in the meanwhile fill with the z80 from 0,128 to 255,255

Tongue

By AxelStone

Prophet (3189)

AxelStone's picture

19-02-2016, 10:19

HMMV is fine for me. I'm not fanatic, simply I'd like clear screen between image sequences.

Thanks people. Wink

By PingPong

Prophet (4093)

PingPong's picture

19-02-2016, 20:48

AxelStone wrote:

HMMV is fine for me. I'm not fanatic, simply I'd like clear screen between image sequences.

Thanks people. Wink

that is what the cls command does.... you already have this.... ;-)

By AxelStone

Prophet (3189)

AxelStone's picture

19-02-2016, 23:12

PingPong wrote:
AxelStone wrote:

HMMV is fine for me. I'm not fanatic, simply I'd like clear screen between image sequences.

Thanks people. Wink

that is what the cls command does.... you already have this.... ;-)

Right, good apreciation. I suposse it works in all graphic modes, right? This is, it clears active page, 32Kb in SC5 mode and 64Kb in SC7/SC8 modes.

By NYYRIKKI

Enlighted (6016)

NYYRIKKI's picture

20-02-2016, 00:50

ARTRAG wrote:

In this case, if you are a fanatic, the fastest way is to use both.
Send an HMMV command to fill from 0,0 to 255,127 and in the meanwhile fill with the z80 from 0,128 to 255,255

I've been thinking about this as well, but not really tested this.. I know that you know lot about VDP, so can you explain why this works? I thought the data to VRAM goes from either CPU or VDP, but they all share the same write clock cycles. How much faster is it? Why the best ratio is 50%/50%?

By Grauw

Ascended (10699)

Grauw's picture

20-02-2016, 01:13

Oh, and disable the screen while clearing it, of course.

The VDP command engine doesn’t use all available VRAM access slots during blanking, it skips some because it isn’t fast enough, so by combining forces with the CPU together they can use the access slots more efficiently…

Many details in the V9938 VRAM timings article, “CPU and command reads/writes” section. Quote:

Quote:

The most extreme situation occurs in this test. Execute a HMMV VDP command (this is the fastest command, see below) while simultaneously executing a long series of OUT (#98),A instructions (the fastest way to send CPU write requests). In our measurements, in the mode 'sprites on' the command execution speed was approximately cut in half! But in the other two modes [sprites off/screen off], the execution speed was barely influenced.

By Grauw

Ascended (10699)

Grauw's picture

20-02-2016, 01:33

If I’m not mistaken, HMMV uses 48 cycles (@21MHz) per byte, OUT (98H),A uses 72 cycles per byte. While the screen is disabled VRAM access slots are usually just 8 cycles apart, so both can achieve their maximum throughput. Although the VDP command engine will be stalled a bit by the CPU at first, probably they will quickly align to interleave nicely avoiding the stall.

So, given that HMMV is 33% faster than OUT, probably a better ratio is 60/40.

Page 1/2
| 2