Skip to content

Commit

Permalink
Use bankless symbols for VC constants
Browse files Browse the repository at this point in the history
This is valid according to the .sym file spec:
<https://rgbds.gbdev.io/sym/>
  • Loading branch information
Rangi42 committed Aug 5, 2024
1 parent 77d0514 commit 59202a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions tools/make_patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ int parse_number(const char *input, int base) {

void parse_symbol_value(char *input, int *restrict bank, int *restrict address) {
char *colon = strchr(input, ':');
if (!colon) {
error_exit("Error: Cannot parse bank+address: \"%s\"\n", input);
if (colon) {
*colon++ = '\0';
*bank = parse_number(input, 16);
*address = parse_number(colon, 16);
} else {
*bank = 0;
*address = parse_number(input, 16);
}
*colon++ = '\0';
*bank = parse_number(input, 16);
*address = parse_number(colon, 16);
}

void parse_symbols(const char *filename, struct Symbol **symbols) {
Expand Down
2 changes: 1 addition & 1 deletion vc/pokeblue.constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MACRO vc_const
DEF x = \1
PRINTLN "00:{04x:x} \1" ; same format as rgblink's .sym file
PRINTLN "{02x:x} \1" ; same format as rgblink's .sym file
ENDM

; [FPA 001 Begin]
Expand Down
2 changes: 1 addition & 1 deletion vc/pokered.constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MACRO vc_const
DEF x = \1
PRINTLN "00:{04x:x} \1" ; same format as rgblink's .sym file
PRINTLN "{02x:x} \1" ; same format as rgblink's .sym file
ENDM

; [FPA 001 Begin]
Expand Down

0 comments on commit 59202a2

Please sign in to comment.