Strange video effect in MrGhost

Page 1/4
| 2 | 3 | 4

By cax

Prophet (3736)

cax's picture

11-05-2004, 12:09

Recently I played MrGhost on real MSX connected to TV via RGB and saw very interesting video effect:
when you find the hidden room
(if I am not mistaken, on level 2, when you go down with the screen all the time),
the screen start showing some kind of wavy effect.
The whole screen moves right-left, creating waves on the borders.

Something like that:

 __________
(         (
 )         )
(         (
 )         )
(         (
 )         )
 ---------- 

I never saw this on any emulator, only on real MSX.

Can anybody comment on this ?
What happens on a hardware level, and how this effect can be made from the software ?

Login or register to post comments

By Latok

msx guru (3861)

Latok's picture

11-05-2004, 12:35

I think you smoked too much Tongue But seriously, both VDPregisters #18 and #23 are being used to create this effect, right?

By BiFi

Enlighted (4348)

BiFi's picture

11-05-2004, 12:44

It's just R#18 for that effect. To be more precise: the R#18 value is changed at every line in such a sine wave style. The CPU waits for the next line by polling a bit in one of the VDP status registers. When it's set, the R#18 register will be updated with a value that was read from a table and the table pointer will be updated. Next it waits for the bit to be reset, so it can test for the next line.

Most of the recent emulators are capable of doing this effect as well.

By Latok

msx guru (3861)

Latok's picture

11-05-2004, 12:59

So all you need is a R#18, a sinustable and the time_interrupt. Hook #fd9f?

By cax

Prophet (3736)

cax's picture

11-05-2004, 13:05

BiFi: to make things clear, I am going to play MrGhost in an emulator and save it's state exactly before the mentioned effect. Which emulator(s) do you suggest to try this on ?

By wolf_

Ambassador_ (9918)

wolf_'s picture

11-05-2004, 13:16

There was a weird effect, once published in mcm.. dunno who came with it.. xelasoft, shuqair or whoever.. it was an 'automated' horizontal wave, fullscreen.. you could run it in basic, by xoring some vdp register... it was pretty weird Smile

By cax

Prophet (3736)

cax's picture

11-05-2004, 13:22

wolf_: do you have the basic code or any other program to show the weird effect you mentioned ?

By chaos

Paladin (809)

chaos's picture

11-05-2004, 13:24

here's the asm code of the effect:
www.mccm.aktu.nl/millennium/milc/asm/topic_0.htm

By wolf_

Ambassador_ (9918)

wolf_'s picture

11-05-2004, 13:32

hm.. my MCM's are almost all in some box..

it was something simple.. like vdp(2)=vdp(2) xor 32 or something.. the numbers are all wrong I guess... but it was like this.. and after that, your screen begins to wave Smile Not with a perfect sine.. but at least it moved Smile

By Grauw

Ascended (10321)

Grauw's picture

11-05-2004, 13:34

This effect is also used in the main screen of Compjoetania's SandStone.

Anyways, "So all you need is a R#18, a sinustable and the time_interrupt. Hook #fd9f?"... No. Well. And yes. Yes it has to be done like that, but no it is not as easy as that, unfortunately. The VDP suffers from some bugs there. More info here and here.

~Grauw

By The_Engineer

Master (177)

The_Engineer's picture

11-05-2004, 13:45

And if you really want to see an interesting effect of the V9938/V9958 VDP, check the 'stress-out' effect of Teachers Terror.

What happens here is that the display alternately shows a correct frame and a frame with the wave effect described above applied. The effect is generated by writing the vdp(18) register while in the vertical blank (which accidentally/intentionally happened in my code):

Note that INT should be called at hook #FD9A.
WRTVDI is the code of bios call WRTVDP (#0047) without the EI and update of the shadow registers at the end.
VDPSTI is the code of subrom call VDPSTA (#????) again without the EI at the end.
Also note that this is very old code and at that time I never had any courses in how you should program and make code readable Wink

DISCLAIMER: Most emulators cannot display this effect. Use a real MSX2 or above

;----------------------------------------------------------------------------
INT:
        LD      A,1
	CALL	VDPSTI
        AND     1
        JP      NZ,LININT
        IN      A,(#99)
        AND     A
        JP      M,H_TIMI
        RET
LININT:
        LD    A,2
        OUT   (#99),A
        LD    A,#8F
        OUT   (#99),A
        LD    A,(COUNT)
        AND   A
        JP    Z,VE
        LD    HL,COUNT1
        DEC   (HL)
        JP    NZ,VE
        LD    (HL),212
        XOR   A
        LD    (COUNT),A
        LD    HL,SINUS
        LD    (LINPNT),HL
VE:
        LD    B,212
        LD    HL,(LINPNT)
LINLP:
LIN2:
        IN    A,(#99)
        AND   #20
        JP    Z,LIN2
        LD    A,(HL)
        CP    #FF
        JP    NZ,LINNEW
        LD    A,1
        LD    (COUNT),A
        LD    HL,SINUS
        LD    A,(HL)
LINNEW:
        OUT   (#99),A
        LD    A,#92
        OUT   (#99),A
        INC   HL
        DJNZ  LINLP
        LD      A,(#F3DF)
        LD      B,A
        LD      C,0
	CALL	WRTVDI
        XOR     A
	JP	VDPSTI
LINPNT: DW    SINUS
COUNT:  DB    0
COUNT1: DB    212
H_TIMI:
        CALL    FDINT
        CALL    MUSINT
        LD      HL,(LINPNT)
        INC     HL
        LD      (LINPNT),HL
        XOR     A
        OUT     (#99),A
        LD      A,#93
        OUT     (#99),A
        LD      A,(#F3DF)
        OR      #10
        OUT     (#99),A
        LD      A,#80
        OUT     (#99),A
        RET
Page 1/4
| 2 | 3 | 4