Skip to content

Commit

Permalink
Upgrade to newer gbdk
Browse files Browse the repository at this point in the history
This uses sm83 instead of gbz80, as well as the new calling convention.
  • Loading branch information
binji committed Jul 26, 2023
1 parent 9c59fd6 commit 9c1b424
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 135 deletions.
8 changes: 4 additions & 4 deletions Makefile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ clean-target:
gb-clean:
${MAKE} clean-target EXT=gb
gb:
${MAKE} build-target PORT=gbz80 PLAT=gb EXT=gb
${MAKE} build-target PORT=sm83 PLAT=gb EXT=gb


gbc-clean:
${MAKE} clean-target EXT=gbc
gbc:
${MAKE} build-target PORT=gbz80 PLAT=gb EXT=gbc
${MAKE} build-target PORT=sm83 PLAT=gb EXT=gbc


pocket-clean:
${MAKE} clean-target EXT=pocket
pocket:
${MAKE} build-target PORT=gbz80 PLAT=ap EXT=pocket
${MAKE} build-target PORT=sm83 PLAT=ap EXT=pocket


megaduck-clean:
${MAKE} clean-target EXT=duck
megaduck:
${MAKE} build-target PORT=gbz80 PLAT=duck EXT=duck
${MAKE} build-target PORT=sm83 PLAT=duck EXT=duck


sms-clean:
Expand Down
2 changes: 1 addition & 1 deletion src/ai.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ u8 ai_dobump(u8 index);
u8 ai_tcheck(u8 index);
u8 ai_getnextstep(u8 index);
u8 ai_getnextstep_rev(u8 index);
void calcdist_ai(u8 from, u8 to);
void calcdist_ai(u8 from, u8 to) __sdcccall(0);

#endif // AI_H_
38 changes: 17 additions & 21 deletions src/music.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ CMD_NOFX = 5
; manually assign song_ptr and wait_timer to HRAM
; TODO: better way?
ch1_wait_timer = 0xffa0
ch1_song_ptr = ch1_wait_timer + 1
ch1_stack = ch1_song_ptr + 2
ch2_wait_timer = ch1_stack + 2
ch2_song_ptr = ch2_wait_timer + 1
ch2_stack = ch2_song_ptr + 2
ch3_wait_timer = ch2_stack + 2
ch3_song_ptr = ch3_wait_timer + 1
ch3_stack = ch3_song_ptr + 2
ch4_wait_timer = ch3_stack + 2
ch4_song_ptr = ch4_wait_timer + 1
ch4_stack = ch4_song_ptr + 2
snddata_end = ch4_stack + 2
ch1_song_ptr = ch1_wait_timer + 1 ; ffa1
ch1_stack = ch1_song_ptr + 2 ; ffa3
ch2_wait_timer = ch1_stack + 2 ; ffa5
ch2_song_ptr = ch2_wait_timer + 1 ; ffa6
ch2_stack = ch2_song_ptr + 2 ; ffa8
ch3_wait_timer = ch2_stack + 2 ; ffaa
ch3_song_ptr = ch3_wait_timer + 1 ; ffab
ch3_stack = ch3_song_ptr + 2 ; ffad
ch4_wait_timer = ch3_stack + 2 ; ffaf
ch4_song_ptr = ch4_wait_timer + 1 ; ffb0
ch4_stack = ch4_song_ptr + 2 ; ffb2
snddata_end = ch4_stack + 2 ; ffb4

current_sfx_priority = snddata_end + 1

Expand Down Expand Up @@ -131,13 +131,12 @@ sfx_priority::

_play_music::
di
ld hl, #snddata_end - #ch1_wait_timer
push hl
push de
ld hl, #ch1_wait_timer
push hl
ld bc, #snddata_end - #ch1_wait_timer
push bc
ld c, e
ld b, d
ld de, #ch1_wait_timer
call _memcpy
add sp, #6
ei
ret

Expand All @@ -158,9 +157,6 @@ _music_win::

_sfx::
di

ldhl sp, #2
ld a, (hl)
ld d, a ; d = a = sfx to play

ld hl, #sfx_priority
Expand Down
Loading

0 comments on commit 9c1b424

Please sign in to comment.