English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 15 November 2019, 16:54   #1
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 2,681
Question 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
roondar is online now  
Old 15 November 2019, 17:10   #2
hooverphonique
ex. demoscener "Bigmama"

 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,217
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).
hooverphonique is offline  
Old 15 November 2019, 17:13   #3
Antiriad_UK
OCS forever!

Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 350
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
Antiriad_UK is offline  
Old 15 November 2019, 17:30   #4
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 2,681
Thanks for the info, I'll make the required changes to do this

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
roondar is online now  
Old 15 November 2019, 17:32   #5
hooverphonique
ex. demoscener "Bigmama"

 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,217
Check the HRM for VPOSR

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

Last edited by hooverphonique; 15 November 2019 at 17:51. Reason: add link to HRM
hooverphonique is offline  
Old 15 November 2019, 17:48   #6
Antiriad_UK
OCS forever!

Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 350
Looks like I found it on page 110 of Amiga System Programmers Guide. Doesn't seem explicitly spelled out in HKRM 1.3.
Antiriad_UK is offline  
Old 15 November 2019, 18:26   #7
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,127
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 is offline  
Old 15 November 2019, 19:00   #8
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,127
This:
Quote:
Originally Posted by Antiriad_UK View Post
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..
ross is offline  
Old 15 November 2019, 22:45   #9
Antiriad_UK
OCS forever!

Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 350
I blame my younger self noted

Edit: And from reading the recent threads from Toni about using copjmp from CPU I'd be scared
Antiriad_UK is offline  
Old 18 November 2019, 15:54   #10
sandruzzo
Registered User
 
Join Date: Feb 2011
Location: Italy/Rome
Posts: 1,923
Quote:
Originally Posted by ross View Post
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?
sandruzzo is offline  
Old 18 November 2019, 18:03   #11
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,127
Quote:
Originally Posted by sandruzzo View Post
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.
ross is offline  
Old 18 November 2019, 19:07   #12
dodke
Registered User

 
Join Date: Feb 2018
Location: London / UK
Posts: 104
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.
dodke is offline  
Old 16 April 2020, 17:28   #13
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,242
Hi all.... resurrecting this thread as I'm trying to setup a Hi-Res interlaced screen and it's not working as I would expect.

There's a decent example in the HRM on page 60 which shows how to do this but i'm not getting the desired results, simply put the Bit 15 of VPOSR is not toggling even though I have the LACE bit set in BLTCON0.

Main loop is here...

Code:
START:
.
.
.
	clr.l	FRAME_COUNT

.frame:	
	;bsr	WaitRaster
	
	move.w	INTREQR(a5),d0
	and.w	#$0020,d0
	beq.s	.frame
	move.w	#$0020,INTREQ(a5)
	
	tst.l	FRAME_COUNT
	bne.s	.lof
	move.w #$8000,$dff02a
	nop

.lof:	
	move.w	VPOSR(a5),d0
	bpl.s	.lof1
.lof0:	clr.l	INTERLACE_OFFSET
	clr.w	$100
	bra.s	.f
.lof1:	
	move.l	#$100,INTERLACE_OFFSET
	clr.w	$102
	nop

.f:
	bsr	agdPanScreen
.
.
.
.
	addq.l	#1,FRAME_COUNT
	bra	.frame

And the copper I have going on is....

Code:
>o 978e0
 000978e0: 01fc 0033            ;  FMODE := 0x0033
 000978e4: 0092 0048            ;  DDFSTRT := 0x0048
 000978e8: 0094 00c8            ;  DDFSTOP := 0x00c8
 000978ec: 008e 1da1            ;  DIWSTRT := 0x1da1
 000978f0: 0090 38a1            ;  DIWSTOP := 0x38a1
 000978f4: 0180 0000            ;  COLOR00 := 0x0000
 000978f8: 0182 000a            ;  COLOR01 := 0x000a
 000978fc: 0184 000f            ;  COLOR02 := 0x000f
 00097900: 0186 004b            ;  COLOR03 := 0x004b
 00097904: 0188 0051            ;  COLOR04 := 0x0051
 00097908: 018a 006f            ;  COLOR05 := 0x006f
 0009790c: 018c 0082            ;  COLOR06 := 0x0082
 00097910: 018e 00a0            ;  COLOR07 := 0x00a0
 00097914: 0190 00d7            ;  COLOR08 := 0x00d7
 00097918: 0192 00eb            ;  COLOR09 := 0x00eb
 0009791c: 0194 00f0            ;  COLOR10 := 0x00f0
 00097920: 0196 0112            ;  COLOR11 := 0x0112
 00097924: 0198 0546            ;  COLOR12 := 0x0546
 00097928: 019a 0557            ;  COLOR13 := 0x0557
 0009792c: 019c 0779            ;  COLOR14 := 0x0779
