VRAM to VRAM copy on Screen 2

Page 1/3
| 2 | 3

By aoineko

Paladin (706)

aoineko's picture

21-05-2011, 23:35

Hi,
I would like to know if it is possible to copy 6 Ko of data from VRAM to VRAM (move along Y axis) on screen 2 for MSX 1 at 60 Hz?

Login or register to post comments

By flyguille

Prophet (3028)

flyguille's picture

22-05-2011, 00:38

the problem is that screen2 is not a bitmap

and if you are thinking in using the CO-VDP iirc is not possible... but I not tested it.

By aoineko

Paladin (706)

aoineko's picture

22-05-2011, 10:16

I know screen 2 is not a bitmap mode but I just would like to switch the content of the 3 patterns buffer each frame. I need 2 YMMM instructions (vertical VRAM>VRAM copy) to do that : One for 4 KB and an other for 2 KB.

In fact, I'm not sure if MSX 1 GPU have a YMMM instruction and I don't know if GPU is quick enough to copy 6 KBytes in 1 frame.

By DanySoft

Champion (452)

DanySoft's picture

22-05-2011, 11:29

Hey, use port# 98h read/write to use read /write vramvram
and copy source vram to destination vram.
use assembleer to make this port but not use VDP CMD vram-vram.
or use BASIC with CALL TURBO ON/OFF

5 screen 0
10 call turbo on
20 a=0 : b = 1020
30 for k=0 to 2048
40 vpoke b + k , vpeek ( a + k)
50 next k
60 call turbo off
Ok

By jltursan

Prophet (2619)

jltursan's picture

22-05-2011, 12:22

Some time ago, ARTRAG developed a technique to swap the screen mode while in vblank and then, execute as many VDP copies as possible. Once finished, you set back the old pattern mode and repeat.

By sd_snatcher

Prophet (3597)

sd_snatcher's picture

22-05-2011, 14:18

Only the V9958 accepts using blitter commands on scr2.

By Metalion

Paragon (1596)

Metalion's picture

22-05-2011, 15:14

In fact, I'm not sure if MSX 1 GPU have a YMMM instruction and I don't know if GPU is quick enough to copy 6 KBytes in 1 frame.
There are no macro instructions available with the MSX1 VDP.
You have to do your copies yourself.

By aoineko

Paladin (706)

aoineko's picture

22-05-2011, 20:55

Ok, thanks everyone.

By Marq

Champion (387)

Marq's picture

22-05-2011, 20:59

Better block copy from main RAM to VRAM (or at least VRAM->RAM->VRAM), because a consecutive read+write from VRAM to a different address will be horribly slow (need two additional port commands each time to set the address). Anyway, 6 kilobytes is too much for the VDP to handle even if copying from main RAM. About 3k is possible, if you use all the available CPU time.

By hit9918

Prophet (2926)

hit9918's picture

27-05-2011, 13:12

Hi,
I would like to know if it is possible to copy 6 Ko of data from VRAM to VRAM (move along Y axis) on screen 2 for MSX 1 at 60 Hz?

@aoineko this sounds like a vertical smoothscroller game, cool Big smile

Copy vram always ends up as copy vram -> ram and then copy ram -> vram. this is factor 2 slower. Make the whole thing only with a copy ram -> vram from different offsets.

;copy RAM to VRAM just as fast as the allowed MSX 1 VDP speed
copy: 
	outi		;C = 0x98
	jp nz,copy

With 6k this gives 20fps. With vram->vram copy only 10 fps.

Step 2, unscramble the bitmap so longer chunks can be written without port 0x99 vram address setup. This nametable gives linear chunks of 64 byte:

08.........
19
2
3
4
5
6
7
08.........
19
2
3
4
5
6
7
08.........
19
2
3
4
5
6
7

Use a RAM buffer with NO scrambling. But not consisting of lines, but columns.

A copy RAM + offset shall roll the screen.
Maybe starting with RAM colums 2*192 high makes it easier to sort out a beta version.
But that needs twice RAM and then you got a problem when this one does wrap around.
192 byte columns with wraparound is probably way to go.

Step 3:
Doublebuffering with the nametable. two nametables, every one showing halve of the charset.
This allows only a playfield area of halve width, 128 pixels. But it allows using full color graphics without nasty effects! And less tearing (TV beam hitting) than unbuffered monochrome.

And it probably would be the first MSX 1 color bitmap scroller ever. Look at this:

Ikari Warriors CPC: http://www.youtube.com/watch?v=zC1vK7q9NVY
Flying Shark ZX: http://www.youtube.com/watch?v=N6debY6Bh4M

Snipping a line from top or bottom of the screen, you get 32 chars to make a sidepanel.
In the area of the middle charset, no side panel action is possible. Still the Ikari style works.

The sprites could stil run full framerate 60fps on top of all that.

By Eugeny_Brychkov

Paragon (1226)

Eugeny_Brychkov's picture

05-06-2011, 16:10

Let's calculate
60 Hz ~ 16.6 milliseconds per cycle
One Z80 clock cycle at 3.579545 MHz ~ 279 nanoseconds
"LD A,(HL) + OUT(98h),A + INC HL" = 7+11+6 (at least) = 24 cycles = 6.7 microseconds.
Moving 6KiB this way will take (not counting cycle commands) 6.7*6*1024 ~ 41.2 milliseconds.
You now can see that you can't use Z80 to do operation requiring 41.2 ms in time of 16.6 ms.

Now let's estimate if it's possible with, let's say, V9938.
Data byte read: 1.12 microseconds, data byte write: 1.12 microseconds = 2.24 microseconds for single YMMM iteration. Simplifying situation, 6*1024 bytes*2.24 miscroseconds = 13.76 ms.
I conclude that YMMM can complete within 14 ms in "background" VPD mode, thus Jose/ARTRAG's way should work.

Think if you really need to move whole 6KiB of data between VRAM areas. Can you use less patterns, reusing some existing? Decreasing number of patterns to copy may dramatically decrease the CPU and GPU workload, and increase reliability and performance of the code.

Page 1/3
| 2 | 3