English Amiga Board


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

 
 
Thread Tools
Old 24 November 2018, 01:51   #1
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
AGA Palette... how to implement

So I managed to get a 32 colour RAW image loaded successfully and now I want to try a 256 colour image. I am using the classic Tutankhamen image from DPaint IV AGA. So I exported that image as a 256 colour binary (Raw?) image (non-interleaved) using PicCon.

Now I know the palette has to be done seperately which is pretty damn annoying and a lot more complicated for 256 colour images. Just to be clear I am setting the correct screenmodes for AGA ($0210) so that is all good I think. What I am not setting yet is bplcon3 bit 9 (LOCT) as mentioned here in this old thread:

http://ada.untergrund.net/?p=boardthread&id=37

The image I get is scrambled though because I haven't a clue how to implement this damn palette. Any hints would be appreciated. I have exported the palette from PicCon as a binary palette and also an Asm source which is posted below. Which one is the easiest to use and how do I implement this damn palette with regards to setting this bit 9 in bplcon3??

Surely I don't have to do this by hand?? Would take me hours!

Any help is much appreciated!
Attached Thumbnails
Click image for larger version

Name:	029.png
Views:	156
Size:	24.1 KB
ID:	60924   Click image for larger version

Name:	fs-uae-full-1811240047-02.png
Views:	178
Size:	64.6 KB
ID:	60925  

Last edited by Steve; 24 November 2018 at 01:58.
Steve is offline  
Old 24 November 2018, 05:30   #2
NorthWay
Registered User
 