>o
 00097930: 019e 07b3            ;  COLOR15 := 0x07b3
 00097934: 01a0 0960            ;  COLOR16 := 0x0960
 00097938: 01a2 0988            ;  COLOR17 := 0x0988
 0009793c: 01a4 0a00            ;  COLOR18 := 0x0a00
 00097940: 01a6 0000            ;  COLOR19 := 0x0000
 00097944: 01a8 0aad            ;  COLOR20 := 0x0aad
 00097948: 01aa 0b30            ;  COLOR21 := 0x0b30
 0009794c: 01ac 0ba0            ;  COLOR22 := 0x0ba0
 00097950: 01ae 0c00            ;  COLOR23 := 0x0c00
 00097954: 01b0 0c70            ;  COLOR24 := 0x0c70
 00097958: 01b2 0ccb            ;  COLOR25 := 0x0ccb
 0009795c: 01b4 0ea0            ;  COLOR26 := 0x0ea0
 00097960: 01b6 0f00            ;  COLOR27 := 0x0f00
 00097964: 01b8 0f30            ;  COLOR28 := 0x0f30
 00097968: 01ba 0fe0            ;  COLOR29 := 0x0fe0
 0009796c: 01bc 0ff0            ;  COLOR30 := 0x0ff0
 00097970: 01be 0fff            ;  COLOR31 := 0x0fff
 00097974: 2001 ff00            ;  Wait for vpos >= 0x20, , ignore horizontal
                                ;  VP 20, VE 7f; HP 00, HE 00; BFD 1
 00097978: 0100 d204            ;  BPLCON0 := 0xd204
 0009797c: 0102 00ff            ;  BPLCON1 := 0x00ff
>o
 00097980: 0104 0000            ;  BPLCON2 := 0x0000
 00097984: 0108 00f8            ;  BPL1MOD := 0x00f8
 00097988: 010a 00f8            ;  BPL2MOD := 0x00f8
 0009798c: 00e0 0009            ;  BPL1PTH := 0x0009
 00097990: 00e2 7ce0            ;  BPL1PTL := 0x7ce0
 00097994: 00e4 0009            ;  BPL2PTH := 0x0009
 00097998: 00e6 7d20            ;  BPL2PTL := 0x7d20
 0009799c: 00e8 0009            ;  BPL3PTH := 0x0009
 000979a0: 00ea 7d60            ;  BPL3PTL := 0x7d60
 000979a4: 00ec 0009            ;  BPL4PTH := 0x0009
 000979a8: 00ee 7da0            ;  BPL4PTL := 0x7da0
 000979ac: 00f0 0009            ;  BPL5PTH := 0x0009
 000979b0: 00f2 7de0            ;  BPL5PTL := 0x7de0
 000979b4: ffff fffe            ;  Wait for vpos >= 0xff and hpos >= 0xfe
                                ;  VP ff, VE 7f; HP fe, HE fe; BFD 1
                                ;  End of Copperlist

INTERLANCE_OFFSET is simply setting the bitplane pointers to the odd lines.

Code:
agdScreenPosition:
	mulu.w	hScreenScanline(a0),d1		; depth
	move.l	hScreenPointers(a0),a2		; Screen Pointer
	move.l	d1,d5
	move.l	d0,d1
	not.w	d0
	and.l	#$f,d0
	and.l	#$fff0,d1
	lsr.w	#3,d1
	add.l	d1,d5
	mulu.l	#$11,d0	

	add.l	INTERLACE_OFFSET,d5			; Add interlace Offset
	
	move.l	COPPTR_BPLCON1,a1
	move.w	d0,(a1)
	
	move.l	COPPTR_BPL0PTH,a1
	move.w	hScreenPlanes(a0),d7			; d7 = Number of planes
	subq.w	#1,d7	
	lea	hScreenPointers(a0),a0
	move.l	#BPL0PTH<<16,d3
.bp:	move.l	(a0)+,d1
	add.l	d5,d1
	swap	d1
	move.w	d1,d3
	move.l	d3,(a1)+
	add.l	#$2<<16,d3
	swap	d1
	move.w	d1,d3
	move.l	d3,(a1)+
	add.l	#$2<<16,d3	
	dbf	d7,.bp	
	
	rts

What on Earth am I missing???

