From 7935a974fd0b53a6b58b00fa6aeb1d82b69481e4 Mon Sep 17 00:00:00 2001 From: droniu Date: Sun, 25 Apr 2021 14:33:12 +0200 Subject: [PATCH] background experminets --- simple/grid.bin | Bin 0 -> 16384 bytes simple/hellomario.chr | Bin 0 -> 8192 bytes simple/main.s | 44 ++++++++++++++++++++++++++++++++++++++++-- simple/make.bat | 2 ++ simple/smile.bin | Bin 0 -> 1024 bytes simple/world.bin | Bin 0 -> 960 bytes 6 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 simple/grid.bin create mode 100644 simple/hellomario.chr create mode 100644 simple/make.bat create mode 100644 simple/smile.bin create mode 100644 simple/world.bin diff --git a/simple/grid.bin b/simple/grid.bin new file mode 100644 index 0000000000000000000000000000000000000000..14c04275b02f15da09c994cf367ce08073b1393b GIT binary patch literal 16384 zcmeIzF%E<<3B1)x1DGIX9e2d ztDTp&pZ9(3oc7<=r`NybZRbh-_P+}xuT;OM9sj=swyaO@ubr1Xv3+{QhVVi=FI=}S zx94r=trrXd?RndIVf=NuJ#Ra2y`TUB1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 e2oNAZfB*pk1PBlyK!5-N0t5&UAV7e?%K|@sYCP@$ literal 0 HcmV?d00001 diff --git a/simple/hellomario.chr b/simple/hellomario.chr new file mode 100644 index 0000000000000000000000000000000000000000..45c403a9983cb586185a0f05ab7913407e422f64 GIT binary patch literal 8192 zcmZWue{dAneSdp<(jL-rd;BmQaNMpW40a|Hjv+BCble`c;~%NVICecaEe!`asDBW1 zLfXeowP+-;eM2eSf|0_xo0|s%hy}t9LViW}22$vwge9bfy=X>jy!xlu}g9 zv@AL#i#DT{$)N&(Dipx# z3Se~w>@H?gkRJ*#HMV5!T3sl>aRU&l74G_qN?aa<)O zs7g6w2h}RH9{3~AO>mwwF=)2w*gBzr5t0|0DRIk8)M}2S9zBQGOoG{O1k~y^+a^&R zdI$&=5WZ_Bi+%vz9zK{LrOKSIUR^AwREv`aG*;zOTX3Km!i#O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Z+&H}EC=l2;}2t+@#7C4hm~0L&;NNF7|!umx4zQaI@N(-Z-(XzDdKZw`T9QU zWf9gJ`;k*!Kacl@H1vwkaUqBf9!Mv`#T)n+u3RJUp92@c3cyi73xF-dK7Hl@JpcUj zxTG+4&pmta3|LFc#unJWwW;aXpTPdn!NH^W4GyA+!6mU&3cUy?p$?%k>2QS*d*-|E zJoHeHDHsS&{}vpo@f9mp&@2@UNSgG?9WoZP*&|1eU~0t*=s=urL@`X^)3fVf>d297 zws?8L0%Dn~_;>_x&~d5ngniW-8l9xfMtPXzp?BJw-VqZ78}v^3yfHpAdu>ibg6nMf zq zb!*3tQ2-wvMR;LV&1Oo?y(b1tHT2D6y;sI?Obw~ksaPffxZ5DM# z1p5hSY}4pB>;e+FBB~0w*RyF=A?9#_a>=RVhU=0ppl(%s&x<#;kiMX9H%Zrr?6C(1 zhF^a9hsf=0b9+1LB{nuQ444@kTTC~p#bXV7LIXf^oQ6H2CX*6h!=A#~rpVHvJu!9k zC?bSYXPA|=Bs|KhA8F2HkI9JiVmjcHmA?Jo`A+ZBZazBs>Z^Mv$Gc|xW@o3oDcs1- z(ysB}i@SNQe1M!O{`#eV@(|mDd}jL}|Mi8M2*JPYfQ9-7VnV?h>{xT~ z|2Xmmks7@l{W=@9DYeXdVg88mLJujcS!PeJiI zd(-mItcQzMML?v83Lw$K-GnoX^*8vBppWWT3U~jM9tm?jem#E8(IalI-~UGam_s+} z=d<$NDDS|TGosF`;(JsI8>@Hx6dPg0F8 zbG^^5NAENE^pTiljdFNtkBN^G?9%l4^TG6g+{<=;LP lTF0B9n literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..1c22c1ee9ebf14bee1791c239fd81b82d2399adb GIT binary patch literal 1024 zcmdUs!4<$D2t!?>`>$Go1Os~Tss{z~lc((%53LXDcxBTXF{A}rxpLl6~b{Fg-?@BulDtU b@VF-P0#JK9$Hh>ZmgsL_j-L8Boj+aw`#}jD literal 0 HcmV?d00001 diff --git a/simple/world.bin b/simple/world.bin new file mode 100644 index 0000000000000000000000000000000000000000..36f2e3e31061aacb2ba64e5f12bb1c002c240a40 GIT binary patch literal 960 zcmZQz7zLvtKtc$(x(0{1y5iR0?j9QE?v7i2n8|F}iXU#