diff --git a/simple/grid.bin b/simple/grid.bin new file mode 100644 index 0000000..14c0427 Binary files /dev/null and b/simple/grid.bin differ diff --git a/simple/hellomario.chr b/simple/hellomario.chr new file mode 100644 index 0000000..45c403a Binary files /dev/null and b/simple/hellomario.chr differ diff --git a/simple/main.s b/simple/main.s index cc780f7..d95fdcc 100644 --- a/simple/main.s +++ b/simple/main.s @@ -10,6 +10,7 @@ .byte $00 .byte $00, $00, $00, $00, $00 ; filler bytes .segment "ZEROPAGE" + background: .res 2 .segment "STARTUP" ; where code starts Reset: sei ; disables all interrupts on NES @@ -81,9 +82,45 @@ cpx #$20 ; 32 in decimal bne LoadPalettes + ; initialize world variable to point to world data + lda #BGData + sta background+1 + + ; setup address in PPU for nametable data + bit $2002 + lda #$20 + sta $2006 + lda #$00 + sta $2006 + + + ldx #$00 + ldy #$00 + + LoadBackground: + lda (background), Y + sta $2007 + iny + ; 960 px is 03 C0 in hex + cpx #$03 + bne :+ + cpy #$C0 + beq DoneLoadingBG + : + cpy #$00 + bne LoadBackground + inx + inc background+1 + jmp LoadBackground + + + DoneLoadingBG: ldx #$00 LoadSprites: + lda SpriteData, X sta $0200, X inx @@ -149,9 +186,12 @@ .byte $20, $06, $00, $08 .byte $20, $07, $00, $10 - + BGData: + .incbin "grid.bin" + + .segment "VECTORS" ; special address which 6502 needs .word NMI ; refresh time .word Reset ; reset button .segment "CHARS" ; graphical data - .incbin "example_sprites.chr" \ No newline at end of file + .incbin "tictactoe.chr" \ No newline at end of file diff --git a/simple/make.bat b/simple/make.bat new file mode 100644 index 0000000..92ec157 --- /dev/null +++ b/simple/make.bat @@ -0,0 +1,2 @@ +ca65 main.s -g -o main.o --debug-info +ld65 main.o -o main.nes -t nes --dbgfile main.dbg \ No newline at end of file diff --git a/simple/smile.bin b/simple/smile.bin new file mode 100644 index 0000000..1c22c1e Binary files /dev/null and b/simple/smile.bin differ diff --git a/simple/world.bin b/simple/world.bin new file mode 100644 index 0000000..36f2e3e Binary files /dev/null and b/simple/world.bin differ