RE: [stella] VBLANK or VSYNC first?

Subject: RE: [stella] VBLANK or VSYNC first?
From: Nicolás Olhaberry <nolh@xxxxxxxxxxxxx>
Date: Sat, 23 Oct 1993 08:08:11 -0300
----- Original Message -----
From: ben <ben@xxxxxxxx>
To: <stella@xxxxxxxxxxx>
Sent: Tuesday, October 23, 2001 5:25 AM
Subject: Re: [stella] VBLANK or VSYNC first?


> Am I not understanding the latch, ie D6 of VBLANK?  help :)

If 1 is written to D6 the latches for both joystick buttons will be enabled,
if 0 is written, both will be disabled. On both cases the latch value will
be 1.

When a latch is enabled, instead of reading the joystick value on bit 7 (0
if pressed, 1 if not) you will read the latch value. This value will be 1
until you press the button, then it will be 0 (were it will remain until you
write to VBLANK again). Notice that pressing a jostick button will set to 0
its respective latch, but not the other.

> My starting code reference had this:
>
> case VBLANK:
> if (!(data & 0x02))
> {
> TIA_vblank = 0;
> }
> else if (data & 0x02)
> {
> TIA_vblank = 1;
> }
>
> Which one is correct?

Your code looks right to me, VBLANK is activated writing 1 to bit 1 (which
means the display output is disabled). You can do the same with one line:

case VBLANK:
    TIA_vblank = data & 0x02;


> Anyways, for syncing, here is what I am trying to achive - note that my
> emulation clock just keeps going, like the TIA output, so on:
> *WSYNC - 'spin' until the next scanline (resync)

If the execution of the opcode that writes WSYNC ends on cicle 76 (which is
cicle 0 from next scanline) you shouldn´t "spin", otherwise some of games
will look very bad ;-)

> *VSYNC - 'spin' until the start of next frame (resync)

I´m not sure if I understood what you want to do here, but the only way to
start a new frame is using vsync, the beam won´t reposition by itself no
matter how many scanlines have passed. So when VSYNC is turned off you
should restart the scanline counter, but not the beam counter. Also, I think
you should activate TIA_vblank while VSYNC is on  ( I would like a
confirmation on this subject).

> *VBLANK - dont draw the current line if set, no matter where it is (no
resync)

You shouldn´t draw the pixels that pass while VBLANK is enabled, instead of
the whole scanline.


Hope this helps...

                    Nicolás.






-
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

Current Thread