mirror of https://github.com/zeldaret/mm.git
				
				
				
			Convert entry.s to IDO, use objcopy instead of ipl3.s and audio/lib/stack.s, add handwritten asm for the code segment
This commit is contained in:
		
							parent
							
								
									a4056abd3c
								
							
						
					
					
						commit
						a49be8121f
					
				
							
								
								
									
										81
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										81
									
								
								Makefile
								
								
								
								
							|  | @ -110,9 +110,11 @@ endif | ||||||
| # Detect compiler and set variables appropriately.
 | # Detect compiler and set variables appropriately.
 | ||||||
| ifeq ($(COMPILER),gcc) | ifeq ($(COMPILER),gcc) | ||||||
|   CC       := $(MIPS_BINUTILS_PREFIX)gcc |   CC       := $(MIPS_BINUTILS_PREFIX)gcc | ||||||
|  |   CCAS     := $(CC) -x assembler-with-cpp | ||||||
| else ifeq ($(COMPILER),ido) | else ifeq ($(COMPILER),ido) | ||||||
|   CC       := tools/ido_recomp/$(DETECTED_OS)/7.1/cc |   CC       := tools/ido_recomp/$(DETECTED_OS)/7.1/cc | ||||||
|   CC_OLD   := tools/ido_recomp/$(DETECTED_OS)/5.3/cc |   CC_OLD   := tools/ido_recomp/$(DETECTED_OS)/5.3/cc | ||||||
|  |   CCAS     := $(CC_OLD) | ||||||
| else | else | ||||||
| $(error Unsupported compiler. Please use either ido or gcc as the COMPILER variable.) | $(error Unsupported compiler. Please use either ido or gcc as the COMPILER variable.) | ||||||
| endif | endif | ||||||
|  | @ -127,6 +129,7 @@ ifeq ($(ORIG_COMPILER),1) | ||||||
|   endif |   endif | ||||||
|   CC        = $(QEMU_IRIX) -L tools/ido7.1_compiler tools/ido7.1_compiler/usr/bin/cc |   CC        = $(QEMU_IRIX) -L tools/ido7.1_compiler tools/ido7.1_compiler/usr/bin/cc | ||||||
|   CC_OLD    = $(QEMU_IRIX) -L tools/ido5.3_compiler tools/ido5.3_compiler/usr/bin/cc |   CC_OLD    = $(QEMU_IRIX) -L tools/ido5.3_compiler tools/ido5.3_compiler/usr/bin/cc | ||||||
|  |   CCAS      = $(CC_OLD) | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| AS      := $(MIPS_BINUTILS_PREFIX)as | AS      := $(MIPS_BINUTILS_PREFIX)as | ||||||
|  | @ -134,6 +137,7 @@ LD      := $(MIPS_BINUTILS_PREFIX)ld | ||||||
| NM      := $(MIPS_BINUTILS_PREFIX)nm | NM      := $(MIPS_BINUTILS_PREFIX)nm | ||||||
| OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy | OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy | ||||||
| OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump | OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump | ||||||
|  | STRIP   := $(MIPS_BINUTILS_PREFIX)strip | ||||||
| 
 | 
 | ||||||
| IINC := -Iinclude -Iinclude/libc -Isrc -I$(BUILD_DIR) -I. -I$(EXTRACTED_DIR) | IINC := -Iinclude -Iinclude/libc -Isrc -I$(BUILD_DIR) -I. -I$(EXTRACTED_DIR) | ||||||
| 
 | 
 | ||||||
|  | @ -207,7 +211,8 @@ ifeq ($(COMPILER),gcc) | ||||||
|   CFLAGS           += -nostdinc -fno-PIC -fno-common -ffreestanding -fbuiltin -fno-builtin-sinf -fno-builtin-cosf -funsigned-char |   CFLAGS           += -nostdinc -fno-PIC -fno-common -ffreestanding -fbuiltin -fno-builtin-sinf -fno-builtin-cosf -funsigned-char | ||||||
| 
 | 
 | ||||||
|   WARNINGS         := $(CC_CHECK_WARNINGS) |   WARNINGS         := $(CC_CHECK_WARNINGS) | ||||||
|   ASFLAGS          := -march=vr4300 -32 -G0 |   ASFLAGS          := -march=vr4300 -32 -G0 -no-pad-sections | ||||||
|  |   CCASFLAGS        := $(GBI_DEFINES) -G 0 -nostdinc -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -fno-PIC -fno-common -Wa,-no-pad-sections | ||||||
|   COMMON_DEFINES   := $(GBI_DEFINES) |   COMMON_DEFINES   := $(GBI_DEFINES) | ||||||
|   AS_DEFINES       := $(COMMON_DEFINES) -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_ULTRA64 |   AS_DEFINES       := $(COMMON_DEFINES) -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_ULTRA64 | ||||||
|   C_DEFINES        := $(COMMON_DEFINES) -D_LANGUAGE_C |   C_DEFINES        := $(COMMON_DEFINES) -D_LANGUAGE_C | ||||||
|  | @ -219,7 +224,8 @@ else | ||||||
|   CFLAGS           += -G 0 -non_shared -Xcpluscomm -nostdinc -Wab,-r4300_mul |   CFLAGS           += -G 0 -non_shared -Xcpluscomm -nostdinc -Wab,-r4300_mul | ||||||
| 
 | 
 | ||||||
|   WARNINGS         := -fullwarn -verbose -woff 624,649,838,712,516,513,596,564,594,807 |   WARNINGS         := -fullwarn -verbose -woff 624,649,838,712,516,513,596,564,594,807 | ||||||
|   ASFLAGS          := -march=vr4300 -32 -G0 |   ASFLAGS          := -march=vr4300 -32 -G0 -no-pad-sections | ||||||
|  |   CCASFLAGS        := $(GBI_DEFINES) -G 0 -non_shared -Xcpluscomm -nostdinc -Wab,-r4300_mul $(WARNINGS) -o32 | ||||||
|   COMMON_DEFINES   := -D_MIPS_SZLONG=32 $(GBI_DEFINES) |   COMMON_DEFINES   := -D_MIPS_SZLONG=32 $(GBI_DEFINES) | ||||||
|   AS_DEFINES       := $(COMMON_DEFINES) -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_ULTRA64 |   AS_DEFINES       := $(COMMON_DEFINES) -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_ULTRA64 | ||||||
|   C_DEFINES        := $(COMMON_DEFINES) -D_LANGUAGE_C |   C_DEFINES        := $(COMMON_DEFINES) -D_LANGUAGE_C | ||||||
|  | @ -228,6 +234,7 @@ else | ||||||
|   OPTFLAGS         := -O2 -g3 |   OPTFLAGS         := -O2 -g3 | ||||||
|   MIPS_VERSION     := -mips2 |   MIPS_VERSION     := -mips2 | ||||||
| endif | endif | ||||||
|  | ASOPTFLAGS := -O1 | ||||||
| 
 | 
 | ||||||
| # Use relocations and abi fpr names in the dump
 | # Use relocations and abi fpr names in the dump
 | ||||||
