To Fudeba (or anyone can help)

Page 1/2
| 2

By PingPong

Enlighted (4155)

PingPong's picture

29-06-2008, 13:52

Hi, all. I've realized a small z80 routine that convert a zx framebuffer to a msx framebuffer taking into account only pattern data, not attributes. Simply the routine copy the ram data into vram taking into account the different vram layout.

However, i cannot get more than 12 fps (or 14 if i unroll) to move those 6144 bytes.
Anyone think could be pushed to more fps? the routine should work on a plain msx1.

Any help is appreciated.

Login or register to post comments

By PingPong

Enlighted (4155)

PingPong's picture

30-06-2008, 19:51

No-news? Crying

By Edwin

Paragon (1182)

Edwin's picture

30-06-2008, 21:25

Seems to be a reasonable speed. You could gain a little by trying to take advantage of the higher allowed speed during vblank, but it's not practical. What speed were you looking for?

By PingPong

Enlighted (4155)

PingPong's picture

01-07-2008, 00:15

Seems to be a reasonable speed. You could gain a little by trying to take advantage of the higher allowed speed during vblank, but it's not practical. What speed were you looking for?

Really the problem is not the speed, but the cpu time taken: the higher the speed, the lower the cpu time used to blit the entire screen, so more time to perform other tasks. Would be good to shrink down of about 30% the actual time, but i'm not sure it's doable, so i ask some z80 or vdp guru. The routine is not soo long i could eventually post here the source if this help...

By Edwin

Paragon (1182)

Edwin's picture

01-07-2008, 00:46

A quick calculation tells me that you can do about 23 fps at maximum transfer rate. That means no cpu time left to do any processing at all. So 12 Hz at 30% seems impossible without tricks to reduce the amount of data to be transferred.

By SLotman

Paragon (1242)

SLotman's picture

01-07-2008, 03:22

If the screen is somehow "static" (no scroll) you could have some sort of check for tiles not changed, and skip them when drawing... but for an adaptation, unless you know everything about the game you're converting, I think that it's hardly an option...

Also, if the game use static tiles (again, no scroll) and you could reduce all of them to 256 (or 3 sets of 768), you could (a lot of work!) re-work everything so you only would have to change the "tilemap" on screen 2, writing only 768 bytes.

But the most simple part: just dont update the screen at every INT Smile
GnG just run as fast as the spectrum on MSX1 without writing the color and with some frameskip... don't think there's another way around it, but if someone knows, please do tell! Smile

And be sure to test your vdp writing routine against some Sony machines... they usually have an very slow vdp (or vram?), so just doing OUT (98h)/NOP/NOP isn't enough, and you'll get screen corruption Sad

By PingPong

Enlighted (4155)

PingPong's picture

01-07-2008, 15:55

Just to see before crying: anyone can test a .com on a sony machine? I can give a binary (.com version) if someone can...

By jltursan

Prophet (2619)

jltursan's picture

01-07-2008, 16:06

And be sure to test your vdp writing routine against some Sony machines...

To be more precise, a Sony HB-20P perhaps?

By PingPong

Enlighted (4155)

PingPong's picture

01-07-2008, 16:09

A quick calculation tells me that you can do about 23 fps at maximum transfer rate. That means no cpu time left to do any processing at all. So 12 Hz at 30% seems impossible without tricks to reduce the amount of data to be transferred.
I've not been clear sorry. What i need to reach is 18fps regardless of CPU time used (i will choose how many frameskip to do). But actually i cannot reach more than 14fps with unrolling...
You told me 23fps. How can you make this result? I'm assuming 3.57Mhz / 28 cycles = 125000 bytes/sec.
In screen it's about 125000/6144=20fps teoretically.
I cannot use tricks to take advantage of vblank. the different layout between speccy and msx slow down the output in vram .

By Edwin

Paragon (1182)

Edwin's picture

01-07-2008, 21:30

You can actually use outi's during vblank, which allows you to greatly speed up things for part of the time, which let's you get there. I actually use that often. But it does require some careful planning sometimes.

By PingPong

Enlighted (4155)

PingPong's picture

01-07-2008, 22:11

You can actually use outi's during vblank, which allows you to greatly speed up things for part of the time, which let's you get there. I actually use that often. But it does require some careful planning sometimes.
That's the problem. Because the convertion between ram and vram could not be done in a single vblank i cannot use this. i will be forced to do a part of the job at high speed, and part at low speed. Plus consider that i need to perform some register operation for each byte i output to vram so i cannot get the full outi speed.

this is an example of the part of the routine i call 24 times. Each time i fill a charather row in screen 2. notice the out(0x98),a. Here is the most time consuming part.

void rowblit()
{
#asm

ld c, 32 ; do 32 times, for each ch
2:
ld e,l ; copy hl to de . hl contain the zx ram ptr
ld d,h

ld b,8 ; output a charather row
1:
ld a,(de) ; load the pattern byte
out (0x98),a ; to vram
inc d ; next pattern byte is 256 bytes far in zx spectrum vram layout
djnz 1b ; loop

inc hl ; go to next column. in spectrum is 1 byte far
dec c
jp nz,2b

#endasm
}

Page 1/2
| 2