Splitscreen and blitter problems

All 680x0 related coding posts in this section please.

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
Zamuel_a
Atari God
Atari God
Posts: 1238
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Splitscreen and blitter problems

Post by Zamuel_a »

I'm using Timer B to generate a split screen and that's no problem, but when using the blitter at the same time it interfere. The Timer B routine waits for the current line to finish and after that sets the new screen address. The blitter is runned in non HOG mode.
When I run the program the screen jumps down one line when there are many objects on screen, so I guess the blitter makes the Timer B to trigger one line to late. Is there a way to determine which line I am at at the moment so that I can start at one or more lines earlier and depending on which line it actually is, wait for a certain amount of time to get to the correct line, (with the blitter turned off at that time ofcourse)

This is the beginning of the Timer B routine as it looks like now:

Code: Select all

TimerB	bclr	#7,$fffff8a3c.w		;turn off blitter
	move.w	#$2700,sr

	movem.l	d0-d2/a0-a2,-(sp)

	lea	$fffffa21.w,a0
	lea	LINEWID,a1
	move.b	tempLINEWID,d1
	lea	HSCROLL,a2
	move.b	tempHSCROLL,d2

	move.b	(a0),d0			;wait for next line
wait_l	cmp.b	(a0),d0
	beq.s	wait_l

	move.b	d1,(a1)
	move.b	d2,(a2)
	move.b	adrtemp+1,VCOUNTHI
	move.b	adrtemp+2,VCOUNTMD
	move.b	adrtemp+3,VCOUNTLO
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2978
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: Splitscreen and blitter problems

Post by AtariZoll »

You can read video pointer registers - $FF8205-9 , and calculate which line is by subtracting screen base .
Maybe it is a worth to add sync with H-blank for more accurate work.
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.

User avatar
Frank B
Atari God
Atari God
Posts: 1029
Joined: Wed Jan 04, 2006 1:28 am
Location: Boston

Re: Splitscreen and blitter problems

Post by Frank B »

Why not run in hog mode and split the blit up into multiples. That way you can control worst case latency at the expense of throughput

Sent from my Nexus 7 using Tapatalk

Zamuel_a
Atari God
Atari God
Posts: 1238
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Splitscreen and blitter problems

Post by Zamuel_a »

Yes, but I don't have any good control of when the blit will start. Depending on the amount of object on screen, I might finish all of them before the split or some before and some after. I think it would be complicated.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

Zamuel_a
Atari God
Atari God
Posts: 1238
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Splitscreen and blitter problems

Post by Zamuel_a »

You can read video pointer registers - $FF8205-9 , and calculate which line is by subtracting screen base .
I tried this and it seems to work. :D Atleast in STEEM so now I just need to try it on a real machine.
I loose 3 scanlines but it's not to bad since it will sync with the blitter.
I first wait for one scanline to make sure I always start at a new line.
I read the current video counter and subtract my screen address from that to get a relative address. If this is equal or less than the maximum address for this line, I wait two more scanlines so I start on a fresh line for the actual split screen. If the address is higher than it should be (blitter took to much time) I instead wait only one line.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

User avatar
bod/STAX
Atari Super Hero
Atari Super Hero
Posts: 508
Joined: Wed Nov 24, 2004 8:13 pm
Location: Halesowen, West Midlands, England

Re: Splitscreen and blitter problems

Post by bod/STAX »

Oh how this problem brings back memories.

This is what I encountered when trying to make the status display look the same in my version of
R-Type as the arcade version. Changing the video pointer to the status gfx after the playfield and
knocking out the bottom border. I tried all sorts to try and get it to work and to this day still no luck.
So let it be written, So let it be done. I'm sent here by the chosen one.

Zamuel_a
Atari God
Atari God
Posts: 1238
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Splitscreen and blitter problems

Post by Zamuel_a »

I tested it on a real STE and it worked perfectly!

All I did was to trigger the Timer B 2 lines earlier than what I did before and in Timer B:

Code: Select all

TimerB	move.w	#$2700,sr
	bclr	#7,$fffff8a3c.w		;turn off blitter

	movem.l	d0-d2/a0-a2,-(sp)

	lea	$fffffa21.w,a0
	lea	LINEWID,a1
	move.b	tempLINEWIDc,d1
	lea	HSCROLL,a2
	move.b	tempHSCROLLc,d2

	move.b	(a0),d0			;wait for next line
wait_l1	cmp.b	(a0),d0
	beq.s	wait_l1

