English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 16 July 2017, 12:17   #1
earok
Registered User

 
Join Date: Dec 2013
Location: Auckland
Posts: 1,826
Updating part of a CopperList's palette? (DisplayLibrary)

Is there a simple way of replacing a couple of colours on the Palette of a copper list, rather than replacing the entire Palette with DisplayPalette? (the colour-offset parameter in DisplayPalette seems to copy from an offset in the Palette, not an offset into the copper list)
earok is offline  
Old 16 July 2017, 23:09   #2
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,640
DisplayRGB Coplist#, Register, line, r, g, b, [copoffset]
CustomColors Coplist#, CCOffset, YPos, Palette, startcol, numcols, [thru256flag]
idrougge is offline  
Old 24 July 2017, 09:07   #3
earok
Registered User

 
Join Date: Dec 2013
Location: Auckland
Posts: 1,826
Quote:
Originally Posted by idrougge View Post
DisplayRGB Coplist#, Register, line, r, g, b, [copoffset]
CustomColors Coplist#, CCOffset, YPos, Palette, startcol, numcols, [thru256flag]
Cheers.. I'm not using up any copper space currently so that's probably the easiest way to do things
earok is offline  
Old 29 August 2018, 02:49   #4
earok
Registered User

 
Join Date: Dec 2013
Location: Auckland
Posts: 1,826
I ended up writing my own solution for what I wanted to do (replace colors 32-47 on an AGA copperlist, which I'm using for sprite colors). This is a very niche implementation, but I'm posting it here on the off chance it's of any help.

In brief, I have a "Sprite Palette" object for holding the 24 bit RGB values (split into upper and lower parts), which I fill with a regular Blitz palette object. I then paste that into the part of the copper list that sets colors 32-47

Code:
NEWTYPE .SpritePalette
	UpperRGB.w[16]
	LowerRGB.w[16]
End NEWTYPE

Statement FillSpritePalette{*SP.SpritePalette,PaletteIndex}
	PaletteInfo PaletteIndex
	for i = 0 to 15
		UpperRed = (AGAPalRed(i) LSR 4) LSL 8
		UpperGreen = (AGAPalGreen(i) LSR 4) LSL 4
		UpperBlue = (AGAPalBlue(i) LSR 4)

		LowerRed = (AGAPalRed(i) & $f) LSL 8
		LowerGreen = (AGAPalGreen(i) & $f) LSL 4
		LowerBlue = (AGAPalBlue(i) & $f)

		*SP\UpperRGB[i] = UpperRed | UpperGreen | UpperBlue
		*SP\LowerRGB[i] = LowerRed | LowerGreen | LowerBlue		
	next
End Statement

Statement UseSpritePalette{*SP.SpritePalette,CopperList}

	*cl.coplist = Addr CopList(CopperList)
	offset.l = *cl\colors + 270
	for i = 0 to 15
		Poke.w offset.l, *SP\UpperRGB[i]
		Poke.w offset.l+132, *SP\LowerRGB[i]
		offset + 4
	next

End Statement
earok 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
The proper way of disabling a sprite? (Using DisplayLibrary) earok Coders. Blitz Basic 6 05 June 2018 10:36
Copperlist optimizations for my tutorial #4 Vikke Coders. Asm / Hardware 3 23 March 2013 22:29
Modifying a copperlist CmdrVimes Coders. General 5 06 September 2010 12:08
Setting up a copperlist oRBIT Coders. General 5 08 April 2010 14:18
Error in copperlist? Nyarlathotep support.WinUAE 7 12 August 2003 23:44

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 15:22.


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