Any help appreciated, I simply don't get any interlacing going on, it's very strange.

Graeme
mcgeezer is online now  
Old 16 April 2020, 18:13   #14
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,127
Hi Graeme, a little binary is really appreciated to debug it

But.. why in copper list you wait y-pos=$20 and in DIWSTRT you setup $1Dxx?
ross is offline  
Old 16 April 2020, 18:27   #15
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 45
Posts: 24,630
System vblank interrupt is active?
Toni Wilen is offline  
Old 16 April 2020, 21:24   #16
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,242
Hi Ross & Toni,

Thanks for you help...

The link below has the binary assets and source code.

http://109.228.4.199/SuperSprintX.zip

I've installed my own IRQ 3 handler for the Vertical Blank which does very little. In the routine i'm doing a clr.w $100.w so it's easy to hook the debugger into it. I'm expecting that bit 15 is toggled each frame of VPOSR but I'm not seeing that for some reason even though I have the LACE bit set in BLTCON0.

I'll keep looking at it tonight as it's bugging me.

All help very much appreciated.

Thanks,
Graeme

Edit - I should explain, the track image is 512x384, I'm trying to get it fit into a hires interlaced screen....
mcgeezer is online now  
Old 16 April 2020, 21:41   #17
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 45
Posts: 24,630
You clear LACE bit at the end of copper list. Hardware only "checks" LACE bit at the end of field.
Toni Wilen is offline  
Old 16 April 2020, 22:07   #18
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,242
Quote:
Originally Posted by Toni Wilen View Post
You clear LACE bit at the end of copper list. Hardware only "checks" LACE bit at the end of field.
That was it Toni - very much appreciated.

Can't believe that tripped me up.

I'm still not getting the interlaced screen but that's now more to do with me not setting bitplane pointers properly.... most likely.

Graeme
mcgeezer is online now  
Old 25 January 2021, 22:50   #19
KONEY
OctaMED Music Composer

KONEY's Avatar
 
Join Date: Jan 2009
Location: Venice - Italy
Age: 46
Posts: 507
I guess it's OK to post here about a problem with hires laced screens which is puzzling me.

The only way I've been able to display such a screen is by using two copperlists with one feeding its address to the other via COP1LCx so that at each frame they're swapped without any action from the CPU.

It works but... it shouldn't! Because I never tell in my code to point to even or odd lines, just a modulo of 80 for the odd lines!

Well actually it does work on winuae but on real hardware I can tell the flickering is more than it should and a test on A3000, where there should be no flicker at all since it's connected to a multiscan, it flickers as well. Something is missing in the second copperlist, like to point the bitmap 640 pixels forward or something.

Any suggestion?

Here is the code: https://github.com/KONEY/take_em_in_...AKEEMIN_MAIN.s
and this is the quite simple copperlist which is included twice: https://github.com/KONEY/take_em_in_...rlist_common.i

and modified before being pointed with some basic changes:
Code:
__POINT_COPPERLISTS:
	MOVE.L	#COPPER2,D0
	LEA	COPPER1\.CopJumpL,A0
	MOVE.W	D0,(A0)
	LEA	COPPER1\.CopJumpH,A0
	SWAP	D0
	MOVE.W	D0,(A0)
	
	MOVE.L	#COPPER1,D0
	LEA	COPPER2\.CopJumpL,A0
	MOVE.W	D0,(A0)
	LEA	COPPER2\.CopJumpH,A0
	SWAP	D0
	MOVE.W	D0,(A0)

	SWAP	D0
	MOVE.W	#$8000,$DFF02A		; FROM EAB
	MOVE.L	D0,COP1LC	; COP1LCH
	RTS
Thanks!
KONEY is offline  
Old 25 January 2021, 23:06   #20
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 3,127
If you compile it for me I'll take a look

However the most important thing is that for each frame you set the pointers for the bitplanes..

Better do
MOVE.W #$8000,$DFF02A
at the beginning of the absolute first frame (so you have a properly defined first long).

Last edited by ross; 25 January 2021 at 23:15.
ross is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting screen resolution mcgeezer Coders. General 4 13 May 2019 23:09
Setting application screen positions? Sinphaltimus support.Other 2 22 January 2018 03:26
skweek doesn't display the screen correctly ldaneels support.WinUAE 5 04 April 2014 21:10
Problem with Interlace Boot Screen R-TEAM support.FS-UAE 2 25 March 2014 06:58
How to get T2: Arcade Game loading screen to display correctly? MethodGit Coders. General 15 30 July 2012 18:37

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:57.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.14394 seconds with 13 queries