Join Date: May 2013
Location: Grimstad / Norway
Posts: 839
The easy way is to save palette as 24-bit copperlist. Just lightly edit it (no sections or labels) and include(not incbin) it as part of your copperlist (which is mostly redundant if you don't keep changing the colours - set them just the once).
Alternatively, just include the same copperlist somewhere and loop over it as a "customoffset,value" pair? You'd do the same job the copper does, only just once.
NorthWay is online now  
Old 24 November 2018, 13:11   #3
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
I only just found these palette setting in PicCon. Which do you suggest I use? The 32bit setting?
Attached Thumbnails
Click image for larger version

Name:	030.png
Views:	174
Size:	30.3 KB
ID:	60931  
Steve is offline  
Old 24 November 2018, 13:23   #4
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Steve View Post
I only just found these palette setting in PicCon. Which do you suggest I use? The 32bit setting?
These settings are right.

PicCon also make the BPLCON3 settings for you.
You simply need to incbin in your copper list.
ross is offline  
Old 24 November 2018, 15:30   #5
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Quote:
Originally Posted by ross View Post
These settings are right.

PicCon also make the BPLCON3 settings for you.
You simply need to incbin in your copper list.
Thanks, I seem to have got a bit closer to the correct colours. Looking a bit strange though and it's glitching-out a lot.

I wonder what I'm doing wrong.
Attached Thumbnails
Click image for larger version

Name:	fs-uae-crop-1811241426-02.png
Views:	126
Size:	87.3 KB
ID:	60932   Click image for larger version

Name:	fs-uae-crop-1811241426-01.png
Views:	131
Size:	115.3 KB
ID:	60933   Click image for larger version

Name:	fs-uae-crop-1811241426-03.png
Views:	121
Size:	115.5 KB
ID:	60934   Click image for larger version

Name:	fs-uae-crop-1811241426-04.png
Views:	146
Size:	105.8 KB
ID:	60935  
Steve is offline  
Old 24 November 2018, 16:00   #6
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Right I think I've found the 'source' of the problem (sorry)

Code:
; Work out the bitplane sizes and addresses and pass to the copperlist.
; Bitplane info: 320*256*8. 40 words per line, 256 lines. 320x356/8bits = 10240bytes
; 10240*5=50kb : 2560 longs per bitplane
;
	lea	bp1h,a0			; first bitplane address in the copper
	moveq	#BITPLANES-1,d0		; Number of bitplanes (BTIPLANES EQU 8)
	move.l	#image,d1		; Address of the picture into d1

	setbpl:
		move.w	d1,6(a0)							; bitplane low address pointer
		swap	d1
		move.w	d1,2(a0)							; bitplane high address
		addq.w	#8,a0								; Point to next bitplane
		swap d1
		add.l 	#10240,d1							; 10240 added for next plane
		dbf d0,setbpl								; branch until all bitplanes are copied
I've not updated these calculations yet! Doh! Scratching my head about the formula for 8 bitplanes. Hmmm.

I've tried increasing the value added to $81920 but that makes it look worse. I bet the solution is obvious to someone.
Steve is offline  
Old 24 November 2018, 18:02   #7
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
Probably a silly question, but have you added instructions to set all eight bitplanes to the copperlist? It looks from your screenshot as though at least one bitplane is showing non-image data.
robinsonb5 is online now  
Old 24 November 2018, 18:19   #8
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Quote:
Originally Posted by robinsonb5 View Post
Probably a silly question, but have you added instructions to set all eight bitplanes to the copperlist? It looks from your screenshot as though at least one bitplane is showing non-image data.
Not a silly question at all. It's a very valid question. Probably what I'm missing. Bugger. lol.

I'm only doing 6 bitplanes. I need to look at this. Not too sure about this part. Still learning this stuff.

Code:
mycopper:			
;	dc.w	BPLCON0,$3200					; %0011001000000000 (3 bitplanes - 8 colours)
;	dc.w	BPLCON0,$5200					; %0101001000000000 (5 bitplanes - 32 colours)
	dc.w	BPLCON0,$0210					; %0101001000000000 (8 bitplanes - 256 colours)
	dc.w	BPLCON1,$0000
	dc.w	BPL1MOD,$0000,BPL2MOD,$0000
	dc.w	DIWSTRT,$2C81,DIWSTOP,$2CC1
	dc.w	DDFSTRT,$0038,DDFSTOP,$00D0
bp1h:	dc.w	BPL1PTH,$0000					; Bitplane 1 high bytes register, use offset
bp1l:	dc.w	BPL1PTL,$0000					; Bitplane 1 high value, Bitplane 1 low register
bp2h:	dc.w	BPL2PTH,$0000					; Bitplane 2 high bytes register, use offset
bp2l:	dc.w	BPL2PTL,$0000					; Bitplane 2 high value, Bitplane 1 low register
bp3h:	dc.w	BPL3PTH,$0000					; Bitplane 3 high bytes register, use offset
bp3l:	dc.w	BPL3PTL,$0000					; Bitplane 3 high value, Bitplane 1 low register
bp4h:	dc.w	BPL4PTH,$0000					; Bitplane 4 high bytes register, use offset
bp4l:	dc.w	BPL4PTL,$0000					; Bitplane 4 high value, Bitplane 1 low register
bp5h:	dc.w	BPL5PTH,$0000					; Bitplane 5 high bytes register, use offset
bp5l:	dc.w	BPL5PTL,$0000					; Bitplane 5 high value, Bitplane 1 low register
bp6h:	dc.w	BPL6PTH,$0000					; Bitplane 6 high bytes register, use offset
bp6l:	dc.w	BPL6PTL,$0000					; Bitplane 6 high value, Bitplane 1 low register
Steve is offline  
Old 24 November 2018, 18:23   #9
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Steve View Post
Right I think I've found the 'source' of the problem (sorry)

I've not updated these calculations yet! Doh! Scratching my head about the formula for 8 bitplanes. Hmmm.

I've tried increasing the value added to $81920 but that makes it look worse. I bet the solution is obvious to someone.
No , the calculation is correct. A bitplane is a bitplane, only the numbers of is changed.
But the real question is: have you inserted in copper list the extra bitplane pointers required to update the extra planes?


EDIT: ok posted before I've seen your post above and as guessed the extra bitplane pointers are missing

Insert:
Code:
bp7h:	dc.w	BPL7PTH,$0000
bp7l:	dc.w	BPL7PTL,$0000
bp8h:	dc.w	BPL8PTH,$0000
bp8l:	dc.w	BPL8PTL,$0000
You are lucky the machine have not crashed, overwriting unwanted memory locations with your code.

Last edited by ross; 24 November 2018 at 18:32.
ross is offline  
Old 24 November 2018, 21:36   #10
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Thanks for the help Ross. I'm close I think.

I had to manually add in the new registers to my registers.i file and odd things are happening!

If I add the code like this:

Code:
BPL1PT          equ     bplpt+$00
BPL1PTH         equ     bplpt+$00
BPL1PTL         equ     bplpt+$02
BPL2PT          equ     bplpt+$04
BPL2PTH         equ     bplpt+$04
BPL2PTL         equ     bplpt+$06
BPL3PT          equ     bplpt+$08
BPL3PTH         equ     bplpt+$08
BPL3PTL         equ     bplpt+$0A
BPL4PT          equ     bplpt+$0C
BPL4PTH         equ     bplpt+$0C
BPL4PTL         equ     bplpt+$0E
BPL5PT          equ     bplpt+$10
BPL5PTH         equ     bplpt+$10
BPL5PTL         equ     bplpt+$12
BPL6PT          equ     bplpt+$14
BPL6PTH         equ     bplpt+$14
BPL6PTL         equ     bplpt+$16
BPL7PT          equ     bplpt+$18
BPL7PTH         EQU     bplpt+$18
BPL7PTL         EQU     bplpt+$20
BPL8PT          EQU     bplpt+$22
BPL8PTH         EQU     bplpt+$22
BPL8PTL         EQU     bplpt+$24
Then all I get is a grey screen?? The image is gone completely!

EDIT: Ah okay schoolboy error here. Should be $1A, $1C, $1E rght?? Still doesn't explain why the version below doesn't work.

So if I change the last few lines to this (looks correct this time):

Code:
BPL7PTH         EQU     $0F8
BPL7PTL         EQU     $0FA
BPL8PTH         EQU     $0FC
BPL8PTL         EQU     $0FE
Then I get an image but it is corrupted. Am I missing something here?? I've added the new lines for clearing BPL7 and BPL8 to my copperlist so it should work now shouldn't it? #confused
Attached Thumbnails
Click image for larger version

Name:	fs-uae-crop-1811242030-01.png
Views:	81
Size:	2.1 KB
ID:	60938   Click image for larger version

Name:	fs-uae-crop-1811242027-01.png
Views:	134
Size:	130.0 KB
ID:	60939  
Steve is offline  
Old 24 November 2018, 21:51   #11
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Is you image steady now, isnt it?
Then last bitplanes for some reason is not properly initialized in copper list.
You can attach your code if you want, also a zip archive.
Hard to help you otherwise.
ross is offline  
Old 24 November 2018, 21:56   #12
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
yeah it's steady now. I'll up it the zone for you.
Steve is offline  
Old 24 November 2018, 22:07   #13
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Check tut.raw file dimension

From your code:
; Bitplane info: 320*256*8. 40 words per line, 256 lines. 320x256/8bits = 10240bytes


x8=?
ross is offline  
Old 24 November 2018, 22:20   #14
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Quote:
Originally Posted by ross View Post
Check tut.raw file dimension

From your code:
; Bitplane info: 320*256*8. 40 words per line, 256 lines. 320x256/8bits = 10240bytes


x8=?
Ah, The code was taken from someone else so all the comments are someone else's. I realise the picture is actually 320x200 but wasn't aware I need to change anything? But the display is 320x256 is not? Standard PAL Low Res.

I guess the screenmode has to match the picture resolution. Seems obvious I guess. So I need to open an NTSC screenmode??

Last edited by Steve; 24 November 2018 at 22:28.
Steve is offline  
Old 24 November 2018, 22:28   #15
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Steve View Post
Ah, The code was taken from someone else so all the comments are someone else's. I realise the picture is actually 320x200 but wasn't aware I need to change anything? But the display is 320x256 is not? Standard PAL Low Res.
You have to adapt screen to picture.
File seems to be for a 320x200 picture, your copper code for a 320x256 screen.
So you need a new raw grab for the image or a change in copper values

EDIT:
Quote:
Originally Posted by Steve View Post
EDIT: I guess the screenmode has to match the picture resolution. Seems obvious I guess. So I need to open an NTSC screenmode??
For a 320x200 screen you need DIWSTOP,$F4C1

Actually not an NTSC screen but a restricted 320x200 PAL screen .
If you want real NTSC video signal you need also another register change in addition (and an ECS Agnus because you are in PAL territory).

Last edited by ross; 24 November 2018 at 22:56. Reason: edit
ross is offline  
Old 24 November 2018, 22:41   #16
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Fantastic! It works. Thank you.

I changed the image to a 320x256 one and converted it again to a raw file.

Here is the correct image.

Quote:
EDIT: use DIWSTOP,$F4C1
This didn't work for some reason. Is this to get the original (320x200) file to work?. Would I also need to set some other register for NTSC?
Attached Thumbnails
Click image for larger version

Name:	fs-uae-full-1811242140-01.png
Views:	121
Size:	51.2 KB
ID:	60944  

Last edited by Steve; 24 November 2018 at 22:49.
Steve is offline  
Old 24 November 2018, 22:53   #17
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Steve View Post
I changed the image to a 320x256 one and converted it again to a raw file.


Quote:
This didn't work for some reason. Is this to get the original (320x200) file to work?. Would I also need to set some other register for NTSC?
Yes, for the original file.
See my edit to previous message.

For real NTSC video you need to modify BEAMCON0, but better leave it alone
ross is offline  
Old 24 November 2018, 23:05   #18
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Hmmm. It would be nice to have the original file working with a restricted screen - good stuff to know.

However setting DIWSTOP to $F4C1 isn't working. See image below.

Is this because of the code in post #6?
Attached Thumbnails
Click image for larger version

Name:	fs-uae-full-1811242203-01.png
Views:	106
Size:	120.6 KB
ID:	60946  
Steve is offline  
Old 24 November 2018, 23:09   #19
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
Quote:
Originally Posted by Steve View Post
Is this because of the code in post #6?
Yes. If you resize the picture to something other than 320x256, the add.l #10240,d1 needs to be changed to reflect the new size - otherwise your bitplane pointers will point to something other than picture data
roondar is offline  
Old 24 November 2018, 23:10   #20
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Steve View Post
Hmmm. It would be nice to have the original file working with a restricted screen - good stuff to know.

However setting DIWSTOP to $F4C1 isn't working. See image below.

Is this because of the code in post #6?
Yes, you have a bitplane of 320x200/8bits.

So you need an
add.l #8000,d1
instead.
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
Trying to implement joystick code in my stuff Amiga1992 Coders. General 26 03 June 2018 23:03
implement others 68000 machines ? turrican3 support.WinUAE 28 23 November 2017 00:54
Implement More Option For DirectDraw Mode. Zilog request.UAE Wishlist 4 01 August 2014 09:18
Any plans to implement JIT for PPC OSs? amigafreak68k support.FS-UAE 3 03 January 2014 10:36
Should I implement PM download now ? RCK project.EAB 12 08 January 2002 01:21

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 13:31.

Top

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