Hello! I've finally got sprites showing up on the screen! I also know how to make objects move on the screen as well, just by adding code in the VBlank. Now, I have a new problem; I have more than 8 sprites I want to display on the screen but the emulator I'm using won't display the last 8 sprites. I'm trying to have the emulator display the phrase, "A winner is you" based on an internet meme. However, so far, I've only got it to write "A winner" and that's it. Am I missing something? Here's the code for reference:
the "ball.chr" now consists of text. The file is attached here.
Any ideas on how to get the emulator to display the rest of the text? Thank you!
P.S.
The emulator I'm using is FCEUX.
Code:
.segment "HEADER"
.byte "NES"
.byte $1a
.byte $02
.byte $01
.byte %00000000
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00,$00,$00,$00,$00
.segment "STARTUP"
.segment "CODE"
WAITVBLANK:
:
BIT $2002
BPL :-
RTS
RESET:
SEI ; disable IRQs
CLD ; disable decimal mode
LDX #$40
STX $4017 ; disable APU frame IRQ
LDX #$FF
TXS ; Set up stack
INX ; now X = 0
STX $2000 ; disable NMI
STX $2001 ; disable rendering
STX $4010 ; disable DMC IRQs
JSR WAITVBLANK
clrmem:
LDA #$00
STA $0000, x
STA $0100, x
STA $0200, x
STA $0400, x
STA $0500, x
STA $0600, x
STA $0700, x
STA $0300, x
INX
BNE clrmem
JSR WAITVBLANK
JSR TEXT
LDA #%10010000
STA $2000
LDA #%00010100
STA $2001
Forever:
JMP Forever
TEXT:
LDA #$08
STA $10
LDA #$00
STA $11
LDX #$00
LDY #$00
LoadTEXT:
JSR LoadPalette
LDA #$08
STA $0200,x ;Y Position
INX
JSR LoadSpriteTile
LDA #$02
STA $0200,x ;Palette Number
INX
JSR LoadXPosition
INY
CPY #$0F
BNE LoadTEXT
RTS
LoadSpriteTile:
LDA $11
STA $0200,x ;Sprite Tile Number
INC $11
INX
RTS
LoadXPosition:
LDA $10
STA $0200,x ;X Position
LDA $10
CLC
ADC #$08
STA $10
INX
RTS
LoadPalette:
LDA #$3F
STA $2006
LDA #$00
STA $2006
LDA #$0F
STA $2007
LDA #$27
STA $2007
LDA #$37
STA $2007
RTS
VBLANK: ;What should happen during a v-blank or nmi?
LDA #$00
STA $2003
LDA #$02
STA $4014
RTI
.segment "VECTORS"
.word VBLANK
.word RESET
.word 0
.segment "CHARS"
.incbin "ball.chr"
.byte "NES"
.byte $1a
.byte $02
.byte $01
.byte %00000000
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00,$00,$00,$00,$00
.segment "STARTUP"
.segment "CODE"
WAITVBLANK:
:
BIT $2002
BPL :-
RTS
RESET:
SEI ; disable IRQs
CLD ; disable decimal mode
LDX #$40
STX $4017 ; disable APU frame IRQ
LDX #$FF
TXS ; Set up stack
INX ; now X = 0
STX $2000 ; disable NMI
STX $2001 ; disable rendering
STX $4010 ; disable DMC IRQs
JSR WAITVBLANK
clrmem:
LDA #$00
STA $0000, x
STA $0100, x
STA $0200, x
STA $0400, x
STA $0500, x
STA $0600, x
STA $0700, x
STA $0300, x
INX
BNE clrmem
JSR WAITVBLANK
JSR TEXT
LDA #%10010000
STA $2000
LDA #%00010100
STA $2001
Forever:
JMP Forever
TEXT:
LDA #$08
STA $10
LDA #$00
STA $11
LDX #$00
LDY #$00
LoadTEXT:
JSR LoadPalette
LDA #$08
STA $0200,x ;Y Position
INX
JSR LoadSpriteTile
LDA #$02
STA $0200,x ;Palette Number
INX
JSR LoadXPosition
INY
CPY #$0F
BNE LoadTEXT
RTS
LoadSpriteTile:
LDA $11
STA $0200,x ;Sprite Tile Number
INC $11
INX
RTS
LoadXPosition:
LDA $10
STA $0200,x ;X Position
LDA $10
CLC
ADC #$08
STA $10
INX
RTS
LoadPalette:
LDA #$3F
STA $2006
LDA #$00
STA $2006
LDA #$0F
STA $2007
LDA #$27
STA $2007
LDA #$37
STA $2007
RTS
VBLANK: ;What should happen during a v-blank or nmi?
LDA #$00
STA $2003
LDA #$02
STA $4014
RTI
.segment "VECTORS"
.word VBLANK
.word RESET
.word 0
.segment "CHARS"
.incbin "ball.chr"
the "ball.chr" now consists of text. The file is attached here.
Any ideas on how to get the emulator to display the rest of the text? Thank you!
P.S.
The emulator I'm using is FCEUX.