Skip to content

Commit

Permalink
Add cnrom example
Browse files Browse the repository at this point in the history
  • Loading branch information
pubby committed Mar 9, 2023
1 parent cfa402d commit e1b6ce4
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
Binary file added examples/cnrom/chr0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/cnrom/chr1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/cnrom/chr2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/cnrom/chr3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions examples/cnrom/cnrom.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mapper = CNROM
output = cnrom.nes
input = ../../lib/nes.fab
input = cnrom.fab
36 changes: 36 additions & 0 deletions examples/cnrom/cnrom.fab
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2023, Patrick Bene
* This file is distributed under the Boost Software License, Version 1.0.
* See LICENSE_1_0.txt or https://www.boost.org/LICENSE_1_0.txt
*/

mode main()
// Set the palette:
palette = example_palette
ppu_upload_palette()

// Setup the nametable:
ppu_reset_addr($2000)
for U y = 0; y < 30; y += 1
for U x = 0; x < 32; x += 1
{PPUDATA}((x & %1111) + ((y & %1111) << 4))
ppu_set_scroll(0, 0)

// Animate the CHRROM:
state(0)
{PPUCTRL}(PPUCTRL_NMI_ON)
{PPUMASK}(PPUMASK_ON)
while true
state((state() + 1) & %11)
wait(8)

// Define the tileset (commonly called CHR):
chrrom
file(fmt, "chr0.png")
file(fmt, "chr0.png")
file(fmt, "chr1.png")
file(fmt, "chr1.png")
file(fmt, "chr2.png")
file(fmt, "chr2.png")
file(fmt, "chr3.png")
file(fmt, "chr3.png")

0 comments on commit e1b6ce4

Please sign in to comment.