diff --git a/LIB/asm/crt0.s b/LIB/asm/crt0.s index 371cdbd1..1e03371f 100644 --- a/LIB/asm/crt0.s +++ b/LIB/asm/crt0.s @@ -4,6 +4,7 @@ ;REMOVED initlib ;this called the CONDES function .include "BUILD_FLAGS.s" +.include "C_defines.s" .exportzp _VRAM_UPDATE := VRAM_UPDATE diff --git a/LIB/asm/nesdash.s b/LIB/asm/nesdash.s index 8daf22d5..73c330ed 100644 --- a/LIB/asm/nesdash.s +++ b/LIB/asm/nesdash.s @@ -2100,8 +2100,8 @@ end: .segment "XCD_BANK_05" -.define CUBE_GRAVITY $6B -.define MINI_CUBE_GRAVITY $6F +.define CUBE_GRAVITY ::_CUBE_GRAVITY +.define MINI_CUBE_GRAVITY ::_MINI_CUBE_GRAVITY .import _player_x, _player_y, _player_gravity, _player_vel_x, _player_vel_y .import _ballframe, _robotframe, _robotjumpframe, _spiderframe, _retro_mode, _icon, _gameState, _titleicon @@ -3406,7 +3406,7 @@ SampleRate_PAL: .export _update_level_completeness .proc _update_level_completeness - levelsInTable = $40 + levelsInTable = ::_MAX_LEVEL_COMPLETE levelLengthLo = ptr1+0 levelLengthMd = ptr1+1 @@ -3911,7 +3911,7 @@ vert_skip: LDA _sprite_data_bank ; Switch to the correct bank JSR mmc3_set_prg_bank_1 ;__ - LDX #16 ;! THIS IS THE SPRITE SLOT COUNT, CHANGE AS NEEDED + LDX #::_max_loaded_sprites LDA #$FF ; clear_spritetype_loop: ; STA _activesprites_type-1, X ; Clear sprites to load them @@ -4019,7 +4019,7 @@ vert_skip: DEY ; Y is 1 - LDX #16 ;! THIS IS THE SPRITE SLOT COUNT, CHANGE AS NEEDED + LDX #::_max_loaded_sprites loading_loop: ;__ Y is 0 LDA (sprite_data), y ; diff --git a/LIB/asm/neslib.s b/LIB/asm/neslib.s index 98a24f10..005225ab 100644 --- a/LIB/asm/neslib.s +++ b/LIB/asm/neslib.s @@ -1718,9 +1718,6 @@ MouseBoundsMax: .popseg -SLOPESA = 16 -luckydraw = $2B - .import _spike_set, _block_set, _saw_set .import _no_parallax, _parallax_scroll_x, _level .export _set_tile_banks @@ -1755,16 +1752,16 @@ luckydraw = $2B lda _no_parallax beq @asdf lda _level - cmp #luckydraw + cmp #::_luckydraw beq @slop - lda #SLOPESA + lda #::_SLOPESA ; clc adc CHRBANK_TEMP jmp _mmc3_set_1kb_chr_bank_2 lda #1 beq @asdf @slop: - lda #SLOPESA + lda #::_SLOPESA jmp _mmc3_set_1kb_chr_bank_2 @asdf: lda _parallax_scroll_x diff --git a/SAUCE/defines/space_defines.h b/SAUCE/defines/space_defines.h index b2c73359..8e0ae467 100644 --- a/SAUCE/defines/space_defines.h +++ b/SAUCE/defines/space_defines.h @@ -15,4 +15,23 @@ #define MAX_FIREBALLS 20 #define MAX_PRACTICE_POINTS 8 #define max_loaded_sprites 16 -#define MAX_LEVEL_COMPLETE 0x60 \ No newline at end of file +#define MAX_LEVEL_COMPLETE 0x60 + +#define NINJABANK 94 +#define MOUSEBANK 96 +#define LETTERBANK 111 +#define MENUBANK 98 +#define MENUICONBANK 102 +#define LEVELCOMPLETEBANK 106 +#define PRACTICECOMPLETEBANK 110 + +#define SPIKESA 0 +#define SPIKESB 2 +#define SPIKESC 4 +#define BLOCKSA 6 +#define BLOCKSB 8 +#define BLOCKSC 10 +#define BLOCKSD 12 +#define SAWBLADESA 14 +#define SLOPESA 16 + diff --git a/SAUCE/famidash.h b/SAUCE/famidash.h index 18c2815b..e2dfaaa0 100644 --- a/SAUCE/famidash.h +++ b/SAUCE/famidash.h @@ -1,21 +1,3 @@ -#define NINJABANK 94 -#define MOUSEBANK 96 -#define LETTERBANK 111 -#define MENUBANK 98 -#define MENUICONBANK 102 -#define LEVELCOMPLETEBANK 106 -#define PRACTICECOMPLETEBANK 110 - -#define SPIKESA 0 -#define SPIKESB 2 -#define SPIKESC 4 -#define BLOCKSA 6 -#define BLOCKSB 8 -#define BLOCKSC 10 -#define BLOCKSD 12 -#define SAWBLADESA 14 -#define SLOPESA 16 - // game states #define MENU 0x01 #define GAME 0x02 diff --git a/makefile b/makefile index 8c4ef5a7..e408c514 100644 --- a/makefile +++ b/makefile @@ -8,6 +8,8 @@ LD65 = ./BIN/ld65.exe DEL = del MKDIR = mkdir PYTHON = python +CAT = type +DS = \\ else ifeq ($(OS),MSDOS) # MS-DOS # add "set OS=MSDOS" to autoexec @@ -18,6 +20,8 @@ LD65 = ./BIN/ld65d.exe DEL = del MKDIR = mkdir PYTHON = python +CAT = type +DS = \\ else # Ubuntu/Debian CC65 = cc65 @@ -26,6 +30,8 @@ LD65 = ld65 DEL = rm MKDIR = mkdir PYTHON = python3 +CAT = cat +DS = / endif define cc65IncDir @@ -61,7 +67,7 @@ $(OUTDIR)/$(NAME).nes: $(OUTDIR) $(TMPDIR)/$(NAME).o $(TMPDIR)/crt0.o $(CFG) $(LD65) -C $(CFG) -o $(OUTDIR)/$(NAME).nes $(call ld65IncDir,$(TMPDIR)) $(call ld65IncDir,LIB) crt0.o $(NAME).o nes.lib --dbgfile $(OUTDIR)/famidash.dbg @echo $(NAME).nes created -$(TMPDIR)/crt0.o: GRAPHICS/*.chr LIB/asm/*.s LEVELS/*.s METATILES/*.s METATILES/*.inc MUSIC/EXPORTS/*.s MUSIC/EXPORTS/music_bank*.dmc $(TMPDIR)/BUILD_FLAGS.s $(TMPDIR)/physics_defines.s $(TMPDIR)/space_defines.s +$(TMPDIR)/crt0.o: GRAPHICS/*.chr LIB/asm/*.s LEVELS/*.s METATILES/*.s METATILES/*.inc MUSIC/EXPORTS/*.s MUSIC/EXPORTS/music_bank*.dmc $(TMPDIR)/BUILD_FLAGS.s $(TMPDIR)/C_defines.s $(CA65) LIB/asm/crt0.s -l $(OUTDIR)/crt0.lst --cpu 6502X -g $(call ca65IncDir,.) $(call ca65IncDir,MUSIC/EXPORTS) $(call ca65IncDir,$(TMPDIR)) -o $(TMPDIR)/crt0.o $(TMPDIR)/$(NAME).o: $(TMPDIR)/$(NAME).s @@ -70,11 +76,9 @@ $(TMPDIR)/$(NAME).o: $(TMPDIR)/$(NAME).s $(TMPDIR)/BUILD_FLAGS.s: BUILD_FLAGS.h defines_to_asm.py $(PYTHON) defines_to_asm.py BUILD_FLAGS.h -$(TMPDIR)/space_defines.s: SAUCE/defines/space_defines.h defines_to_asm.py - $(PYTHON) defines_to_asm.py SAUCE/defines/space_defines.h - -$(TMPDIR)/physics_defines.s: SAUCE/defines/physics_defines.h defines_to_asm.py - $(PYTHON) defines_to_asm.py SAUCE/defines/physics_defines.h +$(TMPDIR)/C_defines.s: SAUCE/defines/*_defines.h defines_to_asm.py + $(PYTHON) defines_to_asm.py SAUCE/defines/space_defines.h SAUCE/defines/physics_defines.h SAUCE/defines/level_defines.h + $(CAT) $(TMPDIR)$(DS)space_defines.s $(TMPDIR)$(DS)physics_defines.s $(TMPDIR)$(DS)level_defines.s > $(TMPDIR)$(DS)C_defines.s $(TMPDIR)/$(NAME).s: $(TMPDIR) SAUCE/$(NAME).c SAUCE/*.h SAUCE/gamestates/*.h SAUCE/gamemodes/*.h SAUCE/defines/*.h SAUCE/functions/*.h METATILES/metatiles.h LEVELS/*.h LIB/headers/*.h MUSIC/EXPORTS/*.h $(CC65) -Osir -g --eagerly-inline-funcs SAUCE/$(NAME).c $(call cc65IncDir,LIB/headers) $(call cc65IncDir,.) -E --add-source -o $(TMPDIR)/$(NAME).c