├── .gitignore ├── 01_Hello ├── Alpha.chr ├── CMakeLists.txt ├── chr-rom.s └── hello.c ├── 02_Hello2 ├── Alpha.chr ├── CMakeLists.txt ├── chr-rom.s └── hello2.c ├── 03_Hello3 ├── Alpha.chr ├── CMakeLists.txt ├── chr-rom.s └── hello3.c ├── 04_FullBG ├── CMakeLists.txt ├── Girl5.chr ├── NESIFY │ ├── Girl5.chr │ ├── Girl5.nam │ ├── Girl5.pal │ ├── NESIFIER.exe │ ├── NESIFIER.png │ ├── girl5.png │ └── girlb.png ├── NES_ST │ ├── Girl5.h │ └── Girl5.nss ├── chr-rom.s ├── fullBG.c └── fullBG.png ├── 05_Fade ├── CMakeLists.txt ├── Girl5.chr ├── NES_ST │ ├── Girl5.h │ └── Girl5.nss ├── chr-rom.s ├── fade.c ├── fade.png └── fade2.png ├── 06_Color ├── CMakeLists.txt ├── NES_ST │ ├── Blocks.nss │ └── blocks.h ├── blocks.chr ├── chr-rom.s └── color.c ├── 07_Sprites ├── Alpha2.chr ├── CMakeLists.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s └── metasprites.c ├── 08_Pads ├── Alpha3.chr ├── CMakeLists.txt ├── Pads.c ├── Sprites.c ├── Sprites.h └── chr-rom.s ├── 09_BG_Collide ├── CMakeLists.txt ├── CSV │ ├── CSV2C.py │ ├── c.h │ ├── c1.c │ ├── c1.csv │ ├── c1.tmx │ ├── c2.c │ ├── c2.csv │ ├── c2.tmx │ ├── c3.c │ ├── c3.csv │ ├── c3.tmx │ ├── c4.c │ ├── c4.csv │ ├── c4.tmx │ └── metatile.png ├── NES_ST │ └── metatiles.nss ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── collide.c └── collide.chr ├── 10_Scroll_H ├── BG │ ├── N.h │ ├── N0.c │ ├── N1.c │ └── N2.c ├── CMakeLists.txt ├── Sprites.c ├── Sprites.h ├── big_numbers.chr ├── chr-rom.s └── scroll_h.c ├── 11_Scroll_V ├── BG │ ├── N.h │ ├── N0.c │ ├── N1.c │ └── N2.c ├── CMakeLists.txt ├── Sprites.c ├── Sprites.h ├── big_numbers.chr ├── chr-rom.s └── scroll_v.c ├── 12_Break ├── BG │ ├── breaky2.nss │ ├── breaky_bg2.c │ └── breaky_bg2.h ├── CMakeLists.txt ├── CSV │ ├── c1.c │ └── c1.h ├── Sprites.c ├── Sprites.h ├── breaky.c ├── breaky.chr └── chr-rom.s ├── 13_Metatiles ├── BG │ ├── CSV2C.py │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.h │ ├── Room1.tmx │ └── metatiles.png ├── CMakeLists.txt ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── metatiles.c └── metatiles.chr ├── 14_Metatiles2 ├── BG │ ├── CSV2C.py │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.h │ ├── Room1.tmx │ └── metatiles.png ├── CMakeLists.txt ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── metatiles2.c ├── metatiles2.chr └── metatiles2.h ├── 15_Scroll_R ├── BG │ ├── CMakeLists.txt │ ├── CSV2C.py │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.tmx │ ├── Room2.c │ ├── Room2.csv │ ├── Room2.tmx │ ├── Room3.c │ ├── Room3.csv │ ├── Room3.tmx │ ├── Room4.c │ ├── Room4.csv │ ├── Room4.tmx │ ├── Room5.c │ ├── Room5.csv │ ├── Room5.tmx │ ├── Rooms.c │ ├── Rooms.h │ └── metatiles.png ├── CMakeLists.txt ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── scroll_r.c └── scroll_r.chr ├── 16_Scroll_Up ├── BG │ ├── CMakeLists.txt │ ├── CSV2C.py │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.tmx │ ├── Room2.c │ ├── Room2.csv │ ├── Room2.tmx │ ├── Room3.c │ ├── Room3.csv │ ├── Room3.tmx │ ├── Room4.c │ ├── Room4.csv │ ├── Room4.tmx │ ├── Room5.c │ ├── Room5.csv │ ├── Room5.tmx │ ├── Rooms.c │ ├── Rooms.h │ └── metatiles.png ├── CMakeLists.txt ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── scroll_up.c └── scroll_up.chr ├── 17_Platformer ├── BG │ ├── CMakeLists.txt │ ├── CSV2C.py │ ├── Metatiles.png │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.tmx │ ├── Room2.c │ ├── Room2.csv │ ├── Room2.tmx │ ├── Room3.c │ ├── Room3.csv │ ├── Room3.tmx │ ├── Room4.c │ ├── Room4.csv │ ├── Room4.tmx │ ├── Room5.c │ ├── Room5.csv │ ├── Room5.tmx │ ├── Rooms.c │ └── Rooms.h ├── CMakeLists.txt ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── platformer.c └── platformer.chr ├── 18_Music ├── BG │ ├── CMakeLists.txt │ ├── CSV2C.py │ ├── Metatiles.png │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.tmx │ ├── Room2.c │ ├── Room2.csv │ ├── Room2.tmx │ ├── Room3.c │ ├── Room3.csv │ ├── Room3.tmx │ ├── Room4.c │ ├── Room4.csv │ ├── Room4.tmx │ ├── Room5.c │ ├── Room5.csv │ ├── Room5.tmx │ ├── Rooms.c │ └── Rooms.h ├── CMakeLists.txt ├── MUSIC │ ├── CMakeLists.txt │ ├── TestMusic3.ftm │ ├── TestMusic3.s │ ├── TestMusic3.txt │ └── music.s ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── platformer.chr └── platformer2.c ├── 19_SFX ├── BG │ ├── CMakeLists.txt │ ├── CSV2C.py │ ├── Metatiles.png │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.tmx │ ├── Room2.c │ ├── Room2.csv │ ├── Room2.tmx │ ├── Room3.c │ ├── Room3.csv │ ├── Room3.tmx │ ├── Room4.c │ ├── Room4.csv │ ├── Room4.tmx │ ├── Room5.c │ ├── Room5.csv │ ├── Room5.tmx │ ├── Rooms.c │ └── Rooms.h ├── CMakeLists.txt ├── MUSIC │ ├── CMakeLists.txt │ ├── SoundFx.ftm │ ├── SoundFx.nsf │ ├── SoundFx.s │ ├── TestMusic3.ftm │ ├── TestMusic3.s │ ├── TestMusic3.txt │ └── music.s ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── platformer.chr └── platformer3.c ├── 20_DPCM ├── BG │ ├── CMakeLists.txt │ ├── CSV2C.py │ ├── Metatiles.png │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.tmx │ ├── Room2.c │ ├── Room2.csv │ ├── Room2.tmx │ ├── Room3.c │ ├── Room3.csv │ ├── Room3.tmx │ ├── Room4.c │ ├── Room4.csv │ ├── Room4.tmx │ ├── Room5.c │ ├── Room5.csv │ ├── Room5.tmx │ ├── Rooms.c │ └── Rooms.h ├── CMakeLists.txt ├── MUSIC │ ├── BassDrum.dmc │ ├── CMakeLists.txt │ ├── DMCmusic.dmc │ ├── DMCmusic.ftm │ ├── DMCmusic.s │ ├── DMCmusic.txt │ ├── HalfHat.dmc │ ├── Jump.dmc │ ├── RimShot.dmc │ ├── Tom.dmc │ └── music.s ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── platformer.chr └── platformer4.c ├── 21_Sprite_Zero ├── BG │ ├── CMakeLists.txt │ ├── CSV2C.py │ ├── Metatiles.png │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.tmx │ ├── Room2.c │ ├── Room2.csv │ ├── Room2.tmx │ ├── Room3.c │ ├── Room3.csv │ ├── Room3.tmx │ ├── Room4.c │ ├── Room4.csv │ ├── Room4.tmx │ ├── Room5.c │ ├── Room5.csv │ ├── Room5.tmx │ ├── Rooms.c │ └── Rooms.h ├── CMakeLists.txt ├── MUSIC │ ├── CMakeLists.txt │ ├── SoundFx.ftm │ ├── SoundFx.nsf │ ├── SoundFx.s │ ├── TestMusic3.ftm │ ├── TestMusic3.s │ ├── TestMusic3.txt │ └── music.s ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── sprite_zero.c └── sprite_zero.chr ├── 22_XY_Split ├── .cache │ └── clangd │ │ └── index │ │ ├── Room1.c.DE1E8A121194B884.idx │ │ ├── Room2.c.B72896D8B4F2AC3F.idx │ │ ├── Room3.c.D9CDC601A0104295.idx │ │ ├── Room4.c.DEADC3456942B524.idx │ │ ├── Room5.c.10C72BB55C689CF0.idx │ │ ├── Rooms.c.B3F8DD29FFC4C551.idx │ │ ├── Rooms.h.6770D64DA0244300.idx │ │ ├── Sprites.c.124895911A0AB117.idx │ │ ├── Sprites.h.7C80014BEAE64E65.idx │ │ └── sprite_zero.c.9C51A9E2F0AABE9B.idx ├── BG │ ├── CMakeLists.txt │ ├── CSV2C.py │ ├── Metatiles.png │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.tmx │ ├── Room2.c │ ├── Room2.csv │ ├── Room2.tmx │ ├── Room3.c │ ├── Room3.csv │ ├── Room3.tmx │ ├── Room4.c │ ├── Room4.csv │ ├── Room4.tmx │ ├── Room5.c │ ├── Room5.csv │ ├── Room5.tmx │ ├── Rooms.c │ └── Rooms.h ├── CMakeLists.txt ├── MUSIC │ ├── CMakeLists.txt │ ├── SoundFx.ftm │ ├── SoundFx.nsf │ ├── SoundFx.s │ ├── TestMusic3.ftm │ ├── TestMusic3.s │ ├── TestMusic3.txt │ └── music.s ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── xy_split.c └── xy_split.chr ├── 23_Random ├── .gitattributes ├── .gitignore ├── Alpha2.chr ├── CMakeLists.txt ├── Random.c ├── Sprites.c ├── Sprites.h └── chr-rom.s ├── 24_Mappers ├── CMakeLists.txt ├── NES_ST │ ├── all_bgs.c │ ├── all_bgs.h │ └── session.nss ├── PICS │ ├── apples.jpg │ ├── balls.jpg │ ├── flower.jpg │ └── snake.jpg ├── apples.chr ├── balls.chr ├── chr-rom.s ├── flower.chr ├── mappers.c └── snake.chr ├── 25_Platform5 ├── BG │ ├── CMakeLists.txt │ ├── CSV2C.py │ ├── Metatiles.png │ ├── Room1.c │ ├── Room1.csv │ ├── Room1.tmx │ ├── Room2.c │ ├── Room2.csv │ ├── Room2.tmx │ ├── Room3.c │ ├── Room3.csv │ ├── Room3.tmx │ ├── Room4.c │ ├── Room4.csv │ ├── Room4.tmx │ ├── Room5.c │ ├── Room5.csv │ ├── Room5.tmx │ ├── Rooms.c │ └── Rooms.h ├── CMakeLists.txt ├── MUSIC │ ├── CMakeLists.txt │ ├── SoundFx.ftm │ ├── SoundFx.nsf │ ├── SoundFx.s │ ├── TestMusic3.ftm │ ├── TestMusic3.s │ ├── TestMusic3.txt │ └── music.s ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ └── metatiles.txt ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── platformer5.c └── platformer5.chr ├── 26_Full_Game ├── BG │ ├── CMakeLists.txt │ ├── CSV2C_BIG.py │ ├── CSV2C_SP.py │ ├── Level1.c │ ├── Level1.csv │ ├── Level1.tmx │ ├── Level1_SP.c │ ├── Level1_SP.csv │ ├── Level2.c │ ├── Level2.csv │ ├── Level2.tmx │ ├── Level2_SP.c │ ├── Level2_SP.csv │ ├── Level3.c │ ├── Level3.csv │ ├── Level3.tmx │ ├── Level3_SP.c │ ├── Level3_SP.csv │ ├── Levels.h │ ├── Metatiles.png │ └── Sprites.png ├── CMakeLists.txt ├── MUSIC │ ├── CMakeLists.txt │ ├── SoundFx.ftm │ ├── SoundFx.nsf │ ├── SoundFx.s │ ├── TestMusic3.ftm │ ├── TestMusic3.s │ ├── TestMusic3.txt │ └── music.s ├── NES_ST │ ├── meta.py │ ├── metatiles.nam │ ├── metatiles.nss │ ├── metatiles.txt │ ├── sprites.nss │ ├── title.c │ ├── title.h │ └── title.nss ├── Sprites.c ├── Sprites.h ├── chr-rom.s ├── full_game.c ├── full_game.chr ├── level_data.c ├── level_data.h ├── palettes.c └── palettes.h ├── 28_Zapper ├── AlphaZ.chr ├── CMakeLists.txt ├── MUSIC │ ├── CMakeLists.txt │ ├── SFX.ftm │ ├── SFX.nsf │ ├── SFX.s │ └── music.s ├── NES_ST │ ├── CMakeLists.txt │ ├── Zap_Test.c │ ├── Zap_Test.h │ └── Zap_Test.nss ├── Sprites.c ├── Sprites.h ├── Zapper.c └── chr-rom.s ├── 29_Powerpad ├── AlphaP.chr ├── CMakeLists.txt ├── NES_ST │ ├── CMakeLists.txt │ ├── PowerBG.c │ ├── PowerBG.h │ └── PowerBG.nss ├── PowerTest.c └── chr-rom.s ├── 32_MMC1 ├── Alpha.chr ├── Alpha2.chr ├── CMakeLists.txt ├── MUSIC │ ├── BassDrum.dmc │ ├── CMakeLists.txt │ ├── SoundFx.ftm │ ├── SoundFx.nsf │ ├── SoundFx.s │ ├── TestMusic3.ftm │ ├── TestMusic3.s │ ├── TestMusic3.txt │ └── music.s ├── chr-rom.s ├── hello_mmc1.c └── hello_mmc1.ld ├── 33_MMC3 ├── Alpha.chr ├── CMakeLists.txt ├── Gears.chr ├── MMC3 │ ├── mmc3_code.asm │ └── mmc3_code.h ├── MUSIC │ ├── CMakeLists.txt │ ├── SoundFx.ftm │ ├── SoundFx.nsf │ ├── SoundFx.s │ ├── TestMusic3.ftm │ ├── TestMusic3.s │ ├── TestMusic3.txt │ └── music.s ├── chr-rom.s ├── crt0.s └── hello_mmc3.c ├── License.txt └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .cache/ 3 | .vscode/ 4 | -------------------------------------------------------------------------------- /01_Hello/Alpha.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/01_Hello/Alpha.chr -------------------------------------------------------------------------------- /01_Hello/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(01_hello LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(hello hello.c chr-rom.s) 11 | target_include_directories(hello PRIVATE .) 12 | target_link_libraries(hello neslib) 13 | set_property(SOURCE chr-rom.s PROPERTY 14 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Alpha.chr) 15 | -------------------------------------------------------------------------------- /01_Hello/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "Alpha.chr" 3 | -------------------------------------------------------------------------------- /02_Hello2/Alpha.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/02_Hello2/Alpha.chr -------------------------------------------------------------------------------- /02_Hello2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(02_hello2 LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(hello2 hello2.c chr-rom.s) 11 | target_include_directories(hello2 PRIVATE .) 12 | target_link_libraries(hello2 neslib) 13 | set_property(SOURCE chr-rom.s PROPERTY 14 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Alpha.chr) 15 | -------------------------------------------------------------------------------- /02_Hello2/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "Alpha.chr" 3 | -------------------------------------------------------------------------------- /03_Hello3/Alpha.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/03_Hello3/Alpha.chr -------------------------------------------------------------------------------- /03_Hello3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(03_hello3 LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(hello3 hello3.c chr-rom.s) 11 | target_include_directories(hello3 PRIVATE .) 12 | target_link_libraries(hello3 nesdoug neslib) 13 | set_property(SOURCE chr-rom.s PROPERTY 14 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Alpha.chr) 15 | -------------------------------------------------------------------------------- /03_Hello3/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "Alpha.chr" 3 | -------------------------------------------------------------------------------- /04_FullBG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(04_fullbg LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(fullBG fullBG.c chr-rom.s) 11 | target_include_directories(fullBG PRIVATE .) 12 | target_link_libraries(fullBG nesdoug neslib) 13 | set_property(SOURCE chr-rom.s PROPERTY 14 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Girl5.chr) 15 | -------------------------------------------------------------------------------- /04_FullBG/Girl5.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/04_FullBG/Girl5.chr -------------------------------------------------------------------------------- /04_FullBG/NESIFY/Girl5.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/04_FullBG/NESIFY/Girl5.chr -------------------------------------------------------------------------------- /04_FullBG/NESIFY/Girl5.nam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/04_FullBG/NESIFY/Girl5.nam -------------------------------------------------------------------------------- /04_FullBG/NESIFY/Girl5.pal: -------------------------------------------------------------------------------- 1 | 2 | &8 3 |  4 |  5 |  -------------------------------------------------------------------------------- /04_FullBG/NESIFY/NESIFIER.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/04_FullBG/NESIFY/NESIFIER.exe -------------------------------------------------------------------------------- /04_FullBG/NESIFY/NESIFIER.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/04_FullBG/NESIFY/NESIFIER.png -------------------------------------------------------------------------------- /04_FullBG/NESIFY/girl5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/04_FullBG/NESIFY/girl5.png -------------------------------------------------------------------------------- /04_FullBG/NESIFY/girlb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/04_FullBG/NESIFY/girlb.png -------------------------------------------------------------------------------- /04_FullBG/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "Girl5.chr" 3 | -------------------------------------------------------------------------------- /04_FullBG/fullBG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/04_FullBG/fullBG.png -------------------------------------------------------------------------------- /05_Fade/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(05_fade LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(fade fade.c chr-rom.s) 11 | target_include_directories(fade PRIVATE .) 12 | target_link_libraries(fade nesdoug neslib) 13 | set_property(SOURCE chr-rom.s PROPERTY 14 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Girl5.chr) 15 | -------------------------------------------------------------------------------- /05_Fade/Girl5.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/05_Fade/Girl5.chr -------------------------------------------------------------------------------- /05_Fade/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "Girl5.chr" 3 | -------------------------------------------------------------------------------- /05_Fade/fade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/05_Fade/fade.png -------------------------------------------------------------------------------- /05_Fade/fade2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/05_Fade/fade2.png -------------------------------------------------------------------------------- /06_Color/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(06_color LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(color color.c chr-rom.s) 11 | target_include_directories(color PRIVATE .) 12 | target_link_libraries(color nesdoug neslib) 13 | set_property(SOURCE chr-rom.s PROPERTY 14 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/blocks.chr) 15 | -------------------------------------------------------------------------------- /06_Color/blocks.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/06_Color/blocks.chr -------------------------------------------------------------------------------- /06_Color/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "blocks.chr" 3 | -------------------------------------------------------------------------------- /07_Sprites/Alpha2.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/07_Sprites/Alpha2.chr -------------------------------------------------------------------------------- /07_Sprites/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(07_sprites LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(Sprites Sprites.c metasprites.c chr-rom.s) 11 | target_include_directories(Sprites PRIVATE .) 12 | target_link_libraries(Sprites nesdoug neslib) 13 | set_property(SOURCE chr-rom.s PROPERTY 14 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Alpha2.chr) 15 | -------------------------------------------------------------------------------- /07_Sprites/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | extern const char metasprite[]; 5 | extern const char metasprite2[]; 6 | 7 | #endif // SPRITES_H 8 | -------------------------------------------------------------------------------- /07_Sprites/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "Alpha2.chr" 3 | -------------------------------------------------------------------------------- /07_Sprites/metasprites.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const char metasprite[] = { 4 | 0, 0, 0x01, 0, 0, 8, 0x11, 0, 8, 5 | 0, 0x01, 0 | OAM_FLIP_H, 8, 8, 0x11, 0 | OAM_FLIP_H, 128}; 6 | 7 | const char metasprite2[] = {8, 0, 0x03, 0, 8 | 0, 8, 0x12, 0, 9 | 8, 8, 0x13, 0, 10 | 16, 8, 0x12, 0 | OAM_FLIP_H, 11 | 0, 16, 0x22, 0, 12 | 8, 16, 0x23, 0, 13 | 16, 16, 0x22, 0 | OAM_FLIP_H, 14 | 128}; 15 | -------------------------------------------------------------------------------- /08_Pads/Alpha3.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/08_Pads/Alpha3.chr -------------------------------------------------------------------------------- /08_Pads/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(08_pads LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(Pads Pads.c Sprites.c chr-rom.s) 11 | target_include_directories(Pads PRIVATE .) 12 | target_link_libraries(Pads nesdoug neslib) 13 | set_property(SOURCE chr-rom.s PROPERTY 14 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Alpha3.chr) 15 | -------------------------------------------------------------------------------- /08_Pads/Sprites.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // a 16x16 pixel metasprite 4 | 5 | const char YellowSpr[] = { 6 | 0, 0, 0x00, 0, 0, 8, 0x10, 0, 8, 7 | 0, 0x00, 0 | OAM_FLIP_H, 8, 8, 0x10, 0 | OAM_FLIP_H, 128}; 8 | 9 | const char BlueSpr[] = { 10 | 0, 0, 0x00, 1, 0, 8, 0x10, 1, 8, 11 | 0, 0x00, 1 | OAM_FLIP_H, 8, 8, 0x10, 1 | OAM_FLIP_H, 128}; 12 | -------------------------------------------------------------------------------- /08_Pads/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | extern const char YellowSpr[]; 5 | extern const char BlueSpr[]; 6 | 7 | #endif // SPRITES_H 8 | -------------------------------------------------------------------------------- /08_Pads/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "Alpha3.chr" 3 | -------------------------------------------------------------------------------- /09_BG_Collide/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(08_bg_collide LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(collide 11 | collide.c 12 | Sprites.c 13 | chr-rom.s 14 | CSV/c1.c 15 | CSV/c2.c 16 | CSV/c3.c 17 | CSV/c4.c 18 | ) 19 | target_include_directories(collide PRIVATE .) 20 | target_link_libraries(collide nesdoug neslib) 21 | set_property(SOURCE chr-rom.s PROPERTY 22 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/collide.chr) 23 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c.h: -------------------------------------------------------------------------------- 1 | #ifndef C_H 2 | #define C_H 3 | 4 | extern const unsigned char c1[]; 5 | extern const unsigned char c2[]; 6 | extern const unsigned char c3[]; 7 | extern const unsigned char c4[]; 8 | 9 | #endif // C_H 10 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c1.c: -------------------------------------------------------------------------------- 1 | const char c1[]={ 2 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 3 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 4 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 5 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 6 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 7 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 8 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 9 | 1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1, 10 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 11 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 12 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 13 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c1.csv: -------------------------------------------------------------------------------- 1 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 2 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 3 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 4 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 5 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 6 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 7 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 8 | 1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1 9 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 10 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 11 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 12 | 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 13 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c1.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 9 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 10 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 11 | 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, 12 | 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, 13 | 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, 14 | 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, 15 | 2,1,1,2,1,1,1,1,1,1,1,1,2,1,1,2, 16 | 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, 17 | 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, 18 | 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, 19 | 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, 20 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 21 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 22 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c2.c: -------------------------------------------------------------------------------- 1 | const char c2[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0, 10 | 0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0, 11 | 0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 13 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 16 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c2.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0 5 | 0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0 6 | 0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0 9 | 0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0 10 | 0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 12 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 13 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 16 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c2.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 10 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 11 | 1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1, 12 | 1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1, 13 | 1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1, 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 15 | 1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1, 16 | 1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,1, 17 | 1,1,1,1,1,2,2,2,2,1,1,1,1,1,1,1, 18 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 19 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 20 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 21 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 22 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c3.c: -------------------------------------------------------------------------------- 1 | const unsigned char c3[]={ 2 | 1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1, 3 | 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0, 4 | 0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0, 5 | 0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0, 6 | 0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0, 7 | 0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0, 8 | 0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0, 9 | 1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1, 10 | 0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 11 | 0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0, 12 | 0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0, 13 | 0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0, 14 | 0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0, 15 | 0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0, 16 | 1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c3.csv: -------------------------------------------------------------------------------- 1 | 1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1 2 | 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0 3 | 0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0 4 | 0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0 5 | 0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0 6 | 0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0 7 | 0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0 8 | 1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1 9 | 0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0 10 | 0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0 11 | 0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0 12 | 0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0 13 | 0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0 14 | 0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0 15 | 1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0 16 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c3.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2, 9 | 1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1, 10 | 1,1,2,1,1,1,1,1,1,1,2,1,1,1,1,1, 11 | 1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,1, 12 | 1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1, 13 | 1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1, 14 | 1,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1, 15 | 2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,2, 16 | 1,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1, 17 | 1,1,2,1,1,1,1,1,1,2,1,1,1,1,1,1, 18 | 1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1, 19 | 1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,1, 20 | 1,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1, 21 | 1,1,1,1,1,1,2,1,1,1,1,1,1,2,1,1, 22 | 2,1,1,1,1,1,1,2,1,1,1,1,1,1,2,1 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c4.c: -------------------------------------------------------------------------------- 1 | const unsigned char c4[]={ 2 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0, 5 | 1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 13 | 1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1, 14 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0, 15 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0, 16 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c4.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0 4 | 1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 12 | 1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1 13 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0 14 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0 15 | 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0 16 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/c4.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1, 9 | 1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1, 10 | 1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1, 11 | 2,2,2,2,1,1,1,2,2,1,1,1,2,2,2,2, 12 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 13 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 17 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 18 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 19 | 2,2,2,2,1,1,1,2,2,1,1,1,2,2,2,2, 20 | 1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1, 21 | 1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1, 22 | 1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /09_BG_Collide/CSV/metatile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/09_BG_Collide/CSV/metatile.png -------------------------------------------------------------------------------- /09_BG_Collide/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | #include 4 | 5 | const unsigned char YellowSpr[] = {0, 0, 0x00, 0, 8, 0, 0x00, 0 | OAM_FLIP_H, 6 | 0, 8, 0x10, 0, 8, 8, 0x10, 0 | OAM_FLIP_H, 7 | 128}; 8 | 9 | const unsigned char BlueSpr[] = {0, 0, 0x00, 1, 8, 0, 0x00, 1 | OAM_FLIP_H, 10 | 0, 8, 0x10, 1, 8, 8, 0x10, 1 | OAM_FLIP_H, 11 | 128}; 12 | -------------------------------------------------------------------------------- /09_BG_Collide/Sprites.h: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | #ifndef SPRITES_H 4 | #define SPRITES_H 5 | 6 | extern const unsigned char YellowSpr[]; 7 | extern const unsigned char BlueSpr[]; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /09_BG_Collide/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "collide.chr" 3 | -------------------------------------------------------------------------------- /09_BG_Collide/collide.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/09_BG_Collide/collide.chr -------------------------------------------------------------------------------- /10_Scroll_H/BG/N.h: -------------------------------------------------------------------------------- 1 | #ifndef N_H 2 | #define N_H 3 | 4 | extern const unsigned char N0[225]; 5 | extern const unsigned char N1[221]; 6 | extern const unsigned char N2[221]; 7 | 8 | #endif // N_H 9 | -------------------------------------------------------------------------------- /10_Scroll_H/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(10_scroll_h LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(scroll_h 11 | scroll_h.c 12 | Sprites.c 13 | chr-rom.s 14 | BG/N0.c 15 | BG/N1.c 16 | BG/N2.c 17 | ) 18 | target_include_directories(scroll_h PRIVATE .) 19 | target_link_libraries(scroll_h nesdoug neslib) 20 | set_property(SOURCE chr-rom.s PROPERTY 21 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/big_numbers.chr) 22 | -------------------------------------------------------------------------------- /10_Scroll_H/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | #include 4 | 5 | const unsigned char YellowSpr[]={ 6 | 0, 0,0x10,0, 7 | 8, 0,0x10,0|OAM_FLIP_H, 8 | 0, 8,0x20,0, 9 | 8, 8,0x20,0|OAM_FLIP_H, 10 | 128 11 | }; 12 | 13 | 14 | const unsigned char BlueSpr[]={ 15 | 0, 0,0x10,1, 16 | 8, 0,0x10,1|OAM_FLIP_H, 17 | 0, 8,0x20,1, 18 | 8, 8,0x20,1|OAM_FLIP_H, 19 | 128 20 | }; 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /10_Scroll_H/Sprites.h: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | #ifndef SPRITES_H 4 | #define SPRITES_H 5 | 6 | extern const unsigned char YellowSpr[]; 7 | extern const unsigned char BlueSpr[]; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /10_Scroll_H/big_numbers.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/10_Scroll_H/big_numbers.chr -------------------------------------------------------------------------------- /10_Scroll_H/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "big_numbers.chr" 3 | -------------------------------------------------------------------------------- /11_Scroll_V/BG/N.h: -------------------------------------------------------------------------------- 1 | #ifndef N_H 2 | #define N_H 3 | 4 | extern const unsigned char N0[225]; 5 | extern const unsigned char N1[221]; 6 | extern const unsigned char N2[221]; 7 | 8 | #endif // N_H 9 | -------------------------------------------------------------------------------- /11_Scroll_V/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(11_scroll_v LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(scroll_v 11 | scroll_v.c 12 | Sprites.c 13 | chr-rom.s 14 | BG/N0.c 15 | BG/N1.c 16 | BG/N2.c 17 | ) 18 | target_include_directories(scroll_v PRIVATE .) 19 | target_link_libraries(scroll_v nesdoug neslib) 20 | set_property(SOURCE chr-rom.s PROPERTY 21 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/big_numbers.chr) 22 | -------------------------------------------------------------------------------- /11_Scroll_V/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | #include 4 | 5 | const unsigned char YellowSpr[]={ 6 | 0, 0,0x10,0, 7 | 8, 0,0x10,0|OAM_FLIP_H, 8 | 0, 8,0x20,0, 9 | 8, 8,0x20,0|OAM_FLIP_H, 10 | 128 11 | }; 12 | 13 | 14 | const unsigned char BlueSpr[]={ 15 | 0, 0,0x10,1, 16 | 8, 0,0x10,1|OAM_FLIP_H, 17 | 0, 8,0x20,1, 18 | 8, 8,0x20,1|OAM_FLIP_H, 19 | 128 20 | }; 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /11_Scroll_V/Sprites.h: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | #ifndef SPRITES_H 4 | #define SPRITES_H 5 | 6 | extern const unsigned char YellowSpr[]; 7 | extern const unsigned char BlueSpr[]; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /11_Scroll_V/big_numbers.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/11_Scroll_V/big_numbers.chr -------------------------------------------------------------------------------- /11_Scroll_V/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "big_numbers.chr" 3 | -------------------------------------------------------------------------------- /12_Break/BG/breaky_bg2.h: -------------------------------------------------------------------------------- 1 | #ifndef BG_BREAKY_BG2_H 2 | #define BG_BREAKY_BG2_H 3 | 4 | extern const unsigned char breaky_bg2[223]; 5 | 6 | #endif // BG_BREAKY_BG2_H 7 | -------------------------------------------------------------------------------- /12_Break/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(12_breaky LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(breaky 11 | breaky.c 12 | Sprites.c 13 | chr-rom.s 14 | BG/breaky_bg2.c 15 | CSV/c1.c 16 | ) 17 | target_include_directories(breaky PRIVATE .) 18 | target_link_libraries(breaky nesdoug neslib) 19 | set_property(SOURCE chr-rom.s PROPERTY 20 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/breaky.chr) 21 | -------------------------------------------------------------------------------- /12_Break/CSV/c1.c: -------------------------------------------------------------------------------- 1 | const unsigned char c1[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 5 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 6 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 7 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 8 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 9 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 10 | 11 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 13 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 16 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 17 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 18 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 19 | }; 20 | 21 | // 16 x 16 = 256 22 | // 16 wide has easier math than 14 wide, so sides are padded with 0 -------------------------------------------------------------------------------- /12_Break/CSV/c1.h: -------------------------------------------------------------------------------- 1 | #ifndef C1_H 2 | #define C1_H 3 | 4 | extern const unsigned char c1[]; 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /12_Break/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | const unsigned char PaddleSpr[]={ 4 | 0, 0,0x00,0, 5 | 8, 0,0x00,0, 6 | 16, 0,0x00,0, 7 | 24, 0,0x00,0, 8 | 128 9 | }; 10 | 11 | 12 | const unsigned char BallSpr[]={ 13 | 0, 0,0x01,0, 14 | 128 15 | }; 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /12_Break/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char PaddleSpr[]; 7 | 8 | extern const unsigned char BallSpr[]; 9 | 10 | #endif // SPRITES_H 11 | -------------------------------------------------------------------------------- /12_Break/breaky.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/12_Break/breaky.chr -------------------------------------------------------------------------------- /12_Break/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "breaky.chr" 3 | -------------------------------------------------------------------------------- /13_Metatiles/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room1[]={ 2 | 1,0,2,2,0,0,0,0,0,0,0,0,3,3,3,3, 3 | 0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0, 7 | 0,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,3,3,3,0,0,0,0,4,4,0,0,0,0,0,0, 9 | 0,3,3,3,0,0,0,0,4,4,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,2,2,0,0,2,2,0,0,0,0, 12 | 0,0,0,4,0,0,2,2,0,0,2,2,0,0,0,0, 13 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 15 | 3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 16 | 3,3,0,1,0,0,0,0,0,0,0,0,0,0,0,4 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /13_Metatiles/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 1,0,2,2,0,0,0,0,0,0,0,0,3,3,3,3 2 | 0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0 6 | 0,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,3,3,3,0,0,0,0,4,4,0,0,0,0,0,0 8 | 0,3,3,3,0,0,0,0,4,4,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0 10 | 0,0,0,0,0,0,2,2,0,0,2,2,0,0,0,0 11 | 0,0,0,4,0,0,2,2,0,0,2,2,0,0,0,0 12 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 13 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 14 | 3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0 15 | 3,3,0,1,0,0,0,0,0,0,0,0,0,0,0,4 16 | -------------------------------------------------------------------------------- /13_Metatiles/BG/Room1.h: -------------------------------------------------------------------------------- 1 | #ifndef ROOM1_H 2 | #define ROOM1_H 3 | 4 | extern const unsigned char Room1[]; 5 | 6 | # endif // ROOM1_H 7 | -------------------------------------------------------------------------------- /13_Metatiles/BG/Room1.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 2,1,3,3,1,1,1,1,1,1,1,1,4,4,4,4, 9 | 1,1,3,3,1,1,1,1,1,1,1,1,1,1,1,1, 10 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 11 | 2,2,2,2,1,1,1,1,1,1,1,2,1,1,2,1, 12 | 1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1, 13 | 1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,1, 14 | 1,4,4,4,1,1,1,1,5,5,1,1,1,1,1,1, 15 | 1,4,4,4,1,1,1,1,5,5,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,5,5,1,1,1,1,1,1, 17 | 1,1,1,1,1,1,3,3,1,1,3,3,1,1,1,1, 18 | 1,1,1,5,1,1,3,3,1,1,3,3,1,1,1,1, 19 | 1,1,1,1,1,1,3,3,1,1,1,1,1,1,1,1, 20 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 21 | 4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 22 | 4,4,1,2,1,1,1,1,1,1,1,1,1,1,1,5 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /13_Metatiles/BG/metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/13_Metatiles/BG/metatiles.png -------------------------------------------------------------------------------- /13_Metatiles/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(13_metatiles LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(metatiles 11 | metatiles.c 12 | Sprites.c 13 | chr-rom.s 14 | BG/Room1.c 15 | ) 16 | target_include_directories(metatiles PRIVATE .) 17 | target_link_libraries(metatiles nesdoug neslib) 18 | set_property(SOURCE chr-rom.s PROPERTY 19 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/metatiles.chr) 20 | -------------------------------------------------------------------------------- /13_Metatiles/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |    -------------------------------------------------------------------------------- /13_Metatiles/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 2, 2, 2, 2, 3, 3 | 4, 4, 4, 4, 1, 4 | 9, 9, 9, 9, 2, 5 | 5, 6, 8, 7, 1, 6 | 5, 6, 8, 7, 0 7 | }; 8 | 9 | -------------------------------------------------------------------------------- /13_Metatiles/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | const unsigned char RoundSprL[] = {0xff, 0xff, 0x02, 0, 7, 0xff, 0x03, 0, 0xff, 4 | 7, 0x12, 0, 7, 7, 0x13, 0, 128}; 5 | 6 | const unsigned char RoundSprR[] = {0xff, 0xff, 0x00, 0, 7, 0xff, 0x01, 0, 0xff, 7 | 7, 0x10, 0, 7, 7, 0x11, 0, 128}; 8 | -------------------------------------------------------------------------------- /13_Metatiles/Sprites.h: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | #ifndef SPRITES_H 4 | #define SPRITES_H 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | 9 | #endif // SPRITES_H 10 | -------------------------------------------------------------------------------- /13_Metatiles/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "metatiles.chr" 3 | -------------------------------------------------------------------------------- /13_Metatiles/metatiles.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/13_Metatiles/metatiles.chr -------------------------------------------------------------------------------- /14_Metatiles2/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const char Room1[] = { 2 | 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 4 | 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 5 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 6 | 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 7 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 8 | 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 9 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 10 | 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 11 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}; 12 | -------------------------------------------------------------------------------- /14_Metatiles2/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 12 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 13 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 14 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 15 | 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0 16 | -------------------------------------------------------------------------------- /14_Metatiles2/BG/Room1.h: -------------------------------------------------------------------------------- 1 | #ifndef BG_ROOM_H 2 | #define BG_ROOM_H 3 | 4 | extern const char Room1[]; 5 | 6 | #endif // BG_ROOM_H 7 | -------------------------------------------------------------------------------- /14_Metatiles2/BG/Room1.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 9 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 10 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 11 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 12 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 13 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 14 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 15 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 17 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 18 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 19 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 20 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 21 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1, 22 | 1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /14_Metatiles2/BG/metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/14_Metatiles2/BG/metatiles.png -------------------------------------------------------------------------------- /14_Metatiles2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(14_metatiles2 LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(metatiles2 11 | metatiles2.c 12 | Sprites.c 13 | chr-rom.s 14 | BG/Room1.c 15 | ) 16 | target_include_directories(metatiles2 PRIVATE .) 17 | target_link_libraries(metatiles2 nesdoug neslib) 18 | set_property(SOURCE chr-rom.s PROPERTY 19 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/metatiles2.chr) 20 | -------------------------------------------------------------------------------- /14_Metatiles2/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |    -------------------------------------------------------------------------------- /14_Metatiles2/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 0, 0, 0, 0, 3, 3 | 4, 4, 4, 4, 1, 4 | 9, 9, 9, 9, 2, 5 | 5, 6, 8, 7, 1, 6 | 5, 6, 8, 7, 0 7 | }; 8 | 9 | -------------------------------------------------------------------------------- /14_Metatiles2/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | const unsigned char RoundSprL[] = {0xff, 0xff, 0x02, 0, 7, 0xff, 0x03, 0, 0xff, 4 | 7, 0x12, 0, 7, 7, 0x13, 0, 128}; 5 | 6 | const unsigned char RoundSprR[] = {0xff, 0xff, 0x00, 0, 7, 0xff, 0x01, 0, 0xff, 7 | 7, 0x10, 0, 7, 7, 0x11, 0, 128}; 8 | -------------------------------------------------------------------------------- /14_Metatiles2/Sprites.h: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | #ifndef SPRITES_H 4 | #define SPRITES_H 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | 9 | #endif // SPRITES_H 10 | -------------------------------------------------------------------------------- /14_Metatiles2/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "metatiles2.chr" 3 | -------------------------------------------------------------------------------- /14_Metatiles2/metatiles2.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/14_Metatiles2/metatiles2.chr -------------------------------------------------------------------------------- /15_Scroll_R/BG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(rooms 2 | Room1.c 3 | Room2.c 4 | Room3.c 5 | Room4.c 6 | Room5.c 7 | Rooms.c 8 | ) 9 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room1[]={ 2 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 4 | 0,1,1,1,1,1,1,0,0,0,0,0,4,4,0,0, 5 | 0,0,0,0,0,1,0,0,0,0,0,0,4,4,0,0, 6 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 13 | 0,0,2,2,0,0,0,0,0,0,0,0,3,3,0,0, 14 | 0,0,2,2,0,0,0,0,0,0,0,0,3,3,0,0, 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 16 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0 3 | 0,1,1,1,1,1,1,0,0,0,0,0,4,4,0,0 4 | 0,0,0,0,0,1,0,0,0,0,0,0,4,4,0,0 5 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 12 | 0,0,2,2,0,0,0,0,0,0,0,0,3,3,0,0 13 | 0,0,2,2,0,0,0,0,0,0,0,0,3,3,0,0 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 16 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room1.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1, 9 | 1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1, 10 | 1,2,2,2,2,2,2,1,1,1,1,1,5,5,1,1, 11 | 1,1,1,1,1,2,1,1,1,1,1,1,5,5,1,1, 12 | 1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1, 13 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 17 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 18 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 19 | 1,1,3,3,1,1,1,1,1,1,1,1,4,4,1,1, 20 | 1,1,3,3,1,1,1,1,1,1,1,1,4,4,1,1, 21 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 22 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room2.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room2[]={ 2 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 3 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 4 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 5 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 6 | 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1, 7 | 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1, 8 | 0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0, 9 | 1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0, 10 | 1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0, 11 | 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0, 12 | 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0, 13 | 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0, 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room2.csv: -------------------------------------------------------------------------------- 1 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 2 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 3 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 4 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 5 | 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1 6 | 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1 7 | 0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0 8 | 1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0 9 | 1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0 10 | 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0 11 | 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0 12 | 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0 13 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room2.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 9 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 10 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 11 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 12 | 1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2, 13 | 1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2, 14 | 1,1,1,1,1,1,1,1,2,2,2,2,2,2,1,1, 15 | 2,2,2,2,2,2,1,1,2,2,2,2,2,2,1,1, 16 | 2,2,2,2,2,2,1,1,2,2,2,2,2,2,1,1, 17 | 2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1, 18 | 2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1, 19 | 2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1, 20 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 21 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 22 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room3.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room3[]={ 2 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 4 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 5 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 6 | 2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2, 7 | 2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2, 8 | 0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0, 11 | 0,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2, 12 | 2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2, 13 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 14 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 15 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 16 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room3.csv: -------------------------------------------------------------------------------- 1 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 2 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 3 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 4 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 5 | 2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2 6 | 2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2 7 | 0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0 10 | 0,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2 11 | 2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2 12 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 13 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 14 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 15 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 16 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room3.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 9 | 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 10 | 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 11 | 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 12 | 3,3,3,3,3,3,1,1,1,1,3,3,3,3,3,3, 13 | 3,3,3,3,3,3,1,1,1,1,3,3,3,3,3,3, 14 | 1,1,1,1,1,1,1,4,4,1,1,1,1,1,1,1, 15 | 1,1,1,1,1,1,1,4,4,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,4,4,1,1,1,1,1,1,1, 17 | 1,3,3,3,3,3,1,1,1,1,3,3,3,3,3,3, 18 | 3,3,3,3,3,3,1,1,1,1,3,3,3,3,3,3, 19 | 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 20 | 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 21 | 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 22 | 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room4.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room4[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, 5 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 6 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0, 10 | 0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0, 11 | 4,4,4,4,4,4,0,0,0,0,4,4,4,4,4,4, 12 | 4,4,4,4,4,4,0,0,0,0,4,4,4,4,4,4, 13 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, 16 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room4.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4 4 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 5 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0 9 | 0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0 10 | 4,4,4,4,4,4,0,0,0,0,4,4,4,4,4,4 11 | 4,4,4,4,4,4,0,0,0,0,4,4,4,4,4,4 12 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4 13 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4 16 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room4.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5, 9 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5, 10 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5, 11 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 12 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 13 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 15 | 1,1,1,1,5,5,5,5,5,5,5,5,1,1,1,1, 16 | 1,1,1,1,5,5,5,5,5,5,5,5,1,1,1,1, 17 | 5,5,5,5,5,5,1,1,1,1,5,5,5,5,5,5, 18 | 5,5,5,5,5,5,1,1,1,1,5,5,5,5,5,5, 19 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5, 20 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5, 21 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5, 22 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room5.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room5[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 6 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 7 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 8 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 9 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 10 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 11 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 12 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 13 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 14 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 16 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room5.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 5 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 6 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 7 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 8 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 9 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 10 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 11 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 12 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 13 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 16 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Room5.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 10 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 11 | 1,1,1,3,3,3,3,3,3,3,3,3,3,3,1,1, 12 | 1,1,1,3,3,3,3,3,3,3,3,3,3,3,1,1, 13 | 1,1,1,3,3,3,3,3,3,3,3,3,3,3,1,1, 14 | 1,1,1,3,3,3,3,3,3,3,3,3,3,3,1,1, 15 | 1,1,1,3,3,3,3,3,3,3,3,3,3,3,1,1, 16 | 1,1,1,3,3,3,3,3,3,3,3,3,3,3,1,1, 17 | 1,1,1,3,3,3,3,3,3,3,3,3,3,3,1,1, 18 | 1,1,1,3,3,3,3,3,3,3,3,3,3,3,1,1, 19 | 1,1,1,3,3,3,3,3,3,3,3,3,3,3,1,1, 20 | 1,1,1,3,3,3,3,3,3,3,3,3,3,3,1,1, 21 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 22 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Rooms.c: -------------------------------------------------------------------------------- 1 | extern const unsigned char Room1[]; 2 | extern const unsigned char Room2[]; 3 | extern const unsigned char Room3[]; 4 | extern const unsigned char Room4[]; 5 | extern const unsigned char Room5[]; 6 | 7 | const unsigned char *const Rooms[] = {Room1, Room2, Room3, Room4, Room5}; 8 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/Rooms.h: -------------------------------------------------------------------------------- 1 | #ifndef ROOMS_H 2 | #define ROOMS_H 3 | 4 | extern const unsigned char *const Rooms[]; 5 | 6 | #define MAX_ROOMS (5 - 1) 7 | #define MAX_SCROLL (MAX_ROOMS * 0x100 - 1) 8 | 9 | #endif // ROOMS_H 10 | -------------------------------------------------------------------------------- /15_Scroll_R/BG/metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/15_Scroll_R/BG/metatiles.png -------------------------------------------------------------------------------- /15_Scroll_R/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(15_scroll_r LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(scroll_r 11 | scroll_r.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(scroll_r PRIVATE .) 16 | target_link_libraries(scroll_r nesdoug neslib rooms) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scroll_r.chr) 19 | 20 | add_subdirectory(BG) 21 | -------------------------------------------------------------------------------- /15_Scroll_R/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |    -------------------------------------------------------------------------------- /15_Scroll_R/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 2, 2, 2, 2, 3, 3 | 4, 4, 4, 4, 1, 4 | 9, 9, 9, 9, 2, 5 | 5, 6, 8, 7, 1, 6 | 5, 6, 8, 7, 0 7 | }; 8 | 9 | -------------------------------------------------------------------------------- /15_Scroll_R/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | const unsigned char RoundSprL[] = {0xff, 0xff, 0x02, 0, 7, 0xff, 0x03, 0, 0xff, 4 | 7, 0x12, 0, 7, 7, 0x13, 0, 128}; 5 | 6 | const unsigned char RoundSprR[] = {0xff, 0xff, 0x00, 0, 7, 0xff, 0x01, 0, 0xff, 7 | 7, 0x10, 0, 7, 7, 0x11, 0, 128}; 8 | -------------------------------------------------------------------------------- /15_Scroll_R/Sprites.h: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | #ifndef SPRITES_H 4 | #define SPRITES_H 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | 9 | #endif // SPRITES_H 10 | -------------------------------------------------------------------------------- /15_Scroll_R/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "scroll_r.chr" 3 | -------------------------------------------------------------------------------- /15_Scroll_R/scroll_r.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/15_Scroll_R/scroll_r.chr -------------------------------------------------------------------------------- /16_Scroll_Up/BG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(rooms 2 | Room1.c 3 | Room2.c 4 | Room3.c 5 | Room4.c 6 | Room5.c 7 | Rooms.c 8 | ) 9 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room1[]={ 2 | 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 10 | 0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0, 11 | 0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0, 12 | 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 13 | 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 14 | 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 16 | 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0 10 | 0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0 11 | 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 12 | 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 13 | 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 15 | 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4 16 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room1.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5, 9 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 10 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 11 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 12 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 13 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,2,2,2,1,1, 17 | 1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1, 18 | 1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1, 19 | 1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1, 20 | 1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1, 21 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 22 | 5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room2.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room2[]={ 2 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1, 3 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1, 4 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1, 5 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1, 6 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1, 7 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1, 8 | 1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1, 9 | 1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1, 10 | 1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1, 11 | 1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1, 12 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1, 13 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1, 14 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1, 15 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room2.csv: -------------------------------------------------------------------------------- 1 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 2 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 3 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 4 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 5 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 6 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 7 | 1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1 8 | 1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1 9 | 1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1 10 | 1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1 11 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 12 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 13 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 14 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room2.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2, 9 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2, 10 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2, 11 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2, 12 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2, 13 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2, 14 | 2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,2, 15 | 2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2, 16 | 2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2, 17 | 2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,2, 18 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2, 19 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2, 20 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2, 21 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2, 22 | 2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room3.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room3[]={ 2 | 2,2,2,2,2,0,0,0,0,0,0,0,2,2,2,2, 3 | 2,2,2,2,2,0,0,0,0,0,0,0,2,2,2,2, 4 | 2,2,2,2,2,0,0,0,0,0,0,0,2,2,2,2, 5 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2, 6 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2, 7 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2, 8 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2, 9 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2, 10 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2, 11 | 2,2,2,2,2,2,0,0,0,0,0,0,2,2,2,2, 12 | 2,2,2,2,2,2,0,0,0,0,0,0,2,2,2,2, 13 | 2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2, 14 | 2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2, 15 | 2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2, 16 | 2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room3.csv: -------------------------------------------------------------------------------- 1 | 2,2,2,2,2,0,0,0,0,0,0,0,2,2,2,2 2 | 2,2,2,2,2,0,0,0,0,0,0,0,2,2,2,2 3 | 2,2,2,2,2,0,0,0,0,0,0,0,2,2,2,2 4 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2 5 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2 6 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2 7 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2 8 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2 9 | 2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2 10 | 2,2,2,2,2,2,0,0,0,0,0,0,2,2,2,2 11 | 2,2,2,2,2,2,0,0,0,0,0,0,2,2,2,2 12 | 2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2 13 | 2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2 14 | 2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2 15 | 2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2 16 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room4.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room4[]={ 2 | 4,4,4,4,4,4,4,4,4,4,0,0,0,4,4,4, 3 | 4,4,4,4,4,4,4,4,4,4,0,0,0,4,4,4, 4 | 4,4,4,4,4,4,4,4,4,4,0,0,0,4,4,4, 5 | 4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4, 6 | 4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4, 7 | 4,4,0,0,0,4,4,4,4,4,4,4,4,4,4,4, 8 | 4,4,0,0,0,4,4,4,4,4,4,4,4,4,4,4, 9 | 4,4,0,0,0,4,4,4,4,4,4,4,4,4,4,4, 10 | 4,4,0,0,0,4,4,4,4,4,4,4,4,4,4,4, 11 | 4,4,0,0,0,0,0,0,4,4,4,4,4,4,4,4, 12 | 4,4,0,0,0,0,0,0,4,4,4,4,4,4,4,4, 13 | 4,4,4,4,4,0,0,0,4,4,4,4,4,4,4,4, 14 | 4,4,4,4,4,0,0,0,4,4,4,4,4,4,4,4, 15 | 4,4,4,4,4,0,0,0,4,4,4,4,4,4,4,4, 16 | 4,4,4,4,4,0,0,0,4,4,4,4,4,4,4,4 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room4.csv: -------------------------------------------------------------------------------- 1 | 4,4,4,4,4,4,4,4,4,4,0,0,0,4,4,4 2 | 4,4,4,4,4,4,4,4,4,4,0,0,0,4,4,4 3 | 4,4,4,4,4,4,4,4,4,4,0,0,0,4,4,4 4 | 4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4 5 | 4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4 6 | 4,4,0,0,0,4,4,4,4,4,4,4,4,4,4,4 7 | 4,4,0,0,0,4,4,4,4,4,4,4,4,4,4,4 8 | 4,4,0,0,0,4,4,4,4,4,4,4,4,4,4,4 9 | 4,4,0,0,0,4,4,4,4,4,4,4,4,4,4,4 10 | 4,4,0,0,0,0,0,0,4,4,4,4,4,4,4,4 11 | 4,4,0,0,0,0,0,0,4,4,4,4,4,4,4,4 12 | 4,4,4,4,4,0,0,0,4,4,4,4,4,4,4,4 13 | 4,4,4,4,4,0,0,0,4,4,4,4,4,4,4,4 14 | 4,4,4,4,4,0,0,0,4,4,4,4,4,4,4,4 15 | 4,4,4,4,4,0,0,0,4,4,4,4,4,4,4,4 16 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room5.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room5[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,2,2,2,2,0,0,2,2,2,2,2,0,0, 6 | 0,0,0,2,2,2,2,0,0,2,2,2,2,2,0,0, 7 | 0,0,0,2,2,2,2,0,0,2,2,2,2,2,0,0, 8 | 0,0,0,2,2,2,0,0,0,0,2,2,2,2,0,0, 9 | 0,0,0,2,2,2,0,3,3,0,2,2,2,2,0,0, 10 | 0,0,0,2,2,2,0,0,0,0,2,2,2,2,0,0, 11 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 12 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 13 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 14 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0, 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 16 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Room5.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,2,2,2,2,0,0,2,2,2,2,2,0,0 5 | 0,0,0,2,2,2,2,0,0,2,2,2,2,2,0,0 6 | 0,0,0,2,2,2,2,0,0,2,2,2,2,2,0,0 7 | 0,0,0,2,2,2,0,0,0,0,2,2,2,2,0,0 8 | 0,0,0,2,2,2,0,3,3,0,2,2,2,2,0,0 9 | 0,0,0,2,2,2,0,0,0,0,2,2,2,2,0,0 10 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 11 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 12 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 13 | 0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 15 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 16 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Rooms.c: -------------------------------------------------------------------------------- 1 | extern const unsigned char Room1[]; 2 | extern const unsigned char Room2[]; 3 | extern const unsigned char Room3[]; 4 | extern const unsigned char Room4[]; 5 | extern const unsigned char Room5[]; 6 | 7 | const unsigned char *const Rooms[] = {Room5, Room4, Room3, Room2, Room1}; 8 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/Rooms.h: -------------------------------------------------------------------------------- 1 | #ifndef BG_ROOMS_H 2 | #define BG_ROOMS_H 3 | 4 | #define MAX_ROOMS (5 - 1) 5 | #define MAX_SCROLL ((MAX_ROOMS * 0x100) - 0x11) 6 | 7 | #define MIN_SCROLL 2 8 | // data is exactly 240 bytes, 16 * 15 9 | // doubles as the collision map data 10 | 11 | extern const unsigned char *const Rooms[]; 12 | 13 | #endif // BG_ROOMS_H 14 | -------------------------------------------------------------------------------- /16_Scroll_Up/BG/metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/16_Scroll_Up/BG/metatiles.png -------------------------------------------------------------------------------- /16_Scroll_Up/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(16_scroll_up LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(scroll_up 11 | scroll_up.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(scroll_up PRIVATE .) 16 | target_link_libraries(scroll_up nesdoug neslib rooms) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scroll_up.chr) 19 | 20 | add_subdirectory(BG) 21 | -------------------------------------------------------------------------------- /16_Scroll_Up/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |    -------------------------------------------------------------------------------- /16_Scroll_Up/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 2, 2, 2, 2, 3, 3 | 4, 4, 4, 4, 1, 4 | 9, 9, 9, 9, 2, 5 | 5, 6, 8, 7, 1, 6 | 5, 6, 8, 7, 0 7 | }; 8 | 9 | -------------------------------------------------------------------------------- /16_Scroll_Up/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | // clang-format off 4 | const unsigned char RoundSprL[] = { 5 | 0xff, 0xfe, 0x02, 0, 6 | 7, 0xfe, 0x03, 0, 7 | 0xff, 6, 0x12, 0, 8 | 7, 6, 0x13, 0, 9 | 128 10 | }; 11 | // clang-format on 12 | 13 | // clang-format off 14 | const unsigned char RoundSprR[] = { 15 | 0xff, 0xfe, 0x00, 0, 16 | 7, 0xfe, 0x01, 0, 17 | 0xff, 6, 0x10, 0, 18 | 7, 6, 0x11, 0, 19 | 128 20 | }; 21 | // clang-format on 22 | -------------------------------------------------------------------------------- /16_Scroll_Up/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | 9 | #endif // SPRITES_H 10 | -------------------------------------------------------------------------------- /16_Scroll_Up/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "scroll_up.chr" 3 | -------------------------------------------------------------------------------- /16_Scroll_Up/scroll_up.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/16_Scroll_Up/scroll_up.chr -------------------------------------------------------------------------------- /17_Platformer/BG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(rooms 2 | Room1.c 3 | Room2.c 4 | Room3.c 5 | Room4.c 6 | Room5.c 7 | Rooms.c 8 | ) 9 | -------------------------------------------------------------------------------- /17_Platformer/BG/Metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/17_Platformer/BG/Metatiles.png -------------------------------------------------------------------------------- /17_Platformer/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room1[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 13 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 14 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /17_Platformer/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 13 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /17_Platformer/BG/Room2.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room2[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 13 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0, 14 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /17_Platformer/BG/Room2.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0 11 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 12 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0 13 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /17_Platformer/BG/Room3.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room3[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0, 12 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0, 13 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0, 14 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /17_Platformer/BG/Room3.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 10 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0 11 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0 12 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0 13 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /17_Platformer/BG/Room4.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room4[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0, 13 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0, 14 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /17_Platformer/BG/Room4.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 11 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0 12 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0 13 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /17_Platformer/BG/Room5.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room5[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 10 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 11 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0, 12 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0, 13 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0, 14 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /17_Platformer/BG/Room5.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 10 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0 11 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0 12 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0 13 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /17_Platformer/BG/Rooms.c: -------------------------------------------------------------------------------- 1 | extern const unsigned char Room1[]; 2 | extern const unsigned char Room2[]; 3 | extern const unsigned char Room3[]; 4 | extern const unsigned char Room4[]; 5 | extern const unsigned char Room5[]; 6 | 7 | const unsigned char *const Rooms[] = {Room1, Room2, Room3, Room4, Room5}; 8 | -------------------------------------------------------------------------------- /17_Platformer/BG/Rooms.h: -------------------------------------------------------------------------------- 1 | #ifndef ROOMS_H 2 | #define ROOMS_H 3 | 4 | // data is exactly 240 bytes, 16 * 15 5 | // doubles as the collision map data 6 | extern const unsigned char *const Rooms[]; 7 | 8 | #define MAX_ROOMS (5 - 1) 9 | #define MAX_SCROLL (MAX_ROOMS * 0x100 - 1) 10 | 11 | #endif // ROOMS_H 12 | -------------------------------------------------------------------------------- /17_Platformer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(17_platformer LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(platformer 11 | platformer.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(platformer PRIVATE .) 16 | target_link_libraries(platformer nesdoug neslib rooms) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/platformer.chr) 19 | 20 | add_subdirectory(BG) 21 | -------------------------------------------------------------------------------- /17_Platformer/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |  2 |  5 -------------------------------------------------------------------------------- /17_Platformer/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 0, 0, 0, 0, 0, 3 | 2, 2, 2, 2, 3, 4 | 20, 20, 20, 20, 0, 5 | 5, 6, 21, 22, 1, 6 | 6, 6, 22, 22, 1, 7 | 6, 7, 22, 23, 1, 8 | 21, 22, 21, 22, 1, 9 | 22, 22, 22, 22, 1, 10 | 22, 23, 22, 23, 1, 11 | 8, 9, 24, 25, 1, 12 | 9, 9, 25, 25, 1, 13 | 9, 10, 25, 26, 1 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /17_Platformer/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | // clang-format off 4 | const unsigned char RoundSprL[]={ 5 | 0xff, 0xfc, 0x02, 0, 6 | 7, 0xfc, 0x03, 0, 7 | 0xff, 4, 0x12, 0, 8 | 7, 4, 0x13, 0, 9 | 128 10 | }; 11 | // clang-format on 12 | 13 | // clang-format off 14 | const unsigned char RoundSprR[]={ 15 | 0xff,0xfc, 0x00, 0, 16 | 7, 0xfc, 0x01, 0, 17 | 0xff,4, 0x10, 0, 18 | 7, 4, 0x11, 0, 19 | 128 20 | }; 21 | // clang-format on 22 | -------------------------------------------------------------------------------- /17_Platformer/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | 9 | #endif // SPRITES_H 10 | -------------------------------------------------------------------------------- /17_Platformer/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "platformer.chr" 3 | -------------------------------------------------------------------------------- /17_Platformer/platformer.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/17_Platformer/platformer.chr -------------------------------------------------------------------------------- /18_Music/BG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(rooms 2 | Room1.c 3 | Room2.c 4 | Room3.c 5 | Room4.c 6 | Room5.c 7 | Rooms.c 8 | ) 9 | -------------------------------------------------------------------------------- /18_Music/BG/Metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/18_Music/BG/Metatiles.png -------------------------------------------------------------------------------- /18_Music/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room1[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 13 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 14 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /18_Music/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 13 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /18_Music/BG/Room2.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room2[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 13 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0, 14 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /18_Music/BG/Room2.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0 11 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 12 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0 13 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /18_Music/BG/Room3.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room3[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0, 12 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0, 13 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0, 14 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /18_Music/BG/Room3.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 10 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0 11 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0 12 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0 13 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /18_Music/BG/Room4.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room4[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0, 13 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0, 14 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /18_Music/BG/Room4.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 11 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0 12 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0 13 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /18_Music/BG/Room5.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room5[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 10 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 11 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0, 12 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0, 13 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0, 14 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /18_Music/BG/Room5.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 10 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0 11 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0 12 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0 13 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /18_Music/BG/Rooms.c: -------------------------------------------------------------------------------- 1 | extern const unsigned char Room1[]; 2 | extern const unsigned char Room2[]; 3 | extern const unsigned char Room3[]; 4 | extern const unsigned char Room4[]; 5 | extern const unsigned char Room5[]; 6 | 7 | const unsigned char *const Rooms[] = {Room1, Room2, Room3, Room4, Room5}; 8 | -------------------------------------------------------------------------------- /18_Music/BG/Rooms.h: -------------------------------------------------------------------------------- 1 | #ifndef ROOMS_H 2 | #define ROOMS_H 3 | 4 | // data is exactly 240 bytes, 16 * 15 5 | // doubles as the collision map data 6 | extern const unsigned char *const Rooms[]; 7 | 8 | #define MAX_ROOMS (5 - 1) 9 | #define MAX_SCROLL (MAX_ROOMS * 0x100 - 1) 10 | 11 | #endif // ROOMS_H 12 | -------------------------------------------------------------------------------- /18_Music/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(18_music LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(platformer2 11 | platformer2.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(platformer2 PRIVATE .) 16 | target_link_libraries(platformer2 nesdoug neslib famitone2 rooms music) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/platformer.chr) 19 | 20 | add_subdirectory(BG) 21 | add_subdirectory(MUSIC) 22 | -------------------------------------------------------------------------------- /18_Music/MUSIC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(music music.s) 2 | target_include_directories(music PRIVATE .) 3 | -------------------------------------------------------------------------------- /18_Music/MUSIC/TestMusic3.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/18_Music/MUSIC/TestMusic3.ftm -------------------------------------------------------------------------------- /18_Music/MUSIC/music.s: -------------------------------------------------------------------------------- 1 | .section .rodata.music_data,"a",@progbits 2 | .globl music_data 3 | music_data: 4 | .include "TestMusic3.s" 5 | 6 | .section .rodata.sounds_data,"a",@progbits 7 | .globl sounds_data 8 | sounds_data: 9 | -------------------------------------------------------------------------------- /18_Music/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |  2 |  5 -------------------------------------------------------------------------------- /18_Music/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 0, 0, 0, 0, 0, 3 | 2, 2, 2, 2, 3, 4 | 20, 20, 20, 20, 0, 5 | 5, 6, 21, 22, 1, 6 | 6, 6, 22, 22, 1, 7 | 6, 7, 22, 23, 1, 8 | 21, 22, 21, 22, 1, 9 | 22, 22, 22, 22, 1, 10 | 22, 23, 22, 23, 1, 11 | 8, 9, 24, 25, 1, 12 | 9, 9, 25, 25, 1, 13 | 9, 10, 25, 26, 1 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /18_Music/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | // clang-format off 4 | const unsigned char RoundSprL[]={ 5 | 0xff, 0xfc, 0x02, 0, 6 | 7, 0xfc, 0x03, 0, 7 | 0xff, 4, 0x12, 0, 8 | 7, 4, 0x13, 0, 9 | 128 10 | }; 11 | // clang-format on 12 | 13 | // clang-format off 14 | const unsigned char RoundSprR[]={ 15 | 0xff,0xfc, 0x00, 0, 16 | 7, 0xfc, 0x01, 0, 17 | 0xff,4, 0x10, 0, 18 | 7, 4, 0x11, 0, 19 | 128 20 | }; 21 | // clang-format on 22 | -------------------------------------------------------------------------------- /18_Music/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | 9 | #endif // SPRITES_H 10 | -------------------------------------------------------------------------------- /18_Music/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "platformer.chr" 3 | -------------------------------------------------------------------------------- /18_Music/platformer.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/18_Music/platformer.chr -------------------------------------------------------------------------------- /19_SFX/BG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(rooms 2 | Room1.c 3 | Room2.c 4 | Room3.c 5 | Room4.c 6 | Room5.c 7 | Rooms.c 8 | ) 9 | -------------------------------------------------------------------------------- /19_SFX/BG/Metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/19_SFX/BG/Metatiles.png -------------------------------------------------------------------------------- /19_SFX/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room1[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 13 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 14 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /19_SFX/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 13 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /19_SFX/BG/Room2.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room2[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 13 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0, 14 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /19_SFX/BG/Room2.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0 11 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 12 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0 13 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /19_SFX/BG/Room3.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room3[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0, 12 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0, 13 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0, 14 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /19_SFX/BG/Room3.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 10 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0 11 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0 12 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0 13 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /19_SFX/BG/Room3.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 10 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 11 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 12 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 13 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 14 | 1,1,1,1,1,1,3,3,1,1,1,1,1,1,1,1, 15 | 1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1, 17 | 1,1,1,1,4,5,3,3,5,5,6,1,1,1,1,1, 18 | 1,1,1,1,7,8,8,8,3,8,9,1,1,1,1,1, 19 | 1,1,4,5,7,8,8,8,3,8,9,1,1,1,1,1, 20 | 1,1,10,11,7,8,3,3,8,8,9,1,1,1,1,1, 21 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 22 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /19_SFX/BG/Room4.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room4[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0, 13 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0, 14 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /19_SFX/BG/Room4.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 11 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0 12 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0 13 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /19_SFX/BG/Room5.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room5[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 10 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 11 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0, 12 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0, 13 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0, 14 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /19_SFX/BG/Room5.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 10 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0 11 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0 12 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0 13 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /19_SFX/BG/Room5.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 10 | 1,1,1,1,1,1,3,3,3,1,1,1,1,1,1,1, 11 | 1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1, 12 | 1,1,1,1,1,1,3,3,1,1,1,1,1,1,1,1, 13 | 1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1, 14 | 1,1,1,1,1,1,3,3,1,1,1,1,1,1,1,1, 15 | 1,1,1,1,1,1,1,1,1,1,1,3,3,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,3,3,1,1,1, 17 | 1,1,1,1,1,1,1,1,1,4,5,5,5,5,6,1, 18 | 1,1,1,1,1,1,1,1,1,7,8,8,8,8,9,1, 19 | 1,1,1,1,1,1,1,4,5,5,5,5,6,8,9,1, 20 | 1,1,1,1,1,1,1,7,8,8,8,8,9,11,12,1, 21 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 22 | 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /19_SFX/BG/Rooms.c: -------------------------------------------------------------------------------- 1 | extern const unsigned char Room1[]; 2 | extern const unsigned char Room2[]; 3 | extern const unsigned char Room3[]; 4 | extern const unsigned char Room4[]; 5 | extern const unsigned char Room5[]; 6 | 7 | const unsigned char *const Rooms[] = {Room1, Room2, Room3, Room4, Room5}; 8 | -------------------------------------------------------------------------------- /19_SFX/BG/Rooms.h: -------------------------------------------------------------------------------- 1 | #ifndef ROOMS_H 2 | #define ROOMS_H 3 | 4 | // data is exactly 240 bytes, 16 * 15 5 | // doubles as the collision map data 6 | extern const unsigned char *const Rooms[]; 7 | 8 | #define MAX_ROOMS (5 - 1) 9 | #define MAX_SCROLL (MAX_ROOMS * 0x100 - 1) 10 | 11 | #endif // ROOMS_H 12 | -------------------------------------------------------------------------------- /19_SFX/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(19_sfx LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(platformer3 11 | platformer3.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(platformer3 PRIVATE .) 16 | target_link_libraries(platformer3 nesdoug neslib famitone2 rooms music) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/platformer.chr) 19 | 20 | add_subdirectory(BG) 21 | add_subdirectory(MUSIC) 22 | -------------------------------------------------------------------------------- /19_SFX/MUSIC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(music music.s) 2 | target_include_directories(music PRIVATE .) 3 | -------------------------------------------------------------------------------- /19_SFX/MUSIC/SoundFx.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/19_SFX/MUSIC/SoundFx.ftm -------------------------------------------------------------------------------- /19_SFX/MUSIC/SoundFx.nsf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/19_SFX/MUSIC/SoundFx.nsf -------------------------------------------------------------------------------- /19_SFX/MUSIC/SoundFx.s: -------------------------------------------------------------------------------- 1 | ;this file for FamiTone2 libary generated by nsf2data tool 2 | 3 | sounds: 4 | .word .Lntsc 5 | .word .Lpal 6 | .Lntsc: 7 | .word .Lsfx_ntsc_0 8 | .word .Lsfx_ntsc_1 9 | .word .Lsfx_ntsc_2 10 | .Lpal: 11 | .word .Lsfx_pal_0 12 | .word .Lsfx_pal_1 13 | .word .Lsfx_pal_2 14 | 15 | .Lsfx_ntsc_0: 16 | .byte $83,$b8,$84,$ab,$85,$01,$02,$84,$93,$02,$84,$67,$01,$84,$3f,$07 17 | .byte $00 18 | .Lsfx_pal_0: 19 | .byte $83,$b8,$84,$8c,$85,$01,$02,$84,$76,$02,$84,$4d,$01,$84,$29,$05 20 | .byte $00 21 | .Lsfx_ntsc_1: 22 | .byte $83,$ba,$84,$54,$85,$00,$04,$84,$6a,$04,$84,$42,$04,$00 23 | .Lsfx_pal_1: 24 | .byte $83,$ba,$84,$4e,$85,$00,$04,$84,$62,$04,$84,$3e,$02,$00 25 | .Lsfx_ntsc_2: 26 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$0a,$00 27 | .Lsfx_pal_2: 28 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$08,$00 29 | -------------------------------------------------------------------------------- /19_SFX/MUSIC/TestMusic3.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/19_SFX/MUSIC/TestMusic3.ftm -------------------------------------------------------------------------------- /19_SFX/MUSIC/music.s: -------------------------------------------------------------------------------- 1 | .section .rodata.music_data,"a",@progbits 2 | .globl music_data 3 | music_data: 4 | .include "TestMusic3.s" 5 | 6 | .section .rodata.sounds_data,"a",@progbits 7 | .globl sounds_data 8 | sounds_data: 9 | .include "SoundFx.s" 10 | -------------------------------------------------------------------------------- /19_SFX/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |  2 |  5 -------------------------------------------------------------------------------- /19_SFX/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 0, 0, 0, 0, 0, 3 | 2, 2, 2, 2, 3, 4 | 20, 20, 20, 20, 0, 5 | 5, 6, 21, 22, 1, 6 | 6, 6, 22, 22, 1, 7 | 6, 7, 22, 23, 1, 8 | 21, 22, 21, 22, 1, 9 | 22, 22, 22, 22, 1, 10 | 22, 23, 22, 23, 1, 11 | 8, 9, 24, 25, 1, 12 | 9, 9, 25, 25, 1, 13 | 9, 10, 25, 26, 1 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /19_SFX/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | // clang-format off 4 | const unsigned char RoundSprL[]={ 5 | 0xff, 0xfc, 0x02, 0, 6 | 7, 0xfc, 0x03, 0, 7 | 0xff, 4, 0x12, 0, 8 | 7, 4, 0x13, 0, 9 | 128 10 | }; 11 | // clang-format on 12 | 13 | // clang-format off 14 | const unsigned char RoundSprR[]={ 15 | 0xff,0xfc, 0x00, 0, 16 | 7, 0xfc, 0x01, 0, 17 | 0xff,4, 0x10, 0, 18 | 7, 4, 0x11, 0, 19 | 128 20 | }; 21 | // clang-format on 22 | -------------------------------------------------------------------------------- /19_SFX/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | 9 | #endif // SPRITES_H 10 | -------------------------------------------------------------------------------- /19_SFX/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "platformer.chr" 3 | -------------------------------------------------------------------------------- /19_SFX/platformer.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/19_SFX/platformer.chr -------------------------------------------------------------------------------- /20_DPCM/BG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(rooms 2 | Room1.c 3 | Room2.c 4 | Room3.c 5 | Room4.c 6 | Room5.c 7 | Rooms.c 8 | ) 9 | -------------------------------------------------------------------------------- /20_DPCM/BG/Metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/20_DPCM/BG/Metatiles.png -------------------------------------------------------------------------------- /20_DPCM/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room1[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 13 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 14 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /20_DPCM/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 13 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /20_DPCM/BG/Room2.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room2[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 13 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0, 14 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /20_DPCM/BG/Room2.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0 11 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 12 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0 13 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /20_DPCM/BG/Room3.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room3[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0, 12 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0, 13 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0, 14 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /20_DPCM/BG/Room3.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 10 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0 11 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0 12 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0 13 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /20_DPCM/BG/Room4.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room4[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0, 13 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0, 14 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /20_DPCM/BG/Room4.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 11 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0 12 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0 13 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /20_DPCM/BG/Room5.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room5[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 10 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 11 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0, 12 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0, 13 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0, 14 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /20_DPCM/BG/Room5.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 10 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0 11 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0 12 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0 13 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /20_DPCM/BG/Rooms.c: -------------------------------------------------------------------------------- 1 | extern const unsigned char Room1[]; 2 | extern const unsigned char Room2[]; 3 | extern const unsigned char Room3[]; 4 | extern const unsigned char Room4[]; 5 | extern const unsigned char Room5[]; 6 | 7 | const unsigned char *const Rooms[] = {Room1, Room2, Room3, Room4, Room5}; 8 | -------------------------------------------------------------------------------- /20_DPCM/BG/Rooms.h: -------------------------------------------------------------------------------- 1 | #ifndef ROOMS_H 2 | #define ROOMS_H 3 | 4 | // data is exactly 240 bytes, 16 * 15 5 | // doubles as the collision map data 6 | extern const unsigned char *const Rooms[]; 7 | 8 | #define MAX_ROOMS (5 - 1) 9 | #define MAX_SCROLL (MAX_ROOMS * 0x100 - 1) 10 | 11 | #endif // ROOMS_H 12 | -------------------------------------------------------------------------------- /20_DPCM/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(20_dpcm LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(platformer4 11 | platformer4.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(platformer4 PRIVATE .) 16 | target_link_libraries(platformer4 nesdoug neslib famitone2 rooms music) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/platformer.chr) 19 | 20 | add_subdirectory(BG) 21 | add_subdirectory(MUSIC) 22 | -------------------------------------------------------------------------------- /20_DPCM/MUSIC/BassDrum.dmc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/20_DPCM/MUSIC/BassDrum.dmc -------------------------------------------------------------------------------- /20_DPCM/MUSIC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(music music.s) 2 | target_include_directories(music PRIVATE .) 3 | set_property(SOURCE music.s 4 | PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/DMCmusic.dmc) 5 | -------------------------------------------------------------------------------- /20_DPCM/MUSIC/DMCmusic.dmc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/20_DPCM/MUSIC/DMCmusic.dmc -------------------------------------------------------------------------------- /20_DPCM/MUSIC/DMCmusic.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/20_DPCM/MUSIC/DMCmusic.ftm -------------------------------------------------------------------------------- /20_DPCM/MUSIC/HalfHat.dmc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/20_DPCM/MUSIC/HalfHat.dmc -------------------------------------------------------------------------------- /20_DPCM/MUSIC/Jump.dmc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/20_DPCM/MUSIC/Jump.dmc -------------------------------------------------------------------------------- /20_DPCM/MUSIC/RimShot.dmc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/20_DPCM/MUSIC/RimShot.dmc -------------------------------------------------------------------------------- /20_DPCM/MUSIC/Tom.dmc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/20_DPCM/MUSIC/Tom.dmc -------------------------------------------------------------------------------- /20_DPCM/MUSIC/music.s: -------------------------------------------------------------------------------- 1 | .section .rodata.music_data,"a",@progbits 2 | .globl music_data 3 | music_data: 4 | .include "DMCmusic.s" 5 | 6 | .section .rodata.sounds_data,"a",@progbits 7 | .globl sounds_data 8 | sounds_data: 9 | 10 | .section .dpcm,"a",@progbits 11 | .incbin "DMCmusic.dmc" 12 | -------------------------------------------------------------------------------- /20_DPCM/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |  2 |  5 -------------------------------------------------------------------------------- /20_DPCM/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 0, 0, 0, 0, 0, 3 | 2, 2, 2, 2, 3, 4 | 20, 20, 20, 20, 0, 5 | 5, 6, 21, 22, 1, 6 | 6, 6, 22, 22, 1, 7 | 6, 7, 22, 23, 1, 8 | 21, 22, 21, 22, 1, 9 | 22, 22, 22, 22, 1, 10 | 22, 23, 22, 23, 1, 11 | 8, 9, 24, 25, 1, 12 | 9, 9, 25, 25, 1, 13 | 9, 10, 25, 26, 1 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /20_DPCM/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | // clang-format off 4 | const unsigned char RoundSprL[]={ 5 | 0xff, 0xfc, 0x02, 0, 6 | 7, 0xfc, 0x03, 0, 7 | 0xff, 4, 0x12, 0, 8 | 7, 4, 0x13, 0, 9 | 128 10 | }; 11 | // clang-format on 12 | 13 | // clang-format off 14 | const unsigned char RoundSprR[]={ 15 | 0xff,0xfc, 0x00, 0, 16 | 7, 0xfc, 0x01, 0, 17 | 0xff,4, 0x10, 0, 18 | 7, 4, 0x11, 0, 19 | 128 20 | }; 21 | // clang-format on 22 | -------------------------------------------------------------------------------- /20_DPCM/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | 9 | #endif // SPRITES_H 10 | -------------------------------------------------------------------------------- /20_DPCM/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "platformer.chr" 3 | -------------------------------------------------------------------------------- /20_DPCM/platformer.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/20_DPCM/platformer.chr -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(rooms 2 | Room1.c 3 | Room2.c 4 | Room3.c 5 | Room4.c 6 | Room5.c 7 | Rooms.c 8 | ) 9 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/21_Sprite_Zero/BG/Metatiles.png -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room1[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 13 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 14 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 13 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Room2.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room2[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 13 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0, 14 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Room2.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0 11 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 12 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0 13 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Room3.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room3[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0, 12 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0, 13 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0, 14 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Room3.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 10 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0 11 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0 12 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0 13 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Room4.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room4[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0, 13 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0, 14 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Room4.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 11 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0 12 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0 13 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Room5.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room5[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 10 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 11 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0, 12 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0, 13 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0, 14 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Room5.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 10 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0 11 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0 12 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0 13 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Rooms.c: -------------------------------------------------------------------------------- 1 | extern const unsigned char Room1[]; 2 | extern const unsigned char Room2[]; 3 | extern const unsigned char Room3[]; 4 | extern const unsigned char Room4[]; 5 | extern const unsigned char Room5[]; 6 | 7 | const unsigned char *const Rooms[] = {Room1, Room2, Room3, Room4, Room5}; 8 | -------------------------------------------------------------------------------- /21_Sprite_Zero/BG/Rooms.h: -------------------------------------------------------------------------------- 1 | #ifndef ROOMS_H 2 | #define ROOMS_H 3 | 4 | // data is exactly 240 bytes, 16 * 15 5 | // doubles as the collision map data 6 | extern const unsigned char *const Rooms[]; 7 | 8 | #define MAX_ROOMS (5 - 1) 9 | #define MAX_SCROLL (MAX_ROOMS * 0x100 - 1) 10 | 11 | #endif // ROOMS_H 12 | -------------------------------------------------------------------------------- /21_Sprite_Zero/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(21_sprite_zero LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(sprite_zero 11 | sprite_zero.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(sprite_zero PRIVATE .) 16 | target_link_libraries(sprite_zero nesdoug neslib famitone2 rooms music) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sprite_zero.chr) 19 | 20 | add_subdirectory(BG) 21 | add_subdirectory(MUSIC) 22 | -------------------------------------------------------------------------------- /21_Sprite_Zero/MUSIC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(music music.s) 2 | target_include_directories(music PRIVATE .) 3 | -------------------------------------------------------------------------------- /21_Sprite_Zero/MUSIC/SoundFx.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/21_Sprite_Zero/MUSIC/SoundFx.ftm -------------------------------------------------------------------------------- /21_Sprite_Zero/MUSIC/SoundFx.nsf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/21_Sprite_Zero/MUSIC/SoundFx.nsf -------------------------------------------------------------------------------- /21_Sprite_Zero/MUSIC/SoundFx.s: -------------------------------------------------------------------------------- 1 | ;this file for FamiTone2 libary generated by nsf2data tool 2 | 3 | sounds: 4 | .word .Lntsc 5 | .word .Lpal 6 | .Lntsc: 7 | .word .Lsfx_ntsc_0 8 | .word .Lsfx_ntsc_1 9 | .word .Lsfx_ntsc_2 10 | .Lpal: 11 | .word .Lsfx_pal_0 12 | .word .Lsfx_pal_1 13 | .word .Lsfx_pal_2 14 | 15 | .Lsfx_ntsc_0: 16 | .byte $83,$b8,$84,$ab,$85,$01,$02,$84,$93,$02,$84,$67,$01,$84,$3f,$07 17 | .byte $00 18 | .Lsfx_pal_0: 19 | .byte $83,$b8,$84,$8c,$85,$01,$02,$84,$76,$02,$84,$4d,$01,$84,$29,$05 20 | .byte $00 21 | .Lsfx_ntsc_1: 22 | .byte $83,$ba,$84,$54,$85,$00,$04,$84,$6a,$04,$84,$42,$04,$00 23 | .Lsfx_pal_1: 24 | .byte $83,$ba,$84,$4e,$85,$00,$04,$84,$62,$04,$84,$3e,$02,$00 25 | .Lsfx_ntsc_2: 26 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$0a,$00 27 | .Lsfx_pal_2: 28 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$08,$00 29 | -------------------------------------------------------------------------------- /21_Sprite_Zero/MUSIC/TestMusic3.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/21_Sprite_Zero/MUSIC/TestMusic3.ftm -------------------------------------------------------------------------------- /21_Sprite_Zero/MUSIC/music.s: -------------------------------------------------------------------------------- 1 | .section .rodata.music_data,"a",@progbits 2 | .globl music_data 3 | music_data: 4 | .include "TestMusic3.s" 5 | 6 | .section .rodata.sounds_data,"a",@progbits 7 | .globl sounds_data 8 | sounds_data: 9 | .include "SoundFx.s" 10 | -------------------------------------------------------------------------------- /21_Sprite_Zero/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |  2 |  5 -------------------------------------------------------------------------------- /21_Sprite_Zero/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 0, 0, 0, 0, 0, 3 | 2, 2, 2, 2, 3, 4 | 20, 20, 20, 20, 0, 5 | 5, 6, 21, 22, 1, 6 | 6, 6, 22, 22, 1, 7 | 6, 7, 22, 23, 1, 8 | 21, 22, 21, 22, 1, 9 | 22, 22, 22, 22, 1, 10 | 22, 23, 22, 23, 1, 11 | 8, 9, 24, 25, 1, 12 | 9, 9, 25, 25, 1, 13 | 9, 10, 25, 26, 1 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /21_Sprite_Zero/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | // clang-format off 4 | const unsigned char RoundSprL[]={ 5 | 0xff, 0xfc, 0x02, 0, 6 | 7, 0xfc, 0x03, 0, 7 | 0xff, 4, 0x12, 0, 8 | 7, 4, 0x13, 0, 9 | 128 10 | }; 11 | // clang-format on 12 | 13 | // clang-format off 14 | const unsigned char RoundSprR[]={ 15 | 0xff,0xfc, 0x00, 0, 16 | 7, 0xfc, 0x01, 0, 17 | 0xff,4, 0x10, 0, 18 | 7, 4, 0x11, 0, 19 | 128 20 | }; 21 | // clang-format on 22 | -------------------------------------------------------------------------------- /21_Sprite_Zero/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | 9 | #endif // SPRITES_H 10 | -------------------------------------------------------------------------------- /21_Sprite_Zero/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "sprite_zero.chr" 3 | -------------------------------------------------------------------------------- /21_Sprite_Zero/sprite_zero.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/21_Sprite_Zero/sprite_zero.chr -------------------------------------------------------------------------------- /22_XY_Split/.cache/clangd/index/Room1.c.DE1E8A121194B884.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/.cache/clangd/index/Room1.c.DE1E8A121194B884.idx -------------------------------------------------------------------------------- /22_XY_Split/.cache/clangd/index/Room2.c.B72896D8B4F2AC3F.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/.cache/clangd/index/Room2.c.B72896D8B4F2AC3F.idx -------------------------------------------------------------------------------- /22_XY_Split/.cache/clangd/index/Room3.c.D9CDC601A0104295.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/.cache/clangd/index/Room3.c.D9CDC601A0104295.idx -------------------------------------------------------------------------------- /22_XY_Split/.cache/clangd/index/Room4.c.DEADC3456942B524.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/.cache/clangd/index/Room4.c.DEADC3456942B524.idx -------------------------------------------------------------------------------- /22_XY_Split/.cache/clangd/index/Room5.c.10C72BB55C689CF0.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/.cache/clangd/index/Room5.c.10C72BB55C689CF0.idx -------------------------------------------------------------------------------- /22_XY_Split/.cache/clangd/index/Rooms.c.B3F8DD29FFC4C551.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/.cache/clangd/index/Rooms.c.B3F8DD29FFC4C551.idx -------------------------------------------------------------------------------- /22_XY_Split/.cache/clangd/index/Rooms.h.6770D64DA0244300.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/.cache/clangd/index/Rooms.h.6770D64DA0244300.idx -------------------------------------------------------------------------------- /22_XY_Split/.cache/clangd/index/Sprites.c.124895911A0AB117.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/.cache/clangd/index/Sprites.c.124895911A0AB117.idx -------------------------------------------------------------------------------- /22_XY_Split/.cache/clangd/index/Sprites.h.7C80014BEAE64E65.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/.cache/clangd/index/Sprites.h.7C80014BEAE64E65.idx -------------------------------------------------------------------------------- /22_XY_Split/.cache/clangd/index/sprite_zero.c.9C51A9E2F0AABE9B.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/.cache/clangd/index/sprite_zero.c.9C51A9E2F0AABE9B.idx -------------------------------------------------------------------------------- /22_XY_Split/BG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(rooms 2 | Room1.c 3 | Room2.c 4 | Room3.c 5 | Room4.c 6 | Room5.c 7 | Rooms.c 8 | ) 9 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/BG/Metatiles.png -------------------------------------------------------------------------------- /22_XY_Split/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room1[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 13 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 14 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 13 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Room2.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room2[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 13 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0, 14 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Room2.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0 11 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 12 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0 13 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Room3.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room3[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0, 12 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0, 13 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0, 14 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Room3.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 10 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0 11 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0 12 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0 13 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Room4.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room4[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0, 13 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0, 14 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Room4.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 11 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0 12 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0 13 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Room5.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room5[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 10 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 11 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0, 12 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0, 13 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0, 14 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Room5.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 10 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0 11 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0 12 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0 13 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Rooms.c: -------------------------------------------------------------------------------- 1 | extern const unsigned char Room1[]; 2 | extern const unsigned char Room2[]; 3 | extern const unsigned char Room3[]; 4 | extern const unsigned char Room4[]; 5 | extern const unsigned char Room5[]; 6 | 7 | const unsigned char *const Rooms[] = {Room1, Room2, Room3, Room4, Room5}; 8 | -------------------------------------------------------------------------------- /22_XY_Split/BG/Rooms.h: -------------------------------------------------------------------------------- 1 | #ifndef ROOMS_H 2 | #define ROOMS_H 3 | 4 | // data is exactly 240 bytes, 16 * 15 5 | // doubles as the collision map data 6 | extern const unsigned char *const Rooms[]; 7 | 8 | #define MAX_ROOMS (5 - 1) 9 | #define MAX_SCROLL (MAX_ROOMS * 0x100 - 1) 10 | 11 | #endif // ROOMS_H 12 | -------------------------------------------------------------------------------- /22_XY_Split/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(22_xy_split LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(xy_split 11 | xy_split.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(xy_split PRIVATE .) 16 | target_link_libraries(xy_split nesdoug neslib famitone2 rooms music) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/xy_split.chr) 19 | 20 | add_subdirectory(BG) 21 | add_subdirectory(MUSIC) 22 | -------------------------------------------------------------------------------- /22_XY_Split/MUSIC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(music music.s) 2 | target_include_directories(music PRIVATE .) 3 | -------------------------------------------------------------------------------- /22_XY_Split/MUSIC/SoundFx.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/MUSIC/SoundFx.ftm -------------------------------------------------------------------------------- /22_XY_Split/MUSIC/SoundFx.nsf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/MUSIC/SoundFx.nsf -------------------------------------------------------------------------------- /22_XY_Split/MUSIC/SoundFx.s: -------------------------------------------------------------------------------- 1 | ;this file for FamiTone2 libary generated by nsf2data tool 2 | 3 | sounds: 4 | .word .Lntsc 5 | .word .Lpal 6 | .Lntsc: 7 | .word .Lsfx_ntsc_0 8 | .word .Lsfx_ntsc_1 9 | .word .Lsfx_ntsc_2 10 | .Lpal: 11 | .word .Lsfx_pal_0 12 | .word .Lsfx_pal_1 13 | .word .Lsfx_pal_2 14 | 15 | .Lsfx_ntsc_0: 16 | .byte $83,$b8,$84,$ab,$85,$01,$02,$84,$93,$02,$84,$67,$01,$84,$3f,$07 17 | .byte $00 18 | .Lsfx_pal_0: 19 | .byte $83,$b8,$84,$8c,$85,$01,$02,$84,$76,$02,$84,$4d,$01,$84,$29,$05 20 | .byte $00 21 | .Lsfx_ntsc_1: 22 | .byte $83,$ba,$84,$54,$85,$00,$04,$84,$6a,$04,$84,$42,$04,$00 23 | .Lsfx_pal_1: 24 | .byte $83,$ba,$84,$4e,$85,$00,$04,$84,$62,$04,$84,$3e,$02,$00 25 | .Lsfx_ntsc_2: 26 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$0a,$00 27 | .Lsfx_pal_2: 28 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$08,$00 29 | -------------------------------------------------------------------------------- /22_XY_Split/MUSIC/TestMusic3.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/MUSIC/TestMusic3.ftm -------------------------------------------------------------------------------- /22_XY_Split/MUSIC/music.s: -------------------------------------------------------------------------------- 1 | .section .rodata.music_data,"a",@progbits 2 | .globl music_data 3 | music_data: 4 | .include "TestMusic3.s" 5 | 6 | .section .rodata.sounds_data,"a",@progbits 7 | .globl sounds_data 8 | sounds_data: 9 | .include "SoundFx.s" 10 | -------------------------------------------------------------------------------- /22_XY_Split/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |  2 |  5 -------------------------------------------------------------------------------- /22_XY_Split/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 0, 0, 0, 0, 0, 3 | 2, 2, 2, 2, 3, 4 | 20, 20, 20, 20, 0, 5 | 5, 6, 21, 22, 1, 6 | 6, 6, 22, 22, 1, 7 | 6, 7, 22, 23, 1, 8 | 21, 22, 21, 22, 1, 9 | 22, 22, 22, 22, 1, 10 | 22, 23, 22, 23, 1, 11 | 8, 9, 24, 25, 1, 12 | 9, 9, 25, 25, 1, 13 | 9, 10, 25, 26, 1 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /22_XY_Split/Sprites.c: -------------------------------------------------------------------------------- 1 | // a 16x16 pixel metasprite 2 | 3 | // clang-format off 4 | const unsigned char RoundSprL[]={ 5 | 0xff, 0xfc, 0x02, 0, 6 | 7, 0xfc, 0x03, 0, 7 | 0xff, 4, 0x12, 0, 8 | 7, 4, 0x13, 0, 9 | 128 10 | }; 11 | // clang-format on 12 | 13 | // clang-format off 14 | const unsigned char RoundSprR[]={ 15 | 0xff,0xfc, 0x00, 0, 16 | 7, 0xfc, 0x01, 0, 17 | 0xff,4, 0x10, 0, 18 | 7, 4, 0x11, 0, 19 | 128 20 | }; 21 | // clang-format on 22 | -------------------------------------------------------------------------------- /22_XY_Split/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | 9 | #endif // SPRITES_H 10 | -------------------------------------------------------------------------------- /22_XY_Split/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "xy_split.chr" 3 | -------------------------------------------------------------------------------- /22_XY_Split/xy_split.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/22_XY_Split/xy_split.chr -------------------------------------------------------------------------------- /23_Random/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /23_Random/.gitignore: -------------------------------------------------------------------------------- 1 | # Windows thumbnail cache files 2 | Thumbs.db 3 | ehthumbs.db 4 | ehthumbs_vista.db 5 | 6 | # Folder config file 7 | Desktop.ini 8 | 9 | # Recycle Bin used on file shares 10 | $RECYCLE.BIN/ 11 | 12 | # Windows Installer files 13 | *.cab 14 | *.msi 15 | *.msm 16 | *.msp 17 | 18 | # Windows shortcuts 19 | *.lnk 20 | 21 | # ========================= 22 | # Operating System Files 23 | # ========================= 24 | -------------------------------------------------------------------------------- /23_Random/Alpha2.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/23_Random/Alpha2.chr -------------------------------------------------------------------------------- /23_Random/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(23_random LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(random 11 | Random.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(random PRIVATE .) 16 | target_link_libraries(random nesdoug neslib) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Alpha2.chr) 19 | -------------------------------------------------------------------------------- /23_Random/Sprites.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | // clang-format off 5 | const unsigned char metasprite[] = { 6 | 0, 0, 0x01, 0, 7 | 0, 8, 0x11, 0, 8 | 8, 0, 0x01, 0 | OAM_FLIP_H, 9 | 8, 8, 0x11, 0 | OAM_FLIP_H, 10 | 128 11 | }; 12 | // clang-format on 13 | 14 | // clang-format off 15 | const unsigned char metasprite2[] = { 16 | 8, 0, 0x03, 0, 17 | 0, 8, 0x12, 0, 18 | 8, 8, 0x13, 0, 19 | 16, 8, 0x12, 0 | OAM_FLIP_H, 20 | 0, 16, 0x22, 0, 21 | 8, 16, 0x23, 0, 22 | 16, 16, 0x22, 0 | OAM_FLIP_H, 23 | 128 24 | }; 25 | // clang-format on 26 | -------------------------------------------------------------------------------- /23_Random/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | extern const unsigned char metasprite[]; 5 | extern const unsigned char metasprite2[]; 6 | 7 | #endif // SPRITES_H 8 | -------------------------------------------------------------------------------- /23_Random/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "Alpha2.chr" 3 | -------------------------------------------------------------------------------- /24_Mappers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-cnrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(24_mappers LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(mappers 11 | mappers.c 12 | chr-rom.s 13 | NES_ST/all_bgs.c 14 | ) 15 | target_include_directories(mappers PRIVATE .) 16 | target_link_libraries(mappers nesdoug neslib) 17 | 18 | set_property(SOURCE chr-rom.s PROPERTY OBJECT_DEPENDS 19 | ${CMAKE_CURRENT_SOURCE_DIR}/apples.chr 20 | ${CMAKE_CURRENT_SOURCE_DIR}/balls.chr 21 | ${CMAKE_CURRENT_SOURCE_DIR}/flower.chr 22 | ${CMAKE_CURRENT_SOURCE_DIR}/snake.chr 23 | ) 24 | -------------------------------------------------------------------------------- /24_Mappers/NES_ST/all_bgs.h: -------------------------------------------------------------------------------- 1 | #ifndef NES_ST_ALL_BGS_H 2 | #define NES_ST_ALL_BGS_H 3 | 4 | extern const unsigned char all_bgs[312]; 5 | 6 | #endif // NES_ST_ALL_BGS_H 7 | -------------------------------------------------------------------------------- /24_Mappers/PICS/apples.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/24_Mappers/PICS/apples.jpg -------------------------------------------------------------------------------- /24_Mappers/PICS/balls.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/24_Mappers/PICS/balls.jpg -------------------------------------------------------------------------------- /24_Mappers/PICS/flower.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/24_Mappers/PICS/flower.jpg -------------------------------------------------------------------------------- /24_Mappers/PICS/snake.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/24_Mappers/PICS/snake.jpg -------------------------------------------------------------------------------- /24_Mappers/apples.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/24_Mappers/apples.chr -------------------------------------------------------------------------------- /24_Mappers/balls.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/24_Mappers/balls.chr -------------------------------------------------------------------------------- /24_Mappers/chr-rom.s: -------------------------------------------------------------------------------- 1 | .globl __chr_rom_size 2 | __chr_rom_size = 32 3 | 4 | .section .chr_rom_0,"a",@progbits 5 | .incbin "apples.chr" 6 | 7 | .section .chr_rom_1,"a",@progbits 8 | .incbin "balls.chr" 9 | 10 | .section .chr_rom_2,"a",@progbits 11 | .incbin "snake.chr" 12 | 13 | .section .chr_rom_3,"a",@progbits 14 | .incbin "flower.chr" 15 | -------------------------------------------------------------------------------- /24_Mappers/flower.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/24_Mappers/flower.chr -------------------------------------------------------------------------------- /24_Mappers/snake.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/24_Mappers/snake.chr -------------------------------------------------------------------------------- /25_Platform5/BG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(rooms 2 | Room1.c 3 | Room2.c 4 | Room3.c 5 | Room4.c 6 | Room5.c 7 | Rooms.c 8 | ) 9 | -------------------------------------------------------------------------------- /25_Platform5/BG/Metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/25_Platform5/BG/Metatiles.png -------------------------------------------------------------------------------- /25_Platform5/BG/Room1.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room1[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 13 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 14 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /25_Platform5/BG/Room1.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 13 | 0,0,0,0,0,9,10,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /25_Platform5/BG/Room2.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room2[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0, 13 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0, 14 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /25_Platform5/BG/Room2.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 10 | 0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,0 11 | 0,0,0,0,0,3,4,4,4,5,0,0,0,0,0,0 12 | 0,0,0,0,0,6,7,7,7,8,0,0,0,0,0,0 13 | 0,0,0,0,3,4,5,10,10,11,0,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /25_Platform5/BG/Room3.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room3[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0, 12 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0, 13 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0, 14 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /25_Platform5/BG/Room3.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 10 | 0,0,0,0,3,4,2,2,4,4,5,0,0,0,0,0 11 | 0,0,0,0,6,7,7,7,2,7,8,0,0,0,0,0 12 | 0,0,3,4,6,7,7,7,2,7,8,0,0,0,0,0 13 | 0,0,9,10,6,7,2,2,7,7,8,0,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /25_Platform5/BG/Room4.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room4[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0, 10 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 11 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 12 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0, 13 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0, 14 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /25_Platform5/BG/Room4.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 10 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 11 | 0,0,0,0,3,4,4,4,2,4,4,5,0,0,0,0 12 | 0,0,0,0,6,7,7,7,2,7,7,8,0,0,0,0 13 | 0,0,2,0,9,10,10,10,10,10,10,11,0,0,0,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /25_Platform5/BG/Room5.c: -------------------------------------------------------------------------------- 1 | const unsigned char Room5[]={ 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 10 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0, 11 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0, 12 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0, 13 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0, 14 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0, 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 16 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /25_Platform5/BG/Room5.csv: -------------------------------------------------------------------------------- 1 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0 4 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0 5 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0 10 | 0,0,0,0,0,0,0,0,0,3,4,4,4,4,5,0 11 | 0,0,0,0,0,0,0,0,0,6,7,7,7,7,8,0 12 | 0,0,0,0,0,0,0,3,4,4,4,4,5,7,8,0 13 | 0,0,0,0,0,0,0,6,7,7,7,7,8,10,11,0 14 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 15 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 16 | -------------------------------------------------------------------------------- /25_Platform5/BG/Rooms.c: -------------------------------------------------------------------------------- 1 | #include "Rooms.h" 2 | 3 | extern const unsigned char Room1[]; 4 | extern const unsigned char Room2[]; 5 | extern const unsigned char Room3[]; 6 | extern const unsigned char Room4[]; 7 | extern const unsigned char Room5[]; 8 | 9 | const unsigned char *const Rooms[] = {Room1, Room2, Room3, Room4, Room5}; 10 | 11 | //y, room, x 12 | //y = TURN_OFF end of list 13 | // clang-format off 14 | const char level_1_coins[] = { 15 | 0x61, 0, 0x65, 16 | 0x81, 1, 0x85, 17 | 0x41, 2, 0x95, 18 | 0x61, 3, 0x75, 19 | 0x41, 4, 0x85, 20 | TURN_OFF 21 | }; 22 | // clang-format off 23 | 24 | //y, room, x 25 | //y = TURN_OFF end of list 26 | // clang-format on 27 | const char level_1_enemies[] = { 28 | 0xc2, 0, 0xb0, 29 | 0xc2, 1, 0x80, 30 | 0xc2, 2, 0xc0, 31 | 0xc2, 3, 0xf0, 32 | TURN_OFF 33 | }; 34 | // clang-format off 35 | -------------------------------------------------------------------------------- /25_Platform5/BG/Rooms.h: -------------------------------------------------------------------------------- 1 | #ifndef ROOMS_H 2 | #define ROOMS_H 3 | 4 | // data is exactly 240 bytes, 16 * 15 5 | // doubles as the collision map data 6 | extern const unsigned char *const Rooms[]; 7 | extern const char level_1_coins[]; 8 | extern const char level_1_enemies[]; 9 | 10 | #define MAX_ROOMS (5 - 1) 11 | #define MAX_SCROLL (MAX_ROOMS * 0x100 - 1) 12 | 13 | #define TURN_OFF 0xff 14 | 15 | #endif // ROOMS_H 16 | -------------------------------------------------------------------------------- /25_Platform5/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(25_platform5 LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(platformer5 11 | platformer5.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(platformer5 PRIVATE .) 16 | target_link_libraries(platformer5 nesdoug neslib famitone2 rooms music) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/platformer5.chr) 19 | 20 | add_subdirectory(BG) 21 | add_subdirectory(MUSIC) 22 | -------------------------------------------------------------------------------- /25_Platform5/MUSIC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(music music.s) 2 | target_include_directories(music PRIVATE .) 3 | -------------------------------------------------------------------------------- /25_Platform5/MUSIC/SoundFx.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/25_Platform5/MUSIC/SoundFx.ftm -------------------------------------------------------------------------------- /25_Platform5/MUSIC/SoundFx.nsf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/25_Platform5/MUSIC/SoundFx.nsf -------------------------------------------------------------------------------- /25_Platform5/MUSIC/SoundFx.s: -------------------------------------------------------------------------------- 1 | ;this file for FamiTone2 libary generated by nsf2data tool 2 | 3 | sounds: 4 | .word .Lntsc 5 | .word .Lpal 6 | .Lntsc: 7 | .word .Lsfx_ntsc_0 8 | .word .Lsfx_ntsc_1 9 | .word .Lsfx_ntsc_2 10 | .Lpal: 11 | .word .Lsfx_pal_0 12 | .word .Lsfx_pal_1 13 | .word .Lsfx_pal_2 14 | 15 | .Lsfx_ntsc_0: 16 | .byte $83,$b8,$84,$ab,$85,$01,$02,$84,$93,$02,$84,$67,$01,$84,$3f,$07 17 | .byte $00 18 | .Lsfx_pal_0: 19 | .byte $83,$b8,$84,$8c,$85,$01,$02,$84,$76,$02,$84,$4d,$01,$84,$29,$05 20 | .byte $00 21 | .Lsfx_ntsc_1: 22 | .byte $83,$ba,$84,$54,$85,$00,$04,$84,$6a,$04,$84,$42,$04,$00 23 | .Lsfx_pal_1: 24 | .byte $83,$ba,$84,$4e,$85,$00,$04,$84,$62,$04,$84,$3e,$02,$00 25 | .Lsfx_ntsc_2: 26 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$0a,$00 27 | .Lsfx_pal_2: 28 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$08,$00 29 | -------------------------------------------------------------------------------- /25_Platform5/MUSIC/TestMusic3.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/25_Platform5/MUSIC/TestMusic3.ftm -------------------------------------------------------------------------------- /25_Platform5/MUSIC/music.s: -------------------------------------------------------------------------------- 1 | .section .rodata.music_data,"a",@progbits 2 | .globl music_data 3 | music_data: 4 | .include "TestMusic3.s" 5 | 6 | .section .rodata.sounds_data,"a",@progbits 7 | .globl sounds_data 8 | sounds_data: 9 | .include "SoundFx.s" 10 | -------------------------------------------------------------------------------- /25_Platform5/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |  2 |  5 -------------------------------------------------------------------------------- /25_Platform5/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 0, 0, 0, 0, 0, 3 | 2, 2, 2, 2, 3, 4 | 20, 20, 20, 20, 0, 5 | 5, 6, 21, 22, 1, 6 | 6, 6, 22, 22, 1, 7 | 6, 7, 22, 23, 1, 8 | 21, 22, 21, 22, 1, 9 | 22, 22, 22, 22, 1, 10 | 22, 23, 22, 23, 1, 11 | 8, 9, 24, 25, 1, 12 | 9, 9, 25, 25, 1, 13 | 9, 10, 25, 26, 1 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /25_Platform5/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | extern const unsigned char CoinSpr[]; 9 | extern const unsigned char EnemySpr[]; 10 | extern const unsigned char CoinsSpr[]; 11 | 12 | #endif // SPRITES_H 13 | -------------------------------------------------------------------------------- /25_Platform5/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "platformer5.chr" 3 | -------------------------------------------------------------------------------- /25_Platform5/platformer5.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/25_Platform5/platformer5.chr -------------------------------------------------------------------------------- /26_Full_Game/BG/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(levels 2 | Level1.c 3 | Level2.c 4 | Level3.c 5 | ) 6 | -------------------------------------------------------------------------------- /26_Full_Game/BG/Level1_SP.c: -------------------------------------------------------------------------------- 1 | // Y, room, X, object # 2 | 3 | 0x90, 0, 0x70, obj2, 4 | 0x90, 0, 0x90, obj2, 5 | 0xc0, 0, 0xc0, obj0, 6 | 0x50, 1, 0x40, obj2, 7 | 0xc0, 1, 0xe0, obj1, 8 | 0x70, 2, 0x00, obj2, 9 | 0xc0, 2, 0x30, obj1, 10 | 0x50, 2, 0x70, obj2, 11 | 0xc0, 2, 0x90, obj0, 12 | 0xb0, 3, 0x20, obj1, 13 | 0x50, 3, 0xa0, obj2, 14 | 0xc0, 3, 0xb0, obj0, 15 | 0x50, 3, 0xd0, obj2, 16 | 0x60, 4, 0xf0, obj2, 17 | 0x80, 5, 0x00, obj1, 18 | 0x60, 5, 0x20, obj2, 19 | 0xc0, 5, 0x90, obj0, 20 | 0xc0, 6, 0x70, obj0, 21 | 0x30, 6, 0xc0, obj2, 22 | 0x30, 6, 0xe0, obj2, 23 | 0x30, 7, 0x80, obj2, 24 | 0xb0, 7, 0xc0, obj3, 25 | TURN_OFF 26 | 27 | -------------------------------------------------------------------------------- /26_Full_Game/BG/Level2_SP.c: -------------------------------------------------------------------------------- 1 | // Y, room, X, object # 2 | 3 | 0xc0, 0, 0x90, obj0, 4 | 0xa0, 1, 0x20, obj2, 5 | 0xa0, 1, 0x40, obj2, 6 | 0xc0, 1, 0xd0, obj0, 7 | 0x60, 2, 0x70, obj2, 8 | 0x30, 3, 0x20, obj2, 9 | 0x40, 3, 0x40, obj1, 10 | 0x30, 3, 0x70, obj2, 11 | 0xc0, 4, 0x30, obj1, 12 | 0xc0, 4, 0x80, obj1, 13 | 0xc0, 5, 0x00, obj2, 14 | 0xc0, 5, 0x50, obj2, 15 | 0xc0, 6, 0x20, obj0, 16 | 0x40, 6, 0x90, obj2, 17 | 0x40, 6, 0xd0, obj2, 18 | 0xc0, 7, 0x20, obj1, 19 | 0x40, 7, 0x40, obj2, 20 | 0xc0, 7, 0x60, obj1, 21 | 0xa0, 7, 0xc0, obj3, 22 | TURN_OFF 23 | 24 | -------------------------------------------------------------------------------- /26_Full_Game/BG/Level3_SP.c: -------------------------------------------------------------------------------- 1 | // Y, room, X, object # 2 | 3 | 0x80, 0, 0x80, obj2, 4 | 0xc0, 0, 0xc0, obj1, 5 | 0xc0, 0, 0xf0, obj1, 6 | 0x70, 1, 0x50, obj2, 7 | 0xc0, 1, 0x80, obj0, 8 | 0x80, 1, 0xd0, obj2, 9 | 0xc0, 1, 0xd0, obj0, 10 | 0x80, 2, 0x40, obj2, 11 | 0xc0, 2, 0x40, obj1, 12 | 0x80, 2, 0x80, obj2, 13 | 0xc0, 2, 0x80, obj1, 14 | 0x80, 2, 0xc0, obj2, 15 | 0xc0, 2, 0xc0, obj1, 16 | 0xb0, 3, 0x10, obj1, 17 | 0x80, 3, 0x30, obj2, 18 | 0xb0, 4, 0x60, obj0, 19 | 0x90, 5, 0x40, obj1, 20 | 0x90, 6, 0x50, obj1, 21 | 0xa0, 6, 0xc0, obj1, 22 | 0x50, 7, 0x20, obj2, 23 | 0x50, 7, 0x80, obj3, 24 | 0xb0, 7, 0xd0, obj2, 25 | 0xc0, 7, 0xe0, obj0, 26 | TURN_OFF 27 | 28 | -------------------------------------------------------------------------------- /26_Full_Game/BG/Levels.h: -------------------------------------------------------------------------------- 1 | #ifndef BG_LEVELS_H 2 | #define BG_LEVELS_H 3 | 4 | extern unsigned char Level1_0[]; 5 | extern unsigned char Level1_1[]; 6 | extern unsigned char Level1_2[]; 7 | extern unsigned char Level1_3[]; 8 | extern unsigned char Level1_4[]; 9 | extern unsigned char Level1_5[]; 10 | extern unsigned char Level1_6[]; 11 | extern unsigned char Level1_7[]; 12 | 13 | extern unsigned char Level2_0[]; 14 | extern unsigned char Level2_1[]; 15 | extern unsigned char Level2_2[]; 16 | extern unsigned char Level2_3[]; 17 | extern unsigned char Level2_4[]; 18 | extern unsigned char Level2_5[]; 19 | extern unsigned char Level2_6[]; 20 | extern unsigned char Level2_7[]; 21 | 22 | extern unsigned char Level3_0[]; 23 | extern unsigned char Level3_1[]; 24 | extern unsigned char Level3_2[]; 25 | extern unsigned char Level3_3[]; 26 | extern unsigned char Level3_4[]; 27 | extern unsigned char Level3_5[]; 28 | extern unsigned char Level3_6[]; 29 | extern unsigned char Level3_7[]; 30 | 31 | #endif // BG_LEVELS_H 32 | -------------------------------------------------------------------------------- /26_Full_Game/BG/Metatiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/26_Full_Game/BG/Metatiles.png -------------------------------------------------------------------------------- /26_Full_Game/BG/Sprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/26_Full_Game/BG/Sprites.png -------------------------------------------------------------------------------- /26_Full_Game/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(25_full_game LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(full_game 11 | full_game.c 12 | level_data.c 13 | palettes.c 14 | Sprites.c 15 | chr-rom.s 16 | NES_ST/title.c 17 | ) 18 | target_include_directories(full_game PRIVATE .) 19 | target_link_libraries(full_game nesdoug neslib famitone2 levels music) 20 | set_property(SOURCE chr-rom.s PROPERTY 21 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/full_game.chr) 22 | 23 | add_subdirectory(BG) 24 | add_subdirectory(MUSIC) 25 | -------------------------------------------------------------------------------- /26_Full_Game/MUSIC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(music music.s) 2 | target_include_directories(music PRIVATE .) 3 | -------------------------------------------------------------------------------- /26_Full_Game/MUSIC/SoundFx.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/26_Full_Game/MUSIC/SoundFx.ftm -------------------------------------------------------------------------------- /26_Full_Game/MUSIC/SoundFx.nsf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/26_Full_Game/MUSIC/SoundFx.nsf -------------------------------------------------------------------------------- /26_Full_Game/MUSIC/SoundFx.s: -------------------------------------------------------------------------------- 1 | ;this file for FamiTone2 libary generated by nsf2data tool 2 | 3 | sounds: 4 | .word .Lntsc 5 | .word .Lpal 6 | .Lntsc: 7 | .word .Lsfx_ntsc_0 8 | .word .Lsfx_ntsc_1 9 | .word .Lsfx_ntsc_2 10 | .Lpal: 11 | .word .Lsfx_pal_0 12 | .word .Lsfx_pal_1 13 | .word .Lsfx_pal_2 14 | 15 | .Lsfx_ntsc_0: 16 | .byte $83,$b8,$84,$ab,$85,$01,$02,$84,$93,$02,$84,$67,$01,$84,$3f,$07 17 | .byte $00 18 | .Lsfx_pal_0: 19 | .byte $83,$b8,$84,$8c,$85,$01,$02,$84,$76,$02,$84,$4d,$01,$84,$29,$05 20 | .byte $00 21 | .Lsfx_ntsc_1: 22 | .byte $83,$ba,$84,$54,$85,$00,$04,$84,$6a,$04,$84,$42,$04,$00 23 | .Lsfx_pal_1: 24 | .byte $83,$ba,$84,$4e,$85,$00,$04,$84,$62,$04,$84,$3e,$02,$00 25 | .Lsfx_ntsc_2: 26 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$0a,$00 27 | .Lsfx_pal_2: 28 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$08,$00 29 | -------------------------------------------------------------------------------- /26_Full_Game/MUSIC/TestMusic3.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/26_Full_Game/MUSIC/TestMusic3.ftm -------------------------------------------------------------------------------- /26_Full_Game/MUSIC/music.s: -------------------------------------------------------------------------------- 1 | .section .rodata.music_data,"a",@progbits 2 | .globl music_data 3 | music_data: 4 | .include "TestMusic3.s" 5 | 6 | .section .rodata.sounds_data,"a",@progbits 7 | .globl sounds_data 8 | sounds_data: 9 | .include "SoundFx.s" 10 | -------------------------------------------------------------------------------- /26_Full_Game/NES_ST/metatiles.nam: -------------------------------------------------------------------------------- 1 |  2 |  5 -------------------------------------------------------------------------------- /26_Full_Game/NES_ST/metatiles.txt: -------------------------------------------------------------------------------- 1 | const unsigned char metatiles[]={ 2 | 0, 0, 0, 0, 0, 3 | 2, 2, 2, 2, 3, 4 | 20, 20, 20, 20, 0, 5 | 5, 6, 21, 22, 1, 6 | 6, 6, 22, 22, 1, 7 | 6, 7, 22, 23, 1, 8 | 21, 22, 21, 22, 1, 9 | 22, 22, 22, 22, 1, 10 | 22, 23, 22, 23, 1, 11 | 8, 9, 24, 25, 1, 12 | 9, 9, 25, 25, 1, 13 | 9, 10, 25, 26, 1 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /26_Full_Game/NES_ST/title.c: -------------------------------------------------------------------------------- 1 | const unsigned char title[147]={ 2 | 0x01,0x00,0x01,0xfe,0x00,0x01,0x0b,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88, 3 | 0x89,0x8a,0x00,0x01,0x14,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a, 4 | 0x00,0x01,0x14,0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0x00,0x01, 5 | 0x32,0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe, 6 | 0x00,0x01,0x10,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc, 7 | 0xcd,0xce,0x00,0x01,0x10,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, 8 | 0xdb,0xdc,0xdd,0xde,0x00,0x01,0x10,0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8, 9 | 0xe9,0xea,0xeb,0xec,0xed,0xee,0x00,0x01,0xaf,0x32,0x30,0x31,0x38,0x00,0x00,0x44, 10 | 0x6f,0x75,0x67,0x00,0x46,0x72,0x61,0x6b,0x65,0x72,0x00,0x01,0xfe,0x00,0x01,0x46, 11 | 0x00,0x01,0x00 12 | }; 13 | -------------------------------------------------------------------------------- /26_Full_Game/NES_ST/title.h: -------------------------------------------------------------------------------- 1 | #ifndef NES_ST_TITLE_H 2 | #define NES_ST_TITLE_H 3 | 4 | extern const unsigned char title[147]; 5 | 6 | #endif // NES_ST_TITLE_H 7 | -------------------------------------------------------------------------------- /26_Full_Game/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char RoundSprL[]; 7 | extern const unsigned char RoundSprR[]; 8 | extern const unsigned char CoinSpr[]; 9 | extern const unsigned char BigCoinSpr[]; 10 | extern const unsigned char CoinHud[]; 11 | extern const unsigned char EnemyChaseSpr[]; 12 | extern const unsigned char EnemyBounceSpr[]; 13 | extern const unsigned char EnemyBounceSpr2[]; 14 | 15 | #endif // SPRITES_H 16 | -------------------------------------------------------------------------------- /26_Full_Game/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "full_game.chr" 3 | -------------------------------------------------------------------------------- /26_Full_Game/full_game.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/26_Full_Game/full_game.chr -------------------------------------------------------------------------------- /26_Full_Game/level_data.h: -------------------------------------------------------------------------------- 1 | #ifndef LEVEL_DATA_H 2 | #define LEVEL_DATA_H 3 | 4 | #include "BG/Levels.h" 5 | 6 | enum { COIN_REG, COIN_END }; 7 | 8 | // NOTE MAX_COINS = 12 9 | 10 | // y, room, x, type 11 | // y = TURN_OFF end of list 12 | extern const unsigned char *const Coins_list[]; 13 | 14 | enum { ENEMY_CHASE, ENEMY_BOUNCE }; 15 | 16 | extern const unsigned char *const Enemy_list[]; 17 | 18 | extern const unsigned char metatiles1[]; 19 | 20 | #define COL_DOWN 0x80 21 | #define COL_ALL 0x40 22 | 23 | extern const unsigned char is_solid[]; 24 | 25 | extern const unsigned char *const Levels_list[]; 26 | 27 | extern const unsigned char Level_offsets[]; 28 | 29 | #define MAX_ROOMS (8 - 1) 30 | #define MAX_SCROLL (MAX_ROOMS * 0x100 - 1) 31 | #define TURN_OFF 0xff 32 | 33 | #endif // LEVEL_DATA_H 34 | -------------------------------------------------------------------------------- /26_Full_Game/palettes.c: -------------------------------------------------------------------------------- 1 | const char palette_title[] = { 2 | // 0x0f, 0x00, 0x10, 0x30, 3 | // clang-format off 4 | 0x0f, 0x04, 0x15, 0x32, 5 | 0, 0, 0, 0, 6 | 0, 0, 0, 0, 7 | 0, 0, 0, 0 8 | // clang-format on 9 | }; 10 | 11 | const char palette_bg[] = { 12 | // clang-format off 13 | 0x22, 0x16, 0x36, 0x0f, 14 | 0, 8, 0x18, 0x39, 15 | 0, 0, 0x10, 0x20, 16 | 0, 0x0a, 0x1a, 0x2a, 17 | // clang-format on 18 | }; 19 | 20 | const char palette_sp[] = { 21 | // clang-format off 22 | 0x22, 0x01, 0x11, 0x10, 23 | 0x22, 0x17, 0x28, 0x38, 24 | 0x22, 0x06, 0x16, 0x37, 25 | 0x22, 0x03, 0x13, 0x33, 26 | // clang-format on 27 | }; 28 | -------------------------------------------------------------------------------- /26_Full_Game/palettes.h: -------------------------------------------------------------------------------- 1 | #ifndef PALETTES_H 2 | #define PALETTES_H 3 | 4 | extern const char palette_title[]; 5 | extern const char palette_bg[]; 6 | extern const char palette_sp[]; 7 | 8 | #endif // PALETTES_H 9 | -------------------------------------------------------------------------------- /28_Zapper/AlphaZ.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/28_Zapper/AlphaZ.chr -------------------------------------------------------------------------------- /28_Zapper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(28_zapper LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(Zapper 11 | Zapper.c 12 | Sprites.c 13 | chr-rom.s 14 | ) 15 | target_include_directories(Zapper PRIVATE .) 16 | target_link_libraries(Zapper nesdoug neslib famitone2 music nes_st) 17 | set_property(SOURCE chr-rom.s PROPERTY 18 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/AlphaZ.chr) 19 | 20 | add_subdirectory(MUSIC) 21 | add_subdirectory(NES_ST) 22 | -------------------------------------------------------------------------------- /28_Zapper/MUSIC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(music music.s) 2 | target_include_directories(music PRIVATE .) 3 | -------------------------------------------------------------------------------- /28_Zapper/MUSIC/SFX.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/28_Zapper/MUSIC/SFX.ftm -------------------------------------------------------------------------------- /28_Zapper/MUSIC/SFX.nsf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/28_Zapper/MUSIC/SFX.nsf -------------------------------------------------------------------------------- /28_Zapper/MUSIC/SFX.s: -------------------------------------------------------------------------------- 1 | ;this file for FamiTone2 libary generated by nsf2data tool 2 | 3 | sounds: 4 | .word .Lntsc 5 | .word .Lpal 6 | .Lntsc: 7 | .word .Lsfx_ntsc_0 8 | .Lpal: 9 | .word .Lsfx_pal_0 10 | 11 | .Lsfx_ntsc_0: 12 | .byte $89,$3f,$8a,$0b,$01,$89,$3a,$01,$89,$38,$01,$89,$36,$01,$89,$35 13 | .byte $8a,$0c,$01,$89,$34,$01,$89,$33,$02,$89,$32,$03,$89,$31,$04,$00 14 | .Lsfx_pal_0: 15 | .byte $89,$3f,$8a,$0b,$01,$89,$3a,$01,$89,$38,$01,$89,$36,$01,$89,$35 16 | .byte $8a,$0c,$01,$89,$34,$01,$89,$33,$02,$89,$32,$03,$89,$31,$04,$00 17 | -------------------------------------------------------------------------------- /28_Zapper/MUSIC/music.s: -------------------------------------------------------------------------------- 1 | .section .rodata.music_data,"a",@progbits 2 | .globl music_data 3 | music_data: 4 | 5 | .section .rodata.sounds_data,"a",@progbits 6 | .globl sounds_data 7 | sounds_data: 8 | .include "SFX.s" 9 | -------------------------------------------------------------------------------- /28_Zapper/NES_ST/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(nes_st Zap_Test.c) 2 | -------------------------------------------------------------------------------- /28_Zapper/NES_ST/Zap_Test.c: -------------------------------------------------------------------------------- 1 | const unsigned char Zap_Test[43] = { 2 | 0x01, 0x00, 0x01, 0x41, 0x5a, 0x41, 0x50, 0x50, 0x45, 0x52, 0x00, 3 | 0x54, 0x45, 0x53, 0x54, 0x00, 0x01, 0x34, 0x53, 0x43, 0x4f, 0x52, 4 | 0x45, 0x3a, 0x00, 0x30, 0x01, 0x03, 0x00, 0x01, 0xfe, 0x00, 0x01, 5 | 0xfe, 0x00, 0x01, 0xfe, 0x00, 0x01, 0x74, 0x00, 0x01, 0x00}; 6 | -------------------------------------------------------------------------------- /28_Zapper/NES_ST/Zap_Test.h: -------------------------------------------------------------------------------- 1 | #ifndef ZAP_TEST_H 2 | #define ZAP_TEST_H 3 | 4 | extern const unsigned char Zap_Test[43]; 5 | 6 | #endif // ZAP_TEST_H 7 | -------------------------------------------------------------------------------- /28_Zapper/Sprites.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // a 16x16 pixel metasprite 4 | 5 | const unsigned char StarDark[] = { 6 | // clang-format off 7 | 0, 0, 0x01, 0, 8 | 8, 0, 0x01, 0 | OAM_FLIP_H, 9 | 0, 8, 0x11, 0, 10 | 8, 8, 0x11, 0 | OAM_FLIP_H, 11 | 128 12 | // clang-format on 13 | }; 14 | 15 | const unsigned char StarLight[] = { 16 | // clang-format off 17 | 0, 0, 0x02, 0, 18 | 8, 0, 0x02, 0 | OAM_FLIP_H, 19 | 0, 8, 0x12, 0, 20 | 8, 8, 0x12, 0 | OAM_FLIP_H, 21 | 128 22 | // clang-format on 23 | }; 24 | 25 | const unsigned char WhiteBox[] = { 26 | // clang-format off 27 | 0xfc, 0xfc, 0x00, 0, 28 | 4, 0xfc, 0x00, 0, 29 | 12, 0xfc, 0x00, 0, 30 | 0xfc, 4, 0x00, 0, 31 | 4, 4, 0x00, 0, 32 | 12, 4, 0x00, 0, 33 | 0xfc, 12, 0x00, 0, 34 | 4, 12, 0x00, 0, 35 | 12, 12, 0x00, 0, 36 | 128 37 | // clang-format on 38 | }; 39 | -------------------------------------------------------------------------------- /28_Zapper/Sprites.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITES_H 2 | #define SPRITES_H 3 | 4 | // a 16x16 pixel metasprite 5 | 6 | extern const unsigned char StarDark[]; 7 | extern const unsigned char StarLight[]; 8 | extern const unsigned char WhiteBox[]; 9 | 10 | #endif // SPRITES_H 11 | -------------------------------------------------------------------------------- /28_Zapper/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "AlphaZ.chr" 3 | -------------------------------------------------------------------------------- /29_Powerpad/AlphaP.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/29_Powerpad/AlphaP.chr -------------------------------------------------------------------------------- /29_Powerpad/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-nrom) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(29_powerpad LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(PowerTest 11 | PowerTest.c 12 | chr-rom.s 13 | ) 14 | target_include_directories(PowerTest PRIVATE .) 15 | target_link_libraries(PowerTest nesdoug neslib nes_st) 16 | set_property(SOURCE chr-rom.s PROPERTY 17 | OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/AlphaP.chr) 18 | 19 | add_subdirectory(NES_ST) 20 | -------------------------------------------------------------------------------- /29_Powerpad/NES_ST/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(nes_st PowerBG.c) 2 | -------------------------------------------------------------------------------- /29_Powerpad/NES_ST/PowerBG.c: -------------------------------------------------------------------------------- 1 | const unsigned char PowerBG[168]={ 2 | 0x01,0x00,0x01,0x41,0x50,0x6f,0x77,0x65,0x72,0x70,0x61,0x64,0x00,0x00,0x54,0x65, 3 | 0x73,0x74,0x00,0x01,0x31,0x50,0x6f,0x72,0x74,0x00,0x32,0x00,0x01,0x63,0xa7,0xa8, 4 | 0xa8,0xa9,0x00,0x01,0x18,0x90,0x91,0x91,0x97,0x98,0x98,0x99,0x91,0x91,0x92,0x00, 5 | 0x01,0x15,0x91,0x01,0x09,0x00,0x01,0x15,0x96,0xa0,0xa1,0xa0,0xa1,0xa2,0xa3,0xa2, 6 | 0xa3,0x96,0x00,0x01,0x15,0x91,0xb0,0xb1,0xb0,0xb1,0xb2,0xb3,0xb2,0xb3,0x91,0x00, 7 | 0x01,0x15,0x95,0x01,0x09,0x00,0x01,0x15,0x96,0xa0,0xa1,0xa0,0xa1,0xa2,0xa3,0xa2, 8 | 0xa3,0x96,0x00,0x01,0x15,0x91,0xb0,0xb1,0xb0,0xb1,0xb2,0xb3,0xb2,0xb3,0x91,0x00, 9 | 0x01,0x15,0x95,0x01,0x09,0x00,0x01,0x15,0x96,0xa0,0xa1,0xa0,0xa1,0xa2,0xa3,0xa2, 10 | 0xa3,0x96,0x00,0x01,0x15,0x91,0xb0,0xb1,0xb0,0xb1,0xb2,0xb3,0xb2,0xb3,0x91,0x00, 11 | 0x01,0x15,0x93,0x91,0x01,0x07,0x94,0x00,0x01,0xfe,0x00,0x01,0x78,0x50,0x00,0x01, 12 | 0x06,0x05,0x00,0x01,0x2a,0x00,0x01,0x00 13 | }; 14 | -------------------------------------------------------------------------------- /29_Powerpad/NES_ST/PowerBG.h: -------------------------------------------------------------------------------- 1 | #ifndef POWER_BG_H 2 | #define POWER_BG_H 3 | 4 | extern const unsigned char PowerBG[168]; 5 | 6 | #endif // POWER_BG_H 7 | -------------------------------------------------------------------------------- /29_Powerpad/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "AlphaP.chr" 3 | -------------------------------------------------------------------------------- /32_MMC1/Alpha.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/32_MMC1/Alpha.chr -------------------------------------------------------------------------------- /32_MMC1/Alpha2.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/32_MMC1/Alpha2.chr -------------------------------------------------------------------------------- /32_MMC1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-mmc1) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(32_mmc1 LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(hello_mmc1 11 | hello_mmc1.c 12 | chr-rom.s 13 | ) 14 | target_include_directories(hello_mmc1 PRIVATE .) 15 | target_link_libraries(hello_mmc1 16 | nesdoug 17 | neslib 18 | ft2-fixed-wrappers 19 | famitone2 20 | music 21 | ) 22 | target_link_directories(hello_mmc1 PRIVATE .) 23 | target_link_options(hello_mmc1 PRIVATE -Thello_mmc1.ld) 24 | set_property(SOURCE chr-rom.s PROPERTY OBJECT_DEPENDS 25 | ${CMAKE_CURRENT_SOURCE_DIR}/Alpha.chr 26 | ${CMAKE_CURRENT_SOURCE_DIR}/Alpha2.chr 27 | ) 28 | 29 | add_subdirectory(MUSIC) 30 | -------------------------------------------------------------------------------- /32_MMC1/MUSIC/BassDrum.dmc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/32_MMC1/MUSIC/BassDrum.dmc -------------------------------------------------------------------------------- /32_MMC1/MUSIC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(music music.s) 2 | target_include_directories(music PRIVATE .) 3 | -------------------------------------------------------------------------------- /32_MMC1/MUSIC/SoundFx.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/32_MMC1/MUSIC/SoundFx.ftm -------------------------------------------------------------------------------- /32_MMC1/MUSIC/SoundFx.nsf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/32_MMC1/MUSIC/SoundFx.nsf -------------------------------------------------------------------------------- /32_MMC1/MUSIC/SoundFx.s: -------------------------------------------------------------------------------- 1 | ;this file for FamiTone2 libary generated by nsf2data tool 2 | 3 | sounds: 4 | .word .Lntsc 5 | .word .Lpal 6 | .Lntsc: 7 | .word .Lsfx_ntsc_0 8 | .word .Lsfx_ntsc_1 9 | .word .Lsfx_ntsc_2 10 | .Lpal: 11 | .word .Lsfx_pal_0 12 | .word .Lsfx_pal_1 13 | .word .Lsfx_pal_2 14 | 15 | .Lsfx_ntsc_0: 16 | .byte $83,$b8,$84,$ab,$85,$01,$02,$84,$93,$02,$84,$67,$01,$84,$3f,$07 17 | .byte $00 18 | .Lsfx_pal_0: 19 | .byte $83,$b8,$84,$8c,$85,$01,$02,$84,$76,$02,$84,$4d,$01,$84,$29,$05 20 | .byte $00 21 | .Lsfx_ntsc_1: 22 | .byte $83,$ba,$84,$54,$85,$00,$04,$84,$6a,$04,$84,$42,$04,$00 23 | .Lsfx_pal_1: 24 | .byte $83,$ba,$84,$4e,$85,$00,$04,$84,$62,$04,$84,$3e,$02,$00 25 | .Lsfx_ntsc_2: 26 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$0a,$00 27 | .Lsfx_pal_2: 28 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$08,$00 29 | -------------------------------------------------------------------------------- /32_MMC1/MUSIC/TestMusic3.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/32_MMC1/MUSIC/TestMusic3.ftm -------------------------------------------------------------------------------- /32_MMC1/MUSIC/music.s: -------------------------------------------------------------------------------- 1 | .section .prg_rom_6.music_data,"a",@progbits 2 | .globl music_data 3 | music_data: 4 | .include "TestMusic3.s" 5 | 6 | .section .prg_rom_6.sounds_data,"a",@progbits 7 | .globl sounds_data 8 | sounds_data: 9 | .include "SoundFx.s" 10 | 11 | .section .dpcm,"a",@progbits 12 | .incbin "BassDrum.dmc" 13 | -------------------------------------------------------------------------------- /32_MMC1/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom_0_1,"a",@progbits 2 | .incbin "Alpha.chr" 3 | 4 | .section .chr_rom_2_3,"a",@progbits 5 | .incbin "Alpha2.chr" 6 | -------------------------------------------------------------------------------- /32_MMC1/hello_mmc1.ld: -------------------------------------------------------------------------------- 1 | SECTIONS { 2 | .ft2 : { 3 | *libfamitone2.a:*(.text .text.* .rodata .rodata.*) 4 | } >prg_rom_6 5 | } 6 | INCLUDE link.ld 7 | -------------------------------------------------------------------------------- /33_MMC3/Alpha.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/33_MMC3/Alpha.chr -------------------------------------------------------------------------------- /33_MMC3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | 3 | set(LLVM_MOS_PLATFORM nes-mmc3) 4 | find_package(llvm-mos-sdk REQUIRED) 5 | 6 | project(33_mmc3 LANGUAGES C ASM) 7 | 8 | set(CMAKE_EXECUTABLE_SUFFIX .nes) 9 | 10 | add_executable(hello_mmc3 11 | hello_mmc3.c 12 | chr-rom.s 13 | ) 14 | target_include_directories(hello_mmc3 PRIVATE .) 15 | target_link_libraries(hello_mmc3 nesdoug neslib famitone2 music) 16 | target_link_directories(hello_mmc3 PRIVATE .) 17 | set_property(SOURCE chr-rom.s PROPERTY OBJECT_DEPENDS 18 | ${CMAKE_CURRENT_SOURCE_DIR}/Alpha.chr 19 | ${CMAKE_CURRENT_SOURCE_DIR}/Gears.chr 20 | ) 21 | 22 | add_subdirectory(MUSIC) 23 | -------------------------------------------------------------------------------- /33_MMC3/Gears.chr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/33_MMC3/Gears.chr -------------------------------------------------------------------------------- /33_MMC3/MUSIC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(music music.s) 2 | target_include_directories(music PRIVATE .) 3 | -------------------------------------------------------------------------------- /33_MMC3/MUSIC/SoundFx.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/33_MMC3/MUSIC/SoundFx.ftm -------------------------------------------------------------------------------- /33_MMC3/MUSIC/SoundFx.nsf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/33_MMC3/MUSIC/SoundFx.nsf -------------------------------------------------------------------------------- /33_MMC3/MUSIC/SoundFx.s: -------------------------------------------------------------------------------- 1 | ;this file for FamiTone2 libary generated by nsf2data tool 2 | 3 | sounds: 4 | .word .Lntsc 5 | .word .Lpal 6 | .Lntsc: 7 | .word .Lsfx_ntsc_0 8 | .word .Lsfx_ntsc_1 9 | .word .Lsfx_ntsc_2 10 | .Lpal: 11 | .word .Lsfx_pal_0 12 | .word .Lsfx_pal_1 13 | .word .Lsfx_pal_2 14 | 15 | .Lsfx_ntsc_0: 16 | .byte $83,$b8,$84,$ab,$85,$01,$02,$84,$93,$02,$84,$67,$01,$84,$3f,$07 17 | .byte $00 18 | .Lsfx_pal_0: 19 | .byte $83,$b8,$84,$8c,$85,$01,$02,$84,$76,$02,$84,$4d,$01,$84,$29,$05 20 | .byte $00 21 | .Lsfx_ntsc_1: 22 | .byte $83,$ba,$84,$54,$85,$00,$04,$84,$6a,$04,$84,$42,$04,$00 23 | .Lsfx_pal_1: 24 | .byte $83,$ba,$84,$4e,$85,$00,$04,$84,$62,$04,$84,$3e,$02,$00 25 | .Lsfx_ntsc_2: 26 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$0a,$00 27 | .Lsfx_pal_2: 28 | .byte $89,$3a,$8a,$0d,$01,$89,$39,$01,$89,$36,$08,$00 29 | -------------------------------------------------------------------------------- /33_MMC3/MUSIC/TestMusic3.ftm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mysterymath/nesdoug-llvm/661a8d0a966cdd44b8f68ba080f84d36e86550ea/33_MMC3/MUSIC/TestMusic3.ftm -------------------------------------------------------------------------------- /33_MMC3/MUSIC/music.s: -------------------------------------------------------------------------------- 1 | .section .prg_rom_12.music_data,"a",@progbits 2 | .globl music_data 3 | music_data: 4 | .include "TestMusic3.s" 5 | 6 | .section .prg_rom_12.sounds_data,"a",@progbits 7 | .globl sounds_data 8 | sounds_data: 9 | .include "SoundFx.s" 10 | -------------------------------------------------------------------------------- /33_MMC3/chr-rom.s: -------------------------------------------------------------------------------- 1 | .section .chr_rom,"a",@progbits 2 | .incbin "Alpha.chr" 3 | .incbin "Gears.chr" 4 | --------------------------------------------------------------------------------