Mystery: game Bestial Warrior with corrupted colors in MSX1

Page 1/6
| 2 | 3 | 4 | 5 | 6

By mcolom

Champion (320)

mcolom's picture

22-12-2019, 22:22

Dear respected MSXers, Smile

Today I played the "Bestial Warrior" game with a Sony HB-20P emulated with openMSX (last version from git's master). It's the CAS version.
The colors are wrong, so I debugged the game a bit to figure out what is going.
And well, I found that from address 0x9BE9 it starts writing the CT (color table) with the following instructions repeated eight times (on the right, the number of Z80 cycles):
ld a, (hl) --> 7
out (#98), a --> 11

So, it's 18 (or 19 at most) cycles. According to this (very excellent this and the others!) source http://map.grauw.nl/articles/vdp-vram-timing/vdp-timing-2.html, one needs at least about 29 cycles in MSX1.
That explains the corruption, and in fact if we "set too_fast_vram_access ignore", the problem disappears.

The mystery is that I don't remember any of that corruption when I played it in my HB-20P!
Has anyone tried this game in a real MSX1? Could someone do?

Even more weird: the game updates the bitmap with the code in address 0x9BAC.
This code repeats eight times this:
add hl, de --> 11
outi --> 16
(A total of 18 cycles, way less than the required 29).
BUT the bitmap that is shown is not corrupted at all (?!)

Actually, I checked by modifying the code of openMSX than actually you can write to VRAM at any speed without corruption, unless it's over VRAM's 0x2000 (CT). I tested in this particular game only.

Well, if anyone has an explanation, ideas or can test the game in a real MSX1, please share!

Login or register to post comments

By Grauw

Ascended (10821)

Grauw's picture

22-12-2019, 22:30

Maybe part of the puzzle: the VRAM access speed limits only apply during active display. Is the bitmap update done during blanking?

By hit9918

Prophet (2932)

hit9918's picture

22-12-2019, 23:37

you took the plain z80 cycles, but the MSX has a different cycle table with M1 wait
grauw has a list http://map.grauw.nl/resources/z80instr.php

By mcolom

Champion (320)

mcolom's picture

23-12-2019, 09:32

Grauw wrote:

Maybe part of the puzzle: the VRAM access speed limits only apply during active display. Is the bitmap update done during blanking?

Yes, that a good clue, I'll check it. However, openMSX takes this into account I guess.

hit9918 wrote:

Maybe part of the puzzle: the VRAM access speed limits only apply during active display. Is the bitmap update done during blanking?

Even adding the extra cycles still it's far away from 29.

About the blanking, I have to check.
But to me the most weird is that it works well in MSX1 and not with openMSX. An actually if you look at the code, assuming that it's not during the blanking and the 9918 timings in openMSX are correct, indeed it's normal that the emulated version does't work.

That game was released in Spain, where there were way more MSX1 than MSX2. Thus, it's really strange that the authors released something that actually didn't work well in a MSX1. I mean, you realize quickly that something is wrong as soon as you run it. And I don't remember (but memories are tricky) that it wasn't OK when I played with it.

The best would be to test it in a real MSX1. That I don't have here, ouch!

By Grauw

Ascended (10821)

Grauw's picture

23-12-2019, 12:13

Indeed openMSX takes it into account. You should test in exactly the same machine configuration as a real machine that is confirmed working. E.g. PAL / NTSC makes a big difference in blanking duration.

By hit9918

Prophet (2932)

hit9918's picture

23-12-2019, 12:31

but the add hl,de : outi goes in 30 cycles.

By mcolom

Champion (320)

mcolom's picture

23-12-2019, 16:09

Grauw wrote:

Indeed openMSX takes it into account. You should test in exactly the same machine configuration as a real machine that is confirmed working. E.g. PAL / NTSC makes a big difference in blanking duration.

Yes, I'm emulating the Sony's HB-20P (PAL) and openMSX is loading the right configuration.
Specifically, the HB-20P is using the T6950A, but it doesn't show good colors with any 9918's variant.

hit9918 wrote:

but the add hl,de : outi goes in 30 cycles.

Oops, you're totally right. Actually I wrote 11 + 16 = 18 XDD
This makes sense totally. The bitmap doesn't show any corruption because it's written at steps of 30 cycles.
However, the CT is written with 8 + 12 = 20 cycles.
So, it's normal that openMSX shows color corruption.

But again, what puzzles me is that I don't recall seeing corruption in that game in my MSX1 and I don't believe that the programmers released a game with such a problem.
The simplest is to test in a real MSX1. If it works well, it'd probably mean that the openMSX's VDP access slot timing are not 100% accurate (I don't know, I'm just guessing). If it shows corrupted colors, then it's my own memory that needs to be fixed Smile

By jltursan

Prophet (2619)

jltursan's picture

23-12-2019, 19:03

I remember screen corruptions back in the day in my brother's MSX, a SVI-738; but can't remember the same of my own machine, a HB-75S...and probably with "Bestial Warrior", it rings a bell. Having bad timed video routines makes the game prone to fault but I guess that it depends on the hardware itself and its tolerance.

By Manuel

Ascended (19678)

Manuel's picture

23-12-2019, 21:30

By mcolom

Champion (320)

mcolom's picture

24-12-2019, 16:45

Thanks jltursan and Manuel for the clues.

Araubi told me that Obliterator has also problems. So I debuged it too to figure out why.
And I found the following:
- It writes the bitmap with a delay of 27 cycles between outs: OK
- It writes the CT with a delay of 17 (!) cycles between outs: TOO FAST! (to the best of our knowledge)

Now, let's compare with Bestial Warrior:
- Bitmap: 30
- It writes the CT with a delay of 17 (!) cycles between outs: TOO FAST! (to the best of our knowledge)

In conclusion, both games write the bitmap using enough, but the color table with 17. To me, that's not a coincidence. It seems that you can indeed write the color table faster than what is explained in the documentation.
Both games show corruption in openMSX (as expected) with any MSX1 VDP.
But we don't recall seeing that corruption when running in real MSXs (unless our memories are also corrupted Smile

I'm waiting for araubi to confirm than Obliterator shows correctly in a real MSX1. If that's the case, it would probably mean that the VDP slots in VDPAccessSlot.cc for MSX1 in openMSX are not accurate.

By Manuel

Ascended (19678)

Manuel's picture

26-12-2019, 16:00

Please test this on as many different MSX1 VDP's as possible. And tell us the result and the corresponding exact VDP type. Thanks!

Page 1/6
| 2 | 3 | 4 | 5 | 6