English Amiga Board


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

 
 
Thread Tools
Old 10 March 2023, 11:01   #1
Brick Nash
Prototron
 
Brick Nash's Avatar
 
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
V-Flip Blit question

Hi all,

I've been trying to flip a Bob vertically, and I'm almost there, but as you can see from the picture the colours are wrong.



Below are the tables I use to Blit an image to the screen. Each line is a horizontal slice of W-nn*H-16, all of which are stacked to make the image.
  • The first LongWord is the address of the slice on the source Bitmap.
  • The next two Words are H-Flip offsets for the slice (R & L)
  • The next two Words are Source and Destination Modulos
  • The final Word is the Blitsize.

DMO (Dest Modulo) is just the width of the Bitmap screen in bytes, and the width of the slice is subtracted. DMO changes when the screen width changes, so Bob tables don't need to be re-calculated (for when I was experimenting with screen sizes).

As you can see, I'm subtracting a negative slice width from DMO, but it's not quite there.

Any suggestions?

Many thanks!

Code:
FLIPPED IMAGE

	if 1=1
GUY_STANCE:			
	dc.w	$0000,$0000,VOS0+2,VOS0+2,$0022,-06-DMO,$1003
	dc.w	$0000,$0004,VOS1+4,VOS1+2,$0020,-08-DMO,$1004
	dc.w	$0000,$000A,VOS2+4,VOS2+4,$001E,-10-DMO,$1005
	dc.w	$0000,$0012,VOS3+4,VOS3+2,$0020,-08-DMO,$1004
	dc.w	$0000,$0018,VOS4+4,VOS4+2,$0020,-08-DMO,$1004
	dc.w	$0000,$001E,VOS5+4,VOS5+2,$0020,-08-DMO,$1004
	;---------------------------------------------------	
;	dc.w	$0000,$000C,$0000,$0000,$0024,DMO-04,$1002		; XY ORIGIN	
	;---------------------------------------------------
	dc.w	-1												; -1 Terminates count
	endif
	
UNFLIPPED IMAGE

	if 1=0
GUY_STANCE:			
	dc.w	$0000,$0000,VOS6+2,VOS6+2,$0022,DMO-06,$1003
	dc.w	$0000,$0004,VOS5+4,VOS5+2,$0020,DMO-08,$1004
	dc.w	$0000,$000A,VOS4+4,VOS4+4,$001E,DMO-10,$1005
	dc.w	$0000,$0012,VOS3+4,VOS3+2,$0020,DMO-08,$1004
	dc.w	$0000,$0018,VOS2+4,VOS2+2,$0020,DMO-08,$1004
	dc.w	$0000,$001E,VOS1+4,VOS1+2,$0020,DMO-08,$1004
	;---------------------------------------------------	
;	dc.w	$0000,$000C,$0000,$0000,$0024,DMO-04,$1002		; XY ORIGIN	
	;---------------------------------------------------
	dc.w	-1												; -1 Terminates count
	endif
Brick Nash is offline  
Old 10 March 2023, 11:30   #2
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
If you're trying to do interleaved blits with reverse modulo, the bitplane order will be reversed. Try non-interleaved blitting.
Samurai_Crow is offline  
Old 10 March 2023, 15:00   #3
Brick Nash
Prototron
 
Brick Nash's Avatar
 
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
Quote:
Originally Posted by Samurai_Crow View Post
If you're trying to do interleaved blits with reverse modulo, the bitplane order will be reversed. Try non-interleaved blitting.
Ok thanks, I'll give that a try.
Brick Nash is offline  
Old 10 March 2023, 15:48   #4
LeCaravage
Registered User
 
LeCaravage's Avatar
 
Join Date: May 2017
Location: AmigaLand
Posts: 459
Interesting problem. I didn't turn things over in my head, so I could be wrong, but I see no reason why the blit does not work. Did you point $dff054 to the last interleaved bitplan ? And did you put negative modulos for source & destination ?
Do you blit each line or the whole bob in one pass ?

Last edited by LeCaravage; 10 March 2023 at 16:09.
LeCaravage is online now  
Old 10 March 2023, 17:56   #5
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
If you single-blit interleaved:
a0b0c0d0 a1b1c1d1 a2b2c2d2 => d2c2b2a2 d1c1b1a1 d0c0b0a0 (wanted: a2b2c2d2...) => lines+planes are flipped
If you single-blit non-interleaved:
a0a1a2 b0b1b2 c0c1c2 d0d1d2 => d2d1d0 c2c1c0 b2b1b0 a2a1a0 (wanted: a2a1a0...) => lines+planes are flipped
If you only want the lines flipped you have to do multiple blits, each plane separately, because single-blit modulo can't handle it.
a/b is online now  
Old 11 March 2023, 23:05   #6
buzzybee
Registered User
 
Join Date: Oct 2015
Location: Landsberg / Germany
Posts: 526
Exactly, the sequence of bitplanes does not work anymore when blitting interleaved bitmaps with negative instead of positive modulo. I did a couple of tests some time ago, but only got tile flipping work on the x- and y-axis with CPU assistance.

One possible workaround is to adjust the palette the moment you flip a blitted object. But this is just an edge case that requires the object to use some color registers exclusively.
buzzybee is offline  
Old 13 March 2023, 13:41   #7
Brick Nash
Prototron
 
Brick Nash's Avatar
 
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
Thanks for the advice everyone!

Looks like it's a bust with interleaved bitmaps, but I think I have enough memory to store the flipped frames I need, so all good.

I'm happy that I learned how it worked and what the limitations are anyway.
Brick Nash 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
How to calculate possible blit times? Tigerskunk Coders. Asm / Hardware 32 11 January 2022 08:24
Blitz- cannot blit a shape peceha Coders. Blitz Basic 8 10 April 2021 23:56
16x16 CPU tile flip optimisations mcgeezer Coders. Asm / Hardware 51 20 February 2021 11:54
Blitter flip with interleaved bitplanes (single blit) alpine9000 Coders. Asm / Hardware 4 15 December 2018 04:49
For sale: Cheap Swap Magic 3.6 and flip lid. Brand new! Smiley MarketPlace 1 12 September 2008 19:01

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 19:41.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07422 seconds with 15 queries