English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 04 December 2020, 17:03   #1
litwr
Registered User
 
Join Date: Mar 2016
Location: Ozherele
Posts: 229
SetRGB4 bug on the A1200

I am curios, am only I so "lucky" that have to face this bug? The documentation about SetRGB4 claims that only 4 bits of d1-d3 registers are used. It is true for the A500 but it is not true for the A1200. I have to use
Code:
and.b #15,d1
and.b #15,d2
and.b #15,d3
to force this function work correctly. Maybe it is special documentation for the A1200 which I missed?
I will be grateful for more clarifications about this issue.
litwr is offline  
Old 05 December 2020, 05:29   #2
Bruce Abbott
Registered User
 
Bruce Abbott's Avatar
 
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,577
It's worse than you think.

For AGA graphics SetRGB4 converts the color values from 4 bit to 32 bit and then calls SetRGB32. However in KS3.0 (and 3.1, others?) the higher bits are not masked off, so some may 'leak' into the 32 bit value.

The code in the ROM looks like this:-
Code:
swap	d1       
lsl.l	#8,d1         ; 4 bit value now in d1 bits 27-24
move.l	d1,d4         ; copy to d4
lsl.l	#4,d4         ; shift the copy into d4 bits 31-28 
or.l	d4,d1         ; combine to get 8 bit value in d1 bits 31-24
The idea is that the 4 bit color channel value gets converted to the 'closest' 8 bit value in the upper 8 bits, eg. $00000001 -> $01000000 | $10000000 = $11000000. However the higher bits are not masked off and remain in d1 and d4, so if the '4 bit' value is eg. $80000081 you get $81000000 | $18000000 = $9900000, a vastly different color!

To prevent this you must ensure that bits 31-28 and 7-5 are cleared when calling SetRGB4. So to be safe you should do eg.
Code:
moveq  #15,d4
and.l  d4,d1
and.l  d4,d2
and.l  d4,d3
Bruce Abbott 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
WinUae 4.4.0 - Action replay bug/ Load Config bug Dan support.WinUAE 2 20 July 2020 07:59
Bug I think... NLS support.WinUAE 8 24 July 2017 22:09
Bug in x64 file requester and bug in Blizzard PPC ROM filesize headkase support.WinUAE 5 26 June 2016 14:17
Hardware to fix A1200 PCMCIA reset bug Calgor support.Hardware 13 27 December 2011 14:27
Bug??: Sound Left/Right flipped for A1200 and setting is not saveable rsn8887 support.WinUAE 3 03 November 2006 17:40

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 01:00.

Top

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