English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Asm / Hardware (http://eab.abime.net/forumdisplay.php?f=112)
-   -   Correctly setting up an interlace screen (http://eab.abime.net/showthread.php?t=99668)

roondar 15 November 2019 16:54

Correctly setting up an interlace screen
 
I have a small question: how do you correctly set up an interlaced screen in a HW banging no OS present situation?

That is, I know which bits to set in BPLCON0 and I do get an interlaced screen, but when testing sometimes it appears the 'order' of the fields is wrong and other times it's correct (meaning sometimes WinUAE shows a distorted screen where the odd and even lines seem to be mixed up, other times running the very same code it shows correctly). This leads me to suspect I'm missing something about how to correctly initialize an interlaced screen.

My code always shows the bitmap containing the even lines on the first frame (0,2,4, etc), the bitmap containing the odd lines on the second - and then repeats this forever. Is there something else I should be doing? Am I supposed to check what kind of field the Amiga is "in" first? If so, how do I do this?

As I'm not at my development PC I don't have the code on hand so I'm first asking for the correct procedure :)

hooverphonique 15 November 2019 17:10

Yes, to get the field sync correct, you need to set your bpl pointers according to if you're currently in the long or short field.

IIRC, you can read bit 15 of VPOSR to check for long frame (LOF).

Antiriad_UK 15 November 2019 17:13

I've only ever done it once in a demo when I was 16, but looks like I setup two copperlists for long and short frames and then before starting it for the first time I found this snippet of code which looks to be what hooverphonique says

Code:

.ll        move.w        vposr(a5),d0
        btst        #15,d0
        beq        .ll

        Move.l        #titleCopperlist1,Cop1lch(a5)
        Move.w        #0,Copjmp1(a5)                ;Start copper1

I doubt I got it right at the time but it looks ok when I play the demo. There's _zero_ comments in this code, wtf was I thinking. I was going "bit 15 eh" before read previous reply :)

roondar 15 November 2019 17:30

Thanks for the info, I'll make the required changes to do this :great

One follow-up question: do either of you know where this is documented (I assume it's in the HRM and I just missed it), as I'd like to know where to find stuff :)

hooverphonique 15 November 2019 17:32

Check the HRM for VPOSR ;)

Edit: http://amigadev.elowar.com/read/ADCD.../node0045.html

Antiriad_UK 15 November 2019 17:48

Looks like I found it on page 110 of Amiga System Programmers Guide. Doesn't seem explicitly spelled out in HKRM 1.3.

ross 15 November 2019 18:26

A little warning: the messed up display could be from a previous frame ended-up in a last short frame.
Remember that the LACE bit in BPLCON0 is a toggle (if 1, change LOF bit on next frame).

So the better and most effective way is to force the very first laced long frame with a write to VPOSW.
A
move.w #$8000,$dff02a
do the job.

ross 15 November 2019 19:00

This:
Quote:

Originally Posted by Antiriad_UK (Post 1359241)
Code:

.ll        move.w        vposr(a5),d0
        btst        #15,d0
        beq        .ll

        Move.l        #titleCopperlist1,Cop1lch(a5)
        Move.w        #0,Copjmp1(a5)                ;Start copper1


can end in a infinite loop :)

If you start on progressive (default LOF) then someone setup an interlace screen and badly exit to progressive on short frame..

Antiriad_UK 15 November 2019 22:45

I blame my younger self ;) noted

Edit: And from reading the recent threads from Toni about using copjmp from CPU I'd be scared :)

sandruzzo 18 November 2019 15:54

Quote:

Originally Posted by ross (Post 1359260)
A little warning: the messed up display could be from a previous frame ended-up in a last short frame.
Remember that the LACE bit in BPLCON0 is a toggle (if 1, change LOF bit on next frame).

So the better and most effective way is to force the very first laced long frame with a write to VPOSW.
A
move.w #$8000,$dff02a
do the job.

This setting must be done every frames, or just the first time, before entering the main loop?

ross 18 November 2019 18:03

Quote:

Originally Posted by sandruzzo (Post 1359799)
This setting must be done every frames, or just the first time, before entering the main loop?

Just in very first frame (to set up a definite start for successive frames).
Then the LACE auto-toggle bit do the work for you.

dodke 18 November 2019 19:07

I think it might also be safest to reset the long frame bit and set the primary and secondary copperlists in the vblank to make sure the bit is not toggled before your copperlist starts. Also remember to test that it works from both an interlaced and non-interlaced WB screens.


All times are GMT +2. The time now is 14:21.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.

Page generated in 0.04254 seconds with 11 queries