;now we are at a line that might jump one line depending on the blitter so we need to sync it

	move.b	VCOUNTHI,scr_counter+1	;get current screen address
	move.b	VCOUNTMD,scr_counter+2
	move.b	VCOUNTLO,scr_counter+3
	move.l	scr_counter,d0
	sub.l	scr_addr,d0		;calc were we are
	
	cmp.l	#160*(16-2),d0		;my screen split is 16 pixels down (Timer B trigger at line 15-2), 2 is the lines needed for sync 
	bgt.s	TB1_a

	move.b	(a0),d0			;wait for next line
wait_l2	cmp.b	(a0),d0
	beq.s	wait_l2

TB1_a	move.b	(a0),d0			;wait for next line
wait_l3	cmp.b	(a0),d0
	beq.s	wait_l3

;sync finished and from here we are always at the correct line, (line 16 in this case)
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

Zamuel_a
Atari God
Atari God
Posts: 1238
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Splitscreen and blitter problems

Post by Zamuel_a »

I noticed that this code works on a real machine and on Steem but NOT on Hatari. On Hatari the screen jumps up and down so I guess the 'wait for next line' loops are not working. Om Steem it works, but the blitter seems to be faster (atleast in the non HOG mode) so I never get's the sync problem that I get on a real machine so I can leave this code out totally and it still works, but for test I tried to put in 50 nops at the beginning of the Timer B routine to simulate that it started to late and it synced correctly, so the sync seems to work in Steem, but the blitter / CPU bus toggle seems to be faster than on a real machine.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

User avatar
bod/STAX
Atari Super Hero
Atari Super Hero
Posts: 508
Joined: Wed Nov 24, 2004 8:13 pm
Location: Halesowen, West Midlands, England

Re: Splitscreen and blitter problems

Post by bod/STAX »

I think I'll give this a try later on today...
So let it be written, So let it be done. I'm sent here by the chosen one.

User avatar
Steven Seagal
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2018
Joined: Sun Dec 04, 2005 9:12 am
Location: Undisclosed
Contact:

Re: Splitscreen and blitter problems

Post by Steven Seagal »

I found a possible reason but it seems a big problem if true, could you upload the first version (shifts on real STE) here and tell about how often it happens (does it at level 1? later?) Thx
In the CIA we learned that ST ruled
Steem SSE: http://sourceforge.net/projects/steemsse

Zamuel_a
Atari God
Atari God
Posts: 1238
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Splitscreen and blitter problems

Post by Zamuel_a »

It happens mostly at later levels with many sprites on screen. Like 8-9 or so
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2978
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: Splitscreen and blitter problems

Post by AtariZoll »

Zamual_a: why you need to use blitter in this ? More speed with RAM area copy, or for sprite draw ?
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.

User avatar
Steven Seagal
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2018
Joined: Sun Dec 04, 2005 9:12 am
Location: Undisclosed
Contact:

Re: Splitscreen and blitter problems

Post by Steven Seagal »

Zamuel_a wrote:It happens mostly at later levels with many sprites on screen. Like 8-9 or so
But could you upload the "trouble" version? Thx
In the CIA we learned that ST ruled
Steem SSE: http://sourceforge.net/projects/steemsse

Zamuel_a
Atari God
Atari God
Posts: 1238
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Splitscreen and blitter problems

Post by Zamuel_a »

Zamual_a: why you need to use blitter in this ? More speed with RAM area copy, or for sprite draw ?
In the Giana sisters game I use the blitter to draw all the sprites. First I wait for the bottom border to start. After that I start to restore all backgrounds and draw the new sprites. If there are not to much on screen, the drawing will be finished before the new screen area starts, but with many sprites on screen it will draw until everything is finished and into the visible screen area. So I need to sort all sprites to get drawn in relation to there Y position on screen or else they might be drawn after the electron beam has passed the area they should be drawn at. Since the top of the screen has two screen splits it's very likely that the blitter will be in use when the split should happen and they must sync together.
But could you upload the "trouble" version? Thx
Yes I can make a version there I remove the syncing so it doesn't work on a real machine, but on Steem.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2978
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: Splitscreen and blitter problems

Post by AtariZoll »

That's pretty much unusual way. In most cases screen alternating, and writing to not visible screen is used.
2 splits because slower scrolling of clouds, I guess. Btw, I don't like that clouds have black border - it is not in harmony with other graphic used in game, what is softer. Some less dark grey would be better IMHO .
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.

Zamuel_a
Atari God
Atari God
Posts: 1238
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Splitscreen and blitter problems

Post by Zamuel_a »

That's pretty much unusual way. In most cases screen alternating, and writing to not visible screen is used.
You save some memory by doing it this way and if it's 50fps it works. Now I have alot of free memory since it could use upto 4Mb if wanted to, but why make things easy ;)
Btw, I don't like that clouds have black border
It's the Amiga clouds so didn't try to change that.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

Post Reply

Return to “680x0”