It is currently Tue Nov 13, 2018 10:46 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Sprite 0 Bug
PostPosted: Sun Sep 23, 2018 1:48 pm 
Offline

Joined: Sun Sep 23, 2018 1:33 pm
Posts: 3
So, I just got done rewriting my code, so that it could fix a few problems with the code (mainly adding stuff to the NMI), until I got to a section where it uses a sprite 0 split, instead of splitting the screen like it did before so it could show a dialogue box and the background, it's now pushing down the background, so it can display the box. It's a little hard to explain, so here's a drawing of it:

Background:
\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ _________________\
\ _________________\
\ _________________\
\ _________________\
\ _________________\
\ _________________\
\ _________________\
\\\\\\\\\\\\\\\\\\\\\\\\\\\

Before with the box:
---------------------------
|__________________|
|__________________|
---------------------------
\ _________________\
\ _________________\
\ _________________\
\ _________________\
\\\\\\\\\\\\\\\\\\\\\\\\\\\

Now with the box:

---------------------------
|__________________|
|__________________|
---------------------------
\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ _________________\
\ _________________\
\ _________________\
\ _________________\

I hope you guys understand what I mean


Top
 Profile  
 
 Post subject: Re: Sprite 0 Bug
PostPosted: Sun Sep 23, 2018 2:01 pm 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 415
It looks like you're setting the Y-scroll to 0 at the sprite 0 hit. That's not what you want. Set the scroll to the background position you want to see.


Top
 Profile  
 
 Post subject: Re: Sprite 0 Bug
PostPosted: Sun Sep 23, 2018 3:43 pm 
Offline

Joined: Sun Sep 23, 2018 1:33 pm
Posts: 3
That only seems to move the box around, which is not what I meant (unless I'm doing it wrong).


Attachments:
File comment: Here is how it looks.
wrong.png
wrong.png [ 13.02 KiB | Viewed 2048 times ]
File comment: And here's how it should look, and how it looked before.
right.png
right.png [ 12.66 KiB | Viewed 2048 times ]
Top
 Profile  
 
 Post subject: Re: Sprite 0 Bug
PostPosted: Sun Sep 23, 2018 4:50 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1440
It would help to explain exactly what your code is doing - from your description, I can only assume that you're doing a pair of writes to $2006 to point the VRAM address at the beginning of a nametable and then trying to set X/Y scroll using $2005, something which will not work because vertical scroll only updates once per frame (unless you use special tricks, like those described on the PPU scrolling wiki page).

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject: Re: Sprite 0 Bug
PostPosted: Sun Sep 23, 2018 5:19 pm 
Online
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10959
Location: Rio de Janeiro - Brazil
It would really help if you could show us what the code around the sprite 0 hit detection looks like.


Top
 Profile  
 
 Post subject: Re: Sprite 0 Bug
PostPosted: Sun Sep 23, 2018 5:24 pm 
Offline

Joined: Sun Sep 23, 2018 1:33 pm
Posts: 3
Thanks! It works now!
I've removed the $2006 writes and that was the problem! :D

Here's how it was

Code:
NMI
   lda #$00
   sta $2006
   sta $2006   
   sta $2005
   sta $2005   

;other NMI stuff       

sprite0
   lda #$40
.waitnospr0
   bit $2002
   bvs .waitnospr0
.waitspr0
   bit $2002
   bvc .waitspr0   
   ldx #$00
.waitscan
   inx
   cpx #$78
   bne .waitscan
   ldx #$00
   lda #$00
   sta $2006
   sta $2006   
   lda scrollh
   sta $2005
   lda scrollv
   sta $2005   
   rts


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: tokumaru and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group