diff options
author | red031000 <rubenru09@aol.com> | 2020-06-07 17:28:17 +0100 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2020-06-07 17:28:17 +0100 |
commit | 1c7bd60010bb429bd6cbcfad889bef9e7058cb89 (patch) | |
tree | fff29ec53e2f943ea73c977e1870c10b985dbd19 /arm9/lib | |
parent | 292a0f16f5492c0b89b11f4eec9bc8397874f9f0 (diff) | |
parent | c2d3d0fb118d3f9ff14f8f5293f54d0c37421a70 (diff) |
Merge branch 'master' of https://github.com/martmists/pokediamond
Diffstat (limited to 'arm9/lib')
-rw-r--r-- | arm9/lib/Makefile | 89 | ||||
-rw-r--r-- | arm9/lib/syscall/_svc_mw.s | 121 |
2 files changed, 210 insertions, 0 deletions
diff --git a/arm9/lib/Makefile b/arm9/lib/Makefile new file mode 100644 index 00000000..c0e95ade --- /dev/null +++ b/arm9/lib/Makefile @@ -0,0 +1,89 @@ + + +# Try to include devkitarm if installed +TOOLCHAIN := $(DEVKITARM) + +ifneq (,$(wildcard $(TOOLCHAIN)/base_tools)) +include $(TOOLCHAIN)/base_tools +endif + +### Default target ### + +default: all + +# If you are using WSL, it is recommended you build with NOWINE=1. +WSLENV ?= no +ifeq ($(WSLENV),) +NOWINE = 1 +else +NOWINE = 0 +endif + +ifeq ($(OS),Windows_NT) +EXE := .exe +WINE := +else +EXE := +WINE := wine +endif + +ifeq ($(NOWINE),1) +WINE := +endif + +# Compare result of arm9, arm7, and ROM to sha1 hash(s) +COMPARE ?= 1 + +##################### Compiler Options ####################### + +MWCCVERSION = 1.2/sp2p3 + +CROSS := arm-none-eabi- + +MWCCARM = ../../tools/mwccarm/$(MWCCVERSION)/mwccarm.exe +# Argh... due to EABI version shenanigans, we can't use GNU LD to link together +# MWCC built objects and GNU built ones. mwldarm, however, doesn't care, so we +# have to use mwldarm for now. +# TODO: Is there a hack workaround to let us go back to GNU LD? Ideally, the +# only dependency should be MWCCARM. +MWLDARM = ../../tools/mwccarm/$(MWCCVERSION)/mwldarm.exe +MWASMARM = ../../tools/mwccarm/$(MWCCVERSION)/mwasmarm.exe +NARCCOMP = ../../tools/narccomp/narccomp$(EXE) +SCANINC = ../../tools/scaninc/scaninc$(EXE) + +AS = $(WINE) $(MWASMARM) +CC = $(WINE) $(MWCCARM) +CPP := cpp -P +LD = $(WINE) $(MWLDARM) +AR := $(CROSS)ar +OBJDUMP := $(CROSS)objdump +OBJCOPY := $(CROSS)objcopy + +# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o +ASFLAGS = -proc arm5te -ir ../.. +CFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -i include -ir include-mw -ir arm9/lib/include -W all +LDFLAGS = -library -nodead -w off -proc v5te -interworking -pic +ARFLAGS = rcS + +export MWCIncludes := include + +################ Targets ################# + +LIBS := libsyscall.a +.PHONY: all clean + +all: $(LIBS) + +clean: + $(RM) $(LIBS) $(LIBS:%.a=%/*.o) + +libsyscall.a: syscall/_svc_mw.o + +%.a: + $(AR) $(ARFLAGS) -o $@ $^ + +%.o: %.c + $(CC) $(CFLAGS) -o $@ $< + +%.o: %.s + $(AS) $(ASFLAGS) -o $@ $< diff --git a/arm9/lib/syscall/_svc_mw.s b/arm9/lib/syscall/_svc_mw.s new file mode 100644 index 00000000..c1e36b4b --- /dev/null +++ b/arm9/lib/syscall/_svc_mw.s @@ -0,0 +1,121 @@ + .include "asm/macros.inc" + + .text + ; NITRO SYSCALL LIBRARY + ; VERSION 3.2 + + ; Secure area + .space 0x800 + + non_word_aligned_thumb_func_start SVC_SoftReset +SVC_SoftReset: + swi 0 + bx lr + thumb_func_end SVC_SoftReset + + non_word_aligned_thumb_func_start SVC_WaitByLoop +SVC_WaitByLoop: + swi 3 + bx lr + thumb_func_end SVC_WaitByLoop + + non_word_aligned_thumb_func_start SVC_WaitIntr +SVC_WaitIntr: + mov r2, #0 + swi 4 + bx lr + thumb_func_end SVC_WaitIntr + + non_word_aligned_thumb_func_start SVC_WaitVBlankIntr +SVC_WaitVBlankIntr: + mov r2, #0 + swi 5 + bx lr + thumb_func_end SVC_WaitVBlankIntr + + non_word_aligned_thumb_func_start SVC_Halt +SVC_Halt: + swi 6 + bx lr + thumb_func_end SVC_Halt + + non_word_aligned_thumb_func_start SVC_Div +SVC_Div: + swi 9 + bx lr + thumb_func_end SVC_Div + + non_word_aligned_thumb_func_start SVC_DimRem +SVC_DivRem: + swi 9 + add r0, r1, #0 + bx lr + thumb_func_end SVC_DivRem + + non_word_aligned_thumb_func_start SVC_CpuSet +SVC_CpuSet: + swi 11 + bx lr + thumb_func_end SVC_CpuSet + + non_word_aligned_thumb_func_start SVC_CpuFastSet +SVC_CpuFastSet: + swi 12 + bx lr + thumb_func_end SVC_CpuFastSet + + non_word_aligned_thumb_func_start SVC_Sqrt +SVC_Sqrt: + swi 13 + bx lr + thumb_func_end SVC_Sqrt + + non_word_aligned_thumb_func_start SVC_GetCRC16 +SVC_GetCRC16: + swi 14 + bx lr + thumb_func_end SVC_GetCRC16 + + non_word_aligned_thumb_func_start IsMemExpanded +IsMemExpanded: + swi 15 + bx lr + thumb_func_end IsMemExpanded + + non_word_aligned_thumb_func_start SVC_UnpackBits +SVC_UnpackBits: + swi 16 + bx lr + thumb_func_end SVC_UnpackBits + + non_word_aligned_thumb_func_start SVC_UncompressLZ8 +SVC_UncompressLZ8: + swi 17 + bx lr + thumb_func_end SVC_UncompressLZ8 + + non_word_aligned_thumb_func_start SVC_UncompressLZ16FromDevice +SVC_UncompressLZ16FromDevice: + swi 18 + bx lr + thumb_func_end SVC_UncompressLZ16FromDevice + + non_word_aligned_thumb_func_start SVC_UncompressHuffmanFromDevice +SVC_UncompressHuffmanFromDevice: + swi 19 + bx lr + thumb_func_end SVC_UncompressHuffmanFromDevice + + non_word_aligned_thumb_func_start SVC_UncompressRL8 +SVC_UncompressRL8: + swi 20 + bx lr + thumb_func_end SVC_UncompressRL8 + + non_word_aligned_thumb_func_start SVC_UncompressRL16FromDevice +SVC_UncompressRL16FromDevice: + swi 21 + bx lr + thumb_func_end SVC_UncompressRL16FromDevice + + .balign 4, 0 ; Don't pad with nop |