Reading the Collision Flag

Do you live and breathe hexadecimal? Do you like speaking to hardware directly?

Moderator: Programming Moderators

Post Reply
johnxmcmanus
Posts: 17
Joined: Mon Aug 07, 2017 8:08 pm

Reading the Collision Flag

Post by johnxmcmanus » Tue Feb 13, 2018 8:46 am

I was wondering how to read if the collision flag has been set.
https://www.specnext.com/sprites/
"
Port 0x303B, if read, returns some information:

Bits 7-2: Reserved, always 0.
Bit 1: max sprites per line flag.
Bit 0: Collision flag.
"


I have done this, but A if set to FF after the IN command. I have not read anything from before so I suspect I a way off, can anyone assist.
(BREAK activate the debugger) Thanks J

checkColl:

ld bc,$303B
in a,(c)
BREAK
cp 1

ret z
BREAK

;further checks then do kill routine
ret

User avatar
chernandezba
Posts: 228
Joined: Mon May 29, 2017 8:14 pm

Re: Reading the Collision Flag

Post by chernandezba » Tue Feb 13, 2018 2:24 pm

It seems the information is not well documented. Please ask the Next team to complete it. The explanation is:

When you read port 303B, bits 0 and 1 are reset to 0. Bit 0 or 1 will be set automatically when max sprites per line or sprites collide
----

ZEsarUX
ZX Second-Emulator And Released for UniX
https://github.com/chernandezba/zesarux

User avatar
chernandezba
Posts: 228
Joined: Mon May 29, 2017 8:14 pm

Re: Reading the Collision Flag

Post by chernandezba » Tue Feb 13, 2018 2:25 pm

Also, you shouldn't do "cp 1" comparation. Better use AND/BIT opcodes
----

ZEsarUX
ZX Second-Emulator And Released for UniX
https://github.com/chernandezba/zesarux

Post Reply