disasm collect_rings program

This commit is contained in:
Oliver Bell committed 2023-05-13 19:43:33 +01:00
1 parent 03a12098fc
commit 64b9426dc9
8 files changed
+43818 -5

No files matched your search

+3 -5
View File
@@ -87,10 +87,8 @@ MAKEFLAGS += --no-print-directory
compare: $(ROM)
$(SHA1) $(BUILD_NAME).sha1
# @$(MAKE) clean -C collect_rings
clean: tidy
@$(MAKE) clean -C collect_rings
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec $(RM) {} +
tidy:
@@ -130,5 +128,5 @@ $(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s $$(data_dep)
@echo "$(AS) <flags> -o $@ $<"
@$(PREPROC) $< | $(CPP) $(CPPFLAGS) - | $(AS) $(ASFLAGS) -o $@
# collect_rings/collect_rings.gba:
# $(MAKE) -C collect_rings
collect_rings/collect_rings.gba:
$(MAKE) -C collect_rings
@@ -0,0 +1,128 @@
TOOLCHAIN := $(DEVKITARM)
COMPARE ?= 0
ifeq (compare,$(MAKECMDGOALS))
COMPARE := 1
endif
# don't use dkP's base_tools anymore
# because the redefinition of $(CC) conflicts
# with when we want to use $(CC) to preprocess files
# thus, manually create the variables for the bin
# files, or use arm-none-eabi binaries on the system
# if dkP is not installed on this system
ifneq (,$(TOOLCHAIN))
ifneq ($(wildcard $(TOOLCHAIN)/bin),)
export PATH := $(TOOLCHAIN)/bin:$(PATH)
endif
endif
PREFIX := arm-none-eabi-
include config.mk
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
#### Tools ####
SHELL := /bin/bash -o pipefail
SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
LD := $(PREFIX)ld
OBJCOPY := $(PREFIX)objcopy
AS := $(PREFIX)as
GFX := ../../../tools/gbagfx/gbagfx$(EXE)
AIF := ../../../tools/aif2pcm/aif2pcm$(EXE)
SCANINC := ../../../tools/scaninc/scaninc$(EXE)
PREPROC := ../../../tools/preproc/preproc$(EXE)
RAMSCRGEN := ../../../tools/ramscrgen/ramscrgen$(EXE)
FIX := ../../../tools/gbafix/gbafix$(EXE)
ASFLAGS := -mcpu=arm7tdmi -mthumb-interwork --defsym $(GAME_REGION)=1
# Clear the default suffixes
.SUFFIXES:
# Don't delete intermediate files
.SECONDARY:
# Delete files that weren't built properly
.DELETE_ON_ERROR:
# Secondary expansion is required for dependency variables in object rules.
.SECONDEXPANSION:
#### Files ####
OBJ_DIR:= build/collect_rings
ROM := collect_rings.gba
ELF := $(ROM:.gba=.elf)
MAP := $(ROM:.gba=.map)
LDSCRIPT := ldscript.txt
ASM_SUBDIR = asm
DATA_ASM_SUBDIR = data
ASM_BUILDDIR = $(OBJ_DIR)/$(ASM_SUBDIR)
DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR)
$(shell mkdir -p $(ASM_BUILDDIR) $(DATA_ASM_BUILDDIR))
ASM_SRCS := $(wildcard $(ASM_SUBDIR)/*.s)
ASM_OBJS := $(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o,$(ASM_SRCS))
DATA_ASM_SRCS := $(wildcard $(DATA_ASM_SUBDIR)/*.s)
DATA_ASM_OBJS := $(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o,$(DATA_ASM_SRCS))
OBJS := $(ASM_OBJS) $(DATA_ASM_OBJS)
OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS))
#### Main Targets ####
MAKEFLAGS += --no-print-directory
compare: $(ROM)
$(SHA1) $(BUILD_NAME).sha1
clean: tidy
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec $(RM) {} +
tidy:
$(RM) -f $(ROM) $(ELF) $(MAP)
$(RM) -r build/*
#### Recipes ####
%.s: ;
$(ELF): $(OBJS) $(LDSCRIPT)
@echo "$(LD) -T $(LD_SCRIPT) -Map $(MAP) <objects> <lib>"
@$(LD) -T $(LDSCRIPT) -Map $(MAP) $(OBJS) ../../../tools/agbcc/lib/libgcc.a ../../../tools/agbcc/lib/libc.a -o $@
%.gba: %.elf
$(OBJCOPY) -O binary $< $@
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(GAME_REVISION) --silent
ifeq ($(NODEP),1)
$(ASM_BUILDDIR)/%.o: asm_dep :=
else
$(ASM_BUILDDIR)/%.o: asm_dep = $(shell $(SCANINC) $(ASM_SUBDIR)/$*.s)
endif
$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s $$(asm_dep)
@echo "$(AS) <flags> -o $@ $<"
@$(AS) $(ASFLAGS) -o $@ $<
ifeq ($(NODEP),1)
$(DATA_ASM_BUILDDIR)/%.o: data_dep :=
else
$(DATA_ASM_BUILDDIR)/%.o: data_dep = $(shell $(SCANINC) $(DATA_ASM_SUBDIR)/$*.s)
endif
$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s $$(data_dep)
@echo "$(AS) <flags> -o $@ $<"
@$(PREPROC) $< | $(CPP) $(CPPFLAGS) - | $(AS) $(ASFLAGS) -o $@
File diff suppressed because it is too large. Load diff
@@ -0,0 +1 @@
5eab21690b2eab4e02d0108a4c8ab60a570c49f6 collect_rings.gba
@@ -0,0 +1,42 @@
### Build Configuration ###
# Default variables
GAME_REVISION ?= 0
GAME_REGION ?= USA
DEBUG ?= 0
COMPARE ?= 1
# For gbafix
MAKER_CODE := 8P
# Version
BUILD_NAME := collect_rings
TITLE := SONICADVANC2
GAME_CODE := A2N
# Revision
ifeq ($(GAME_REVISION), 0)
BUILD_NAME := $(BUILD_NAME)
else
$(error unknown revision $(GAME_REVISION))
endif
# Region
ifeq ($(GAME_REGION), USA)
BUILD_NAME := $(BUILD_NAME)
GAME_CODE := $(GAME_CODE)E
else
ifeq ($(GAME_REGION), EUROPE)
BUILD_NAME := $(BUILD_NAME)_europe
GAME_CODE := $(GAME_CODE)P
else
$(error unknown region $(GAME_REGION))
endif
endif
# Debug
ifeq ($(DEBUG), 1)
COMPARE := 0
BUILD_NAME := $(BUILD_NAME)_debug
endif
@@ -0,0 +1,5 @@
.section .rodata
.global gRomData
gUnknown_02014F10:
.incbin "data/rom_data.bin", 0x00014E50, 0x7d1C
@@ -0,0 +1,43 @@
SECTIONS {
. = 0x20000C0;
.text :
ALIGN(4) {
build/collect_rings/asm/code.o(.text);
}
.rodata :
ALIGN(4) {
build/collect_rings/data/data.o(.rodata);
}
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* Discard everything not specifically mentioned above. */
/DISCARD/ :
{
*(*);
}
}