From 079c9b078b144ee21f62a5ca40299052c664edf0 Mon Sep 17 00:00:00 2001 From: Patrick Kingston Date: Sat, 14 Feb 2026 20:54:34 -0500 Subject: Create toggleable screens --- main.fab | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- nEs.nes | Bin 40976 -> 40976 bytes nEslabels.mlb | 32 ++++++++++++++++++-------------- spritesheet.chr | Bin 8192 -> 8192 bytes 4 files changed, 64 insertions(+), 18 deletions(-) diff --git a/main.fab b/main.fab index 948bd1c..8b52021 100644 --- a/main.fab +++ b/main.fab @@ -1,4 +1,4 @@ -vars /allvars +vars /ecavars U[64] buf // A buffer that can store the current and next row U curr_gen = 0 // Swap these offsets back and forth per generation U next_gen = 32 @@ -105,6 +105,8 @@ fn upload_curr_gen() nmi eca_nmi() // Turn on rendering sprites and bg + ppu_upload_oam_poll_pads(0) + {PPUMASK}(PPUMASK_ON | PPUMASK_NO_CLIP) upload_curr_gen() @@ -114,6 +116,11 @@ nmi eca_nmi() // Main mode for running the ECA mode eca_main() : nmi eca_nmi +: vars /ecavars + nmi + nmi + nmi + nmi // Initialize the screen init_eca_state() // Wait 60 frames before beginning @@ -122,9 +129,43 @@ mode eca_main() // Loop forever: while true nmi + update_pads() + if pads[0].held & BUTTON_START + goto mode settings() + : preserves /ecavars calc_and_advance_gen() -charmap(".#-=n!@~E$%^S&*(C)_+A{}|12345678qwertyuiop") +//charmap settingsscreen("E", 48) + +vars /settings_vars + U slow_counter = 0 + +nmi settings_nmi() + // Turn on rendering sprites and bg + ppu_upload_oam_poll_pads(0) + + {PPUMASK}(PPUMASK_ON | PPUMASK_NO_CLIP) + + ppu_reset_scroll(0, 0) + +mode settings() +: nmi settings_nmi +: vars /ecavars +: vars /settings_vars + nmi + nmi + nmi + nmi + while true + nmi + update_pads() + //update_cursor() + //upload_cursor() + if pads[0].held & BUTTON_START + goto mode eca_main() + : preserves /ecavars + +charmap (".#-=n!@~E$%^S&*(C)_+A{}|12345678qwertyuiop") data /titlescreen [] title @@ -181,6 +222,7 @@ nmi main_nmi() // The main entry point for the program mode main() : nmi main_nmi +: vars /titlescreen /ecavars // Set the palette: palette = example_palette ppu_upload_palette() @@ -210,8 +252,8 @@ mode main() nmi // Go to the main eca mode - goto mode eca_main() - : preserves /allvars + goto mode settings() + : preserves /ecavars // Define the tileset (commonly called CHR): chrrom diff --git a/nEs.nes b/nEs.nes index cff0c1a..14d5359 100644 Binary files a/nEs.nes and b/nEs.nes differ diff --git a/nEslabels.mlb b/nEslabels.mlb index bcf5f9c..6b3797a 100644 --- a/nEslabels.mlb +++ b/nEslabels.mlb @@ -1,20 +1,24 @@ -NesPrgRom:000A8D:calc_next_cell@0_0: -NesPrgRom:000988:calc_and_advance_gen@0_0: -NesPrgRom:000991:calc_and_advance_gen@0_0_entry: -NesPrgRom:000A12:eca_nmi@0_1: -NesPrgRom:000AFA:eca_main@0_0: -NesPrgRom:0007F8:main_nmi@0_1: -NesPrgRom:0007FB:main_nmi@0_1_entry: -NesPrgRom:000250:main@0_0: -NesPrgRom:00073F:ppu_upload_palette@0_0: -NesPrgRom:00035F-00073E:title@0_0: +NesPrgRom:000B21:calc_next_cell@0_0: +NesPrgRom:000A15:calc_and_advance_gen@0_0: +NesPrgRom:000A1E:calc_and_advance_gen@0_0_entry: +NesPrgRom:000A9F:eca_nmi@0_1: +NesPrgRom:000988:eca_main@0_0: +NesPrgRom:000BE6:settings_nmi@0_1: +NesPrgRom:000BC3:settings@0_0: +NesPrgRom:000826:main_nmi@0_1: +NesPrgRom:000829:main_nmi@0_1_entry: +NesPrgRom:000279:main@0_0: +NesPrgRom:000238:ppu_upload_oam_poll_pads@0_1: +NesPrgRom:000B8E:update_pads@0_0: +NesPrgRom:00076D:ppu_upload_palette@0_0: +NesPrgRom:00038D-00076C:title@0_0: NesPrgRom:007FFA-007FFF:runtime_vectors@0_0: NesPrgRom:00011C-00012F:runtime_nmi@0_1: NesPrgRom:000130-000137:runtime_nmi_exit@0_1: NesPrgRom:000139-000147:runtime_wait_nmi@0_0: -NesPrgRom:00022C-00022E:runtime_nmi_lo_table@0_0: -NesPrgRom:000230-000232:runtime_nmi_hi_table@0_0: -NesPrgRom:000234-000236:runtime_nmi_bank_table@0_0: +NesPrgRom:00022C-00022F:runtime_nmi_lo_table@0_0: +NesPrgRom:000230-000233:runtime_nmi_hi_table@0_0: +NesPrgRom:000234-000237:runtime_nmi_bank_table@0_0: NesPrgRom:000138-000138:runtime_irq@0_2: NesPrgRom:000138-000138:runtime_irq_exit@0_2: NesPrgRom:000148-00014D:runtime_reset@0_0: @@ -28,7 +32,7 @@ NesPrgRom:0001E3-000228:runtime_mul8@0_2: NesPrgRom:000100-00010F:runtime_shl4_table@0_0: NesPrgRom:000110-000117:runtime_shl5_table@0_0: NesPrgRom:000118-00011B:runtime_shl6_table@0_0: -R:031F:buf@0: +R:031F:buf@0__slow_counter@0: R:000D:curr_gen@0: R:0010:next_gen@0: R:000E:drawing_row_offset@0: diff --git a/spritesheet.chr b/spritesheet.chr index 93d1ad4..fe7a52c 100644 Binary files a/spritesheet.chr and b/spritesheet.chr differ -- cgit v1.2.3