First of all, hi all im new in nesdev (great site and community btw).
In new in NES programming and for my first program i tried to show some tiles of a chr file (tiles.chr) in the screen. Here is my code so far (im using asm6):
I expected to see the first tile of the chr file in the screen but all i got is a grey screen in the emulator, dont know whats is wrong.
Also i want to ask if i can put an attribute table after the ".include .chr", something like this:
Thanks in advance.
PS: im from Spain, sorry for my english.
In new in NES programming and for my first program i tried to show some tiles of a chr file (tiles.chr) in the screen. Here is my code so far (im using asm6):
Code:
.DB "NES", $1A
.DB $01
.DB $01
.DB %00000000, %00000000
.DB $00, $00, $00, $00, $00, $00, $00, $00
.org $C000
reset: sei
cld
- lda $2002
bpl -
- lda $2002
bpl -
lda #$3F
ldx #$00
sta $2006
stx $2006
- lda pallete,x
sta $2007
inx
cpx #$32
bne -
lda #$20
sta $2006
sta $2006
lda #$01
sta $2007
lda #%10001000
sta $2000
lda #%00011110
sta $2001
cli
loop: jmp loop
irq: rti
pallete:
.byte $0D,$00,$28,$01,$0D,$00,$10,$20,$0D,$20,$08,$06,$0D,$22,$28,$2D
.byte $0D,$38,$0D,$01,$0D,$30,$07,$1A,$0D,$06,$16,$26,$0D,$31,$32,$33
.pad $FFFA
.DW 0, reset, irq
.include "tiles.chr"
.DB $01
.DB $01
.DB %00000000, %00000000
.DB $00, $00, $00, $00, $00, $00, $00, $00
.org $C000
reset: sei
cld
- lda $2002
bpl -
- lda $2002
bpl -
lda #$3F
ldx #$00
sta $2006
stx $2006
- lda pallete,x
sta $2007
inx
cpx #$32
bne -
lda #$20
sta $2006
sta $2006
lda #$01
sta $2007
lda #%10001000
sta $2000
lda #%00011110
sta $2001
cli
loop: jmp loop
irq: rti
pallete:
.byte $0D,$00,$28,$01,$0D,$00,$10,$20,$0D,$20,$08,$06,$0D,$22,$28,$2D
.byte $0D,$38,$0D,$01,$0D,$30,$07,$1A,$0D,$06,$16,$26,$0D,$31,$32,$33
.pad $FFFA
.DW 0, reset, irq
.include "tiles.chr"
I expected to see the first tile of the chr file in the screen but all i got is a grey screen in the emulator, dont know whats is wrong.
Also i want to ask if i can put an attribute table after the ".include .chr", something like this:
Code:
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0
.byte $FF,$FF,$FF,%FF,$FF,$FF,$FF,$FF,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0
.byte $FF,$FF,$FF,%FF,$FF,$FF,$FF,$FF,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F
Thanks in advance.
PS: im from Spain, sorry for my english.