diff --git a/Makefile b/Makefile index d708f5d435..66d38f9063 100644 --- a/Makefile +++ b/Makefile @@ -158,7 +158,6 @@ else SRC_DIRS := $(shell find src -type d) endif -ASM_DIRS := $(shell find asm -type d -not -path "asm/non_matchings*") $(shell find data -type d) ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*" -not -path "assets/text") ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml)) ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin)) @@ -166,9 +165,11 @@ ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \ $(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),build/$f) \ $(foreach f,$(wildcard assets/text/*.c),build/$(f:.c=.o)) +UNDECOMPILED_DATA_DIRS := $(shell find data -type d) + # source files C_FILES := $(foreach dir,$(SRC_DIRS) $(ASSET_BIN_DIRS),$(wildcard $(dir)/*.c)) -S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s)) +S_FILES := $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(wildcard $(dir)/*.s)) O_FILES := $(foreach f,$(S_FILES:.s=.o),build/$f) \ $(foreach f,$(C_FILES:.c=.o),build/$f) \ $(foreach f,$(wildcard baserom/*),build/$f.o) @@ -186,7 +187,7 @@ TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),build/$f) \ $(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),build/$f) \ # create build directories -$(shell mkdir -p build/baserom build/assets/text $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(ASSET_BIN_DIRS),build/$(dir))) +$(shell mkdir -p build/baserom build/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS) $(ASSET_BIN_DIRS),build/$(dir))) ifeq ($(COMPILER),ido) build/src/code/fault.o: CFLAGS += -trapuv @@ -297,9 +298,6 @@ build/undefined_syms.txt: undefined_syms.txt build/baserom/%.o: baserom/% $(OBJCOPY) -I binary -O elf32-big $< $@ -build/asm/%.o: asm/%.s - $(CPP) $(CPPFLAGS) -Iinclude $< | $(AS) $(ASFLAGS) -o $@ - build/data/%.o: data/%.s $(AS) $(ASFLAGS) $< -o $@ @@ -315,6 +313,9 @@ build/assets/%.o: assets/%.c $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< $(OBJCOPY) -O binary $@ $@.bin +build/src/%.o: src/%.s + $(CPP) $(CPPFLAGS) -Iinclude $< | $(AS) $(ASFLAGS) -o $@ + build/dmadata_table_spec.h: build/$(SPEC) $(MKDMADATA) $< $@ diff --git a/progress.py b/progress.py index 7f86da71b7..5c56e4c6c4 100755 --- a/progress.py +++ b/progress.py @@ -58,6 +58,9 @@ def GetNonMatchingSize(path): return size +def IsCFile(objfile): + srcfile = objfile.strip().replace("build/", "").replace(".o", ".c") + return os.path.isfile(srcfile) mapFile = ReadAllLines("build/z64.map") curSegment = None @@ -82,7 +85,7 @@ for line in mapFile: size = int(lineSplit[2], 16) objFile = lineSplit[3] - if (section == ".text"): + if (section == ".text" and IsCFile(objFile)): if (objFile.startswith("build/src")): src += size diff --git a/spec b/spec index 503150a295..8fbf7b6eca 100644 --- a/spec +++ b/spec @@ -4,9 +4,9 @@ beginseg name "makerom" - include "build/asm/rom_header.o" - include "build/asm/ipl3.o" - include "build/asm/entry.o" + include "build/src/makerom/rom_header.o" + include "build/src/makerom/ipl3.o" + include "build/src/makerom/entry.o" endseg beginseg @@ -23,7 +23,7 @@ beginseg include "build/src/boot/assert.o" include "build/src/boot/is_debug.o" include "build/src/libultra/io/driverominit.o" - include "build/asm/mio0.o" + include "build/src/boot/mio0.o" include "build/src/boot/stackcheck.o" include "build/src/boot/logutils.o" include "build/src/libultra/rmon/sprintf.o" @@ -35,15 +35,15 @@ beginseg include "build/src/libultra/os/recvmesg.o" include "build/src/libultra/os/initialize.o" include "build/src/libultra/libc/ll.o" - include "build/asm/exceptasm.o" + include "build/src/libultra/os/exceptasm.o" include "build/src/libultra/os/dequeuethread.o" include "build/src/libultra/os/destroythread.o" - include "build/asm/bzero.o" - include "build/asm/parameters.o" + include "build/src/libultra/libc//bzero.o" + include "build/src/libultra/os/parameters.o" include "build/src/libultra/os/createthread.o" - include "build/asm/__osSetSR.o" - include "build/asm/__osGetSR.o" - include "build/asm/osWritebackDCache.o" + include "build/src/libultra/os/setsr.o" + include "build/src/libultra/os/getsr.o" + include "build/src/libultra/os/writebackdcache.o" include "build/src/libultra/io/vigetnextframebuf.o" include "build/src/libultra/io/pimgr.o" include "build/src/libultra/io/devmgr.o" @@ -52,18 +52,18 @@ beginseg include "build/src/libultra/io/viblack.o" include "build/src/libultra/io/sirawread.o" include "build/src/libultra/os/getthreadid.o" - include "build/asm/osSetIntMask.o" + include "build/src/libultra/os/setintmask.o" include "build/src/libultra/io/visetmode.o" - include "build/asm/__osProbeTLB.o" + include "build/src/libultra/os/probetlb.o" include "build/src/libultra/os/getmemsize.o" include "build/src/libultra/os/seteventmesg.o" include "build/src/libultra/rmon/xprintf.o" - include "build/asm/osUnmapTLBAll.o" + include "build/src/libultra/os/unmaptlball.o" include "build/src/libultra/io/epidma.o" include "build/src/libultra/libc/string.o" - include "build/asm/osInvalICache.o" + include "build/src/libultra/os/invalicache.o" include "build/src/libultra/os/createmesgqueue.o" - include "build/asm/osInvalDCache.o" + include "build/src/libultra/os/invaldcache.o" include "build/src/libultra/io/si.o" include "build/src/libultra/os/jammesg.o" include "build/src/libultra/os/setthreadpri.o" @@ -71,15 +71,15 @@ beginseg include "build/src/libultra/io/epirawread.o" include "build/src/libultra/io/viswapbuf.o" include "build/src/libultra/io/epirawdma.o" - include "build/asm/bcmp.o" + include "build/src/libultra/libc/bcmp.o" include "build/src/libultra/os/gettime.o" include "build/src/libultra/os/timerintr.o" - include "build/asm/osGetCount.o" + include "build/src/libultra/os/getcount.o" include "build/src/libultra/os/setglobalintmask.o" - include "build/asm/__osSetCompare.o" - include "build/asm/bcopy.o" + include "build/src/libultra/os/setcompare.o" + include "build/src/libultra/libc/bcopy.o" include "build/src/libultra/os/resetglobalintmask.o" - include "build/asm/interrupt.o" + include "build/src/libultra/os/interrupt.o" include "build/src/libultra/io/vimodentsclan1.o" include "build/src/libultra/io/vimodempallan1.o" include "build/src/libultra/io/vi.o" @@ -89,12 +89,12 @@ beginseg include "build/src/libultra/io/visetspecial.o" include "build/src/libultra/io/cartrominit.o" include "build/src/libultra/io/vimodefpallan1.o" - include "build/asm/__osSetFpcCsr.o" - include "build/asm/__osGetFpcCsr.o" + include "build/src/libultra/os/setfpccsr.o" + include "build/src/libultra/os/getfpccsr.o" include "build/src/libultra/io/epiwrite.o" - include "build/asm/osMapTLBRdb.o" + include "build/src/libultra/os/maptlbrdb.o" include "build/src/libultra/os/yieldthread.o" - include "build/asm/__osGetCause.o" + include "build/src/libultra/os/getcause.o" include "build/src/libultra/io/epirawwrite.o" include "build/src/libultra/rmon/xlitob.o" include "build/src/libultra/libc/ldiv.o" @@ -108,7 +108,7 @@ beginseg include "build/src/libultra/io/visetxscale.o" include "build/src/libultra/os/sethwintrroutine.o" include "build/src/libultra/os/gethwintrroutine.o" - include "build/asm/__osSetWatchLo.o" + include "build/src/libultra/os/setwatchlo.o" include "build/data/rsp_boot.text.o" #ifdef COMPILER_GCC include "build/src/gcc_fix/missing_gcc_functions.o" @@ -409,7 +409,7 @@ beginseg include "build/src/code/fault.o" include "build/data/fault.bss.o" include "build/src/code/fault_drawer.o" - include "build/asm/kanread.o" + include "build/src/code/kanread.o" include "build/src/code/ucode_disas.o" pad_text // audio library aligned to 32 bytes? include "build/src/code/audio_data.o" @@ -438,7 +438,7 @@ beginseg include "build/src/code/padutils.o" include "build/src/code/padsetup.o" include "build/src/code/code_800FCE80.o" - include "build/asm/fp.o" + include "build/src/code/fp.o" include "build/src/code/system_malloc.o" include "build/src/code/code_800FD970.o" include "build/src/code/__osMalloc.o" @@ -447,7 +447,7 @@ beginseg include "build/src/code/jpegutils.o" include "build/src/code/jpegdecoder.o" include "build/src/libultra/io/pfsfreeblocks.o" - include "build/asm/guScale.o" + include "build/src/libultra/mgu/scale.o" include "build/src/libultra/gu/sinf.o" include "build/src/libultra/gu/sins.o" include "build/src/libultra/io/sptask.o" @@ -461,31 +461,31 @@ beginseg include "build/src/libultra/io/sptaskyield.o" include "build/src/libultra/io/pfsreadwritefile.o" include "build/src/libultra/io/pfsgetstatus.o" - include "build/asm/guMtxIdentF.o" + include "build/src/libultra/mgu/mtxidentf.o" include "build/src/libultra/gu/lookat.o" include "build/src/libultra/io/pfsallocatefile.o" include "build/src/libultra/os/stoptimer.o" include "build/src/libultra/io/contpfs.o" - include "build/asm/guMtxL2F.o" + include "build/src/libultra/mgu/mtxl2f.o" include "build/src/libultra/io/pfsfindfile.o" include "build/src/libultra/gu/sqrtf.o" include "build/src/libultra/os/afterprenmi.o" include "build/src/libultra/io/contquery.o" include "build/src/libultra/gu/lookathil.o" include "build/src/libultra/io/sp.o" - include "build/asm/guMtxIdent.o" + include "build/src/libultra/mgu/mtxident.o" include "build/src/libultra/gu/position.o" include "build/src/libultra/io/sptaskyielded.o" include "build/src/libultra/gu/rotate.o" include "build/src/libultra/io/aisetfreq.o" include "build/src/libultra/os/getactivequeue.o" - include "build/asm/guNormalize.o" + include "build/src/libultra/mgu/normalize.o" include "build/src/libultra/io/dpgetstat.o" include "build/src/libultra/io/dpsetstat.o" include "build/src/libultra/io/pfsdeletefile.o" include "build/src/libultra/gu/ortho.o" include "build/src/libultra/gu/cosf.o" - include "build/asm/libm_vals.o" + include "build/src/libultra/gu/libm_vals.o" include "build/src/libultra/gu/coss.o" include "build/src/libultra/io/visetevent.o" include "build/src/libultra/io/pfsisplug.o" @@ -496,16 +496,16 @@ beginseg include "build/src/libultra/io/pfsinitpak.o" include "build/src/libultra/io/pfschecker.o" include "build/src/libultra/io/aigetlen.o" - include "build/asm/guTranslate.o" + include "build/src/libultra/mgu/translate.o" include "build/src/libultra/io/contramwrite.o" include "build/src/libultra/io/contramread.o" include "build/src/libultra/io/crc.o" include "build/src/libultra/os/settimer.o" include "build/src/libultra/io/spgetstat.o" include "build/src/libultra/io/spsetstat.o" - include "build/asm/osWritebackDCacheAll.o" + include "build/src/libultra/os/writebackdcacheall.o" include "build/src/libultra/os/getcurrfaultedthread.o" - include "build/asm/guMtxF2L.o" + include "build/src/libultra/mgu/mtxf2l.o" include "build/src/libultra/libc/llcvt.o" include "build/src/libultra/io/vigetcurrframebuf.o" include "build/src/libultra/io/spsetpc.o" diff --git a/asm/mio0.s b/src/boot/mio0.s similarity index 99% rename from asm/mio0.s rename to src/boot/mio0.s index bdf57397eb..a3fb8eba26 100644 --- a/asm/mio0.s +++ b/src/boot/mio0.s @@ -1,6 +1,5 @@ #include "ultra64/asm.h" -.set noat .set noreorder .section .text diff --git a/asm/fp.s b/src/code/fp.s similarity index 100% rename from asm/fp.s rename to src/code/fp.s diff --git a/asm/kanread.s b/src/code/kanread.s similarity index 99% rename from asm/kanread.s rename to src/code/kanread.s index f155704fa1..70a884870e 100644 --- a/asm/kanread.s +++ b/src/code/kanread.s @@ -1,6 +1,5 @@ #include "ultra64/asm.h" -// assembler directives .set noat .set noreorder diff --git a/asm/libm_vals.s b/src/libultra/gu/libm_vals.s similarity index 100% rename from asm/libm_vals.s rename to src/libultra/gu/libm_vals.s diff --git a/asm/bcmp.s b/src/libultra/libc/bcmp.s similarity index 100% rename from asm/bcmp.s rename to src/libultra/libc/bcmp.s diff --git a/asm/bcopy.s b/src/libultra/libc/bcopy.s similarity index 100% rename from asm/bcopy.s rename to src/libultra/libc/bcopy.s diff --git a/asm/bzero.s b/src/libultra/libc/bzero.s similarity index 100% rename from asm/bzero.s rename to src/libultra/libc/bzero.s diff --git a/asm/guMtxF2L.s b/src/libultra/mgu/mtxf2l.s similarity index 100% rename from asm/guMtxF2L.s rename to src/libultra/mgu/mtxf2l.s diff --git a/asm/guMtxIdent.s b/src/libultra/mgu/mtxident.s similarity index 98% rename from asm/guMtxIdent.s rename to src/libultra/mgu/mtxident.s index e28bf70f1f..fb0e4c44ad 100644 --- a/asm/guMtxIdent.s +++ b/src/libultra/mgu/mtxident.s @@ -1,6 +1,5 @@ #include "ultra64/asm.h" -.set noat .set noreorder .section .text diff --git a/asm/guMtxIdentF.s b/src/libultra/mgu/mtxidentf.s similarity index 98% rename from asm/guMtxIdentF.s rename to src/libultra/mgu/mtxidentf.s index 0a23adf77a..583fc22184 100644 --- a/asm/guMtxIdentF.s +++ b/src/libultra/mgu/mtxidentf.s @@ -1,6 +1,5 @@ #include "ultra64/asm.h" -.set noat .set noreorder .section .text diff --git a/asm/guMtxL2F.s b/src/libultra/mgu/mtxl2f.s similarity index 100% rename from asm/guMtxL2F.s rename to src/libultra/mgu/mtxl2f.s diff --git a/asm/guNormalize.s b/src/libultra/mgu/normalize.s similarity index 98% rename from asm/guNormalize.s rename to src/libultra/mgu/normalize.s index fe7b303b2b..7686317ea2 100644 --- a/asm/guNormalize.s +++ b/src/libultra/mgu/normalize.s @@ -1,6 +1,5 @@ #include "ultra64/asm.h" -.set noat .set noreorder .section .text diff --git a/asm/guScale.s b/src/libultra/mgu/scale.s similarity index 100% rename from asm/guScale.s rename to src/libultra/mgu/scale.s diff --git a/asm/guTranslate.s b/src/libultra/mgu/translate.s similarity index 100% rename from asm/guTranslate.s rename to src/libultra/mgu/translate.s diff --git a/asm/exceptasm.s b/src/libultra/os/exceptasm.s similarity index 100% rename from asm/exceptasm.s rename to src/libultra/os/exceptasm.s diff --git a/asm/__osGetCause.s b/src/libultra/os/getcause.s similarity index 94% rename from asm/__osGetCause.s rename to src/libultra/os/getcause.s index 46c56d16ef..48fbf3236e 100644 --- a/asm/__osGetCause.s +++ b/src/libultra/os/getcause.s @@ -1,7 +1,6 @@ #include "ultra64/asm.h" #include "ultra64/r4300.h" -.set noat .set noreorder .section .text diff --git a/asm/osGetCount.s b/src/libultra/os/getcount.s similarity index 94% rename from asm/osGetCount.s rename to src/libultra/os/getcount.s index cd4cc326f6..bad47d0bc5 100644 --- a/asm/osGetCount.s +++ b/src/libultra/os/getcount.s @@ -1,7 +1,6 @@ #include "ultra64/asm.h" #include "ultra64/r4300.h" -.set noat .set noreorder .section .text diff --git a/asm/__osGetFpcCsr.s b/src/libultra/os/getfpccsr.s similarity index 94% rename from asm/__osGetFpcCsr.s rename to src/libultra/os/getfpccsr.s index 28ad5cf907..d86734ad00 100644 --- a/asm/__osGetFpcCsr.s +++ b/src/libultra/os/getfpccsr.s @@ -1,7 +1,6 @@ #include "ultra64/asm.h" #include "ultra64/r4300.h" -.set noat .set noreorder .section .text diff --git a/asm/__osGetSR.s b/src/libultra/os/getsr.s similarity index 94% rename from asm/__osGetSR.s rename to src/libultra/os/getsr.s index d47f244404..aed66d40a2 100644 --- a/asm/__osGetSR.s +++ b/src/libultra/os/getsr.s @@ -1,7 +1,6 @@ #include "ultra64/asm.h" #include "ultra64/r4300.h" -.set noat .set noreorder .section .text diff --git a/asm/interrupt.s b/src/libultra/os/interrupt.s similarity index 100% rename from asm/interrupt.s rename to src/libultra/os/interrupt.s diff --git a/asm/osInvalDCache.s b/src/libultra/os/invaldcache.s similarity index 100% rename from asm/osInvalDCache.s rename to src/libultra/os/invaldcache.s diff --git a/asm/osInvalICache.s b/src/libultra/os/invalicache.s similarity index 100% rename from asm/osInvalICache.s rename to src/libultra/os/invalicache.s diff --git a/asm/osMapTLBRdb.s b/src/libultra/os/maptlbrdb.s similarity index 98% rename from asm/osMapTLBRdb.s rename to src/libultra/os/maptlbrdb.s index fdcea87010..ea8fe4aa4a 100644 --- a/asm/osMapTLBRdb.s +++ b/src/libultra/os/maptlbrdb.s @@ -2,7 +2,6 @@ #include "ultra64/r4300.h" #include "ultra64/rdb.h" -.set noat .set noreorder .section .text diff --git a/asm/parameters.s b/src/libultra/os/parameters.s similarity index 100% rename from asm/parameters.s rename to src/libultra/os/parameters.s diff --git a/asm/__osProbeTLB.s b/src/libultra/os/probetlb.s similarity index 100% rename from asm/__osProbeTLB.s rename to src/libultra/os/probetlb.s diff --git a/asm/__osSetCompare.s b/src/libultra/os/setcompare.s similarity index 95% rename from asm/__osSetCompare.s rename to src/libultra/os/setcompare.s index f3c5fc18a7..4b69b2ea90 100644 --- a/asm/__osSetCompare.s +++ b/src/libultra/os/setcompare.s @@ -1,7 +1,6 @@ #include "ultra64/asm.h" #include "ultra64/r4300.h" -.set noat .set noreorder .section .text diff --git a/asm/__osSetFpcCsr.s b/src/libultra/os/setfpccsr.s similarity index 95% rename from asm/__osSetFpcCsr.s rename to src/libultra/os/setfpccsr.s index ec12e21559..9b6b368f39 100644 --- a/asm/__osSetFpcCsr.s +++ b/src/libultra/os/setfpccsr.s @@ -1,7 +1,6 @@ #include "ultra64/asm.h" #include "ultra64/r4300.h" -.set noat .set noreorder .section .text diff --git a/asm/osSetIntMask.s b/src/libultra/os/setintmask.s similarity index 100% rename from asm/osSetIntMask.s rename to src/libultra/os/setintmask.s diff --git a/asm/__osSetSR.s b/src/libultra/os/setsr.s similarity index 94% rename from asm/__osSetSR.s rename to src/libultra/os/setsr.s index 977b661bd8..382f2eada1 100644 --- a/asm/__osSetSR.s +++ b/src/libultra/os/setsr.s @@ -1,7 +1,6 @@ #include "ultra64/asm.h" #include "ultra64/r4300.h" -.set noat .set noreorder .section .text diff --git a/asm/__osSetWatchLo.s b/src/libultra/os/setwatchlo.s similarity index 95% rename from asm/__osSetWatchLo.s rename to src/libultra/os/setwatchlo.s index 0c8752e984..749b1dbd85 100644 --- a/asm/__osSetWatchLo.s +++ b/src/libultra/os/setwatchlo.s @@ -1,7 +1,6 @@ #include "ultra64/asm.h" #include "ultra64/r4300.h" -.set noat .set noreorder .section .text diff --git a/asm/osUnmapTLBAll.s b/src/libultra/os/unmaptlball.s similarity index 98% rename from asm/osUnmapTLBAll.s rename to src/libultra/os/unmaptlball.s index ef75432df5..d7fe7cf53b 100644 --- a/asm/osUnmapTLBAll.s +++ b/src/libultra/os/unmaptlball.s @@ -1,7 +1,6 @@ #include "ultra64/asm.h" #include "ultra64/r4300.h" -.set noat .set noreorder .section .text diff --git a/asm/osWritebackDCache.s b/src/libultra/os/writebackdcache.s similarity index 100% rename from asm/osWritebackDCache.s rename to src/libultra/os/writebackdcache.s diff --git a/asm/osWritebackDCacheAll.s b/src/libultra/os/writebackdcacheall.s similarity index 100% rename from asm/osWritebackDCacheAll.s rename to src/libultra/os/writebackdcacheall.s diff --git a/asm/entry.s b/src/makerom/entry.s similarity index 98% rename from asm/entry.s rename to src/makerom/entry.s index 72c18131e1..6be493e6b6 100644 --- a/asm/entry.s +++ b/src/makerom/entry.s @@ -1,7 +1,6 @@ #include "ultra64/asm.h" #include "boot.h" -.set noat .set noreorder .section .text diff --git a/asm/ipl3.s b/src/makerom/ipl3.s similarity index 100% rename from asm/ipl3.s rename to src/makerom/ipl3.s diff --git a/asm/rom_header.s b/src/makerom/rom_header.s similarity index 100% rename from asm/rom_header.s rename to src/makerom/rom_header.s