
New Project
Moderator: Moderators
In short, you use AND to clear bits, ORA to set bits, and EOR to invert bits.
You can also use ASL/LSR/ROL/ROR to move a bit into the carry flag and check the carry flag (BCC/BCS), and using BPL/BMI is a common trick to check the state of the highest bit (even without any other operation, after an LDA is fine, such as you see with the common LDA $2002 / BPL loop)
You can also use ASL/LSR/ROL/ROR to move a bit into the carry flag and check the carry flag (BCC/BCS), and using BPL/BMI is a common trick to check the state of the highest bit (even without any other operation, after an LDA is fine, such as you see with the common LDA $2002 / BPL loop)
Some sprites wont show
Some sprites wont show, and i dont see why.
The second set of 6 wont show, is my compiler screwing up, or am I an idiot?
The second set of 6 wont show, is my compiler screwing up, or am I an idiot?
Code: Select all
sprites: ; y tile atr x
.db $10, $00, $01, $10 ; $0200-$0203 Ship left half
.db $10, $01, $01, $18 ; $0204-$0207 Shtp Second Half
.db $10, $03, $01, $20 ; $0208-$020B Bullet
.db $10, $03, $01, $28 ; $020C-$020F Bullet
.db $10, $03, $01, $30 ; $0210-$0213 Bullet
.db $10, $02, $01, $38 ; $0214-$0217 Bullet
.db $10, $02, $01, $40 ; $0218-$021B Bullet
.db $10, $02, $01, $48 ; $021C-$021F Bullet
.db $20, $03, $01, $20 ; $0220-$0223 Bullet
.db $20, $03, $01, $28 ; $0224-$0227 Bullet
.db $20, $03, $01, $30 ; $0228-$022B Bullet
.db $20, $02, $01, $38 ; $022C-$022F Bullet
.db $20, $02, $01, $40 ; $0230-$0233 Bullet
.db $20, $02, $01, $48 ; $0234-$0237 Bullet
- cpow
- NESICIDE developer
- Posts: 1099
- Joined: Mon Oct 13, 2008 7:55 pm
- Location: Minneapolis, MN
- Contact:
Re: Some sprites wont show
The data looks OK to me, how about pasting the code that's putting it in RAM and DMAing (or copying via $2003/$2004 perhaps) it to the PPU?dsv101 wrote:Some sprites wont show, and i dont see why.
The second set of 6 wont show, is my compiler screwing up, or am I an idiot?
Open the ROM in Nintendulator (or some other debugger with PPU viewer) and see if the sprites appear in the sprite list. If not, single step through your code to find out why.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Code: Select all
LoadPalettes:
LDA $2002
LDA #$3F
STA $2006
LDA #$00
STA $2006
LDX #$00
LoadPalettesLoop:
LDA palette, x
STA $2007
INX
CPX #$20
BNE LoadPalettesLoop
LoadSprites:
LDX #$00
LoadSpritesLoop:
LDA sprites, x
STA $0200, x
INX
CPX #$20
BNE LoadSpritesLoop
LDA #%10000000
STA $2000
LDA #%00010000
STA $2001
~Yeah, I Said That
- cpow
- NESICIDE developer
- Posts: 1099
- Joined: Mon Oct 13, 2008 7:55 pm
- Location: Minneapolis, MN
- Contact:
Where's the:
There's only code there to set up the sprite RAM area. Not that that is the problem...it's just hard to tell what might be wrong with only snippets.
EDIT: Nevermind in this case the problem is obvious after looking again:
You have way more than 32 bytes of sprite data...so you're cutting off the copy loop too early.
Code: Select all
lda #2
sta $4014
EDIT: Nevermind in this case the problem is obvious after looking again:
Code: Select all
LoadSpritesLoop:
LDA sprites, x
STA $0200, x
INX
CPX #$20
BNE LoadSpritesLoop
Do you see the "cpx #$20" line? That controls how many bytes you are loading into your sprite RAM. $20 is 32 in decimal, or 8 sprite's worth of data. You have 56 bytes of data for 14 sprites. So change the "cpx #$20" to "cpx #56" and it should all work.
Each time you add or remove sprites from that table you'll need to change that line. Sounds like a great use for an EQU statment.
Example:
That way you'll only have to change the EQU line and not have to go hunting through your code.
Got ninja'ed, but yea
Each time you add or remove sprites from that table you'll need to change that line. Sounds like a great use for an EQU statment.
Example:
Code: Select all
.equ sprite_data_length 56
; 56 bytes of sprite data
; ...In your loading loop...
cpx #sprite_data_length
Got ninja'ed, but yea