English Amiga Board


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

 
 
Thread Tools
Old 15 April 2018, 12:26   #1
Ozzyboshi
Registered User
 
Join Date: Aug 2017
Location: Italy
Posts: 22
[ASM BEGINNER] Sprite0 does not overlay

Hello EAB coders.
I am currentlly studying the italian ramjam course ( http://corsodiassembler.ramjam.it/ ).
At chapter 7 is stated that sprites are pointed by SPRXPT register (for example $dff120 is sprite0) and they allow to draw simple images OVER bitplanes.

Based on this assumption i created a little test program where only 1 bitplane is activated and pointers BPL1PTH-BPL1PTL point to an area of memory which I inizialized with $DD value in every bytes, total of 40*256 to cover the whole LOWRES PAL screen.

Oddly the sprite is visible only where there there are 0 values on the bitplane (color 0), on the contrary, for bitplanes bits equal to 1, color palette 1 is used instead the one set up for the sprite (from color 17 up to color 19).

Can anybody tell me where I am wrong? According to my text book this cant happen since the sprite is drawn over bitplanes.
Where am I wrong?

My code is available at

https://gist.githubusercontent.com/O...d/spritetest.s

I used devpac 3.04 as an assembler on a stock A600.
I attached also a png screenshot where, if you look closely at the top center of the screen there is my sprite hidden by black bars.

Thanks in advance for your support.
Attached Thumbnails
Click image for larger version

Name:	Schermata-FS-UAE ยท Amiga 1200.png
Views:	111
Size:	3.5 KB
ID:	57863  
Attached Files
File Type: s copperlist.s (6.2 KB, 64 views)
Ozzyboshi is offline  
Old 15 April 2018, 12:34   #2
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Check BPLCON2 value.
ross is offline  
Old 15 April 2018, 12:50   #3
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,209
BPLCON2 controls the sprite / playfield priority... try writing (IIRC) #$24 into BPLCON2

ie. in your copperlist dc.w $104,$0024
DanScott is online now  
Old 15 April 2018, 13:43   #4
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by DanScott View Post
BPLCON2 controls the sprite / playfield priority... try writing (IIRC) #$24 into BPLCON2

ie. in your copperlist dc.w $104,$0024
Dan, do not give him directly the solution otherwise he will not learn
ross is offline  
Old 15 April 2018, 14:14   #5
Ozzyboshi
Registered User
 
Join Date: Aug 2017
Location: Italy
Posts: 22
Ok you guys nailed it, with setting dff104 to hex 24 works as I wanted but... why?

In other words you told me to set PF2P2 and PF1P2 ON.
Since I use one playfield only I expected that setting PF1P2 on was enough but.. actually it's PF2P2 that it's forcing the sprite to be on top.

Then I found this document:
http://amigadev.elowar.com/read/ADCD.../node0159.html

that states:
Be careful:
-----------
PF2P2 - PF2P0, bits 5-3, are the priority bits for normal (non-dual)
playfields.

According to this, since I use a single playfield mode, all I really need is to set PF1P2, is it correct?


Quote:
Originally Posted by DanScott View Post
BPLCON2 controls the sprite / playfield priority... try writing (IIRC) #$24 into BPLCON2

ie. in your copperlist dc.w $104,$0024
Ozzyboshi is offline  
Old 15 April 2018, 15:04   #6
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Ozzyboshi View Post
According to this, since I use a single playfield mode, all I really need is to set PF1P2, is it correct?
No, PF2P2 - PF2P0, bits 5-3, are the priority bits for normal playfields (like you have written above).
Also doesn't hurt setting valid priority for PF2PRI and PF1P2 - PF1P0.
You can experiment strange value to make special effect but this is an advanced topic.
ross is offline  
Old 15 April 2018, 20:45   #7
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
Quote:
Originally Posted by Ozzyboshi View Post
Hello EAB coders.
I am currentlly studying the italian ramjam course ( http://corsodiassembler.ramjam.it/ ). [...]
Thanks for the link ! Amazing lecture !
Back in the 80' a really well known French humorist (of Italian origin from his father) said in a sketch that he was able to speak some foreign language... "under torture" .
For such RamJam reading I am sure I can read Italian .
Edit: If you read the sketch : "Lisieux" is a place in France but sounding may be like "les yeux" (the eyes), so when it's said "il vous reste Lisieux pour pleurer" you have to understand "you still have your eyes to cry". It's kind of black humour

Last edited by malko; 15 April 2018 at 20:52.
malko is offline  
Old 15 April 2018, 21:12   #8
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Il est temps de changer Canton

Un saluto ai vecchi amici in RamJam.

It's always nice to see new users approaching assembly/metal programming.
ross is offline  
Old 15 April 2018, 22:57   #9
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
I have other UK books to finish first.
Anyway this IT one is definitively in my list
(but damn, +1800 pages... it's a huge one for a non IT speaker guy... Fortunately FR & IT have a common Latin base. If I forgot to be dumb, I will manage to understand a bit )
malko is offline  
Old 16 April 2018, 11:55   #10
Ozzyboshi
Registered User
 
Join Date: Aug 2017
Location: Italy
Posts: 22
Ok let me try again , I read some stuff and now I think I have a better understanding about sprite/bitplanes priorities:

$DFF104 (BPLCON2) among other things lets you define if the sprites must be printed under or over playfields.
To do this it uses bits from 0 to 5 (6 in total), bits 0-1-2 are fiags that contain the priority against playfield1, the others 3-4-5 against playfield2.

Assuming that:
- Playfield 1 uses odd bitplanes (1-3-5) and Playfield 2 uses even bitplanes (2-4-6).
- My amiga has 8 sprites registers

In my asm code i set $dff100 (BPLCON0) in a way that uses one bitplane only setting bit 12 (BPU0) to 1.Dual playfield mode is disabled because the tenth bit of bplcon0 is 0.

Since dual playfield mode is disabled, to achieve sprites over playfield I oddly must set PF1PX bits and PF2PX.Yesterday i was assuming that PF1PX were enough because I am using bitplane 1 only which is ODD and so It must be referred to playfield 1.

On the contrary in dual playfield mode i would have set PF1PX for declaring sprite priority related to odd bitplanes (playfield 1) and PF2PX for even bitplanes (playfield 2).

Now the question is, how to set PF1PX and PF2PX?
First of all I noticed that sprites are always shown over the playfield zeros, so if the bitplane is filled with zeros the sprite must be completely visible.
If the bitplane's bits are not zero, PFXPX bits of bplcon2 are questioned.
if PFXP(0-2) is 000 - playfield is over all the sprites
if PFXP(0-2) is 001 - playfield is over sprites from 2 to 7 (but not 0-1)
if PFXP(0-2) is 010 - playfield is over sprites from 4 to 7 (but not from 0 to 3)
if PFXP(0-2) is 011 - playfield is over sprites from 6 to 7 (but not from 0 to 5)
if PFXP(0-2) is 100 - all sprites are always over the playfield
if PFXP(0-2) is 101 - I don't know
if PFXP(0-2) is 110 - I don't know
if PFXP(0-2) is 111 - I don't know

Now I realize why you told me to write #$24 (binary 100100).
In this way you told me to put all sprites over the playfield, actually in this case, since i am using only one sprite and this prites belongs to the first couple, you could have suggested something like

dc.w $104,$0009

I'd like to know from you if all of this makes sense or not.If not I have to start over my research again.
Feel free to fill in the "I don't know" I put on the PFXPX use cases.
Thanks a lot for your help.


Quote:
Originally Posted by ross View Post
No, PF2P2 - PF2P0, bits 5-3, are the priority bits for normal playfields (like you have written above).
Also doesn't hurt setting valid priority for PF2PRI and PF1P2 - PF1P0.
You can experiment strange value to make special effect but this is an advanced topic.
Ozzyboshi is offline  
Old 16 April 2018, 11:58   #11
Ozzyboshi
Registered User
 
Join Date: Aug 2017
Location: Italy
Posts: 22
Dont be scared of the 1800 pages, they are very repetitive and contains a lot of code.
I am a native italian speaker if you have trouble translating in your language feel free to contact me, we can use english as a bridge language, my french is very poor.


Quote:
Originally Posted by malko View Post
I have other UK books to finish first.
Anyway this IT one is definitively in my list
(but damn, +1800 pages... it's a huge one for a non IT speaker guy... Fortunately FR & IT have a common Latin base. If I forgot to be dumb, I will manage to understand a bit )
Ozzyboshi is offline  
Old 16 April 2018, 17:08   #12
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
Thanks !
malko 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
Tool to convert asm to gnu asm (gas) Asman Coders. Asm / Hardware 13 30 December 2020 11:57
Absolute beginner! JonniR New to Emulation or Amiga scene 8 25 February 2012 21:49
Beginner need help. thexfilez New to Emulation or Amiga scene 7 23 August 2009 10:35
Not even a beginner yet.... coustasse New to Emulation or Amiga scene 18 13 December 2007 15:01
Help! Beginner Chris743 New to Emulation or Amiga scene 1 28 June 2002 20: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 15:19.

Top

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