| OBJDUMP_FLAGS := --disassemble --reloc --disassemble-zeroes -Mreg-names=32 | OBJDUMP_FLAGS := --disassemble --reloc --disassemble-zeroes -Mreg-names=32 | ||||||
|  | @ -374,7 +381,8 @@ O_FILES        := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \ | ||||||
|                   $(foreach f,$(ASSET_C_FILES_EXTRACTED:.c=.o),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
 |                   $(foreach f,$(ASSET_C_FILES_EXTRACTED:.c=.o),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
 | ||||||
|                   $(foreach f,$(ASSET_C_FILES_COMMITTED:.c=.o),$(BUILD_DIR)/$f) \
 |                   $(foreach f,$(ASSET_C_FILES_COMMITTED:.c=.o),$(BUILD_DIR)/$f) \
 | ||||||
|                   $(foreach f,$(BASEROM_FILES),$(BUILD_DIR)/$f.o) \
 |                   $(foreach f,$(BASEROM_FILES),$(BUILD_DIR)/$f.o) \
 | ||||||
|                   $(foreach f,$(ARCHIVES_O),$(BUILD_DIR)/$f) |                   $(foreach f,$(ARCHIVES_O),$(BUILD_DIR)/$f) \
 | ||||||
|  |                   $(BUILD_DIR)/src/makerom/ipl3.o $(BUILD_DIR)/src/audio/lib/stack.o | ||||||
| 
 | 
 | ||||||
| SHIFTJIS_C_FILES := src/libultra/voice/voicecheckword.c src/audio/voice_external.c src/code/z_message.c src/code/z_message_nes.c | SHIFTJIS_C_FILES := src/libultra/voice/voicecheckword.c src/audio/voice_external.c src/code/z_message.c src/code/z_message_nes.c | ||||||
| SHIFTJIS_O_FILES := $(foreach f,$(SHIFTJIS_C_FILES:.c=.o),$(BUILD_DIR)/$f) | SHIFTJIS_O_FILES := $(foreach f,$(SHIFTJIS_C_FILES:.c=.o),$(BUILD_DIR)/$f) | ||||||
|  | @ -420,7 +428,11 @@ endif | ||||||
| 
 | 
 | ||||||
| $(BUILD_DIR)/src/audio/lib/seqplayer.o: C_DEFINES += -DMML_VERSION=MML_VERSION_MM | $(BUILD_DIR)/src/audio/lib/seqplayer.o: C_DEFINES += -DMML_VERSION=MML_VERSION_MM | ||||||
| 
 | 
 | ||||||
|  | # Command to patch certain object files after they are built
 | ||||||
|  | POSTPROCESS_OBJ := @: | ||||||
|  | 
 | ||||||
| ifeq ($(COMPILER),ido) | ifeq ($(COMPILER),ido) | ||||||
|  | 
 | ||||||
| # directory flags
 | # directory flags
 | ||||||
| $(BUILD_DIR)/src/libultra/os/%.o: OPTFLAGS := -O1 | $(BUILD_DIR)/src/libultra/os/%.o: OPTFLAGS := -O1 | ||||||
| $(BUILD_DIR)/src/libultra/voice/%.o: OPTFLAGS := -O2 | $(BUILD_DIR)/src/libultra/voice/%.o: OPTFLAGS := -O2 | ||||||
|  | @ -435,6 +447,8 @@ $(BUILD_DIR)/src/boot/libc/%.o: OPTFLAGS := -O2 | ||||||
| $(BUILD_DIR)/src/boot/libm/%.o: OPTFLAGS := -O2 | $(BUILD_DIR)/src/boot/libm/%.o: OPTFLAGS := -O2 | ||||||
| $(BUILD_DIR)/src/boot/libc64/%.o: OPTFLAGS := -O2 | $(BUILD_DIR)/src/boot/libc64/%.o: OPTFLAGS := -O2 | ||||||
| 
 | 
 | ||||||
|  | $(BUILD_DIR)/src/code/%.o: ASOPTFLAGS := -O2 | ||||||
|  | 
 | ||||||
| $(BUILD_DIR)/src/audio/%.o: OPTFLAGS := -O2 | $(BUILD_DIR)/src/audio/%.o: OPTFLAGS := -O2 | ||||||
| 
 | 
 | ||||||
| $(BUILD_DIR)/assets/%.o: OPTFLAGS := -O1 | $(BUILD_DIR)/assets/%.o: OPTFLAGS := -O1 | ||||||
|  | @ -442,8 +456,14 @@ $(BUILD_DIR)/assets/%.o: OPTFLAGS := -O1 | ||||||
| # file flags
 | # file flags
 | ||||||
| $(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -O1 | $(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -O1 | ||||||
| $(BUILD_DIR)/src/libultra/libc/ll.o: MIPS_VERSION := -mips3 -32 | $(BUILD_DIR)/src/libultra/libc/ll.o: MIPS_VERSION := -mips3 -32 | ||||||
|  | $(BUILD_DIR)/src/libultra/libc/ll.o: POSTPROCESS_OBJ := $(PYTHON) tools/set_o32abi_bit.py | ||||||
|  | 
 | ||||||
| $(BUILD_DIR)/src/libultra/libc/llcvt.o: OPTFLAGS := -O1 | $(BUILD_DIR)/src/libultra/libc/llcvt.o: OPTFLAGS := -O1 | ||||||
| $(BUILD_DIR)/src/libultra/libc/llcvt.o: MIPS_VERSION := -mips3 -32 | $(BUILD_DIR)/src/libultra/libc/llcvt.o: MIPS_VERSION := -mips3 -32 | ||||||
|  | $(BUILD_DIR)/src/libultra/libc/llcvt.o: POSTPROCESS_OBJ := $(PYTHON) tools/set_o32abi_bit.py | ||||||
|  | 
 | ||||||
|  | $(BUILD_DIR)/src/libultra/os/exceptasm.o: MIPS_VERSION := -mips3 -32 | ||||||
|  | $(BUILD_DIR)/src/libultra/os/exceptasm.o: POSTPROCESS_OBJ := $(PYTHON) tools/set_o32abi_bit.py | ||||||
| 
 | 
 | ||||||
| $(BUILD_DIR)/src/boot/fault.o: CFLAGS += -trapuv | $(BUILD_DIR)/src/boot/fault.o: CFLAGS += -trapuv | ||||||
| $(BUILD_DIR)/src/boot/fault_drawer.o: CFLAGS += -trapuv | $(BUILD_DIR)/src/boot/fault_drawer.o: CFLAGS += -trapuv | ||||||
|  | @ -607,8 +627,44 @@ $(BUILD_DIR)/dmadata/dmadata_table_spec.h $(BUILD_DIR)/dmadata/compress_ranges.t | ||||||
| $(BUILD_DIR)/src/boot/z_std_dma.o: $(BUILD_DIR)/dmadata/dmadata_table_spec.h | $(BUILD_DIR)/src/boot/z_std_dma.o: $(BUILD_DIR)/dmadata/dmadata_table_spec.h | ||||||
| $(BUILD_DIR)/src/dmadata/dmadata.o: $(BUILD_DIR)/dmadata/dmadata_table_spec.h | $(BUILD_DIR)/src/dmadata/dmadata.o: $(BUILD_DIR)/dmadata/dmadata_table_spec.h | ||||||
| 
 | 
 | ||||||
| $(BUILD_DIR)/%.o: %.s | $(BUILD_DIR)/asm/%.o: asm/%.s | ||||||
| 	$(CPP) $(CPPFLAGS) $(IINC) $< | $(AS) $(ASFLAGS) $(IINC) $(ENDIAN) -o $@ | 	$(AS) $(ASFLAGS) $(IINC) $(ENDIAN) $< -o $@ | ||||||
|  | 
 | ||||||
|  | $(BUILD_DIR)/data/%.o: data/%.s | ||||||
|  | 	$(AS) $(ASFLAGS) $(IINC) $(ENDIAN) $< -o $@ | ||||||
|  | 
 | ||||||
|  | $(BUILD_DIR)/rsp/%.o: rsp/%.s | ||||||
|  | 	$(AS) $(ASFLAGS) $(IINC) $(ENDIAN) $< -o $@ | ||||||
|  | 
 | ||||||
|  | # Assemble the ROM header with GNU AS always
 | ||||||
|  | $(BUILD_DIR)/src/makerom/rom_header.o: src/makerom/rom_header.s | ||||||
|  | ifeq ($(COMPILER),ido) | ||||||
|  | 	$(CPP) $(CPPFLAGS) $(MIPS_BUILTIN_DEFS) $(IINC) $< | $(AS) $(ASFLAGS) $(IINC) $(ENDIAN) -o $@ | ||||||
|  | else | ||||||
|  | 	$(CCAS) -c $(CCASFLAGS) $(IINC) $(MIPS_VERSION) $(ASOPTFLAGS) -o $@ $< | ||||||
|  | endif | ||||||
|  | 	$(OBJDUMP_CMD) | ||||||
|  | 
 | ||||||
|  | $(BUILD_DIR)/src/makerom/ipl3.o: $(EXTRACTED_DIR)/incbin/ipl3 | ||||||
|  | 	$(OBJCOPY) -I binary -O elf32-big --rename-section .data=.text $< $@ | ||||||
|  | 
 | ||||||
|  | $(BUILD_DIR)/src/audio/lib/stack.o: $(EXTRACTED_DIR)/incbin/aspMainStack | ||||||
|  | 	$(OBJCOPY) -I binary -O elf32-big --add-symbol aspMainStack=.data:0,global $< $@ | ||||||
|  | 
 | ||||||
|  | $(BUILD_DIR)/src/%.o: src/%.s | ||||||
|  | ifeq ($(COMPILER),ido) | ||||||
|  | 	$(CCAS) -c $(CCASFLAGS) $(IINC) $(MIPS_VERSION) $(ASOPTFLAGS) -o $(@:.o=.tmp.o) $< | ||||||
|  | # IDO generates bad symbol tables, fix the symbol table with strip..
 | ||||||
|  | 	$(STRIP) $(@:.o=.tmp.o) -N dummy-symbol-name | ||||||
|  | # but strip doesn't know about file-relative offsets in .mdebug and doesn't relocate them, ld will
 | ||||||
|  | # segfault unless .mdebug is removed
 | ||||||
|  | 	$(OBJCOPY) --remove-section .mdebug $(@:.o=.tmp.o) $@ | ||||||
|  | else | ||||||
|  | 	$(CCAS) -c $(CCASFLAGS) $(IINC) $(MIPS_VERSION) $(ASOPTFLAGS) -o $@ $< | ||||||
|  | endif | ||||||
|  | 	$(POSTPROCESS_OBJ) $@ | ||||||
|  | 	$(OBJDUMP_CMD) | ||||||
|  | 	$(RM_MDEBUG) | ||||||
| 
 | 
 | ||||||
| $(BUILD_DIR)/assets/text/%.o: assets/text/%.c | $(BUILD_DIR)/assets/text/%.o: assets/text/%.c | ||||||
| ifneq ($(COMPILER),gcc) | ifneq ($(COMPILER),gcc) | ||||||
|  | @ -675,23 +731,10 @@ $(SHIFTJIS_O_FILES): $(BUILD_DIR)/src/%.o: src/%.c | ||||||
| 	$(OBJDUMP_CMD) | 	$(OBJDUMP_CMD) | ||||||
| 	$(RM_MDEBUG) | 	$(RM_MDEBUG) | ||||||
| 
 | 
 | ||||||
| $(BUILD_DIR)/src/libultra/libc/ll.o: src/libultra/libc/ll.c |  | ||||||
| 	$(CC_CHECK_COMP) $(CC_CHECK_FLAGS) $(IINC) $(CC_CHECK_WARNINGS) $(C_DEFINES) $(MIPS_BUILTIN_DEFS) $< |  | ||||||
| 	$(CC) -c $(CFLAGS) $(IINC) $(WARNINGS) $(C_DEFINES) $(MIPS_VERSION) $(ENDIAN) $(OPTFLAGS) -o $@ $< |  | ||||||
| 	$(PYTHON) tools/set_o32abi_bit.py $@ |  | ||||||
| 	$(OBJDUMP_CMD) |  | ||||||
| 	$(RM_MDEBUG) |  | ||||||
| 
 |  | ||||||
| $(BUILD_DIR)/src/libultra/libc/llcvt.o: src/libultra/libc/llcvt.c |  | ||||||
| 	$(CC_CHECK_COMP) $(CC_CHECK_FLAGS) $(IINC) $(CC_CHECK_WARNINGS) $(C_DEFINES) $(MIPS_BUILTIN_DEFS) $< |  | ||||||
| 	$(CC) -c $(CFLAGS) $(IINC) $(WARNINGS) $(C_DEFINES) $(MIPS_VERSION) $(ENDIAN) $(OPTFLAGS) -o $@ $< |  | ||||||
| 	$(PYTHON) tools/set_o32abi_bit.py $@ |  | ||||||
| 	$(OBJDUMP_CMD) |  | ||||||
| 	$(RM_MDEBUG) |  | ||||||
| 
 |  | ||||||
| $(BUILD_DIR)/%.o: %.c | $(BUILD_DIR)/%.o: %.c | ||||||
| 	$(CC_CHECK_COMP) $(CC_CHECK_FLAGS) $(IINC) $(CC_CHECK_WARNINGS) $(C_DEFINES) $(MIPS_BUILTIN_DEFS) $< | 	$(CC_CHECK_COMP) $(CC_CHECK_FLAGS) $(IINC) $(CC_CHECK_WARNINGS) $(C_DEFINES) $(MIPS_BUILTIN_DEFS) $< | ||||||
| 	$(CC) -c $(CFLAGS) $(IINC) $(WARNINGS) $(C_DEFINES) $(MIPS_VERSION) $(ENDIAN) $(OPTFLAGS) -o $@ $< | 	$(CC) -c $(CFLAGS) $(IINC) $(WARNINGS) $(C_DEFINES) $(MIPS_VERSION) $(ENDIAN) $(OPTFLAGS) -o $@ $< | ||||||
|  | 	$(POSTPROCESS_OBJ) $@ | ||||||
| 	$(OBJDUMP_CMD) | 	$(OBJDUMP_CMD) | ||||||
| 	$(RM_MDEBUG) | 	$(RM_MDEBUG) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,60 +1,112 @@ | ||||||
| #ifndef PR_ASM_H | #ifndef ASM_H | ||||||
| #define PR_ASM_H | #define ASM_H | ||||||
| 
 | 
 | ||||||
| #ifdef __sgi | #ifdef __sgi | ||||||
| #define _MIPS_ISA_MIPS1 1 | #define _MIPS_ISA_MIPS1 1 | ||||||
| #define _MIPS_ISA_MIPS2 2 | #define _MIPS_ISA_MIPS2 2 | ||||||
| #define _MIPS_ISA_MIPS3 3 | #define _MIPS_ISA_MIPS3 3 | ||||||
| #define _MIPS_ISA_MIPS4 4 | #define _MIPS_ISA_MIPS4 4 | ||||||
|  | 
 | ||||||
|  | #define _MIPS_SIM_ABI32     1   /* MIPS MSIG calling convention */ | ||||||
|  | #define _MIPS_SIM_NABI32    2   /* MIPS new 32-bit abi */ | ||||||
|  |                                 /* NABI32 is 64bit calling convention but 32bit type sizes) */ | ||||||
|  | #define _MIPS_SIM_ABI64     3   /* MIPS 64 calling convention */ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifndef _LANGUAGE_C | #ifndef _LANGUAGE_C | ||||||
| 
 | 
 | ||||||
|  | #ifdef __GNUC__ | ||||||
|  | #define TYPE(x, t) .type x, @t | ||||||
|  | #define SIZE(x)    .size x, . - x | ||||||
|  | #else | ||||||
|  | #define TYPE(x, t) | ||||||
|  | #define SIZE(x) | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #define LEAF(x)                 \ | #define LEAF(x)                 \ | ||||||
|     .balign 4                  ;\ |     .align 2                   ;\ | ||||||
|     .globl x                   ;\ |     .globl x                   ;\ | ||||||
|     .type x, @function         ;\ |     TYPE(x, function)          ;\ | ||||||
|  |     .ent x, 0                  ;\ | ||||||
|     x:                         ;\ |     x:                         ;\ | ||||||
|         .ent x, 0              ;\ |         .frame sp, 0, ra | ||||||
|         .frame $sp, 0, $ra |  | ||||||
| 
 | 
 | ||||||
| #define XLEAF(x)                \ | #define XLEAF(x)                \ | ||||||
|     .balign 4                  ;\ |     .align 2                   ;\ | ||||||
|     .globl x                   ;\ |     .globl x                   ;\ | ||||||
|     .type x, @function         ;\ |     TYPE(x, function)          ;\ | ||||||
|     x:                         ;\ |     .aent x, 0                 ;\ | ||||||
|         .aent x, 0 |     x: | ||||||
| 
 | 
 | ||||||
| #define NESTED(x, fsize, ra)    \ | #define NESTED(x, fsize, ra)    \ | ||||||
|     .globl x                   ;\ |     .globl x                   ;\ | ||||||
|  |     .ent x, 0                  ;\ | ||||||
|     x:                         ;\ |     x:                         ;\ | ||||||
|         .ent x, 0              ;\ |         .frame sp, fsize, ra | ||||||
|         .frame $sp, fsize, ra |  | ||||||
| 
 | 
 | ||||||
| #define XNESTED(x)              \ | #define XNESTED(x)              \ | ||||||
|     .globl x                   ;\ |     .globl x                   ;\ | ||||||
|     x:                         ;\ |     .aent x, 0                 ;\ | ||||||
|         .aent x, 0 |     x: | ||||||
| 
 | 
 | ||||||
| #define END(x)                  \ | #define END(x)                  \ | ||||||
|     .size x, . - x             ;\ |     SIZE(x)                    ;\ | ||||||
|     .end x |     .end x | ||||||
| 
 | 
 | ||||||
| #define IMPORT(x, size)         \ |  | ||||||
|     .extern x, size |  | ||||||
| 
 |  | ||||||
| #define EXPORT(x)               \ | #define EXPORT(x)               \ | ||||||
|     .globl x                   ;\ |     .globl x                   ;\ | ||||||
|     x: |     x: | ||||||
| 
 | 
 | ||||||
|  | #ifdef __sgi | ||||||
|  | #define IMPORT(sym, size)       \ | ||||||
|  |     .extern sym, size | ||||||
|  | #else | ||||||
|  | #define IMPORT(sym, size) | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #define DATA(x)                 \ | #define DATA(x)                 \ | ||||||
|     .balign 4                  ;\ |     .align 2                   ;\ | ||||||
|     .globl x                   ;\ |     .globl x                   ;\ | ||||||
|     .type x, @object           ;\ |     TYPE(x, object)            ;\ | ||||||
|     x: |     x: | ||||||
| 
 | 
 | ||||||
| #define ENDDATA(x)              \ | #define ENDDATA(x)              \ | ||||||
|     .size x, . - x |     SIZE(x) | ||||||
|  | 
 | ||||||
|  | #define MFC0(dst, src) \ | ||||||
|  |     .set noreorder; mfc0 dst, src; .set reorder | ||||||
|  | #define MTC0(dst, src) \ | ||||||
|  |     .set noreorder; mtc0 dst, src; .set reorder | ||||||
|  | 
 | ||||||
|  | #define CACHE(op, base)  \ | ||||||
|  |     .set noreorder; cache op, base; .set reorder | ||||||
|  | 
 | ||||||
|  | #define CFC1(dst, src) \ | ||||||
|  |     .set noreorder; cfc1 dst, src; .set reorder | ||||||
|  | #define CTC1(src, dst) \ | ||||||
|  |     .set noreorder; ctc1 src, dst; .set reorder | ||||||
|  | 
 | ||||||
|  | #define NOP \ | ||||||
|  |     .set noreorder; nop; .set reorder | ||||||
|  | 
 | ||||||
|  | #define TLBWI \ | ||||||
|  |     .set noreorder; tlbwi; .set reorder | ||||||
|  | 
 | ||||||
|  | #define TLBR \ | ||||||
|  |     .set noreorder; tlbr; .set reorder | ||||||
|  | 
 | ||||||
|  | #define TLBP \ | ||||||
|  |     .set noreorder; tlbp; .set reorder | ||||||
|  | 
 | ||||||
|  | #ifndef __GNUC__ | ||||||
|  | #define ABS(x, y)   \ | ||||||
|  |     .globl  x;      \ | ||||||
|  |     x = y | ||||||
|  | #else | ||||||
|  | #define ABS(x, y)   \ | ||||||
|  |     .globl x;       \ | ||||||
|  |     .set x, y | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -62,11 +114,11 @@ | ||||||
|  *  Stack Alignment |  *  Stack Alignment | ||||||
|  */ |  */ | ||||||
| #if   (_MIPS_SIM == _ABIO32) | #if   (_MIPS_SIM == _ABIO32) | ||||||
| #define NARGSAVE 4      // space for 4 args must be allocated
 | #define NARGSAVE 4      /* space for 4 args must be allocated */ | ||||||
| #define ALSZ    (8-1) | #define ALSZ    (8-1) | ||||||
| #define ALMASK ~(8-1) | #define ALMASK ~(8-1) | ||||||
| #elif (_MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64) | #elif (_MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64) | ||||||
| #define NARGSAVE 0      // no caller responsibilities
 | #define NARGSAVE 0      /* no caller responsibilities */ | ||||||
| #define ALSZ    (16-1) | #define ALSZ    (16-1) | ||||||
| #define ALMASK ~(16-1) | #define ALMASK ~(16-1) | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -0,0 +1,164 @@ | ||||||
|  | #ifndef REGDEF_H | ||||||
|  | #define REGDEF_H | ||||||
|  | 
 | ||||||
|  | #ifdef __GNUC__ | ||||||
|  | #define _MIPS_SIM_ABI32 _ABIO32 | ||||||
|  | #define _MIPS_SIM_NABI32 _ABIN32 | ||||||
|  | #define _MIPS_SIM_ABI64 _ABI64 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #if (_MIPS_SIM == _MIPS_SIM_ABI32) | ||||||
|  | #define zero    $0 | ||||||
|  | #define AT      $at | ||||||
|  | #define v0      $2 | ||||||
|  | #define v1      $3 | ||||||
|  | #define a0      $4 | ||||||
|  | #define a1      $5 | ||||||
|  | #define a2      $6 | ||||||
|  | #define a3      $7 | ||||||
|  | #define t0      $8 | ||||||
|  | #define t1      $9 | ||||||
|  | #define t2      $10 | ||||||
|  | #define t3      $11 | ||||||
|  | #define t4      $12 | ||||||
|  | #define ta0     $12 | ||||||
|  | #define t5      $13 | ||||||
|  | #define ta1     $13 | ||||||
|  | #define t6      $14 | ||||||
|  | #define ta2     $14 | ||||||
|  | #define t7      $15 | ||||||
|  | #define ta3     $15 | ||||||
|  | #define s0      $16 | ||||||
|  | #define s1      $17 | ||||||
|  | #define s2      $18 | ||||||
|  | #define s3      $19 | ||||||
|  | #define s4      $20 | ||||||
|  | #define s5      $21 | ||||||
|  | #define s6      $22 | ||||||
|  | #define s7      $23 | ||||||
|  | #define t8      $24 | ||||||
|  | #define t9      $25 | ||||||
|  | #define jp      $25 | ||||||
|  | #define k0      $26 | ||||||
|  | #define k1      $27 | ||||||
|  | #define gp      $28 | ||||||
|  | #define sp      $29 | ||||||
|  | #define fp      $30 | ||||||
|  | #define s8      $30 | ||||||
|  | #define ra      $31 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #if (_MIPS_SIM == _MIPS_SIM_ABI64) | ||||||
|  | #define zero    $0 | ||||||
|  | #define AT      $at | ||||||
|  | #define v0      $2 | ||||||
|  | #define v1      $3 | ||||||
|  | #define a0      $4 | ||||||
|  | #define a1      $5 | ||||||
|  | #define a2      $6 | ||||||
|  | #define a3      $7 | ||||||
|  | #define a4      $8 | ||||||
|  | #define ta0     $8 | ||||||
|  | #define a5      $9 | ||||||
|  | #define ta1     $9 | ||||||
|  | #define a6      $10 | ||||||
|  | #define ta2     $10 | ||||||
|  | #define a7      $11 | ||||||
|  | #define ta3     $11 | ||||||
|  | #define t0      $12 | ||||||
|  | #define t1      $13 | ||||||
|  | #define t2      $14 | ||||||
|  | #define t3      $15 | ||||||
|  | #define s0      $16 | ||||||
|  | #define s1      $17 | ||||||
|  | #define s2      $18 | ||||||
|  | #define s3      $19 | ||||||
|  | #define s4      $20 | ||||||
|  | #define s5      $21 | ||||||
|  | #define s6      $22 | ||||||
|  | #define s7      $23 | ||||||
|  | #define t8      $24 | ||||||
|  | #define t9      $25 | ||||||
|  | #define jp      $25 | ||||||
|  | #define k0      $26 | ||||||
|  | #define k1      $27 | ||||||
|  | #define gp      $28 | ||||||
|  | #define sp      $29 | ||||||
|  | #define fp      $30 | ||||||
|  | #define s8      $30 | ||||||
|  | #define ra      $31 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #if (_MIPS_SIM == _MIPS_SIM_ABI32) | ||||||
|  | #define fv0     $f0 | ||||||
|  | #define fv0f    $f1 | ||||||
|  | #define fv1     $f2 | ||||||
|  | #define fv1f    $f3 | ||||||
|  | #define fa0     $f12 | ||||||
|  | #define fa0f    $f13 | ||||||
|  | #define fa1     $f14 | ||||||
|  | #define fa1f    $f15 | ||||||
|  | #define ft0     $f4 | ||||||
|  | #define ft0f    $f5 | ||||||
|  | #define ft1     $f6 | ||||||
|  | #define ft1f    $f7 | ||||||
|  | #define ft2     $f8 | ||||||
|  | #define ft2f    $f9 | ||||||
|  | #define ft3     $f10 | ||||||
|  | #define ft3f    $f11 | ||||||
|  | #define ft4     $f16 | ||||||
|  | #define ft4f    $f17 | ||||||
|  | #define ft5     $f18 | ||||||
|  | #define ft5f    $f19 | ||||||
|  | #define fs0     $f20 | ||||||
|  | #define fs0f    $f21 | ||||||
|  | #define fs1     $f22 | ||||||
|  | #define fs1f    $f23 | ||||||
|  | #define fs2     $f24 | ||||||
|  | #define fs2f    $f25 | ||||||
|  | #define fs3     $f26 | ||||||
|  | #define fs3f    $f27 | ||||||
|  | #define fs4     $f28 | ||||||
|  | #define fs4f    $f29 | ||||||
|  | #define fs5     $f30 | ||||||
|  | #define fs5f    $f31 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #if (_MIPS_SIM == _MIPS_SIM_ABI64) | ||||||
|  | #define fv0     $f0 | ||||||
|  | #define fv1     $f2 | ||||||
|  | #define fa0     $f12 | ||||||
|  | #define fa1     $f13 | ||||||
|  | #define fa2     $f14 | ||||||
|  | #define fa3     $f15 | ||||||
|  | #define fa4     $f16 | ||||||
|  | #define fa5     $f17 | ||||||
|  | #define fa6     $f18 | ||||||
|  | #define fa7     $f19 | ||||||
|  | #define ft0     $f4 | ||||||
|  | #define ft1     $f5 | ||||||
|  | #define ft2     $f6 | ||||||
|  | #define ft3     $f7 | ||||||
|  | #define ft4     $f8 | ||||||
|  | #define ft5     $f9 | ||||||
|  | #define ft6     $f10 | ||||||
|  | #define ft7     $f11 | ||||||
|  | #define ft8     $f20 | ||||||
|  | #define ft9     $f21 | ||||||
|  | #define ft10    $f22 | ||||||
|  | #define ft11    $f23 | ||||||
|  | #define ft12    $f1 | ||||||
|  | #define ft13    $f3 | ||||||
|  | #define fs0     $f24 | ||||||
|  | #define fs1     $f25 | ||||||
|  | #define fs2     $f26 | ||||||
|  | #define fs3     $f27 | ||||||
|  | #define fs4     $f28 | ||||||
|  | #define fs5     $f29 | ||||||
|  | #define fs6     $f30 | ||||||
|  | #define fs7     $f31 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #define fcr31   $31 | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | @ -744,7 +744,7 @@ beginseg | ||||||
|     include "$(BUILD_DIR)/src/code/c_keyframe.o" |     include "$(BUILD_DIR)/src/code/c_keyframe.o" | ||||||
|     include "$(BUILD_DIR)/src/code/sys_slowly.o" |     include "$(BUILD_DIR)/src/code/sys_slowly.o" | ||||||
|     include "$(BUILD_DIR)/src/code/sys_flashrom.o" |     include "$(BUILD_DIR)/src/code/sys_flashrom.o" | ||||||
|     include "$(BUILD_DIR)/asm/code/kanread.text.o" // handwritten |     include "$(BUILD_DIR)/src/code/kanread.o" | ||||||
|     include "$(BUILD_DIR)/src/code/osFlash.o" |     include "$(BUILD_DIR)/src/code/osFlash.o" | ||||||
|     pad_text |     pad_text | ||||||
|     pad_text |     pad_text | ||||||
|  | @ -760,9 +760,8 @@ beginseg | ||||||
|     include "$(BUILD_DIR)/src/audio/lib/effects.o" |     include "$(BUILD_DIR)/src/audio/lib/effects.o" | ||||||
|     include "$(BUILD_DIR)/src/audio/lib/seqplayer.o" |     include "$(BUILD_DIR)/src/audio/lib/seqplayer.o" | ||||||
|     include "$(BUILD_DIR)/src/audio/lib/stack.o" |     include "$(BUILD_DIR)/src/audio/lib/stack.o" | ||||||
|     include "$(BUILD_DIR)/asm/code/code_8019AE40.text.o" // handwritten |     include "$(BUILD_DIR)/src/audio/code_8019AE40.o" | ||||||
|     pad_text |     include "$(BUILD_DIR)/src/audio/code_8019AEC0.o" | ||||||
|     include "$(BUILD_DIR)/asm/code/code_8019AEC0.text.o" // handwritten |  | ||||||
|     include "$(BUILD_DIR)/src/audio/code_8019AF00.o" |     include "$(BUILD_DIR)/src/audio/code_8019AF00.o" | ||||||
|     include "$(BUILD_DIR)/src/audio/voice_external.o" |     include "$(BUILD_DIR)/src/audio/voice_external.o" | ||||||
|     include "$(BUILD_DIR)/src/audio/voice_internal.o" |     include "$(BUILD_DIR)/src/audio/voice_internal.o" | ||||||
|  |  | ||||||
|  | @ -0,0 +1,39 @@ | ||||||
|  | #include "PR/asm.h" | ||||||
|  | #include "PR/regdef.h" | ||||||
|  | 
 | ||||||
|  | .text | ||||||
|  | 
 | ||||||
|  | /* void func_8019AE40(UNK* a0, UNK* a1, u16 a2, s32 a3) */ | ||||||
|  | LEAF(func_8019AE40) | ||||||
|  |     andi    a2, a2, 0xFFFF | ||||||
|  |     srl     a2, a2, 1 | ||||||
|  |     lw      t0, 0x28(a0) | ||||||
|  |     lw      t1, 0x2C(a0) | ||||||
|  |     lw      t2, 0xC(a1) | ||||||
|  |     bnez    a3, 1f | ||||||
|  |     sll     t2, t2, 1 | ||||||
|  |     add     t0, t0, t2 | ||||||
|  |     add     t1, t1, t2 | ||||||
|  | 1: | ||||||
|  |     lw      t2, 0x4(a1) | ||||||
|  |     lw      t3, 0x8(a1) | ||||||
|  |     lbu     t4, 0x4(a0) | ||||||
|  |     sll     a3, a3, 1 | ||||||
|  |     add     t2, t2, a3 | ||||||
|  |     add     t3, t3, a3 | ||||||
|  |     sll     t4, t4, 1 | ||||||
|  | 2: | ||||||
|  | .set noreorder
 | ||||||
|  |     lh      t5, (t2) | ||||||
|  |     lh      t6, (t3) | ||||||
|  |     add     t2, t2, t4 | ||||||
|  |     add     t3, t3, t4 | ||||||
|  |     addi    a2, a2, -1 | ||||||
|  |     sh      t5, (t0) | ||||||
|  |     addi    t0, t0, 2 | ||||||
|  |     sh      t6, (t1) | ||||||
|  | .set reorder
 | ||||||
|  |     addi    t1, t1, 2 | ||||||
|  |     bgtz    a2, 2b | ||||||
|  |     jr      ra | ||||||
|  | END(func_8019AE40) | ||||||
|  | @ -0,0 +1,25 @@ | ||||||
|  | #include "PR/asm.h" | ||||||
|  | #include "PR/regdef.h" | ||||||
|  | 
 | ||||||
|  | .text | ||||||
|  | .align 5
 | ||||||
|  | 
 | ||||||
|  | /* Copy 0x20 bytes at a1 to a0, with word alignment */ | ||||||
|  | LEAF(func_8019AEC0) | ||||||
|  |     addi    t7, a1, 0x20 | ||||||
|  | 1: | ||||||
|  | .set noreorder
 | ||||||
|  |     lw      t0, 0x0(a1) | ||||||
|  |     lw      t1, 0x4(a1) | ||||||
|  |     lw      t2, 0x8(a1) | ||||||
|  |     lw      t3, 0xC(a1) | ||||||
|  |     addi    a1, a1, 0x10 | ||||||
|  |     sw      t0, 0x0(a0) | ||||||
|  |     sw      t1, 0x4(a0) | ||||||
|  |     sw      t2, 0x8(a0) | ||||||
|  |     sw      t3, 0xC(a0) | ||||||
|  | .set reorder
 | ||||||
|  |     addi    a0, a0, 0x10 | ||||||
|  |     bne     a1, t7, 1b | ||||||
|  |     jr      ra | ||||||
|  | END(func_8019AEC0) | ||||||
|  | @ -1,6 +0,0 @@ | ||||||
| .include "macro.inc" |  | ||||||
| 
 |  | ||||||
| .section .data |  | ||||||
| 
 |  | ||||||
| dlabel aspMainStack |  | ||||||
|     .incbin "incbin/aspMainStack" |  | ||||||
|  | @ -0,0 +1,205 @@ | ||||||
|  | #include "PR/asm.h" | ||||||
|  | #include "PR/regdef.h" | ||||||
|  | 
 | ||||||
|  | .text | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * s32 Kanji_OffsetFromShiftJIS(s32 sjis);
 | ||||||
|  |  * | ||||||
|  |  * Returns the offset of the glyph texture data in the file `kanji` corresponding | ||||||
|  |  * to a given 2-byte Shift-JIS codepoint. No range validity check is carried out. | ||||||
|  |  * | ||||||
|  |  * A nice Shift-JIS codepoint table: https://uic.io/en/charset/show/shift_jis/ | ||||||
|  |  * The file `kanji` contains the 'Level 1' kanji (0x889F-0x9872), and a reworked | ||||||
|  |  * version of the non-kanji section that includes extra English and Hylian glyphs. | ||||||
|  |  * | ||||||
|  |  * @note This function assumes that its argument is a valid Shift-JIS codepoint;
 | ||||||
|  |  * there is no range protection at all. | ||||||
|  |  * | ||||||
|  |  * @param sjis Shift-JIS Codepoint of glyph.
 | ||||||
|  |  * @return s32 offset into `kanji` file.
 | ||||||
|  |  * | ||||||
|  |  * @remark Almost identical to "LeoGetKadr" from libleo.
 | ||||||
|  |  */ | ||||||
|  | LEAF(Kanji_OffsetFromShiftJIS) | ||||||
|  |     /* Characters with codepoints >= 0x8800 are kanji. Arrangement is regular, */ | ||||||
|  |     /* so convert index directly. */ | ||||||
|  |     li      a2, 0xBC | ||||||
|  |     blt     a0, 0x8800, .nonkanji | ||||||
|  |      /* 0xBC is number of glyphs in one block in the `kanji` file: */ | ||||||
|  |      /* 0x100 possible codepoints with the same byte1 */ | ||||||
|  |      /* - 0x40 unused at beginning */ | ||||||
|  |      /* - 1 unused at 0x7F */ | ||||||
|  |      /* - 3 unused at 0xFD, 0xFE, 0xFF */ | ||||||
|  |     /* Get byte1 and adjust so starts at 0 */ | ||||||
|  |     srl     a1, a0, 8 | ||||||
|  |     addi    a1, a1, -0x88 | ||||||
|  |     /* Get byte2 and adjust so starts at 0 */ | ||||||
|  |     andi    a3, a0, 0xFF | ||||||
|  |     addi    a3, a3, -0x40 | ||||||
|  |     mul     a2, a2, a1 | ||||||
|  |     blt     a3, 0x40, .kanji_lower_halfblock | ||||||
|  | 
 | ||||||
|  |     /* 0x__7F is always empty and elided in the file, so decrement if larger */ | ||||||
|  |     addi    a3, a3, -1 | ||||||
|  | .kanji_lower_halfblock: | ||||||
|  |     mflo    a2  /* Unncessary mflo: the pseudo-op `mul` already performs mflo */ | ||||||
|  |     addi    a3, a3, 0x30A | ||||||
|  |     add     a3, a3, a2 | ||||||
|  |     /* returns (0x30A + (adjusted byte2) + (adjusted byte1) * 0xBC) * FONT_CHAR_TEX_SIZE */ | ||||||
|  |     sll     v0, a3, 7 | ||||||
|  |     jr      ra | ||||||
|  | 
 | ||||||
|  | /* Non-kanji are arranged with irregular gaps, use the lookup table. */ | ||||||
|  | .nonkanji: | ||||||
|  |     /* Get byte1 and adjust so starts at 0 */ | ||||||
|  |     srl     a1, a0, 8 | ||||||
|  |     addi    a1, a1, -0x81 | ||||||
|  |     /* Get byte2 and adjust so starts at 0 */ | ||||||
|  |     andi    a3, a0, 0xFF | ||||||
|  |     addi    a3, a3, -0x40 | ||||||
|  |     mul     a2, a2, a1 | ||||||
|  |     blt     a3, 0x40, .nonkanji_lower_halfblock | ||||||
|  | 
 | ||||||
|  |     /* 0x__7F is always empty and elided in the file, so decrement if larger */ | ||||||
|  |     addi    a3, a3, -1 | ||||||
|  | .nonkanji_lower_halfblock: | ||||||
|  |     mflo    a2  /* Unncessary mflo: the pseudo-op `mul` already performs mflo */ | ||||||
|  |     add     a3, a3, a2 | ||||||
|  |     sll     a3, a3, 1 | ||||||
|  |     la      a2, sNonKanjiIndices | ||||||
|  |     add     a3, a3, a2 | ||||||
|  |     lh      a2, (a3) | ||||||
|  |     /* returns sNonKanjiIndices[(adjusted byte2) + (adjusted byte1) * 0xBC] * FONT_CHAR_TEX_SIZE */ | ||||||
|  |     sll     v0, a2, 7 | ||||||
|  |     jr      ra | ||||||
|  | END(Kanji_OffsetFromShiftJIS) | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Nearly equivalent C code (Equivalent for all valid input, will behave differently on overflow due to the use of `add` in the original): | ||||||
|  |  * | ||||||
|  |  * extern u16 sNonKanjiIndices[];
 | ||||||
|  |  * | ||||||
|  |  * s32 Kanji_OffsetFromShiftJIS(s32 sjis) { | ||||||
|  |  *     u32 byte1 = (u32)sjis >> 8;
 | ||||||
|  |  *     u32 byte2 = sjis & 0xFF;
 | ||||||
|  |  * | ||||||
|  |  *     byte2 -= 0x40;
 | ||||||
|  |  *     if (byte2 >= 0x40) { | ||||||
|  |  *         byte2--;
 | ||||||
|  |  *     } | ||||||
|  |  * | ||||||
|  |  *     if (sjis >= 0x8800) { | ||||||
|  |  *         byte1 -= 0x88;
 | ||||||
|  |  *         return (0x30A + byte2 + byte1 * 0xBC) * FONT_CHAR_TEX_SIZE;
 | ||||||
|  |  *     } else { | ||||||
|  |  *         byte1 -= 0x81;
 | ||||||
|  |  *         return sNonKanjiIndices[byte2 + byte1 * 0xBC] * FONT_CHAR_TEX_SIZE;
 | ||||||
|  |  *     } | ||||||
|  |  * } | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Index table, formatting follows conventional Shift-JIS character table layout, | ||||||
|  |  * with space for the missing 0x__7F,0x__FD,0x__FE,0x__FF entries, and split | ||||||
|  |  * into blocks by high byte. | ||||||
|  |  */ | ||||||
|  | DATA(sNonKanjiIndices) | ||||||
|  | /*                 0x___0  0x___1  0x___2  0x___3  0x___4  0x___5  0x___6  0x___7  0x___8  0x___9  0x___A  0x___B  0x___C  0x___D  0x___E  0x___F */ | ||||||
|  | /* 0x814_ */ .half 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F | ||||||
|  | /* 0x815_ */ .half 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F | ||||||
|  | /* 0x816_ */ .half 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F | ||||||
|  | /* 0x817_ */ .half 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E | ||||||
|  | /* 0x818_ */ .half 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E | ||||||
|  | /* 0x819_ */ .half 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E | ||||||
|  | /* 0x81A_ */ .half 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x81B_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073 | ||||||
|  | /* 0x81C_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x0000 | ||||||
|  | /* 0x81D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F | ||||||
|  | /* 0x81E_ */ .half 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x81F_ */ .half 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0000, 0x0000, 0x0000, 0x0000, 0x0091 | ||||||
|  | 
 | ||||||
|  | /*                 0x___0  0x___1  0x___2  0x___3  0x___4  0x___5  0x___6  0x___7  0x___8  0x___9  0x___A  0x___B  0x___C  0x___D  0x___E  0x___F */ | ||||||
|  | /* 0x824_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0092 | ||||||
|  | /* 0x825_ */ .half 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x826_ */ .half 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB | ||||||
|  | /* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x828_ */ .half 0x0000, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4 | ||||||
|  | /* 0x829_ */ .half 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0000, 0x0000, 0x0000, 0x0000, 0x00D0 | ||||||
|  | /* 0x82A_ */ .half 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0 | ||||||
|  | /* 0x82B_ */ .half 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0 | ||||||
|  | /* 0x82C_ */ .half 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, 0x0100 | ||||||
|  | /* 0x82D_ */ .half 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x010F, 0x0110 | ||||||
|  | /* 0x82E_ */ .half 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, 0x0119, 0x011A, 0x011B, 0x011C, 0x011D, 0x011E, 0x011F, 0x0120 | ||||||
|  | /* 0x82F_ */ .half 0x0121, 0x0122, 0x0123, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | 
 | ||||||
|  | /*                 0x___0  0x___1  0x___2  0x___3  0x___4  0x___5  0x___6  0x___7  0x___8  0x___9  0x___A  0x___B  0x___C  0x___D  0x___E  0x___F */ | ||||||
|  | /* 0x834_ */ .half 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132, 0x0133 | ||||||
|  | /* 0x835_ */ .half 0x0134, 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x013F, 0x0140, 0x0141, 0x0142, 0x0143 | ||||||
|  | /* 0x836_ */ .half 0x0144, 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x014F, 0x0150, 0x0151, 0x0152, 0x0153 | ||||||
|  | /* 0x837_ */ .half 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x015F, 0x0160, 0x0161, 0x0162 | ||||||
|  | /* 0x838_ */ .half 0x0163, 0x0164, 0x0165, 0x0166, 0x0167, 0x0168, 0x0169, 0x016A, 0x016B, 0x016C, 0x016D, 0x016E, 0x016F, 0x0170, 0x0171, 0x0172 | ||||||
|  | /* 0x839_ */ .half 0x0173, 0x0174, 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x017A | ||||||
|  | /* 0x83A_ */ .half 0x017B, 0x017C, 0x017D, 0x017E, 0x017F, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189, 0x018A | ||||||
|  | /* 0x83B_ */ .half 0x018B, 0x018C, 0x018D, 0x018E, 0x018F, 0x0190, 0x0191, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192 | ||||||
|  | /* 0x83C_ */ .half 0x0193, 0x0194, 0x0195, 0x0196, 0x0197, 0x0198, 0x0199, 0x019A, 0x019B, 0x019C, 0x019D, 0x019E, 0x019F, 0x01A0, 0x01A1, 0x01A2 | ||||||
|  | /* 0x83D_ */ .half 0x01A3, 0x01A4, 0x01A5, 0x01A6, 0x01A7, 0x01A8, 0x01A9, 0x01AA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x83E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x83F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | 
 | ||||||
|  | /*                 0x___0  0x___1  0x___2  0x___3  0x___4  0x___5  0x___6  0x___7  0x___8  0x___9  0x___A  0x___B  0x___C  0x___D  0x___E  0x___F */ | ||||||
|  | /* 0x844_ */ .half 0x01AB, 0x01AC, 0x01AD, 0x01AE, 0x01AF, 0x01B0, 0x01B1, 0x01B2, 0x01B3, 0x01B4, 0x01B5, 0x01B6, 0x01B7, 0x01B8, 0x01B9, 0x01BA | ||||||
|  | /* 0x845_ */ .half 0x01BB, 0x01BC, 0x01BD, 0x01BE, 0x01BF, 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C4, 0x01C5, 0x01C6, 0x01C7, 0x01C8, 0x01C9, 0x01CA | ||||||
|  | /* 0x846_ */ .half 0x01CB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x847_ */ .half 0x01CC, 0x01CD, 0x01CE, 0x01CF, 0x01D0, 0x01D1, 0x01D2, 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA | ||||||
|  | /* 0x848_ */ .half 0x01DB, 0x01DC, 0x01DD, 0x01DE, 0x01DF, 0x01E0, 0x01E1, 0x01E2, 0x01E3, 0x01E4, 0x01E5, 0x01E6, 0x01E7, 0x01E8, 0x01E9, 0x01EA | ||||||
|  | /* 0x849_ */ .half 0x01EB, 0x01EC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01ED | ||||||
|  | /* 0x84A_ */ .half 0x01EE, 0x01EF, 0x01F0, 0x01F1, 0x01F2, 0x01F3, 0x01F4, 0x01F5, 0x01F6, 0x01F7, 0x01F8, 0x01F9, 0x01FA, 0x01FB, 0x01FC, 0x01FD | ||||||
|  | /* 0x84B_ */ .half 0x01FE, 0x01FF, 0x0200, 0x0201, 0x0202, 0x0203, 0x0204, 0x0205, 0x0206, 0x0207, 0x0208, 0x0209, 0x020A, 0x020B, 0x020C, 0x020D | ||||||
|  | /* 0x84C_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x84D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x84E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x84F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | 
 | ||||||
|  | /*                 0x___0  0x___1  0x___2  0x___3  0x___4  0x___5  0x___6  0x___7  0x___8  0x___9  0x___A  0x___B  0x___C  0x___D  0x___E  0x___F */ | ||||||
|  | /* 0x854_ */ .half 0x020E, 0x020F, 0x0210, 0x0211, 0x0212, 0x0213, 0x0214, 0x0215, 0x0216, 0x0217, 0x0218, 0x0219, 0x021A, 0x021B, 0x021C, 0x021D | ||||||
|  | /* 0x855_ */ .half 0x021E, 0x021F, 0x0220, 0x0221, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0222, 0x0223 | ||||||
|  | /* 0x856_ */ .half 0x0224, 0x0225, 0x0226, 0x0227, 0x0228, 0x0229, 0x022A, 0x022B, 0x022C, 0x022D, 0x022E, 0x022F, 0x0230, 0x0231, 0x0232, 0x0233 | ||||||
|  | /* 0x857_ */ .half 0x0234, 0x0235, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0236, 0x0237, 0x0238 | ||||||
|  | /* 0x858_ */ .half 0x0239, 0x023A, 0x023B, 0x023C, 0x023D, 0x023E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x859_ */ .half 0x0000, 0x023F, 0x0240, 0x0241, 0x0242, 0x0243, 0x0244, 0x0245, 0x0246, 0x0247, 0x0248, 0x0000, 0x0000, 0x0000, 0x0000, 0x0249 | ||||||
|  | /* 0x85A_ */ .half 0x024A, 0x024B, 0x024C, 0x024D, 0x024E, 0x024F, 0x0250, 0x0251, 0x0252, 0x0253, 0x0254, 0x0255, 0x0256, 0x0257, 0x0000, 0x0000 | ||||||
|  | /* 0x85B_ */ .half 0x0000, 0x0000, 0x0000, 0x0258, 0x0259, 0x025A, 0x025B, 0x025C, 0x025D, 0x025E, 0x025F, 0x0260, 0x0261, 0x0262, 0x0263, 0x0264 | ||||||
|  | /* 0x85C_ */ .half 0x0265, 0x0266, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x85D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0267, 0x0268, 0x0269, 0x026A, 0x026B | ||||||
|  | /* 0x85E_ */ .half 0x026C, 0x026D, 0x026E, 0x026F, 0x0270, 0x0271, 0x0272, 0x0273, 0x0274, 0x0275, 0x0276, 0x0277, 0x0278, 0x0279, 0x027A, 0x027B | ||||||
|  | /* 0x85F_ */ .half 0x027C, 0x027D, 0x027E, 0x027F, 0x0280, 0x0281, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | 
 | ||||||
|  | /*                 0x___0  0x___1  0x___2  0x___3  0x___4  0x___5  0x___6  0x___7  0x___8  0x___9  0x___A  0x___B  0x___C  0x___D  0x___E  0x___F */ | ||||||
|  | /* 0x864_ */ .half 0x0282, 0x0283, 0x0284, 0x0285, 0x0286, 0x0287, 0x0288, 0x0289, 0x028A, 0x028B, 0x028C, 0x028D, 0x028E, 0x028F, 0x0290, 0x0291 | ||||||
|  | /* 0x865_ */ .half 0x0292, 0x0293, 0x0294, 0x0295, 0x0296, 0x0297, 0x0298, 0x0299, 0x029A, 0x029B, 0x029C, 0x029D, 0x029E, 0x029F, 0x0000, 0x0000 | ||||||
|  | /* 0x866_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x867_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x868_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x869_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02A0, 0x02A1, 0x02A2, 0x02A3, 0x02A4 | ||||||
|  | /* 0x86A_ */ .half 0x02A5, 0x02A6, 0x02A7, 0x02A8, 0x02A9, 0x02AA, 0x02AB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x86B_ */ .half 0x0000, 0x0000, 0x0000, 0x02AC, 0x02AD, 0x02AE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x86C_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02AF, 0x02B0, 0x02B1, 0x02B2, 0x02B3, 0x02B4, 0x02B5, 0x02B6, 0x02B7 | ||||||
|  | /* 0x86D_ */ .half 0x02B8, 0x02B9, 0x02BA, 0x02BB, 0x02BC, 0x02BD, 0x02BE, 0x02BF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x86E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x86F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | 
 | ||||||
|  | /*                 0x___0  0x___1  0x___2  0x___3  0x___4  0x___5  0x___6  0x___7  0x___8  0x___9  0x___A  0x___B  0x___C  0x___D  0x___E  0x___F */ | ||||||
|  | /* 0x874_ */ .half 0x02C0, 0x02C1, 0x02C2, 0x02C3, 0x02C4, 0x02C5, 0x02C6, 0x02C7, 0x02C8, 0x02C9, 0x02CA, 0x02CB, 0x02CC, 0x02CD, 0x02CE, 0x02CF | ||||||
|  | /* 0x875_ */ .half 0x02D0, 0x02D1, 0x02D2, 0x02D3, 0x02D4, 0x02D5, 0x02D6, 0x02D7, 0x02D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x876_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x877_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x878_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x879_ */ .half 0x0000, 0x02D9, 0x02DA, 0x02DB, 0x02DC, 0x02DD, 0x02DE, 0x02DF, 0x02E0, 0x02E1, 0x02E2, 0x02E3, 0x02E4, 0x02E5, 0x02E6, 0x02E7 | ||||||
|  | /* 0x87A_ */ .half 0x02E8, 0x02E9, 0x02EA, 0x02EB, 0x02EC, 0x02ED, 0x02EE, 0x02EF, 0x02F0, 0x02F1, 0x02F2, 0x02F3, 0x02F4, 0x02F5, 0x02F6, 0x02F7 | ||||||
|  | /* 0x87B_ */ .half 0x02F8, 0x02F9, 0x02FA, 0x02FB, 0x02FC, 0x02FD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02FE, 0x02FF, 0x0300 | ||||||
|  | /* 0x87C_ */ .half 0x0301, 0x0302, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x87D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x87E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0303, 0x0304, 0x0305, 0x0306, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 | ||||||
|  | /* 0x87F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0307, 0x0308, 0x0309 | ||||||
|  | ENDDATA(sNonKanjiIndices) | ||||||
|  | @ -1,34 +1,49 @@ | ||||||
| #include "PR/asm.h" | #include "PR/asm.h" | ||||||
|  | #include "PR/regdef.h" | ||||||
| #include "boot.h" | #include "boot.h" | ||||||
| 
 | 
 | ||||||
| .set noreorder
 | .text | ||||||
| 
 | 
 | ||||||
| .section .text | #define PAD_TO 0x60 | ||||||
|  | #define LA(reg, sym) la reg, sym | ||||||
| 
 | 
 | ||||||
| .balign 16
 | #if !defined(AVOID_UB) | ||||||
|  | /* Old assembler workarounds: The makerom tool in the N64 SDK was given the bss segment size as a const | ||||||
|  |  * literal, and since this literal was < 0x10000 it was loaded in one instruction. We don't have access | ||||||
|  |  * to the bss segment size until we link everything so we cannot do the same thing. Instead we must load | ||||||
|  |  * only the lower 16 bits of the bss size for matching. | ||||||
|  |  * When AVOID_UB is enabled, don't do this and instead load the full symbol value, otherwise not all of | ||||||
|  |  * bss may be cleared. */ | ||||||
|  | # if defined(__sgi) | ||||||
|  | #  define LOAD_BSS_SIZE(reg) li reg, %half(_bootSegmentBssSize) | ||||||
|  | # else | ||||||
|  | #  define LOAD_BSS_SIZE(reg) ori reg, zero, %lo(_bootSegmentBssSize) | ||||||
|  | # endif | ||||||
|  | #else | ||||||
|  | # define LOAD_BSS_SIZE(reg) LA(reg, _bootSegmentBssSize) | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| LEAF(entrypoint) | LEAF(entrypoint) | ||||||
|     // Clear boot segment .bss |     /* Clear boot segment .bss */ | ||||||
|     la      $t0, _bootSegmentBssStart |     LA(     t0, _bootSegmentBssStart) | ||||||
| #ifndef AVOID_UB |     LOAD_BSS_SIZE(t1) | ||||||
|     // UB: li only loads the lower 16 bits of _bootSegmentBssSize when it may be larger than this, |  | ||||||
|     // so not all of bss may be cleared if it is too large |  | ||||||
|     li      $t1, _bootSegmentBssSize |  | ||||||
| #else |  | ||||||
|     la      $t1, _bootSegmentBssSize |  | ||||||
| #endif |  | ||||||
| .clear_bss: | .clear_bss: | ||||||
|     addi    $t1, $t1, -8 |     sw      zero, 0(t0) | ||||||
|     sw      $zero, 0($t0) |     sw      zero, 4(t0) | ||||||
|     sw      $zero, 4($t0) |     addi    t0, t0, 8 | ||||||
|     bnez    $t1, .clear_bss |     addi    t1, t1, -8 | ||||||
|      addi   $t0, $t0, 8 |     bnez    t1, .clear_bss | ||||||
|     // Set up stack and enter program code | 
 | ||||||
|     lui     $t2, %hi(bootproc) |     /* Set up stack and enter program code */ | ||||||
|     lui     $sp, %hi(sBootStack + BOOT_STACK_SIZE) |     LA(     sp, sBootStack + BOOT_STACK_SIZE) | ||||||
|     addiu   $t2, %lo(bootproc) |     LA(     t2, bootproc) | ||||||
|     jr      $t2 |     jr      t2 | ||||||
|      addiu  $sp, %lo(sBootStack + BOOT_STACK_SIZE) |  | ||||||
| END(entrypoint) | END(entrypoint) | ||||||
| 
 | 
 | ||||||
| .fill 0x60 - (. - entrypoint) | #ifdef __sgi | ||||||
|  | /* IDO can't take absolute differences of symbols so the size of the above is hardcoded */ | ||||||
|  | .space PAD_TO - 0x34 | ||||||
|  | #else | ||||||
|  | /* Pad to a total size taking into account the size of the above */ | ||||||
|  | .space PAD_TO - (. - entrypoint) | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| .section .text |  | ||||||
| 
 |  | ||||||
| .incbin "incbin/ipl3" |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Thar0
						Thar0