Skip to content

Commit 9c1b424

Browse files
committed
Upgrade to newer gbdk
This uses sm83 instead of gbz80, as well as the new calling convention.
1 parent 9c59fd6 commit 9c1b424

File tree

4 files changed

+123
-135
lines changed

4 files changed

+123
-135
lines changed

Makefile.targets

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ clean-target:
1616
gb-clean:
1717
${MAKE} clean-target EXT=gb
1818
gb:
19-
${MAKE} build-target PORT=gbz80 PLAT=gb EXT=gb
19+
${MAKE} build-target PORT=sm83 PLAT=gb EXT=gb
2020

2121

2222
gbc-clean:
2323
${MAKE} clean-target EXT=gbc
2424
gbc:
25-
${MAKE} build-target PORT=gbz80 PLAT=gb EXT=gbc
25+
${MAKE} build-target PORT=sm83 PLAT=gb EXT=gbc
2626

2727

2828
pocket-clean:
2929
${MAKE} clean-target EXT=pocket
3030
pocket:
31-
${MAKE} build-target PORT=gbz80 PLAT=ap EXT=pocket
31+
${MAKE} build-target PORT=sm83 PLAT=ap EXT=pocket
3232

3333

3434
megaduck-clean:
3535
${MAKE} clean-target EXT=duck
3636
megaduck:
37-
${MAKE} build-target PORT=gbz80 PLAT=duck EXT=duck
37+
${MAKE} build-target PORT=sm83 PLAT=duck EXT=duck
3838

3939

4040
sms-clean:

src/ai.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ u8 ai_dobump(u8 index);
99
u8 ai_tcheck(u8 index);
1010
u8 ai_getnextstep(u8 index);
1111
u8 ai_getnextstep_rev(u8 index);
12-
void calcdist_ai(u8 from, u8 to);
12+
void calcdist_ai(u8 from, u8 to) __sdcccall(0);
1313

1414
#endif // AI_H_

src/music.s

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ CMD_NOFX = 5
88
; manually assign song_ptr and wait_timer to HRAM
99
; TODO: better way?
1010
ch1_wait_timer = 0xffa0
11-
ch1_song_ptr = ch1_wait_timer + 1
12-
ch1_stack = ch1_song_ptr + 2
13-
ch2_wait_timer = ch1_stack + 2
14-
ch2_song_ptr = ch2_wait_timer + 1
15-
ch2_stack = ch2_song_ptr + 2
16-
ch3_wait_timer = ch2_stack + 2
17-
ch3_song_ptr = ch3_wait_timer + 1
18-
ch3_stack = ch3_song_ptr + 2
19-
ch4_wait_timer = ch3_stack + 2
20-
ch4_song_ptr = ch4_wait_timer + 1
21-
ch4_stack = ch4_song_ptr + 2
22-
snddata_end = ch4_stack + 2
11+
ch1_song_ptr = ch1_wait_timer + 1 ; ffa1
12+
ch1_stack = ch1_song_ptr + 2 ; ffa3
13+
ch2_wait_timer = ch1_stack + 2 ; ffa5
14+
ch2_song_ptr = ch2_wait_timer + 1 ; ffa6
15+
ch2_stack = ch2_song_ptr + 2 ; ffa8
16+
ch3_wait_timer = ch2_stack + 2 ; ffaa
17+
ch3_song_ptr = ch3_wait_timer + 1 ; ffab
18+
ch3_stack = ch3_song_ptr + 2 ; ffad
19+
ch4_wait_timer = ch3_stack + 2 ; ffaf
20+
ch4_song_ptr = ch4_wait_timer + 1 ; ffb0
21+
ch4_stack = ch4_song_ptr + 2 ; ffb2
22+
snddata_end = ch4_stack + 2 ; ffb4
2323

2424
current_sfx_priority = snddata_end + 1
2525

@@ -131,13 +131,12 @@ sfx_priority::
131131

132132
_play_music::
133133
di
134-
ld hl, #snddata_end - #ch1_wait_timer
135-
push hl
136-
push de
137-
ld hl, #ch1_wait_timer
138-
push hl
134+
ld bc, #snddata_end - #ch1_wait_timer
135+
push bc
136+
ld c, e
137+
ld b, d
138+
ld de, #ch1_wait_timer
139139
call _memcpy
140-
add sp, #6
141140
ei
142141
ret
143142

@@ -158,9 +157,6 @@ _music_win::
158157

159158
_sfx::
160159
di
161-
162-
ldhl sp, #2
163-
ld a, (hl)
164160
ld d, a ; d = a = sfx to play
165161

166162
ld hl, #sfx_priority

0 commit comments

Comments
 (0)