Skip to content

Commit

Permalink
Finally the define files are available in asm
Browse files Browse the repository at this point in the history
  • Loading branch information
ADM228 committed Jan 9, 2025
1 parent f9860d9 commit eb1b632
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
1 change: 1 addition & 0 deletions LIB/asm/crt0.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
;REMOVED initlib
;this called the CONDES function
.include "BUILD_FLAGS.s"
.include "C_defines.s"

.exportzp _VRAM_UPDATE := VRAM_UPDATE

Expand Down
10 changes: 5 additions & 5 deletions LIB/asm/nesdash.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ;
Expand Down
9 changes: 3 additions & 6 deletions LIB/asm/neslib.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
21 changes: 20 additions & 1 deletion SAUCE/defines/space_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,23 @@
#define MAX_FIREBALLS 20
#define MAX_PRACTICE_POINTS 8
#define max_loaded_sprites 16
#define MAX_LEVEL_COMPLETE 0x60
#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

18 changes: 0 additions & 18 deletions SAUCE/famidash.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 7 additions & 6 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ LD65 = ./BIN/ld65.exe
DEL = del
MKDIR = mkdir
PYTHON = python
CAT = type
else ifeq ($(OS),MSDOS)
# MS-DOS
# add "set OS=MSDOS" to autoexec
Expand All @@ -18,6 +19,7 @@ LD65 = ./BIN/ld65d.exe
DEL = del
MKDIR = mkdir
PYTHON = python
CAT = type
else
# Ubuntu/Debian
CC65 = cc65
Expand All @@ -26,6 +28,7 @@ LD65 = ld65
DEL = rm
MKDIR = mkdir
PYTHON = python3
CAT = cat
endif

define cc65IncDir
Expand Down Expand Up @@ -61,7 +64,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
Expand All @@ -70,11 +73,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)/space_defines.s $(TMPDIR)/physics_defines.s $(TMPDIR)/level_defines.s > $(TMPDIR)/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
Expand Down

0 comments on commit eb1b632

Please sign in to comment.