Skip to content

Commit

Permalink
Preliminary exit to menu feature - only for a53
Browse files Browse the repository at this point in the history
  • Loading branch information
potatolain committed Apr 15, 2017
1 parent 101a6ae commit f719028
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 15 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -149,6 +149,7 @@ are for can be looked up from constants in `main.asm`.
- Intro is now slower. (And sounds crummier... sorry :()
- Jump sound effect made less annoying (maybe)
- Added Exit to Title button
- Added return to A53 option (A53 builds only)

# Tools Used

Expand Down
2 changes: 1 addition & 1 deletion lib/buildnumber.txt
@@ -1 +1 @@
6213
6238
8 changes: 4 additions & 4 deletions lib/project_constants.asm
@@ -1,8 +1,8 @@
.define BUILD 6213
.define BUILD 6238
.define VERSION "1.1 "
.define BUILD_DATE "Fri 04/14/2017 22:59"
.define BUILD_DATE "Fri 04/14/2017 23:55"
.define SPLASH_MESSAGE "Post-Contest Build"
.define COPYRIGHT "Copyright 2016-2017 cpprograms"
.define COMMIT_COUNT 220
.define CODE_LINE_COUNT 9481
.define COMMIT_COUNT 221
.define CODE_LINE_COUNT 9523
.define SHOW_VERSION_STRING 0
20 changes: 14 additions & 6 deletions makefile
Expand Up @@ -49,7 +49,7 @@ else
UPLOADER=tools/uploader/upload.sh
endif

all: generate_constants sound_files convert_levels convert_sprites convert_graphics convert_nametables build
all: build

generate_constants:
@$(shell echo $(BUILD_NUMBER_INCREMENTED) > lib/buildnumber.txt)
Expand Down Expand Up @@ -97,21 +97,29 @@ graphics/processed/%.chr.pkb: graphics/%.chr
graphics/processed/%.nam.pkb: graphics/%.nam
$(PACKBITS) $< $@

build:
cd bin && $(MAIN_COMPILER) --config $(CONFIG_FILE) -t nes -o main.nes -Wa "-D DEBUGGING=1" ../main.asm
build: generate_constants sound_files convert_levels convert_sprites convert_graphics convert_nametables
cd bin && $(MAIN_COMPILER) --config $(CONFIG_FILE) -t nes -o main.nes -Wa "-D DEBUGGING=1 -D ACTION53=0" ../main.asm

build_release:
cd bin && $(MAIN_COMPILER) --config $(CONFIG_FILE) -t nes -o main.nes -Wa "-D DEBUGGING=0" ../main.asm
build_release: generate_constants sound_files convert_levels convert_sprites convert_graphics convert_nametables
cd bin && $(MAIN_COMPILER) --config $(CONFIG_FILE) -t nes -o main.nes -Wa "-D DEBUGGING=0 -D ACTION53=0" ../main.asm

build_action53: generate_constants sound_files convert_levels convert_sprites convert_graphics convert_nametables
cd bin && $(MAIN_COMPILER) --config $(CONFIG_FILE) -t nes -o main-53.nes -Wa "-D DEBUGGING=0 -D ACTION53=1" ../main.asm

build_debug:
build_debug: generate_constants sound_files convert_levels convert_sprites convert_graphics convert_nametables
cd bin && ca65 -g -o main.o ../main.asm -D DEBUGGING=1
cd bin && ld65 -o main.nes --config $(CONFIG_FILE) --dbgfile main.nes.dbg main.o

fceux:
$(MAIN_EMULATOR) bin/main.nes

fceux_53:
$(MAIN_EMULATOR) bin/main-53.nes

run: fceux

run_53: fceux_53

nintendulator:
$(DEBUG_EMULATOR) bin/main.nes

Expand Down
49 changes: 45 additions & 4 deletions menus.asm
Expand Up @@ -95,8 +95,10 @@ load_title:
write_string COPYRIGHT, $2361, $1e
.endif

.if DEBUGGING = 1
.if ACTION53 = 1
write_string .sprintf("Hold select and Start to"), $2304
write_string .sprintf("return to the A53 menu"), $2325
.elseif DEBUGGING = 1
write_string .sprintf("Debug enabled"), $2301
.endif

Expand Down Expand Up @@ -192,14 +194,29 @@ show_title:
jsr read_controller
jsr vblank_wait
.if ACTION53 = 1
; Special action53 combo to exit to the game menu.
lda ctrlButtons
and #CONTROLLER_SELECT
beq @no_select
lda ctrlButtons
and #CONTROLLER_START
beq @no_select
; Okay, you're holding select and start. Time to do some magic to put you back in the A53 menu.
jmp reset_to_action53

@no_select:
.endif


; Check for start button...

; Make sure we don't count keypresses from last cycle.
lda lastCtrlButtons
eor #$ff ; flip the bits.
and ctrlButtons

and #CONTROLLER_START
bne @game_time

Expand Down Expand Up @@ -262,6 +279,30 @@ show_title:
jmp show_ready


.if ACTION53 = 1
reset_to_action53:
; NOTE: Code borrowed/ripped-off from exitpatch.py in the A53 menu tools.
sei
ldx #11
@loop:
lda @cpsrc,x
sta $F0,x
dex
bpl @loop
; X = $FF at end
ldy #$80
sty $5000
lda #$00
iny
jmp $00F0
@cpsrc:
sta $8000
sty $5000
stx $8000
jmp ($FFFC)

.endif

load_ready:
jsr load_menu

Expand Down

0 comments on commit f719028

Please sign in to comment.