diff --git a/.gitignore b/.gitignore index 188bb3cc..1d19ffb5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,9 +9,8 @@ asm/nonmatchings asm/data asm/*.s asm/*/*.s -asm/core1/os -!asm/ultra -!asm/core1/ultra +asm/boot/ +asm/core1/ build/* build/ diff --git a/.gitmodules b/.gitmodules index f4e226fe..9e6266ed 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,7 @@ [submodule "tools/bk_rom_compressor"] path = tools/bk_rom_compressor url = https://github.com/MittenzHugg/bk_rom_compressor.git +[submodule "lib/ultralib"] + path = lib/ultralib + url = https://github.com/mariob92/ultralib.git + branch = banjo-kazooie diff --git a/Makefile b/Makefile index 8049ec89..fe1f2de3 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ BUILD_ROOT := build BUILD_DIR := $(BUILD_ROOT)/$(VERSION) ALL_ASSET_FILES := $(shell find $(ASSET_ROOT) -type f -iname '*.*' 2> /dev/null) C_SRCS := $(shell find $(SRC_ROOT) -type f -iname '*.c' 2> /dev/null) -BOOT_C_SRCS := $(wildcard $(SRC_ROOT)/done/*.c) +BOOT_C_SRCS := $(shell find $(SRC_ROOT)/boot -type f -iname '*.c' 2> /dev/null) ALL_ASM_SRCS := $(filter-out $(ASM_ROOT)/$(NONMATCHINGS), $(shell find $(ASM_ROOT) -name $(NONMATCHINGS) -prune -o -iname '*.s' 2> /dev/null)) ALL_BINS := $(shell find $(BIN_ROOT) -type f -iname '*.bin' 2> /dev/null) # Files referenced in the splat file @@ -116,8 +116,8 @@ BIN_OBJS := $(filter-out $(ASSET_OBJS),$(BIN_OBJS)) ALL_OBJS := $(C_OBJS) $(ASM_OBJS) $(BIN_OBJS) SYMBOL_ADDRS := symbol_addrs.$(VERSION).txt SYMBOL_ADDR_FILES := $(filter-out $(SYMBOL_ADDRS), $(wildcard symbol_addrs.*.$(VERSION).txt)) -MIPS3_OBJS := $(BUILD_DIR)/$(SRC_ROOT)/core1/ll.c.o $(BUILD_DIR)/$(SRC_ROOT)/core1/ll_cvt.c.o -BOOT_MIPS3_OBJS := $(BUILD_DIR)/$(SRC_ROOT)/done/ll.c.o +MIPS3_OBJS := $(BUILD_DIR)/$(SRC_ROOT)/core1/ultra/libc/ll.c.o $(BUILD_DIR)/$(SRC_ROOT)/core1/ultra/libc/llcvt.c.o +BOOT_MIPS3_OBJS := $(BUILD_DIR)/$(SRC_ROOT)/boot/ultra/libc/ll.c.o BOOT_C_OBJS := $(filter-out $(BOOT_MIPS3_OBJS),$(BOOT_C_OBJS)) COMPRESSED_SYMBOLS := $(BUILD_DIR)/compressed_symbols.txt @@ -158,10 +158,10 @@ endef ### Flags ### # Build tool flags -CFLAGS := -c -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm $(OPT_FLAGS) $(MIPSBIT) -D_FINALROM -DF3DEX_GBI -DVERSION='$(C_VERSION)' +CFLAGS := -c -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm $(OPT_FLAGS) $(MIPSBIT) -D_FINALROM -DF3DEX_GBI -DVERSION='$(C_VERSION)' -DNDEBUG -DBUILD_VERSION=VERSION_I -DBKDIFFS CFLAGS += -woff 649,654,838,807 -CPPFLAGS := -D_FINALROM -DN_MICRO -INCLUDE_CFLAGS := -I . -I include -I include/2.0L -I include/2.0L/PR +CPPFLAGS := -D_FINALROM -DN_MICRO -DNDEBUG -DBUILD_VERSION=VERSION_I -DBKDIFFS +INCLUDE_CFLAGS := -I . -I include -I lib/ultralib/include -I lib/ultralib/include/PR -I lib/ultralib/include/PRinternal -I lib/ultralib/include/compiler/ido -I include/n_audio/PR -I lib/ultralib/src/audio OPT_FLAGS := -O2 MIPSBIT := -mips2 ASFLAGS := -EB -mtune=vr4300 -march=vr4300 -mabi=32 -I include @@ -325,9 +325,9 @@ $(DECOMPRESSED_BASEROM): $(BASEROM) $(BK_ROM_DECOMPRESS) @$(BK_ROM_DECOMPRESS) $< $@ # .o -> .elf (dummy symbols) -$(PRELIM_ELF): $(ALL_OBJS) $(LD_SCRIPT) $(ASSET_OBJS) +$(PRELIM_ELF): $(ALL_OBJS) $(LD_SCRIPT) $(ASSET_OBJS) $(BUILD_DIR)/libultra_rom.a $(BUILD_DIR)/libultra_rom_boot.a $(call print1,Linking elf:,$@) - @$(LD) $(LDFLAGS) -T rzip_dummy_addrs.$(VERSION).txt -o $@ + @$(LD) $(LDFLAGS) -T rzip_dummy_addrs.$(VERSION).txt $(BUILD_DIR)/libultra_rom.a $(BUILD_DIR)/libultra_rom_boot.a -o $@ # .elf -> .z64 (dummy symbols) $(PRELIM_Z64) : $(PRELIM_ELF) @@ -339,9 +339,9 @@ $(COMPRESSED_SYMBOLS): $(PRELIM_ELF) $(PRELIM_Z64) $(BK_ROM_COMPRESS) @$(BK_ROM_COMPRESS) --symbols $(PRELIM_ELF) $(PRELIM_Z64) $@ # .o -> .elf (game) -$(ELF): $(ALL_OBJS) $(LD_SCRIPT) $(ASSET_OBJS) $(COMPRESSED_SYMBOLS) +$(ELF): $(ALL_OBJS) $(LD_SCRIPT) $(ASSET_OBJS) $(COMPRESSED_SYMBOLS) $(BUILD_DIR)/libultra_rom.a $(BUILD_DIR)/libultra_rom_boot.a $(call print1,Linking elf:,$@) - @$(LD) $(LDFLAGS) -T $(COMPRESSED_SYMBOLS) -o $@ + @$(LD) $(LDFLAGS) -T $(COMPRESSED_SYMBOLS) $(BUILD_DIR)/libultra_rom.a $(BUILD_DIR)/libultra_rom_boot.a -o $@ # .elf -> .z64 (uncompressed) $(UNCOMPRESSED_Z64) : $(ELF) @@ -352,6 +352,15 @@ $(UNCOMPRESSED_Z64) : $(ELF) $(FINAL_Z64) : $(UNCOMPRESSED_Z64) $(ELF) $(BK_ROM_COMPRESS) @$(BK_ROM_COMPRESS) $(ELF) $(UNCOMPRESSED_Z64) $@ +# Libultra files +$(BUILD_DIR)/libultra_rom.a: + @$(MAKE) -C lib/ultralib VERSION=I TARGET=libultra_rom COMPARE=0 MODERN_LD=1 setup + @$(MAKE) -C lib/ultralib VERSION=I TARGET=libultra_rom COMPARE=0 MODERN_LD=1 + @$(CP) lib/ultralib/build/I/libultra_rom/libultra_rom.a $@ + +$(BUILD_DIR)/libultra_rom_boot.a: $(BUILD_DIR)/libultra_rom.a + @$(OBJCOPY) --prefix-symbols=boot_ $< $@ + # TOOLS # Tool for spliting BK asset sections into and from ROM Bin and transforming certain file types $(BK_ASSET_TOOL): tools/bk_asset_tool/Cargo.toml tools/bk_asset_tool/Cargo.lock $(wildcard tools/bk_rom_compressor/src/*.rs) @@ -367,6 +376,7 @@ $(BK_ROM_DECOMPRESS): tools/bk_rom_compressor/Cargo.toml tools/bk_rom_compressor clean: $(call print0,Cleaning build artifacts) + @$(MAKE) -C lib/ultralib clean @$(RM) -rf $(BUILD_ROOT) @$(RM) -rf $(DECOMPRESSED_BASEROM) @$(RM) -rf $(BIN_ROOT) @@ -375,54 +385,12 @@ clean: @$(RM) -rf $(addprefix $(ASM_ROOT)/,$(filter-out core1,$(OVERLAYS))) @$(RM) -rf $(ASM_ROOT)/data @$(RM) -rf $(ASM_ROOT)/core1/*.s - @$(RM) -rf $(ASM_ROOT)/core1/os @$(RM) -f *.ld # Per-file flag definitions -build/$(VERSION)/src/core1/io/%.c.o: OPT_FLAGS = -O1 -build/$(VERSION)/src/core1/os/%.c.o: OPT_FLAGS = -O1 -build/$(VERSION)/src/core1/gu/%.c.o: OPT_FLAGS = -O3 -build/$(VERSION)/src/core1/gu/%.c.o: INCLUDE_CFLAGS = -I . -I include -I include/2.0L -I include/2.0L/PR -build/$(VERSION)/src/core1/audio/%.c.o: OPT_FLAGS = -O3 -build/$(VERSION)/src/core1/audio/%.c.o: INCLUDE_CFLAGS = -I . -I include -I include/2.0L -I include/2.0L/PR -build/$(VERSION)/src/core1/ll.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/core1/ll.c.o: MIPSBIT := -mips3 -o32 -build/$(VERSION)/src/core1/ll_cvt.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/core1/ll_cvt.c.o: MIPSBIT := -mips3 -o32 - -build/$(VERSION)/src/bk_boot_27F0.c.o: OPT_FLAGS = -O2 -build/$(VERSION)/src/done/destroythread.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/pirawdma.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/thread.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/pimgr.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/getthreadid.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/setthreadpri.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/createthread.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/yieldthread.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/setglobalintmask.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/recvmesg.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/startthread.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/devmgr.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/sendmesg.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/pigetstat.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/si.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/resetglobalintmask.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/epirawwrite.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/epirawread.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/createmesgqueue.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/leodiskinit.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/virtualtophysical.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/ll.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/ll.c.o: MIPSBIT := -mips3 -o32 -build/$(VERSION)/src/done/sirawwrite.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/sirawread.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/initialize.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/pirawread.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/seteventmesg.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/siacs.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/cartrominit.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/leointerrupt.c.o: OPT_FLAGS := -O1 -build/$(VERSION)/src/done/epirawdma.c.o: OPT_FLAGS := -O1 +build/$(VERSION)/src/core1/ultra/audio/%.c.o: OPT_FLAGS = -O3 +build/$(VERSION)/src/core1/n_audio/%.c.o: OPT_FLAGS = -O3 +build/$(VERSION)/src/core1/ultra/gu/%.c.o: OPT_FLAGS := -O3 # Disable implicit rules MAKEFLAGS += -r diff --git a/asm/core1/ultra/exceptasm.s b/asm/core1/ultra/exceptasm.s deleted file mode 100644 index 6048455b..00000000 --- a/asm/core1/ultra/exceptasm.s +++ /dev/null @@ -1,743 +0,0 @@ -#include -#include -.include "macro.inc" - -/* assembler directives */ -.set noat /* allow manual use of $at */ -.set noreorder /* don't insert nops after branches */ -.set gp=64 /* allow use of 64-bit general purpose registers */ - -.data - -EXPORT(__osHwIntTable) -.word 0x0, 0x0, 0x0, 0x0, 0x0 - -.rdata -#define REDISPATCH 0x00 -#define SW1 0x04 -#define SW2 0x08 -#define RCP 0x0c -#define CART 0x10 -#define PRENMI 0x14 -#define IP6_HDLR 0x18 -#define IP7_HDLR 0x1c -#define COUNTER 0x20 -__osIntOffTable: -.byte REDISPATCH -.byte PRENMI -.byte IP6_HDLR -.byte IP6_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte COUNTER -.byte COUNTER -.byte IP6_HDLR -.byte IP6_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte REDISPATCH -.byte SW1 -.byte SW2 -.byte SW2 -.byte RCP -.byte RCP -.byte RCP -.byte RCP -.byte CART -.byte CART -.byte CART -.byte CART -.byte CART -.byte CART -.byte CART -.byte CART -__osIntTable: -.word redispatch, sw1, sw2, rcp, cart, prenmi, IP6_Hdlr, IP7_Hdlr, counter - -.section .text, "ax" - -/* Generated by spimdisasm 1.24.3 */ - -# Handwritten function -glabel func_8026A2E0 -/* F45B10 8026A2E0 3C1A8027 */ lui $k0, %hi(D_8026A300) -/* F45B14 8026A2E4 275AA300 */ addiu $k0, $k0, %lo(D_8026A300) -/* F45B18 8026A2E8 03400008 */ jr $k0 -/* F45B1C 8026A2EC 00000000 */ nop -/* F45B20 8026A2F0 3C1A8027 */ lui $k0, %hi(D_8026A300) -/* F45B24 8026A2F4 275AA300 */ addiu $k0, $k0, %lo(D_8026A300) -/* F45B28 8026A2F8 03400008 */ jr $k0 -/* F45B2C 8026A2FC 00000000 */ nop -D_8026A300: -/* F45B30 8026A300 3C1A8028 */ lui $k0, %hi(__osThreadSave) -/* F45B34 8026A304 275A5DE0 */ addiu $k0, $k0, %lo(__osThreadSave) -/* F45B38 8026A308 FF410020 */ sd $at, 0x20($k0) -/* F45B3C 8026A30C 401B6000 */ mfc0 $k1, $12 -/* F45B40 8026A310 AF5B0118 */ sw $k1, 0x118($k0) -/* F45B44 8026A314 2401FFFC */ addiu $at, $zero, -0x4 -/* F45B48 8026A318 0361D824 */ and $k1, $k1, $at -/* F45B4C 8026A31C 409B6000 */ mtc0 $k1, $12 -/* F45B50 8026A320 FF480058 */ sd $t0, 0x58($k0) -/* F45B54 8026A324 FF490060 */ sd $t1, 0x60($k0) -/* F45B58 8026A328 FF4A0068 */ sd $t2, 0x68($k0) -/* F45B5C 8026A32C AF400018 */ sw $zero, 0x18($k0) -/* F45B60 8026A330 40086800 */ mfc0 $t0, $13 -/* F45B64 8026A334 03404025 */ or $t0, $k0, $zero -/* F45B68 8026A338 3C1A8027 */ lui $k0, %hi(__osRunningThread) -/* F45B6C 8026A33C 8F5A7380 */ lw $k0, %lo(__osRunningThread)($k0) -/* F45B70 8026A340 DD090020 */ ld $t1, 0x20($t0) -/* F45B74 8026A344 FF490020 */ sd $t1, 0x20($k0) -/* F45B78 8026A348 DD090118 */ ld $t1, 0x118($t0) -/* F45B7C 8026A34C FF490118 */ sd $t1, 0x118($k0) -/* F45B80 8026A350 DD090058 */ ld $t1, 0x58($t0) -/* F45B84 8026A354 FF490058 */ sd $t1, 0x58($k0) -/* F45B88 8026A358 DD090060 */ ld $t1, 0x60($t0) -/* F45B8C 8026A35C FF490060 */ sd $t1, 0x60($k0) -/* F45B90 8026A360 DD090068 */ ld $t1, 0x68($t0) -/* F45B94 8026A364 FF490068 */ sd $t1, 0x68($k0) -/* F45B98 8026A368 8F5B0118 */ lw $k1, 0x118($k0) -/* F45B9C 8026A36C 00004012 */ mflo $t0 -/* F45BA0 8026A370 FF480108 */ sd $t0, 0x108($k0) -/* F45BA4 8026A374 00004010 */ mfhi $t0 -/* F45BA8 8026A378 3369FF00 */ andi $t1, $k1, 0xFF00 -/* F45BAC 8026A37C FF420028 */ sd $v0, 0x28($k0) -/* F45BB0 8026A380 FF430030 */ sd $v1, 0x30($k0) -/* F45BB4 8026A384 FF440038 */ sd $a0, 0x38($k0) -/* F45BB8 8026A388 FF450040 */ sd $a1, 0x40($k0) -/* F45BBC 8026A38C FF460048 */ sd $a2, 0x48($k0) -/* F45BC0 8026A390 FF470050 */ sd $a3, 0x50($k0) -/* F45BC4 8026A394 FF4B0070 */ sd $t3, 0x70($k0) -/* F45BC8 8026A398 FF4C0078 */ sd $t4, 0x78($k0) -/* F45BCC 8026A39C FF4D0080 */ sd $t5, 0x80($k0) -/* F45BD0 8026A3A0 FF4E0088 */ sd $t6, 0x88($k0) -/* F45BD4 8026A3A4 FF4F0090 */ sd $t7, 0x90($k0) -/* F45BD8 8026A3A8 FF500098 */ sd $s0, 0x98($k0) -/* F45BDC 8026A3AC FF5100A0 */ sd $s1, 0xA0($k0) -/* F45BE0 8026A3B0 FF5200A8 */ sd $s2, 0xA8($k0) -/* F45BE4 8026A3B4 FF5300B0 */ sd $s3, 0xB0($k0) -/* F45BE8 8026A3B8 FF5400B8 */ sd $s4, 0xB8($k0) -/* F45BEC 8026A3BC FF5500C0 */ sd $s5, 0xC0($k0) -/* F45BF0 8026A3C0 FF5600C8 */ sd $s6, 0xC8($k0) -/* F45BF4 8026A3C4 FF5700D0 */ sd $s7, 0xD0($k0) -/* F45BF8 8026A3C8 FF5800D8 */ sd $t8, 0xD8($k0) -/* F45BFC 8026A3CC FF5900E0 */ sd $t9, 0xE0($k0) -/* F45C00 8026A3D0 FF5C00E8 */ sd $gp, 0xE8($k0) -/* F45C04 8026A3D4 FF5D00F0 */ sd $sp, 0xF0($k0) -/* F45C08 8026A3D8 FF5E00F8 */ sd $fp, 0xF8($k0) -/* F45C0C 8026A3DC FF5F0100 */ sd $ra, 0x100($k0) -/* F45C10 8026A3E0 1120000D */ beqz $t1, .L8026A418 -/* F45C14 8026A3E4 FF480110 */ sd $t0, 0x110($k0) -/* F45C18 8026A3E8 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) -/* F45C1C 8026A3EC 25087130 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* F45C20 8026A3F0 8D080000 */ lw $t0, 0x0($t0) -/* F45C24 8026A3F4 2401FFFF */ addiu $at, $zero, -0x1 -/* F45C28 8026A3F8 01014026 */ xor $t0, $t0, $at -/* F45C2C 8026A3FC 3C01FFFF */ lui $at, (0xFFFF00FF >> 16) -/* F45C30 8026A400 3108FF00 */ andi $t0, $t0, 0xFF00 -/* F45C34 8026A404 342100FF */ ori $at, $at, (0xFFFF00FF & 0xFFFF) -/* F45C38 8026A408 01284825 */ or $t1, $t1, $t0 -/* F45C3C 8026A40C 0361D824 */ and $k1, $k1, $at -/* F45C40 8026A410 0369D825 */ or $k1, $k1, $t1 -/* F45C44 8026A414 AF5B0118 */ sw $k1, 0x118($k0) -.L8026A418: -/* F45C48 8026A418 3C09A430 */ lui $t1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) -/* F45C4C 8026A41C 8D29000C */ lw $t1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t1) -/* F45C50 8026A420 5120000C */ beql $t1, $zero, .L8026A454 -/* F45C54 8026A424 AF490128 */ sw $t1, 0x128($k0) -/* F45C58 8026A428 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) -/* F45C5C 8026A42C 25087130 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* F45C60 8026A430 8D080000 */ lw $t0, 0x0($t0) -/* F45C64 8026A434 8F4C0128 */ lw $t4, 0x128($k0) -/* F45C68 8026A438 2401FFFF */ addiu $at, $zero, -0x1 -/* F45C6C 8026A43C 00084402 */ srl $t0, $t0, 16 -/* F45C70 8026A440 01014026 */ xor $t0, $t0, $at -/* F45C74 8026A444 3108003F */ andi $t0, $t0, 0x3F -/* F45C78 8026A448 010C4024 */ and $t0, $t0, $t4 -/* F45C7C 8026A44C 01284825 */ or $t1, $t1, $t0 -/* F45C80 8026A450 AF490128 */ sw $t1, 0x128($k0) -.L8026A454: -/* F45C84 8026A454 40087000 */ mfc0 $t0, $14 -/* F45C88 8026A458 AF48011C */ sw $t0, 0x11C($k0) -/* F45C8C 8026A45C 8F480018 */ lw $t0, 0x18($k0) -/* F45C90 8026A460 11000014 */ beqz $t0, .L8026A4B4 -/* F45C94 8026A464 00000000 */ nop -/* F45C98 8026A468 4448F800 */ cfc1 $t0, $31 -/* F45C9C 8026A46C 00000000 */ nop -/* F45CA0 8026A470 AF48012C */ sw $t0, 0x12C($k0) -/* F45CA4 8026A474 F7400130 */ sdc1 $f0, 0x130($k0) -/* F45CA8 8026A478 F7420138 */ sdc1 $f2, 0x138($k0) -/* F45CAC 8026A47C F7440140 */ sdc1 $f4, 0x140($k0) -/* F45CB0 8026A480 F7460148 */ sdc1 $f6, 0x148($k0) -/* F45CB4 8026A484 F7480150 */ sdc1 $f8, 0x150($k0) -/* F45CB8 8026A488 F74A0158 */ sdc1 $f10, 0x158($k0) -/* F45CBC 8026A48C F74C0160 */ sdc1 $f12, 0x160($k0) -/* F45CC0 8026A490 F74E0168 */ sdc1 $f14, 0x168($k0) -/* F45CC4 8026A494 F7500170 */ sdc1 $f16, 0x170($k0) -/* F45CC8 8026A498 F7520178 */ sdc1 $f18, 0x178($k0) -/* F45CCC 8026A49C F7540180 */ sdc1 $f20, 0x180($k0) -/* F45CD0 8026A4A0 F7560188 */ sdc1 $f22, 0x188($k0) -/* F45CD4 8026A4A4 F7580190 */ sdc1 $f24, 0x190($k0) -/* F45CD8 8026A4A8 F75A0198 */ sdc1 $f26, 0x198($k0) -/* F45CDC 8026A4AC F75C01A0 */ sdc1 $f28, 0x1A0($k0) -/* F45CE0 8026A4B0 F75E01A8 */ sdc1 $f30, 0x1A8($k0) -.L8026A4B4: -/* F45CE4 8026A4B4 40086800 */ mfc0 $t0, $13 -/* F45CE8 8026A4B8 AF480120 */ sw $t0, 0x120($k0) -/* F45CEC 8026A4BC 24090002 */ addiu $t1, $zero, 0x2 -/* F45CF0 8026A4C0 A7490010 */ sh $t1, 0x10($k0) -/* F45CF4 8026A4C4 3109007C */ andi $t1, $t0, 0x7C -/* F45CF8 8026A4C8 240A0024 */ addiu $t2, $zero, 0x24 -/* F45CFC 8026A4CC 512A00B1 */ beql $t1, $t2, handle_break -/* F45D00 8026A4D0 24090001 */ addiu $t1, $zero, 0x1 -/* F45D04 8026A4D4 240A002C */ addiu $t2, $zero, 0x2C -/* F45D08 8026A4D8 112A00FF */ beq $t1, $t2, .L8026A8D8 -/* F45D0C 8026A4DC 00000000 */ nop -/* F45D10 8026A4E0 240A0000 */ addiu $t2, $zero, 0x0 -/* F45D14 8026A4E4 152A00C3 */ bne $t1, $t2, .L8026A7F4 -/* F45D18 8026A4E8 00000000 */ nop -/* F45D1C 8026A4EC 03688024 */ and $s0, $k1, $t0 -.L8026A4F0: -/* F45D20 8026A4F0 3209FF00 */ andi $t1, $s0, 0xFF00 -.L8026A4F4: -/* F45D24 8026A4F4 00095302 */ srl $t2, $t1, 12 -/* F45D28 8026A4F8 15400003 */ bnez $t2, .L8026A508 -/* F45D2C 8026A4FC 00000000 */ nop -/* F45D30 8026A500 00095202 */ srl $t2, $t1, 8 -/* F45D34 8026A504 214A0010 */ addi $t2, $t2, 0x10 -.L8026A508: -/* F45D38 8026A508 3C018028 */ lui $at, %hi(__osIntOffTable) -/* F45D3C 8026A50C 002A0821 */ addu $at, $at, $t2 -/* F45D40 8026A510 902A8D60 */ lbu $t2, %lo(__osIntOffTable)($at) -/* F45D44 8026A514 3C018028 */ lui $at, %hi(__osIntTable) -/* F45D48 8026A518 002A0821 */ addu $at, $at, $t2 -/* F45D4C 8026A51C 8C2A8D80 */ lw $t2, %lo(__osIntTable)($at) -/* F45D50 8026A520 01400008 */ jr $t2 -/* F45D54 8026A524 00000000 */ nop -IP6_Hdlr: -/* F45D58 8026A528 2401DFFF */ addiu $at, $zero, -0x2001 -/* F45D5C 8026A52C 1000FFF0 */ b .L8026A4F0 -/* F45D60 8026A530 02018024 */ and $s0, $s0, $at -IP7_Hdlr: -/* F45D64 8026A534 2401BFFF */ addiu $at, $zero, -0x4001 -/* F45D68 8026A538 1000FFED */ b .L8026A4F0 -/* F45D6C 8026A53C 02018024 */ and $s0, $s0, $at -counter: -/* F45D70 8026A540 40095800 */ mfc0 $t1, $11 -/* F45D74 8026A544 40895800 */ mtc0 $t1, $11 -/* F45D78 8026A548 0C09AA09 */ jal func_8026A824 -/* F45D7C 8026A54C 24040018 */ addiu $a0, $zero, 0x18 -/* F45D80 8026A550 3C01FFFF */ lui $at, (0xFFFF7FFF >> 16) -/* F45D84 8026A554 34217FFF */ ori $at, $at, (0xFFFF7FFF & 0xFFFF) -/* F45D88 8026A558 1000FFE5 */ b .L8026A4F0 -/* F45D8C 8026A55C 02018024 */ and $s0, $s0, $at -cart: -/* F45D90 8026A560 2401F7FF */ addiu $at, $zero, -0x801 -/* F45D94 8026A564 02018024 */ and $s0, $s0, $at -/* F45D98 8026A568 240A0004 */ addiu $t2, $zero, 0x4 -/* F45D9C 8026A56C 3C018027 */ lui $at, %hi(__osHwIntTable) -/* F45DA0 8026A570 002A0821 */ addu $at, $at, $t2 -/* F45DA4 8026A574 8C2A7350 */ lw $t2, %lo(__osHwIntTable)($at) -/* F45DA8 8026A578 3C1D8028 */ lui $sp, %hi(leoDiskStack) -/* F45DAC 8026A57C 27BD5F90 */ addiu $sp, $sp, %lo(leoDiskStack) -/* F45DB0 8026A580 24040010 */ addiu $a0, $zero, 0x10 -/* F45DB4 8026A584 11400007 */ beqz $t2, .L8026A5A4 -/* F45DB8 8026A588 27BD0FF0 */ addiu $sp, $sp, 0xFF0 -/* F45DBC 8026A58C 0140F809 */ jalr $t2 -/* F45DC0 8026A590 00000000 */ nop -/* F45DC4 8026A594 10400003 */ beqz $v0, .L8026A5A4 -/* F45DC8 8026A598 00000000 */ nop -/* F45DCC 8026A59C 10000082 */ b redispatch -/* F45DD0 8026A5A0 00000000 */ nop -.L8026A5A4: -/* F45DD4 8026A5A4 0C09AA09 */ jal func_8026A824 -/* F45DD8 8026A5A8 00000000 */ nop -/* F45DDC 8026A5AC 1000FFD1 */ b .L8026A4F4 -/* F45DE0 8026A5B0 3209FF00 */ andi $t1, $s0, 0xFF00 -rcp: -/* F45DE4 8026A5B4 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) -/* F45DE8 8026A5B8 25087130 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* F45DEC 8026A5BC 8D080000 */ lw $t0, 0x0($t0) -/* F45DF0 8026A5C0 3C11A430 */ lui $s1, %hi(PHYS_TO_K1(MI_INTR_REG)) -/* F45DF4 8026A5C4 8E310008 */ lw $s1, %lo(PHYS_TO_K1(MI_INTR_REG))($s1) -/* F45DF8 8026A5C8 00084402 */ srl $t0, $t0, 16 -/* F45DFC 8026A5CC 02288824 */ and $s1, $s1, $t0 -/* F45E00 8026A5D0 32290001 */ andi $t1, $s1, 0x1 -/* F45E04 8026A5D4 51200014 */ beql $t1, $zero, .L8026A628 -/* F45E08 8026A5D8 32290008 */ andi $t1, $s1, 0x8 -/* F45E0C 8026A5DC 3C0CA404 */ lui $t4, %hi(PHYS_TO_K1(SP_STATUS_REG)) -/* F45E10 8026A5E0 8D8C0010 */ lw $t4, %lo(PHYS_TO_K1(SP_STATUS_REG))($t4) -/* F45E14 8026A5E4 24090008 */ addiu $t1, $zero, 0x8 -/* F45E18 8026A5E8 3C01A404 */ lui $at, %hi(PHYS_TO_K1(SP_STATUS_REG)) -/* F45E1C 8026A5EC 318C0300 */ andi $t4, $t4, 0x300 -/* F45E20 8026A5F0 3231003E */ andi $s1, $s1, 0x3E -/* F45E24 8026A5F4 11800007 */ beqz $t4, .L8026A614 -/* F45E28 8026A5F8 AC290010 */ sw $t1, %lo(PHYS_TO_K1(SP_STATUS_REG))($at) -/* F45E2C 8026A5FC 0C09AA09 */ jal func_8026A824 -/* F45E30 8026A600 24040020 */ addiu $a0, $zero, 0x20 -/* F45E34 8026A604 52200039 */ beql $s1, $zero, .L8026A6EC -/* F45E38 8026A608 2401FBFF */ addiu $at, $zero, -0x401 -/* F45E3C 8026A60C 10000006 */ b .L8026A628 -/* F45E40 8026A610 32290008 */ andi $t1, $s1, 0x8 -.L8026A614: -/* F45E44 8026A614 0C09AA09 */ jal func_8026A824 -/* F45E48 8026A618 24040058 */ addiu $a0, $zero, 0x58 -/* F45E4C 8026A61C 52200033 */ beql $s1, $zero, .L8026A6EC -/* F45E50 8026A620 2401FBFF */ addiu $at, $zero, -0x401 -/* F45E54 8026A624 32290008 */ andi $t1, $s1, 0x8 -.L8026A628: -/* F45E58 8026A628 11200007 */ beqz $t1, .L8026A648 -/* F45E5C 8026A62C 3C01A440 */ lui $at, %hi(PHYS_TO_K1(VI_CURRENT_REG)) -/* F45E60 8026A630 32310037 */ andi $s1, $s1, 0x37 -/* F45E64 8026A634 AC200010 */ sw $zero, %lo(PHYS_TO_K1(VI_CURRENT_REG))($at) -/* F45E68 8026A638 0C09AA09 */ jal func_8026A824 -/* F45E6C 8026A63C 24040038 */ addiu $a0, $zero, 0x38 -/* F45E70 8026A640 5220002A */ beql $s1, $zero, .L8026A6EC -/* F45E74 8026A644 2401FBFF */ addiu $at, $zero, -0x401 -.L8026A648: -/* F45E78 8026A648 32290004 */ andi $t1, $s1, 0x4 -/* F45E7C 8026A64C 5120000A */ beql $t1, $zero, .L8026A678 -/* F45E80 8026A650 32290002 */ andi $t1, $s1, 0x2 -/* F45E84 8026A654 24090001 */ addiu $t1, $zero, 0x1 -/* F45E88 8026A658 3C01A450 */ lui $at, %hi(PHYS_TO_K1(AI_STATUS_REG)) -/* F45E8C 8026A65C 3231003B */ andi $s1, $s1, 0x3B -/* F45E90 8026A660 AC29000C */ sw $t1, %lo(PHYS_TO_K1(AI_STATUS_REG))($at) -/* F45E94 8026A664 0C09AA09 */ jal func_8026A824 -/* F45E98 8026A668 24040030 */ addiu $a0, $zero, 0x30 -/* F45E9C 8026A66C 5220001F */ beql $s1, $zero, .L8026A6EC -/* F45EA0 8026A670 2401FBFF */ addiu $at, $zero, -0x401 -/* F45EA4 8026A674 32290002 */ andi $t1, $s1, 0x2 -.L8026A678: -/* F45EA8 8026A678 11200007 */ beqz $t1, .L8026A698 -/* F45EAC 8026A67C 3C01A480 */ lui $at, %hi(PHYS_TO_K1(SI_STATUS_REG)) -/* F45EB0 8026A680 3231003D */ andi $s1, $s1, 0x3D -/* F45EB4 8026A684 AC200018 */ sw $zero, %lo(PHYS_TO_K1(SI_STATUS_REG))($at) -/* F45EB8 8026A688 0C09AA09 */ jal func_8026A824 -/* F45EBC 8026A68C 24040028 */ addiu $a0, $zero, 0x28 -/* F45EC0 8026A690 52200016 */ beql $s1, $zero, .L8026A6EC -/* F45EC4 8026A694 2401FBFF */ addiu $at, $zero, -0x401 -.L8026A698: -/* F45EC8 8026A698 32290010 */ andi $t1, $s1, 0x10 -/* F45ECC 8026A69C 5120000A */ beql $t1, $zero, .L8026A6C8 -/* F45ED0 8026A6A0 32290020 */ andi $t1, $s1, 0x20 -/* F45ED4 8026A6A4 24090002 */ addiu $t1, $zero, 0x2 -/* F45ED8 8026A6A8 3C01A460 */ lui $at, %hi(PHYS_TO_K1(PI_STATUS_REG)) -/* F45EDC 8026A6AC 3231002F */ andi $s1, $s1, 0x2F -/* F45EE0 8026A6B0 AC290010 */ sw $t1, %lo(PHYS_TO_K1(PI_STATUS_REG))($at) -/* F45EE4 8026A6B4 0C09AA09 */ jal func_8026A824 -/* F45EE8 8026A6B8 24040040 */ addiu $a0, $zero, 0x40 -/* F45EEC 8026A6BC 5220000B */ beql $s1, $zero, .L8026A6EC -/* F45EF0 8026A6C0 2401FBFF */ addiu $at, $zero, -0x401 -/* F45EF4 8026A6C4 32290020 */ andi $t1, $s1, 0x20 -.L8026A6C8: -/* F45EF8 8026A6C8 51200008 */ beql $t1, $zero, .L8026A6EC -/* F45EFC 8026A6CC 2401FBFF */ addiu $at, $zero, -0x401 -/* F45F00 8026A6D0 24090800 */ addiu $t1, $zero, 0x800 -/* F45F04 8026A6D4 3C01A430 */ lui $at, %hi(PHYS_TO_K1(MI_MODE_REG)) -/* F45F08 8026A6D8 3231001F */ andi $s1, $s1, 0x1F -/* F45F0C 8026A6DC AC290000 */ sw $t1, %lo(PHYS_TO_K1(MI_MODE_REG))($at) -/* F45F10 8026A6E0 0C09AA09 */ jal func_8026A824 -/* F45F14 8026A6E4 24040048 */ addiu $a0, $zero, 0x48 -/* F45F18 8026A6E8 2401FBFF */ addiu $at, $zero, -0x401 -.L8026A6EC: -/* F45F1C 8026A6EC 1000FF80 */ b .L8026A4F0 -/* F45F20 8026A6F0 02018024 */ and $s0, $s0, $at -prenmi: -/* F45F24 8026A6F4 8F5B0118 */ lw $k1, 0x118($k0) -/* F45F28 8026A6F8 2401EFFF */ addiu $at, $zero, -0x1001 -/* F45F2C 8026A6FC 3C098027 */ lui $t1, %hi(__osShutdown) -/* F45F30 8026A700 0361D824 */ and $k1, $k1, $at -/* F45F34 8026A704 AF5B0118 */ sw $k1, 0x118($k0) -/* F45F38 8026A708 2529712C */ addiu $t1, $t1, %lo(__osShutdown) -/* F45F3C 8026A70C 8D2A0000 */ lw $t2, 0x0($t1) -/* F45F40 8026A710 11400003 */ beqz $t2, firstnmi -/* F45F44 8026A714 2401EFFF */ addiu $at, $zero, -0x1001 -/* F45F48 8026A718 10000023 */ b redispatch -/* F45F4C 8026A71C 02018024 */ and $s0, $s0, $at -firstnmi: -/* F45F50 8026A720 240A0001 */ addiu $t2, $zero, 0x1 -/* F45F54 8026A724 AD2A0000 */ sw $t2, 0x0($t1) -/* F45F58 8026A728 0C09AA09 */ jal func_8026A824 -/* F45F5C 8026A72C 24040070 */ addiu $a0, $zero, 0x70 -/* F45F60 8026A730 3C0A8027 */ lui $t2, %hi(__osRunQueue) -/* F45F64 8026A734 8D4A7378 */ lw $t2, %lo(__osRunQueue)($t2) -/* F45F68 8026A738 2401EFFF */ addiu $at, $zero, -0x1001 -/* F45F6C 8026A73C 02018024 */ and $s0, $s0, $at -/* F45F70 8026A740 8D5B0118 */ lw $k1, 0x118($t2) -/* F45F74 8026A744 0361D824 */ and $k1, $k1, $at -/* F45F78 8026A748 10000017 */ b redispatch -/* F45F7C 8026A74C AD5B0118 */ sw $k1, 0x118($t2) -sw2: -/* F45F80 8026A750 2401FDFF */ addiu $at, $zero, -0x201 -/* F45F84 8026A754 01014024 */ and $t0, $t0, $at -/* F45F88 8026A758 40886800 */ mtc0 $t0, $13 -/* F45F8C 8026A75C 0C09AA09 */ jal func_8026A824 -/* F45F90 8026A760 24040008 */ addiu $a0, $zero, 0x8 -/* F45F94 8026A764 2401FDFF */ addiu $at, $zero, -0x201 -/* F45F98 8026A768 1000FF61 */ b .L8026A4F0 -/* F45F9C 8026A76C 02018024 */ and $s0, $s0, $at -sw1: -/* F45FA0 8026A770 2401FEFF */ addiu $at, $zero, -0x101 -/* F45FA4 8026A774 01014024 */ and $t0, $t0, $at -/* F45FA8 8026A778 40886800 */ mtc0 $t0, $13 -/* F45FAC 8026A77C 0C09AA09 */ jal func_8026A824 -/* F45FB0 8026A780 24040000 */ addiu $a0, $zero, 0x0 -/* F45FB4 8026A784 2401FEFF */ addiu $at, $zero, -0x101 -/* F45FB8 8026A788 1000FF59 */ b .L8026A4F0 -/* F45FBC 8026A78C 02018024 */ and $s0, $s0, $at -/* F45FC0 8026A790 24090001 */ addiu $t1, $zero, 0x1 -handle_break: -/* F45FC4 8026A794 A7490012 */ sh $t1, 0x12($k0) -/* F45FC8 8026A798 0C09AA09 */ jal func_8026A824 -/* F45FCC 8026A79C 24040050 */ addiu $a0, $zero, 0x50 -/* F45FD0 8026A7A0 10000001 */ b redispatch -/* F45FD4 8026A7A4 00000000 */ nop -redispatch: -/* F45FD8 8026A7A8 3C0A8027 */ lui $t2, %hi(__osRunQueue) -/* F45FDC 8026A7AC 8D4A7378 */ lw $t2, %lo(__osRunQueue)($t2) -/* F45FE0 8026A7B0 8F490004 */ lw $t1, 0x4($k0) -/* F45FE4 8026A7B4 8D4B0004 */ lw $t3, 0x4($t2) -/* F45FE8 8026A7B8 012B082A */ slt $at, $t1, $t3 -/* F45FEC 8026A7BC 10200007 */ beqz $at, enqueueRunning -/* F45FF0 8026A7C0 00000000 */ nop -/* F45FF4 8026A7C4 3C048027 */ lui $a0, %hi(__osRunQueue) -/* F45FF8 8026A7C8 03402825 */ or $a1, $k0, $zero -/* F45FFC 8026A7CC 0C09AA83 */ jal __osEnqueueThread -/* F46000 8026A7D0 24847378 */ addiu $a0, $a0, %lo(__osRunQueue) -/* F46004 8026A7D4 0809AA99 */ j __osDispatchThread -/* F46008 8026A7D8 00000000 */ nop -enqueueRunning: -/* F4600C 8026A7DC 3C098027 */ lui $t1, %hi(__osRunQueue) -/* F46010 8026A7E0 25297378 */ addiu $t1, $t1, %lo(__osRunQueue) -/* F46014 8026A7E4 8D2A0000 */ lw $t2, 0x0($t1) -/* F46018 8026A7E8 AF4A0000 */ sw $t2, 0x0($k0) -/* F4601C 8026A7EC 0809AA99 */ j __osDispatchThread -/* F46020 8026A7F0 AD3A0000 */ sw $k0, 0x0($t1) -.L8026A7F4: -/* F46024 8026A7F4 3C018027 */ lui $at, %hi(__osFaultedThread) -/* F46028 8026A7F8 AC3A7384 */ sw $k0, %lo(__osFaultedThread)($at) -/* F4602C 8026A7FC 24090001 */ addiu $t1, $zero, 0x1 -/* F46030 8026A800 A7490010 */ sh $t1, 0x10($k0) -/* F46034 8026A804 24090002 */ addiu $t1, $zero, 0x2 -/* F46038 8026A808 A7490012 */ sh $t1, 0x12($k0) -/* F4603C 8026A80C 400A4000 */ mfc0 $t2, $8 -/* F46040 8026A810 AF4A0124 */ sw $t2, 0x124($k0) -/* F46044 8026A814 0C09AA09 */ jal func_8026A824 -/* F46048 8026A818 24040060 */ addiu $a0, $zero, 0x60 -/* F4604C 8026A81C 0809AA99 */ j __osDispatchThread -/* F46050 8026A820 00000000 */ nop -endlabel func_8026A2E0 -.size func_8026A2E0, . - func_8026A2E0 - -# Handwritten function -glabel func_8026A824 -/* F46054 8026A824 3C0A8028 */ lui $t2, %hi(__osEventStateTab) -/* F46058 8026A828 254A4660 */ addiu $t2, $t2, %lo(__osEventStateTab) -/* F4605C 8026A82C 01445021 */ addu $t2, $t2, $a0 -/* F46060 8026A830 8D490000 */ lw $t1, 0x0($t2) -/* F46064 8026A834 03E09025 */ or $s2, $ra, $zero -/* F46068 8026A838 11200025 */ beqz $t1, .L8026A8D0 -/* F4606C 8026A83C 00000000 */ nop -/* F46070 8026A840 8D2B0008 */ lw $t3, 0x8($t1) -/* F46074 8026A844 8D2C0010 */ lw $t4, 0x10($t1) -/* F46078 8026A848 016C082A */ slt $at, $t3, $t4 -/* F4607C 8026A84C 10200020 */ beqz $at, .L8026A8D0 -/* F46080 8026A850 00000000 */ nop -/* F46084 8026A854 8D2D000C */ lw $t5, 0xC($t1) -/* F46088 8026A858 01AB6821 */ addu $t5, $t5, $t3 -/* F4608C 8026A85C 01AC001A */ div $zero, $t5, $t4 -/* F46090 8026A860 15800002 */ bnez $t4, .L8026A86C -/* F46094 8026A864 00000000 */ nop -/* F46098 8026A868 0007000D */ break 7 -.L8026A86C: -/* F4609C 8026A86C 2401FFFF */ addiu $at, $zero, -0x1 -/* F460A0 8026A870 15810004 */ bne $t4, $at, .L8026A884 -/* F460A4 8026A874 3C018000 */ lui $at, (0x80000000 >> 16) -/* F460A8 8026A878 15A10002 */ bne $t5, $at, .L8026A884 -/* F460AC 8026A87C 00000000 */ nop -/* F460B0 8026A880 0006000D */ break 6 -.L8026A884: -/* F460B4 8026A884 8D2C0014 */ lw $t4, 0x14($t1) -/* F460B8 8026A888 00006810 */ mfhi $t5 -/* F460BC 8026A88C 000D6880 */ sll $t5, $t5, 2 -/* F460C0 8026A890 018D6021 */ addu $t4, $t4, $t5 -/* F460C4 8026A894 8D4D0004 */ lw $t5, 0x4($t2) -/* F460C8 8026A898 256A0001 */ addiu $t2, $t3, 0x1 -/* F460CC 8026A89C AD8D0000 */ sw $t5, 0x0($t4) -/* F460D0 8026A8A0 AD2A0008 */ sw $t2, 0x8($t1) -/* F460D4 8026A8A4 8D2A0000 */ lw $t2, 0x0($t1) -/* F460D8 8026A8A8 8D4B0000 */ lw $t3, 0x0($t2) -/* F460DC 8026A8AC 11600008 */ beqz $t3, .L8026A8D0 -/* F460E0 8026A8B0 00000000 */ nop -/* F460E4 8026A8B4 0C09AA95 */ jal __osPopThread -/* F460E8 8026A8B8 01202025 */ or $a0, $t1, $zero -/* F460EC 8026A8BC 00405025 */ or $t2, $v0, $zero -/* F460F0 8026A8C0 3C048027 */ lui $a0, %hi(__osRunQueue) -/* F460F4 8026A8C4 01402825 */ or $a1, $t2, $zero -/* F460F8 8026A8C8 0C09AA83 */ jal __osEnqueueThread -/* F460FC 8026A8CC 24847378 */ addiu $a0, $a0, %lo(__osRunQueue) -.L8026A8D0: -/* F46100 8026A8D0 02400008 */ jr $s2 -/* F46104 8026A8D4 00000000 */ nop -.L8026A8D8: -/* F46108 8026A8D8 3C013000 */ lui $at, (0x30000000 >> 16) -/* F4610C 8026A8DC 01014824 */ and $t1, $t0, $at -/* F46110 8026A8E0 00094F02 */ srl $t1, $t1, 28 -/* F46114 8026A8E4 240A0001 */ addiu $t2, $zero, 0x1 -/* F46118 8026A8E8 152AFFC2 */ bne $t1, $t2, .L8026A7F4 -/* F4611C 8026A8EC 00000000 */ nop -/* F46120 8026A8F0 8F5B0118 */ lw $k1, 0x118($k0) -/* F46124 8026A8F4 3C012000 */ lui $at, (0x20000000 >> 16) -/* F46128 8026A8F8 24090001 */ addiu $t1, $zero, 0x1 -/* F4612C 8026A8FC 0361D825 */ or $k1, $k1, $at -/* F46130 8026A900 AF490018 */ sw $t1, 0x18($k0) -/* F46134 8026A904 1000FFB5 */ b enqueueRunning -/* F46138 8026A908 AF5B0118 */ sw $k1, 0x118($k0) -endlabel func_8026A824 -.size func_8026A824, . - func_8026A824 - -# Handwritten function -glabel __osEnqueueAndYield -/* F4613C 8026A90C 3C058027 */ lui $a1, %hi(__osRunningThread) -/* F46140 8026A910 8CA57380 */ lw $a1, %lo(__osRunningThread)($a1) -/* F46144 8026A914 40086000 */ mfc0 $t0, $12 -/* F46148 8026A918 8CBB0018 */ lw $k1, 0x18($a1) -/* F4614C 8026A91C 35080002 */ ori $t0, $t0, 0x2 -/* F46150 8026A920 ACA80118 */ sw $t0, 0x118($a1) -/* F46154 8026A924 FCB00098 */ sd $s0, 0x98($a1) -/* F46158 8026A928 FCB100A0 */ sd $s1, 0xA0($a1) -/* F4615C 8026A92C FCB200A8 */ sd $s2, 0xA8($a1) -/* F46160 8026A930 FCB300B0 */ sd $s3, 0xB0($a1) -/* F46164 8026A934 FCB400B8 */ sd $s4, 0xB8($a1) -/* F46168 8026A938 FCB500C0 */ sd $s5, 0xC0($a1) -/* F4616C 8026A93C FCB600C8 */ sd $s6, 0xC8($a1) -/* F46170 8026A940 FCB700D0 */ sd $s7, 0xD0($a1) -/* F46174 8026A944 FCBC00E8 */ sd $gp, 0xE8($a1) -/* F46178 8026A948 FCBD00F0 */ sd $sp, 0xF0($a1) -/* F4617C 8026A94C FCBE00F8 */ sd $fp, 0xF8($a1) -/* F46180 8026A950 FCBF0100 */ sd $ra, 0x100($a1) -/* F46184 8026A954 13600009 */ beqz $k1, .L8026A97C -/* F46188 8026A958 ACBF011C */ sw $ra, 0x11C($a1) -/* F4618C 8026A95C 445BF800 */ cfc1 $k1, $31 -/* F46190 8026A960 F4B40180 */ sdc1 $f20, 0x180($a1) -/* F46194 8026A964 F4B60188 */ sdc1 $f22, 0x188($a1) -/* F46198 8026A968 F4B80190 */ sdc1 $f24, 0x190($a1) -/* F4619C 8026A96C F4BA0198 */ sdc1 $f26, 0x198($a1) -/* F461A0 8026A970 F4BC01A0 */ sdc1 $f28, 0x1A0($a1) -/* F461A4 8026A974 F4BE01A8 */ sdc1 $f30, 0x1A8($a1) -/* F461A8 8026A978 ACBB012C */ sw $k1, 0x12C($a1) -.L8026A97C: -/* F461AC 8026A97C 8CBB0118 */ lw $k1, 0x118($a1) -/* F461B0 8026A980 3369FF00 */ andi $t1, $k1, 0xFF00 -/* F461B4 8026A984 5120000E */ beql $t1, $zero, .L8026A9C0 -/* F461B8 8026A988 3C1BA430 */ lui $k1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) -/* F461BC 8026A98C 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) -/* F461C0 8026A990 25087130 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* F461C4 8026A994 8D080000 */ lw $t0, 0x0($t0) -/* F461C8 8026A998 2401FFFF */ addiu $at, $zero, -0x1 -/* F461CC 8026A99C 01014026 */ xor $t0, $t0, $at -/* F461D0 8026A9A0 3C01FFFF */ lui $at, (0xFFFF00FF >> 16) -/* F461D4 8026A9A4 3108FF00 */ andi $t0, $t0, 0xFF00 -/* F461D8 8026A9A8 342100FF */ ori $at, $at, (0xFFFF00FF & 0xFFFF) -/* F461DC 8026A9AC 01284825 */ or $t1, $t1, $t0 -/* F461E0 8026A9B0 0361D824 */ and $k1, $k1, $at -/* F461E4 8026A9B4 0369D825 */ or $k1, $k1, $t1 -/* F461E8 8026A9B8 ACBB0118 */ sw $k1, 0x118($a1) -/* F461EC 8026A9BC 3C1BA430 */ lui $k1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) -.L8026A9C0: -/* F461F0 8026A9C0 8F7B000C */ lw $k1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($k1) -/* F461F4 8026A9C4 1360000B */ beqz $k1, .L8026A9F4 -/* F461F8 8026A9C8 00000000 */ nop -/* F461FC 8026A9CC 3C1A8027 */ lui $k0, %hi(__OSGlobalIntMask) -/* F46200 8026A9D0 275A7130 */ addiu $k0, $k0, %lo(__OSGlobalIntMask) -/* F46204 8026A9D4 8F5A0000 */ lw $k0, 0x0($k0) -/* F46208 8026A9D8 8CA80128 */ lw $t0, 0x128($a1) -/* F4620C 8026A9DC 2401FFFF */ addiu $at, $zero, -0x1 -/* F46210 8026A9E0 001AD402 */ srl $k0, $k0, 16 -/* F46214 8026A9E4 0341D026 */ xor $k0, $k0, $at -/* F46218 8026A9E8 335A003F */ andi $k0, $k0, 0x3F -/* F4621C 8026A9EC 0348D024 */ and $k0, $k0, $t0 -/* F46220 8026A9F0 037AD825 */ or $k1, $k1, $k0 -.L8026A9F4: -/* F46224 8026A9F4 10800003 */ beqz $a0, .L8026AA04 -/* F46228 8026A9F8 ACBB0128 */ sw $k1, 0x128($a1) -/* F4622C 8026A9FC 0C09AA83 */ jal __osEnqueueThread -/* F46230 8026AA00 00000000 */ nop -.L8026AA04: -/* F46234 8026AA04 0809AA99 */ j __osDispatchThread -/* F46238 8026AA08 00000000 */ nop -endlabel __osEnqueueAndYield -.size __osEnqueueAndYield, . - __osEnqueueAndYield - -glabel __osEnqueueThread -/* F4623C 8026AA0C 8C980000 */ lw $t8, 0x0($a0) -/* F46240 8026AA10 8CAF0004 */ lw $t7, 0x4($a1) -/* F46244 8026AA14 0080C825 */ or $t9, $a0, $zero -/* F46248 8026AA18 8F0E0004 */ lw $t6, 0x4($t8) -/* F4624C 8026AA1C 01CF082A */ slt $at, $t6, $t7 -/* F46250 8026AA20 54200008 */ bnel $at, $zero, .L8026AA44 -/* F46254 8026AA24 8F380000 */ lw $t8, 0x0($t9) -/* F46258 8026AA28 0300C825 */ or $t9, $t8, $zero -.L8026AA2C: -/* F4625C 8026AA2C 8F180000 */ lw $t8, 0x0($t8) -/* F46260 8026AA30 8F0E0004 */ lw $t6, 0x4($t8) -/* F46264 8026AA34 01CF082A */ slt $at, $t6, $t7 -/* F46268 8026AA38 5020FFFC */ beql $at, $zero, .L8026AA2C -/* F4626C 8026AA3C 0300C825 */ or $t9, $t8, $zero -/* F46270 8026AA40 8F380000 */ lw $t8, 0x0($t9) -.L8026AA44: -/* F46274 8026AA44 ACB80000 */ sw $t8, 0x0($a1) -/* F46278 8026AA48 AF250000 */ sw $a1, 0x0($t9) -/* F4627C 8026AA4C 03E00008 */ jr $ra -/* F46280 8026AA50 ACA40008 */ sw $a0, 0x8($a1) -endlabel __osEnqueueThread -.size __osEnqueueThread, . - __osEnqueueThread - -glabel __osPopThread -/* F46284 8026AA54 8C820000 */ lw $v0, 0x0($a0) -/* F46288 8026AA58 8C590000 */ lw $t9, 0x0($v0) -/* F4628C 8026AA5C 03E00008 */ jr $ra -/* F46290 8026AA60 AC990000 */ sw $t9, 0x0($a0) -endlabel __osPopThread -.size __osPopThread, . - __osPopThread - -# Handwritten function -glabel __osDispatchThread -/* F46294 8026AA64 3C048027 */ lui $a0, %hi(__osRunQueue) -/* F46298 8026AA68 0C09AA95 */ jal __osPopThread -/* F4629C 8026AA6C 24847378 */ addiu $a0, $a0, %lo(__osRunQueue) -/* F462A0 8026AA70 3C018027 */ lui $at, %hi(__osRunningThread) -/* F462A4 8026AA74 AC227380 */ sw $v0, %lo(__osRunningThread)($at) -/* F462A8 8026AA78 24080004 */ addiu $t0, $zero, 0x4 -/* F462AC 8026AA7C A4480010 */ sh $t0, 0x10($v0) -/* F462B0 8026AA80 0040D025 */ or $k0, $v0, $zero -/* F462B4 8026AA84 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) -/* F462B8 8026AA88 8F5B0118 */ lw $k1, 0x118($k0) -/* F462BC 8026AA8C 25087130 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* F462C0 8026AA90 8D080000 */ lw $t0, 0x0($t0) -/* F462C4 8026AA94 3C01FFFF */ lui $at, (0xFFFF00FF >> 16) -/* F462C8 8026AA98 3369FF00 */ andi $t1, $k1, 0xFF00 -/* F462CC 8026AA9C 342100FF */ ori $at, $at, (0xFFFF00FF & 0xFFFF) -/* F462D0 8026AAA0 3108FF00 */ andi $t0, $t0, 0xFF00 -/* F462D4 8026AAA4 01284824 */ and $t1, $t1, $t0 -/* F462D8 8026AAA8 0361D824 */ and $k1, $k1, $at -/* F462DC 8026AAAC 0369D825 */ or $k1, $k1, $t1 -/* F462E0 8026AAB0 409B6000 */ mtc0 $k1, $12 -/* F462E4 8026AAB4 DF5B0108 */ ld $k1, 0x108($k0) -/* F462E8 8026AAB8 DF410020 */ ld $at, 0x20($k0) -/* F462EC 8026AABC DF420028 */ ld $v0, 0x28($k0) -/* F462F0 8026AAC0 03600013 */ mtlo $k1 -/* F462F4 8026AAC4 DF5B0110 */ ld $k1, 0x110($k0) -/* F462F8 8026AAC8 DF430030 */ ld $v1, 0x30($k0) -/* F462FC 8026AACC DF440038 */ ld $a0, 0x38($k0) -/* F46300 8026AAD0 DF450040 */ ld $a1, 0x40($k0) -/* F46304 8026AAD4 DF460048 */ ld $a2, 0x48($k0) -/* F46308 8026AAD8 DF470050 */ ld $a3, 0x50($k0) -/* F4630C 8026AADC DF480058 */ ld $t0, 0x58($k0) -/* F46310 8026AAE0 DF490060 */ ld $t1, 0x60($k0) -/* F46314 8026AAE4 DF4A0068 */ ld $t2, 0x68($k0) -/* F46318 8026AAE8 DF4B0070 */ ld $t3, 0x70($k0) -/* F4631C 8026AAEC DF4C0078 */ ld $t4, 0x78($k0) -/* F46320 8026AAF0 DF4D0080 */ ld $t5, 0x80($k0) -/* F46324 8026AAF4 DF4E0088 */ ld $t6, 0x88($k0) -/* F46328 8026AAF8 DF4F0090 */ ld $t7, 0x90($k0) -/* F4632C 8026AAFC DF500098 */ ld $s0, 0x98($k0) -/* F46330 8026AB00 DF5100A0 */ ld $s1, 0xA0($k0) -/* F46334 8026AB04 DF5200A8 */ ld $s2, 0xA8($k0) -/* F46338 8026AB08 DF5300B0 */ ld $s3, 0xB0($k0) -/* F4633C 8026AB0C DF5400B8 */ ld $s4, 0xB8($k0) -/* F46340 8026AB10 DF5500C0 */ ld $s5, 0xC0($k0) -/* F46344 8026AB14 DF5600C8 */ ld $s6, 0xC8($k0) -/* F46348 8026AB18 DF5700D0 */ ld $s7, 0xD0($k0) -/* F4634C 8026AB1C DF5800D8 */ ld $t8, 0xD8($k0) -/* F46350 8026AB20 DF5900E0 */ ld $t9, 0xE0($k0) -/* F46354 8026AB24 DF5C00E8 */ ld $gp, 0xE8($k0) -/* F46358 8026AB28 03600011 */ mthi $k1 -/* F4635C 8026AB2C DF5D00F0 */ ld $sp, 0xF0($k0) -/* F46360 8026AB30 DF5E00F8 */ ld $fp, 0xF8($k0) -/* F46364 8026AB34 DF5F0100 */ ld $ra, 0x100($k0) -/* F46368 8026AB38 8F5B011C */ lw $k1, 0x11C($k0) -/* F4636C 8026AB3C 409B7000 */ mtc0 $k1, $14 -/* F46370 8026AB40 8F5B0018 */ lw $k1, 0x18($k0) -/* F46374 8026AB44 13600013 */ beqz $k1, .L8026AB94 -/* F46378 8026AB48 00000000 */ nop -/* F4637C 8026AB4C 8F5B012C */ lw $k1, 0x12C($k0) -/* F46380 8026AB50 44DBF800 */ ctc1 $k1, $31 -/* F46384 8026AB54 D7400130 */ ldc1 $f0, 0x130($k0) -/* F46388 8026AB58 D7420138 */ ldc1 $f2, 0x138($k0) -/* F4638C 8026AB5C D7440140 */ ldc1 $f4, 0x140($k0) -/* F46390 8026AB60 D7460148 */ ldc1 $f6, 0x148($k0) -/* F46394 8026AB64 D7480150 */ ldc1 $f8, 0x150($k0) -/* F46398 8026AB68 D74A0158 */ ldc1 $f10, 0x158($k0) -/* F4639C 8026AB6C D74C0160 */ ldc1 $f12, 0x160($k0) -/* F463A0 8026AB70 D74E0168 */ ldc1 $f14, 0x168($k0) -/* F463A4 8026AB74 D7500170 */ ldc1 $f16, 0x170($k0) -/* F463A8 8026AB78 D7520178 */ ldc1 $f18, 0x178($k0) -/* F463AC 8026AB7C D7540180 */ ldc1 $f20, 0x180($k0) -/* F463B0 8026AB80 D7560188 */ ldc1 $f22, 0x188($k0) -/* F463B4 8026AB84 D7580190 */ ldc1 $f24, 0x190($k0) -/* F463B8 8026AB88 D75A0198 */ ldc1 $f26, 0x198($k0) -/* F463BC 8026AB8C D75C01A0 */ ldc1 $f28, 0x1A0($k0) -/* F463C0 8026AB90 D75E01A8 */ ldc1 $f30, 0x1A8($k0) -.L8026AB94: -/* F463C4 8026AB94 8F5B0128 */ lw $k1, 0x128($k0) -/* F463C8 8026AB98 3C1A8027 */ lui $k0, %hi(__OSGlobalIntMask) -/* F463CC 8026AB9C 275A7130 */ addiu $k0, $k0, %lo(__OSGlobalIntMask) -/* F463D0 8026ABA0 8F5A0000 */ lw $k0, 0x0($k0) -/* F463D4 8026ABA4 001AD402 */ srl $k0, $k0, 16 -/* F463D8 8026ABA8 037AD824 */ and $k1, $k1, $k0 -/* F463DC 8026ABAC 001BD840 */ sll $k1, $k1, 1 -/* F463E0 8026ABB0 3C1A8028 */ lui $k0, %hi(__osRcpImTable) -/* F463E4 8026ABB4 275A8C60 */ addiu $k0, $k0, %lo(__osRcpImTable) -/* F463E8 8026ABB8 037AD821 */ addu $k1, $k1, $k0 -/* F463EC 8026ABBC 977B0000 */ lhu $k1, 0x0($k1) -/* F463F0 8026ABC0 3C1AA430 */ lui $k0, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) -/* F463F4 8026ABC4 275A000C */ addiu $k0, $k0, %lo(PHYS_TO_K1(MI_INTR_MASK_REG)) -/* F463F8 8026ABC8 AF5B0000 */ sw $k1, 0x0($k0) -/* F463FC 8026ABCC 00000000 */ nop -/* F46400 8026ABD0 00000000 */ nop -/* F46404 8026ABD4 00000000 */ nop -/* F46408 8026ABD8 00000000 */ nop -/* F4640C 8026ABDC 42000018 */ eret -endlabel __osDispatchThread -.size __osDispatchThread, . - __osDispatchThread - -glabel __osCleanupThread -/* F46410 8026ABE0 0C09936C */ jal osDestroyThread -/* F46414 8026ABE4 00002025 */ or $a0, $zero, $zero -/* F46418 8026ABE8 00000000 */ nop -/* F4641C 8026ABEC 00000000 */ nop -endlabel __osCleanupThread -.size __osCleanupThread, . - __osCleanupThread - -# Handwritten function -glabel osMapTLBRdb -/* F46420 8026ABF0 40085000 */ mfc0 $t0, $10 -/* F46424 8026ABF4 2409001F */ addiu $t1, $zero, 0x1F -/* F46428 8026ABF8 40890000 */ mtc0 $t1, $0 -/* F4642C 8026ABFC 40802800 */ mtc0 $zero, $5 -/* F46430 8026AC00 240A0017 */ addiu $t2, $zero, 0x17 -/* F46434 8026AC04 3C09C000 */ lui $t1, (0xC0000000 >> 16) -/* F46438 8026AC08 40895000 */ mtc0 $t1, $10 -/* F4643C 8026AC0C 3C098000 */ lui $t1, (0x80000000 >> 16) -/* F46440 8026AC10 00095982 */ srl $t3, $t1, 6 -/* F46444 8026AC14 016A5825 */ or $t3, $t3, $t2 -/* F46448 8026AC18 408B1000 */ mtc0 $t3, $2 -/* F4644C 8026AC1C 24090001 */ addiu $t1, $zero, 0x1 -/* F46450 8026AC20 40891800 */ mtc0 $t1, $3 -/* F46454 8026AC24 00000000 */ nop -/* F46458 8026AC28 42000002 */ tlbwi -/* F4645C 8026AC2C 00000000 */ nop -/* F46460 8026AC30 00000000 */ nop -/* F46464 8026AC34 00000000 */ nop -/* F46468 8026AC38 00000000 */ nop -/* F4646C 8026AC3C 40885000 */ mtc0 $t0, $10 -/* F46470 8026AC40 03E00008 */ jr $ra -/* F46474 8026AC44 00000000 */ nop -/* F46478 8026AC48 00000000 */ nop -/* F4647C 8026AC4C 00000000 */ nop -endlabel osMapTLBRdb -.size osMapTLBRdb, . - osMapTLBRdb diff --git a/asm/core1/ultra/libm_vals.s b/asm/core1/ultra/libm_vals.s deleted file mode 100644 index b88ad985..00000000 --- a/asm/core1/ultra/libm_vals.s +++ /dev/null @@ -1,5 +0,0 @@ - .rdata - .align 4 - .globl __libm_qnan_f -__libm_qnan_f: - .word 0x7F810000 diff --git a/asm/core1/ultra/parameters.s b/asm/core1/ultra/parameters.s deleted file mode 100644 index 450af31b..00000000 --- a/asm/core1/ultra/parameters.s +++ /dev/null @@ -1,17 +0,0 @@ -#include "PR/R4300.h" -#include "sys/asm.h" -#include "sys/regdef.h" - -.text -ABS(leoBootID, 0x800001a0) -ABS(osTvType, 0x80000300) -ABS(osRomType, 0x80000304) -ABS(osRomBase, 0x80000308) -ABS(osResetType, 0x8000030c) -ABS(osCicId, 0x80000310) -ABS(osVersion, 0x80000314) -ABS(osMemSize, 0x80000318) -ABS(osAppNMIBuffer, 0x8000031c) - -.space 0x60 -/* padded to 0x60 in the object file */ diff --git a/asm/core1/ultra/setintmask.s b/asm/core1/ultra/setintmask.s deleted file mode 100644 index a5cf9f88..00000000 --- a/asm/core1/ultra/setintmask.s +++ /dev/null @@ -1,136 +0,0 @@ -#include -#include -.include "macro.inc" -# assembler directives -.set noat # allow manual use of $at -.set gp=64 # allow use of 64-bit general purpose registers - -.rdata - -#define MI_INTR_MASK 0x3f -#define CLR_SP 0x0001 -#define SET_SP 0x0002 -#define CLR_SI 0x0004 -#define SET_SI 0x0008 -#define CLR_AI 0x0010 -#define SET_AI 0x0020 -#define CLR_VI 0x0040 -#define SET_VI 0x0080 -#define CLR_PI 0x0100 -#define SET_PI 0x0200 -#define CLR_DP 0x0400 -#define SET_DP 0x0800 - -EXPORT(__osRcpImTable) -/* LUT to convert between MI_INTR and MI_INTR_MASK */ -/* MI_INTR is status for each interrupt whereas */ -/* MI_INTR_MASK has seperate bits for set/clr */ -.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP -.half SET_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP -.half CLR_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP -.half SET_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP -.half CLR_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP -.half SET_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP -.half CLR_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP -.half SET_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP -.half CLR_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP -.half SET_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP -.half CLR_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP -.half SET_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP -.half CLR_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | CLR_DP -.half SET_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | CLR_DP -.half CLR_SP | SET_SI | SET_AI | SET_VI | CLR_PI | CLR_DP -.half SET_SP | SET_SI | SET_AI | SET_VI | CLR_PI | CLR_DP -.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP -.half SET_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP -.half CLR_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP -.half SET_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP -.half CLR_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | CLR_DP -.half SET_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | CLR_DP -.half CLR_SP | SET_SI | SET_AI | CLR_VI | SET_PI | CLR_DP -.half SET_SP | SET_SI | SET_AI | CLR_VI | SET_PI | CLR_DP -.half CLR_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | CLR_DP -.half SET_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | CLR_DP -.half CLR_SP | SET_SI | CLR_AI | SET_VI | SET_PI | CLR_DP -.half SET_SP | SET_SI | CLR_AI | SET_VI | SET_PI | CLR_DP -.half CLR_SP | CLR_SI | SET_AI | SET_VI | SET_PI | CLR_DP -.half SET_SP | CLR_SI | SET_AI | SET_VI | SET_PI | CLR_DP -.half CLR_SP | SET_SI | SET_AI | SET_VI | SET_PI | CLR_DP -.half SET_SP | SET_SI | SET_AI | SET_VI | SET_PI | CLR_DP -.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP -.half SET_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP -.half CLR_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP -.half SET_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP -.half CLR_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | SET_DP -.half SET_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | SET_DP -.half CLR_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | SET_DP -.half SET_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | SET_DP -.half CLR_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | SET_DP -.half SET_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | SET_DP -.half CLR_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | SET_DP -.half SET_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | SET_DP -.half CLR_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | SET_DP -.half SET_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | SET_DP -.half CLR_SP | SET_SI | SET_AI | SET_VI | CLR_PI | SET_DP -.half SET_SP | SET_SI | SET_AI | SET_VI | CLR_PI | SET_DP -.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | SET_DP -.half SET_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | SET_DP -.half CLR_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | SET_DP -.half SET_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | SET_DP -.half CLR_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | SET_DP -.half SET_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | SET_DP -.half CLR_SP | SET_SI | SET_AI | CLR_VI | SET_PI | SET_DP -.half SET_SP | SET_SI | SET_AI | CLR_VI | SET_PI | SET_DP -.half CLR_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | SET_DP -.half SET_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | SET_DP -.half CLR_SP | SET_SI | CLR_AI | SET_VI | SET_PI | SET_DP -.half SET_SP | SET_SI | CLR_AI | SET_VI | SET_PI | SET_DP -.half CLR_SP | CLR_SI | SET_AI | SET_VI | SET_PI | SET_DP -.half SET_SP | CLR_SI | SET_AI | SET_VI | SET_PI | SET_DP -.half CLR_SP | SET_SI | SET_AI | SET_VI | SET_PI | SET_DP -.half SET_SP | SET_SI | SET_AI | SET_VI | SET_PI | SET_DP -.text -.set noreorder -glabel osSetIntMask - mfc0 $t4, $12 - andi $v0, $t4, 0xff01 - lui $t0, %hi(__OSGlobalIntMask) - addiu $t0, $t0, %lo(__OSGlobalIntMask) - lw $t3, ($t0) - addiu $at, $zero, -1 - xor $t0, $t3, $at - andi $t0, $t0, 0xff00 - or $v0, $v0, $t0 - lui $t2, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) - lw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t2) - beqz $t2, setintmask_1 - srl $t1, $t3, 0x10 - addiu $at, $zero, -1 - xor $t1, $t1, $at - andi $t1, $t1, 0x3f - or $t2, $t2, $t1 -setintmask_1: - sll $t2, $t2, 0x10 - or $v0, $v0, $t2 - lui $at, 0x3f - and $t0, $a0, $at - and $t0, $t0, $t3 - srl $t0, $t0, 0xf - lui $t2, %hi(__osRcpImTable) - addu $t2, $t2, $t0 - lhu $t2, %lo(__osRcpImTable)($t2) - lui $at, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) - sw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($at) - andi $t0, $a0, 0xff01 - andi $t1, $t3, 0xff00 - and $t0, $t0, $t1 - lui $at, 0xffff - ori $at, $at, 0xff - and $t4, $t4, $at - or $t4, $t4, $t0 - mtc0 $t4, $12 - nop - nop - jr $ra - nop -endlabel osSetIntMask diff --git a/asm/ultra/exceptasm.s b/asm/ultra/exceptasm.s deleted file mode 100644 index ac13e866..00000000 --- a/asm/ultra/exceptasm.s +++ /dev/null @@ -1,708 +0,0 @@ -#include -#include -.include "macro.inc" - -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 # allow use of 64-bit general purpose registers - -.data - -EXPORT(__osHwIntTable) -.word 0x0, 0x0, 0x0, 0x0, 0x0 - -.rdata -#define REDISPATCH 0x00 -#define SW1 0x04 -#define SW2 0x08 -#define RCP 0x0c -#define CART 0x10 -#define PRENMI 0x14 -#define IP6_HDLR 0x18 -#define IP7_HDLR 0x1c -#define COUNTER 0x20 -__osIntOffTable: -.byte REDISPATCH -.byte PRENMI -.byte IP6_HDLR -.byte IP6_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte COUNTER -.byte COUNTER -.byte IP6_HDLR -.byte IP6_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte IP7_HDLR -.byte REDISPATCH -.byte SW1 -.byte SW2 -.byte SW2 -.byte RCP -.byte RCP -.byte RCP -.byte RCP -.byte CART -.byte CART -.byte CART -.byte CART -.byte CART -.byte CART -.byte CART -.byte CART -__osIntTable: -.word redispatch, sw1, sw2, rcp, cart, prenmi, IP6_Hdlr, IP7_Hdlr, counter - -.text - -glabel __osExceptionPreamble -/* 2E60 80002260 3C1A8000 */ lui $k0, %hi(__osException) -/* 2E64 80002264 275A2280 */ addiu $k0, $k0, %lo(__osException) -/* 2E68 80002268 03400008 */ jr $k0 -/* 2E6C 8000226C 00000000 */ nop -endlabel __osExceptionPreamble - -# What is this? -glabel __osExceptionPreamble2 -/* 2E70 80002270 3C1A8000 */ lui $k0, %hi(__osException) -/* 2E74 80002274 275A2280 */ addiu $k0, $k0, %lo(__osException) -/* 2E78 80002278 03400008 */ jr $k0 -/* 2E7C 8000227C 00000000 */ nop -endlabel __osExceptionPreamble2 - -glabel __osException -/* 2E80 80002280 3C1A8000 */ lui $k0, %hi(__osThreadSave) -/* 2E84 80002284 275A72C0 */ addiu $k0, $k0, %lo(__osThreadSave) -/* 2E88 80002288 FF410020 */ sd $at, 0x20($k0) -/* 2E8C 8000228C 401B6000 */ mfc0 $k1, $12 -/* 2E90 80002290 AF5B0118 */ sw $k1, 0x118($k0) -/* 2E94 80002294 2401FFFC */ addiu $at, $zero, -4 -/* 2E98 80002298 0361D824 */ and $k1, $k1, $at -/* 2E9C 8000229C 409B6000 */ mtc0 $k1, $12 -/* 2EA0 800022A0 FF480058 */ sd $t0, 0x58($k0) -/* 2EA4 800022A4 FF490060 */ sd $t1, 0x60($k0) -/* 2EA8 800022A8 FF4A0068 */ sd $t2, 0x68($k0) -/* 2EAC 800022AC AF400018 */ sw $zero, 0x18($k0) -/* 2EB0 800022B0 40086800 */ mfc0 $t0, $13 -/* 2EB4 800022B4 03404025 */ or $t0, $k0, $zero -/* 2EB8 800022B8 3C1A8000 */ lui $k0, %hi(__osRunningThread) -/* 2EBC 800022BC 8F5A5130 */ lw $k0, %lo(__osRunningThread)($k0) -/* 2EC0 800022C0 DD090020 */ ld $t1, 0x20($t0) -/* 2EC4 800022C4 FF490020 */ sd $t1, 0x20($k0) -/* 2EC8 800022C8 DD090118 */ ld $t1, 0x118($t0) -/* 2ECC 800022CC FF490118 */ sd $t1, 0x118($k0) -/* 2ED0 800022D0 DD090058 */ ld $t1, 0x58($t0) -/* 2ED4 800022D4 FF490058 */ sd $t1, 0x58($k0) -/* 2ED8 800022D8 DD090060 */ ld $t1, 0x60($t0) -/* 2EDC 800022DC FF490060 */ sd $t1, 0x60($k0) -/* 2EE0 800022E0 DD090068 */ ld $t1, 0x68($t0) -/* 2EE4 800022E4 FF490068 */ sd $t1, 0x68($k0) -/* 2EE8 800022E8 8F5B0118 */ lw $k1, 0x118($k0) -/* 2EEC 800022EC 00004012 */ mflo $t0 -/* 2EF0 800022F0 FF480108 */ sd $t0, 0x108($k0) -/* 2EF4 800022F4 00004010 */ mfhi $t0 -/* 2EF8 800022F8 3369FF00 */ andi $t1, $k1, 0xff00 -/* 2EFC 800022FC FF420028 */ sd $v0, 0x28($k0) -/* 2F00 80002300 FF430030 */ sd $v1, 0x30($k0) -/* 2F04 80002304 FF440038 */ sd $a0, 0x38($k0) -/* 2F08 80002308 FF450040 */ sd $a1, 0x40($k0) -/* 2F0C 8000230C FF460048 */ sd $a2, 0x48($k0) -/* 2F10 80002310 FF470050 */ sd $a3, 0x50($k0) -/* 2F14 80002314 FF4B0070 */ sd $t3, 0x70($k0) -/* 2F18 80002318 FF4C0078 */ sd $t4, 0x78($k0) -/* 2F1C 8000231C FF4D0080 */ sd $t5, 0x80($k0) -/* 2F20 80002320 FF4E0088 */ sd $t6, 0x88($k0) -/* 2F24 80002324 FF4F0090 */ sd $t7, 0x90($k0) -/* 2F28 80002328 FF500098 */ sd $s0, 0x98($k0) -/* 2F2C 8000232C FF5100A0 */ sd $s1, 0xa0($k0) -/* 2F30 80002330 FF5200A8 */ sd $s2, 0xa8($k0) -/* 2F34 80002334 FF5300B0 */ sd $s3, 0xb0($k0) -/* 2F38 80002338 FF5400B8 */ sd $s4, 0xb8($k0) -/* 2F3C 8000233C FF5500C0 */ sd $s5, 0xc0($k0) -/* 2F40 80002340 FF5600C8 */ sd $s6, 0xc8($k0) -/* 2F44 80002344 FF5700D0 */ sd $s7, 0xd0($k0) -/* 2F48 80002348 FF5800D8 */ sd $t8, 0xd8($k0) -/* 2F4C 8000234C FF5900E0 */ sd $t9, 0xe0($k0) -/* 2F50 80002350 FF5C00E8 */ sd $gp, 0xe8($k0) -/* 2F54 80002354 FF5D00F0 */ sd $sp, 0xf0($k0) -/* 2F58 80002358 FF5E00F8 */ sd $fp, 0xf8($k0) -/* 2F5C 8000235C FF5F0100 */ sd $ra, 0x100($k0) -/* 2F60 80002360 1120000D */ beqz $t1, .L80002398 -/* 2F64 80002364 FF480110 */ sd $t0, 0x110($k0) -/* 2F68 80002368 3C088000 */ lui $t0, %hi(__OSGlobalIntMask) -/* 2F6C 8000236C 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* 2F70 80002370 8D080000 */ lw $t0, ($t0) -/* 2F74 80002374 2401FFFF */ addiu $at, $zero, -1 -/* 2F78 80002378 01014026 */ xor $t0, $t0, $at -/* 2F7C 8000237C 3C01FFFF */ lui $at, 0xffff -/* 2F80 80002380 3108FF00 */ andi $t0, $t0, 0xff00 -/* 2F84 80002384 342100FF */ ori $at, $at, 0xff -/* 2F88 80002388 01284825 */ or $t1, $t1, $t0 -/* 2F8C 8000238C 0361D824 */ and $k1, $k1, $at -/* 2F90 80002390 0369D825 */ or $k1, $k1, $t1 -/* 2F94 80002394 AF5B0118 */ sw $k1, 0x118($k0) -.L80002398: -/* 2F98 80002398 3C09A430 */ lui $t1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) -/* 2F9C 8000239C 8D29000C */ lw $t1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t1) -/* 2FA0 800023A0 5120000C */ beql $t1, $zero, .L800023D4 -/* 2FA4 800023A4 AF490128 */ sw $t1, 0x128($k0) -/* 2FA8 800023A8 3C088000 */ lui $t0, %hi(__OSGlobalIntMask) -/* 2FAC 800023AC 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* 2FB0 800023B0 8D080000 */ lw $t0, ($t0) -/* 2FB4 800023B4 8F4C0128 */ lw $t4, 0x128($k0) -/* 2FB8 800023B8 2401FFFF */ addiu $at, $zero, -1 -/* 2FBC 800023BC 00084402 */ srl $t0, $t0, 0x10 -/* 2FC0 800023C0 01014026 */ xor $t0, $t0, $at -/* 2FC4 800023C4 3108003F */ andi $t0, $t0, 0x3f -/* 2FC8 800023C8 010C4024 */ and $t0, $t0, $t4 -/* 2FCC 800023CC 01284825 */ or $t1, $t1, $t0 -/* 2FD0 800023D0 AF490128 */ sw $t1, 0x128($k0) -.L800023D4: -/* 2FD4 800023D4 40087000 */ mfc0 $t0, $14 -/* 2FD8 800023D8 AF48011C */ sw $t0, 0x11c($k0) -/* 2FDC 800023DC 8F480018 */ lw $t0, 0x18($k0) -/* 2FE0 800023E0 11000014 */ beqz $t0, .L80002434 -/* 2FE4 800023E4 00000000 */ nop -/* 2FE8 800023E8 4448F800 */ cfc1 $t0, $31 -/* 2FEC 800023EC 00000000 */ nop -/* 2FF0 800023F0 AF48012C */ sw $t0, 0x12c($k0) -/* 2FF4 800023F4 F7400130 */ sdc1 $f0, 0x130($k0) -/* 2FF8 800023F8 F7420138 */ sdc1 $f2, 0x138($k0) -/* 2FFC 800023FC F7440140 */ sdc1 $f4, 0x140($k0) -/* 3000 80002400 F7460148 */ sdc1 $f6, 0x148($k0) -/* 3004 80002404 F7480150 */ sdc1 $f8, 0x150($k0) -/* 3008 80002408 F74A0158 */ sdc1 $f10, 0x158($k0) -/* 300C 8000240C F74C0160 */ sdc1 $f12, 0x160($k0) -/* 3010 80002410 F74E0168 */ sdc1 $f14, 0x168($k0) -/* 3014 80002414 F7500170 */ sdc1 $f16, 0x170($k0) -/* 3018 80002418 F7520178 */ sdc1 $f18, 0x178($k0) -/* 301C 8000241C F7540180 */ sdc1 $f20, 0x180($k0) -/* 3020 80002420 F7560188 */ sdc1 $f22, 0x188($k0) -/* 3024 80002424 F7580190 */ sdc1 $f24, 0x190($k0) -/* 3028 80002428 F75A0198 */ sdc1 $f26, 0x198($k0) -/* 302C 8000242C F75C01A0 */ sdc1 $f28, 0x1a0($k0) -/* 3030 80002430 F75E01A8 */ sdc1 $f30, 0x1a8($k0) -.L80002434: -/* 3034 80002434 40086800 */ mfc0 $t0, $13 -/* 3038 80002438 AF480120 */ sw $t0, 0x120($k0) -/* 303C 8000243C 24090002 */ addiu $t1, $zero, 2 -/* 3040 80002440 A7490010 */ sh $t1, 0x10($k0) -/* 3044 80002444 3109007C */ andi $t1, $t0, 0x7c -/* 3048 80002448 240A0024 */ addiu $t2, $zero, 0x24 -/* 304C 8000244C 512A00B1 */ beql $t1, $t2, handle_break -/* 3050 80002450 24090001 */ addiu $t1, $zero, 1 -/* 3054 80002454 240A002C */ addiu $t2, $zero, 0x2c -/* 3058 80002458 112A00FF */ beq $t1, $t2, handle_CpU -/* 305C 8000245C 00000000 */ nop -/* 3060 80002460 240A0000 */ addiu $t2, $zero, 0 -/* 3064 80002464 152A00C3 */ bne $t1, $t2, .L80002774 -/* 3068 80002468 00000000 */ nop -/* 306C 8000246C 03688024 */ and $s0, $k1, $t0 -next_interrupt: -/* 3070 80002470 3209FF00 */ andi $t1, $s0, 0xff00 -/* 3074 80002474 00095302 */ srl $t2, $t1, 0xc -/* 3078 80002478 15400003 */ bnez $t2, .L80002488 -/* 307C 8000247C 00000000 */ nop -/* 3080 80002480 00095202 */ srl $t2, $t1, 8 -/* 3084 80002484 214A0010 */ addi $t2, $t2, 0x10 -.L80002488: -/* 3088 80002488 3C018000 */ lui $at, %hi(__osIntOffTable) -/* 308C 8000248C 002A0821 */ addu $at, $at, $t2 -/* 3090 80002490 902A5180 */ lbu $t2, %lo(__osIntOffTable)($at) -/* 3094 80002494 3C018000 */ lui $at, %hi(__osIntTable) -/* 3098 80002498 002A0821 */ addu $at, $at, $t2 -/* 309C 8000249C 8C2A51A0 */ lw $t2, %lo(__osIntTable)($at) -/* 30A0 800024A0 01400008 */ jr $t2 -/* 30A4 800024A4 00000000 */ nop -IP6_Hdlr: -/* 30A8 800024A8 2401DFFF */ addiu $at, $zero, -0x2001 -/* 30AC 800024AC 1000FFF0 */ b next_interrupt -/* 30B0 800024B0 02018024 */ and $s0, $s0, $at -IP7_Hdlr: -/* 30B4 800024B4 2401BFFF */ addiu $at, $zero, -0x4001 -/* 30B8 800024B8 1000FFED */ b next_interrupt -/* 30BC 800024BC 02018024 */ and $s0, $s0, $at -counter: -/* 30C0 800024C0 40095800 */ mfc0 $t1, $11 -/* 30C4 800024C4 40895800 */ mtc0 $t1, $11 -/* 30C8 800024C8 0C0009E9 */ jal send_mesg -/* 30CC 800024CC 24040018 */ addiu $a0, $zero, 0x18 -/* 30D0 800024D0 3C01FFFF */ lui $at, 0xffff -/* 30D4 800024D4 34217FFF */ ori $at, $at, 0x7fff -/* 30D8 800024D8 1000FFE5 */ b next_interrupt -/* 30DC 800024DC 02018024 */ and $s0, $s0, $at -cart: -/* 30E0 800024E0 2401F7FF */ addiu $at, $zero, -0x801 -/* 30E4 800024E4 02018024 */ and $s0, $s0, $at -/* 30E8 800024E8 240A0004 */ addiu $t2, $zero, 4 -/* 30EC 800024EC 3C018000 */ lui $at, %hi(__osHwIntTable) -/* 30F0 800024F0 002A0821 */ addu $at, $at, $t2 -/* 30F4 800024F4 8C2A5100 */ lw $t2, %lo(__osHwIntTable)($at) -/* 30F8 800024F8 3C1D8000 */ lui $sp, %hi(leoDiskStack) -/* 30FC 800024FC 27BD7470 */ addiu $sp, $sp, %lo(leoDiskStack) -/* 3100 80002500 24040010 */ addiu $a0, $zero, 0x10 -/* 3104 80002504 11400007 */ beqz $t2, .L80002524 -/* 3108 80002508 27BD0FF0 */ addiu $sp, $sp, 0xff0 -/* 310C 8000250C 0140F809 */ jalr $t2 -/* 3110 80002510 00000000 */ nop -/* 3114 80002514 10400003 */ beqz $v0, .L80002524 -/* 3118 80002518 00000000 */ nop -/* 311C 8000251C 10000082 */ b redispatch -/* 3120 80002520 00000000 */ nop -.L80002524: -/* 3124 80002524 0C0009E9 */ jal send_mesg -/* 3128 80002528 00000000 */ nop -/* 312C 8000252C 1000FFD1 */ b next_interrupt + 4 -/* 3130 80002530 3209FF00 */ andi $t1, $s0, 0xff00 -rcp: -/* 3134 80002534 3C088000 */ lui $t0, %hi(__OSGlobalIntMask) -/* 3138 80002538 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* 313C 8000253C 8D080000 */ lw $t0, ($t0) -/* 3140 80002540 3C11A430 */ lui $s1, %hi(PHYS_TO_K1(MI_INTR_REG)) -/* 3144 80002544 8E310008 */ lw $s1, %lo(PHYS_TO_K1(MI_INTR_REG))($s1) -/* 3148 80002548 00084402 */ srl $t0, $t0, 0x10 -/* 314C 8000254C 02288824 */ and $s1, $s1, $t0 -/* 3150 80002550 32290001 */ andi $t1, $s1, 1 -/* 3154 80002554 51200014 */ beql $t1, $zero, .L800025A8 -/* 3158 80002558 32290008 */ andi $t1, $s1, 8 -/* 315C 8000255C 3C0CA404 */ lui $t4, %hi(PHYS_TO_K1(SP_STATUS_REG)) -/* 3160 80002560 8D8C0010 */ lw $t4, %lo(PHYS_TO_K1(SP_STATUS_REG))($t4) -/* 3164 80002564 24090008 */ addiu $t1, $zero, 8 -/* 3168 80002568 3C01A404 */ lui $at, %hi(PHYS_TO_K1(SP_STATUS_REG)) -/* 316C 8000256C 318C0300 */ andi $t4, $t4, 0x300 -/* 3170 80002570 3231003E */ andi $s1, $s1, 0x3e -/* 3174 80002574 11800007 */ beqz $t4, .L80002594 -/* 3178 80002578 AC290010 */ sw $t1, %lo(PHYS_TO_K1(SP_STATUS_REG))($at) -/* 317C 8000257C 0C0009E9 */ jal send_mesg -/* 3180 80002580 24040020 */ addiu $a0, $zero, 0x20 -/* 3184 80002584 52200039 */ beql $s1, $zero, .L8000266C -/* 3188 80002588 2401FBFF */ addiu $at, $zero, -0x401 -/* 318C 8000258C 10000006 */ b .L800025A8 -/* 3190 80002590 32290008 */ andi $t1, $s1, 8 -.L80002594: -/* 3194 80002594 0C0009E9 */ jal send_mesg -/* 3198 80002598 24040058 */ addiu $a0, $zero, 0x58 -/* 319C 8000259C 52200033 */ beql $s1, $zero, .L8000266C -/* 31A0 800025A0 2401FBFF */ addiu $at, $zero, -0x401 -/* 31A4 800025A4 32290008 */ andi $t1, $s1, 8 -.L800025A8: -/* 31A8 800025A8 11200007 */ beqz $t1, .L800025C8 -/* 31AC 800025AC 3C01A440 */ lui $at, %hi(PHYS_TO_K1(VI_CURRENT_REG)) -/* 31B0 800025B0 32310037 */ andi $s1, $s1, 0x37 -/* 31B4 800025B4 AC200010 */ sw $zero, %lo(PHYS_TO_K1(VI_CURRENT_REG))($at) -/* 31B8 800025B8 0C0009E9 */ jal send_mesg -/* 31BC 800025BC 24040038 */ addiu $a0, $zero, 0x38 -/* 31C0 800025C0 5220002A */ beql $s1, $zero, .L8000266C -/* 31C4 800025C4 2401FBFF */ addiu $at, $zero, -0x401 -.L800025C8: -/* 31C8 800025C8 32290004 */ andi $t1, $s1, 4 -/* 31CC 800025CC 5120000A */ beql $t1, $zero, .L800025F8 -/* 31D0 800025D0 32290002 */ andi $t1, $s1, 2 -/* 31D4 800025D4 24090001 */ addiu $t1, $zero, 1 -/* 31D8 800025D8 3C01A450 */ lui $at, %hi(PHYS_TO_K1(AI_STATUS_REG)) -/* 31DC 800025DC 3231003B */ andi $s1, $s1, 0x3b -/* 31E0 800025E0 AC29000C */ sw $t1, %lo(PHYS_TO_K1(AI_STATUS_REG))($at) -/* 31E4 800025E4 0C0009E9 */ jal send_mesg -/* 31E8 800025E8 24040030 */ addiu $a0, $zero, 0x30 -/* 31EC 800025EC 5220001F */ beql $s1, $zero, .L8000266C -/* 31F0 800025F0 2401FBFF */ addiu $at, $zero, -0x401 -/* 31F4 800025F4 32290002 */ andi $t1, $s1, 2 -.L800025F8: -/* 31F8 800025F8 11200007 */ beqz $t1, .L80002618 -/* 31FC 800025FC 3C01A480 */ lui $at, %hi(PHYS_TO_K1(SI_STATUS_REG)) -/* 3200 80002600 3231003D */ andi $s1, $s1, 0x3d -/* 3204 80002604 AC200018 */ sw $zero, %lo(PHYS_TO_K1(SI_STATUS_REG))($at) -/* 3208 80002608 0C0009E9 */ jal send_mesg -/* 320C 8000260C 24040028 */ addiu $a0, $zero, 0x28 -/* 3210 80002610 52200016 */ beql $s1, $zero, .L8000266C -/* 3214 80002614 2401FBFF */ addiu $at, $zero, -0x401 -.L80002618: -/* 3218 80002618 32290010 */ andi $t1, $s1, 0x10 -/* 321C 8000261C 5120000A */ beql $t1, $zero, .L80002648 -/* 3220 80002620 32290020 */ andi $t1, $s1, 0x20 -/* 3224 80002624 24090002 */ addiu $t1, $zero, 2 -/* 3228 80002628 3C01A460 */ lui $at, %hi(PHYS_TO_K1(PI_STATUS_REG)) -/* 322C 8000262C 3231002F */ andi $s1, $s1, 0x2f -/* 3230 80002630 AC290010 */ sw $t1, %lo(PHYS_TO_K1(PI_STATUS_REG))($at) -/* 3234 80002634 0C0009E9 */ jal send_mesg -/* 3238 80002638 24040040 */ addiu $a0, $zero, 0x40 -/* 323C 8000263C 5220000B */ beql $s1, $zero, .L8000266C -/* 3240 80002640 2401FBFF */ addiu $at, $zero, -0x401 -/* 3244 80002644 32290020 */ andi $t1, $s1, 0x20 -.L80002648: -/* 3248 80002648 51200008 */ beql $t1, $zero, .L8000266C -/* 324C 8000264C 2401FBFF */ addiu $at, $zero, -0x401 -/* 3250 80002650 24090800 */ addiu $t1, $zero, 0x800 -/* 3254 80002654 3C01A430 */ lui $at, 0xa430 -/* 3258 80002658 3231001F */ andi $s1, $s1, 0x1f -/* 325C 8000265C AC290000 */ sw $t1, ($at) -/* 3260 80002660 0C0009E9 */ jal send_mesg -/* 3264 80002664 24040048 */ addiu $a0, $zero, 0x48 -/* 3268 80002668 2401FBFF */ addiu $at, $zero, -0x401 -.L8000266C: -/* 326C 8000266C 1000FF80 */ b next_interrupt -/* 3270 80002670 02018024 */ and $s0, $s0, $at -prenmi: -/* 3274 80002674 8F5B0118 */ lw $k1, 0x118($k0) -/* 3278 80002678 2401EFFF */ addiu $at, $zero, -0x1001 -/* 327C 8000267C 3C098000 */ lui $t1, %hi(__osShutdown) -/* 3280 80002680 0361D824 */ and $k1, $k1, $at -/* 3284 80002684 AF5B0118 */ sw $k1, 0x118($k0) -/* 3288 80002688 252950EC */ addiu $t1, $t1, %lo(__osShutdown) -/* 328C 8000268C 8D2A0000 */ lw $t2, ($t1) -/* 3290 80002690 11400003 */ beqz $t2, firstnmi -/* 3294 80002694 2401EFFF */ addiu $at, $zero, -0x1001 -/* 3298 80002698 10000023 */ b redispatch -/* 329C 8000269C 02018024 */ and $s0, $s0, $at -firstnmi: -/* 32A0 800026A0 240A0001 */ addiu $t2, $zero, 1 -/* 32A4 800026A4 AD2A0000 */ sw $t2, ($t1) -/* 32A8 800026A8 0C0009E9 */ jal send_mesg -/* 32AC 800026AC 24040070 */ addiu $a0, $zero, 0x70 -/* 32B0 800026B0 3C0A8000 */ lui $t2, %hi(__osRunQueue) -/* 32B4 800026B4 8D4A5128 */ lw $t2, %lo(__osRunQueue)($t2) -/* 32B8 800026B8 2401EFFF */ addiu $at, $zero, -0x1001 -/* 32BC 800026BC 02018024 */ and $s0, $s0, $at -/* 32C0 800026C0 8D5B0118 */ lw $k1, 0x118($t2) -/* 32C4 800026C4 0361D824 */ and $k1, $k1, $at -/* 32C8 800026C8 10000017 */ b redispatch -/* 32CC 800026CC AD5B0118 */ sw $k1, 0x118($t2) -sw2: -/* 32D0 800026D0 2401FDFF */ addiu $at, $zero, -0x201 -/* 32D4 800026D4 01014024 */ and $t0, $t0, $at -/* 32D8 800026D8 40886800 */ mtc0 $t0, $13 -/* 32DC 800026DC 0C0009E9 */ jal send_mesg -/* 32E0 800026E0 24040008 */ addiu $a0, $zero, 8 -/* 32E4 800026E4 2401FDFF */ addiu $at, $zero, -0x201 -/* 32E8 800026E8 1000FF61 */ b next_interrupt -/* 32EC 800026EC 02018024 */ and $s0, $s0, $at -sw1: -/* 32F0 800026F0 2401FEFF */ addiu $at, $zero, -0x101 -/* 32F4 800026F4 01014024 */ and $t0, $t0, $at -/* 32F8 800026F8 40886800 */ mtc0 $t0, $13 -/* 32FC 800026FC 0C0009E9 */ jal send_mesg -/* 3300 80002700 24040000 */ addiu $a0, $zero, 0 -/* 3304 80002704 2401FEFF */ addiu $at, $zero, -0x101 -/* 3308 80002708 1000FF59 */ b next_interrupt -/* 330C 8000270C 02018024 */ and $s0, $s0, $at -/* 3310 80002710 24090001 */ addiu $t1, $zero, 1 -handle_break: -/* 3314 80002714 A7490012 */ sh $t1, 0x12($k0) -/* 3318 80002718 0C0009E9 */ jal send_mesg -/* 331C 8000271C 24040050 */ addiu $a0, $zero, 0x50 -/* 3320 80002720 10000001 */ b redispatch -/* 3324 80002724 00000000 */ nop -redispatch: -/* 3328 80002728 3C0A8000 */ lui $t2, %hi(__osRunQueue) -/* 332C 8000272C 8D4A5128 */ lw $t2, %lo(__osRunQueue)($t2) -/* 3330 80002730 8F490004 */ lw $t1, 4($k0) -/* 3334 80002734 8D4B0004 */ lw $t3, 4($t2) -/* 3338 80002738 012B082A */ slt $at, $t1, $t3 -/* 333C 8000273C 10200007 */ beqz $at, enqueueRunning -/* 3340 80002740 00000000 */ nop -/* 3344 80002744 3C048000 */ lui $a0, %hi(__osRunQueue) -/* 3348 80002748 03402825 */ or $a1, $k0, $zero -/* 334C 8000274C 0C000A63 */ jal __osEnqueueThread -/* 3350 80002750 24845128 */ addiu $a0, $a0, %lo(__osRunQueue) -/* 3354 80002754 08000A79 */ j __osDispatchThread -/* 3358 80002758 00000000 */ nop -enqueueRunning: -/* 335C 8000275C 3C098000 */ lui $t1, %hi(__osRunQueue) -/* 3360 80002760 25295128 */ addiu $t1, $t1, %lo(__osRunQueue) -/* 3364 80002764 8D2A0000 */ lw $t2, ($t1) -/* 3368 80002768 AF4A0000 */ sw $t2, ($k0) -/* 336C 8000276C 08000A79 */ j __osDispatchThread -/* 3370 80002770 AD3A0000 */ sw $k0, ($t1) -.L80002774: -/* 3374 80002774 3C018000 */ lui $at, %hi(__osFaultedThread) -/* 3378 80002778 AC3A5134 */ sw $k0, %lo(__osFaultedThread)($at) -/* 337C 8000277C 24090001 */ addiu $t1, $zero, 1 -/* 3380 80002780 A7490010 */ sh $t1, 0x10($k0) -/* 3384 80002784 24090002 */ addiu $t1, $zero, 2 -/* 3388 80002788 A7490012 */ sh $t1, 0x12($k0) -/* 338C 8000278C 400A4000 */ mfc0 $t2, $8 -/* 3390 80002790 AF4A0124 */ sw $t2, 0x124($k0) -/* 3394 80002794 0C0009E9 */ jal send_mesg -/* 3398 80002798 24040060 */ addiu $a0, $zero, 0x60 -/* 339C 8000279C 08000A79 */ j __osDispatchThread -/* 33A0 800027A0 00000000 */ nop -endlabel __osException - -glabel send_mesg -/* 33A4 800027A4 3C0A8001 */ lui $t2, %hi(__osEventStateTab) -/* 33A8 800027A8 254A8470 */ addiu $t2, $t2, %lo(__osEventStateTab) -/* 33AC 800027AC 01445021 */ addu $t2, $t2, $a0 -/* 33B0 800027B0 8D490000 */ lw $t1, ($t2) -/* 33B4 800027B4 03E09025 */ or $s2, $ra, $zero -/* 33B8 800027B8 11200025 */ beqz $t1, send_done -/* 33BC 800027BC 00000000 */ nop -/* 33C0 800027C0 8D2B0008 */ lw $t3, 8($t1) -/* 33C4 800027C4 8D2C0010 */ lw $t4, 0x10($t1) -/* 33C8 800027C8 016C082A */ slt $at, $t3, $t4 -/* 33CC 800027CC 10200020 */ beqz $at, send_done -/* 33D0 800027D0 00000000 */ nop -/* 33D4 800027D4 8D2D000C */ lw $t5, 0xc($t1) -/* 33D8 800027D8 01AB6821 */ addu $t5, $t5, $t3 -/* 33DC 800027DC 01AC001A */ div $zero, $t5, $t4 -/* 33E0 800027E0 15800002 */ bnez $t4, .L800027EC -/* 33E4 800027E4 00000000 */ nop -/* 33E8 800027E8 0007000D */ break 7 -.L800027EC: -/* 33EC 800027EC 2401FFFF */ addiu $at, $zero, -1 -/* 33F0 800027F0 15810004 */ bne $t4, $at, .L80002804 -/* 33F4 800027F4 3C018000 */ lui $at, 0x8000 -/* 33F8 800027F8 15A10002 */ bne $t5, $at, .L80002804 -/* 33FC 800027FC 00000000 */ nop -/* 3400 80002800 0006000D */ break 6 -.L80002804: -/* 3404 80002804 8D2C0014 */ lw $t4, 0x14($t1) -/* 3408 80002808 00006810 */ mfhi $t5 -/* 340C 8000280C 000D6880 */ sll $t5, $t5, 2 -/* 3410 80002810 018D6021 */ addu $t4, $t4, $t5 -/* 3414 80002814 8D4D0004 */ lw $t5, 4($t2) -/* 3418 80002818 256A0001 */ addiu $t2, $t3, 1 -/* 341C 8000281C AD8D0000 */ sw $t5, ($t4) -/* 3420 80002820 AD2A0008 */ sw $t2, 8($t1) -/* 3424 80002824 8D2A0000 */ lw $t2, ($t1) -/* 3428 80002828 8D4B0000 */ lw $t3, ($t2) -/* 342C 8000282C 11600008 */ beqz $t3, send_done -/* 3430 80002830 00000000 */ nop -/* 3434 80002834 0C000A75 */ jal __osPopThread -/* 3438 80002838 01202025 */ or $a0, $t1, $zero -/* 343C 8000283C 00405025 */ or $t2, $v0, $zero -/* 3440 80002840 3C048000 */ lui $a0, %hi(__osRunQueue) -/* 3444 80002844 01402825 */ or $a1, $t2, $zero -/* 3448 80002848 0C000A63 */ jal __osEnqueueThread -/* 344C 8000284C 24845128 */ addiu $a0, $a0, %lo(__osRunQueue) -send_done: -/* 3450 80002850 02400008 */ jr $s2 -/* 3454 80002854 00000000 */ nop -endlabel send_mesg - -glabel handle_CpU -/* 3458 80002858 3C013000 */ lui $at, 0x3000 -/* 345C 8000285C 01014824 */ and $t1, $t0, $at -/* 3460 80002860 00094F02 */ srl $t1, $t1, 0x1c -/* 3464 80002864 240A0001 */ addiu $t2, $zero, 1 -/* 3468 80002868 152AFFC2 */ bne $t1, $t2, .L80002774 -/* 346C 8000286C 00000000 */ nop -/* 3470 80002870 8F5B0118 */ lw $k1, 0x118($k0) -/* 3474 80002874 3C012000 */ lui $at, 0x2000 -/* 3478 80002878 24090001 */ addiu $t1, $zero, 1 -/* 347C 8000287C 0361D825 */ or $k1, $k1, $at -/* 3480 80002880 AF490018 */ sw $t1, 0x18($k0) -/* 3484 80002884 1000FFB5 */ b enqueueRunning -/* 3488 80002888 AF5B0118 */ sw $k1, 0x118($k0) -endlabel handle_CpU - -glabel __osEnqueueAndYield -/* 348C 8000288C 3C058000 */ lui $a1, %hi(__osRunningThread) -/* 3490 80002890 8CA55130 */ lw $a1, %lo(__osRunningThread)($a1) -/* 3494 80002894 40086000 */ mfc0 $t0, $12 -/* 3498 80002898 8CBB0018 */ lw $k1, 0x18($a1) -/* 349C 8000289C 35080002 */ ori $t0, $t0, 2 -/* 34A0 800028A0 ACA80118 */ sw $t0, 0x118($a1) -/* 34A4 800028A4 FCB00098 */ sd $s0, 0x98($a1) -/* 34A8 800028A8 FCB100A0 */ sd $s1, 0xa0($a1) -/* 34AC 800028AC FCB200A8 */ sd $s2, 0xa8($a1) -/* 34B0 800028B0 FCB300B0 */ sd $s3, 0xb0($a1) -/* 34B4 800028B4 FCB400B8 */ sd $s4, 0xb8($a1) -/* 34B8 800028B8 FCB500C0 */ sd $s5, 0xc0($a1) -/* 34BC 800028BC FCB600C8 */ sd $s6, 0xc8($a1) -/* 34C0 800028C0 FCB700D0 */ sd $s7, 0xd0($a1) -/* 34C4 800028C4 FCBC00E8 */ sd $gp, 0xe8($a1) -/* 34C8 800028C8 FCBD00F0 */ sd $sp, 0xf0($a1) -/* 34CC 800028CC FCBE00F8 */ sd $fp, 0xf8($a1) -/* 34D0 800028D0 FCBF0100 */ sd $ra, 0x100($a1) -/* 34D4 800028D4 13600009 */ beqz $k1, .L800028FC -/* 34D8 800028D8 ACBF011C */ sw $ra, 0x11c($a1) -/* 34DC 800028DC 445BF800 */ cfc1 $k1, $31 -/* 34E0 800028E0 F4B40180 */ sdc1 $f20, 0x180($a1) -/* 34E4 800028E4 F4B60188 */ sdc1 $f22, 0x188($a1) -/* 34E8 800028E8 F4B80190 */ sdc1 $f24, 0x190($a1) -/* 34EC 800028EC F4BA0198 */ sdc1 $f26, 0x198($a1) -/* 34F0 800028F0 F4BC01A0 */ sdc1 $f28, 0x1a0($a1) -/* 34F4 800028F4 F4BE01A8 */ sdc1 $f30, 0x1a8($a1) -/* 34F8 800028F8 ACBB012C */ sw $k1, 0x12c($a1) -.L800028FC: -/* 34FC 800028FC 8CBB0118 */ lw $k1, 0x118($a1) -/* 3500 80002900 3369FF00 */ andi $t1, $k1, 0xff00 -/* 3504 80002904 5120000E */ beql $t1, $zero, .L80002940 -/* 3508 80002908 3C1BA430 */ lui $k1, 0xa430 -/* 350C 8000290C 3C088000 */ lui $t0, %hi(__OSGlobalIntMask) -/* 3510 80002910 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* 3514 80002914 8D080000 */ lw $t0, ($t0) -/* 3518 80002918 2401FFFF */ addiu $at, $zero, -1 -/* 351C 8000291C 01014026 */ xor $t0, $t0, $at -/* 3520 80002920 3C01FFFF */ lui $at, 0xffff -/* 3524 80002924 3108FF00 */ andi $t0, $t0, 0xff00 -/* 3528 80002928 342100FF */ ori $at, $at, 0xff -/* 352C 8000292C 01284825 */ or $t1, $t1, $t0 -/* 3530 80002930 0361D824 */ and $k1, $k1, $at -/* 3534 80002934 0369D825 */ or $k1, $k1, $t1 -/* 3538 80002938 ACBB0118 */ sw $k1, 0x118($a1) -/* 353C 8000293C 3C1BA430 */ lui $k1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) -.L80002940: -/* 3540 80002940 8F7B000C */ lw $k1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($k1) -/* 3544 80002944 1360000B */ beqz $k1, .L80002974 -/* 3548 80002948 00000000 */ nop -/* 354C 8000294C 3C1A8000 */ lui $k0, %hi(__OSGlobalIntMask) -/* 3550 80002950 275A50F0 */ addiu $k0, $k0, %lo(__OSGlobalIntMask) -/* 3554 80002954 8F5A0000 */ lw $k0, ($k0) -/* 3558 80002958 8CA80128 */ lw $t0, 0x128($a1) -/* 355C 8000295C 2401FFFF */ addiu $at, $zero, -1 -/* 3560 80002960 001AD402 */ srl $k0, $k0, 0x10 -/* 3564 80002964 0341D026 */ xor $k0, $k0, $at -/* 3568 80002968 335A003F */ andi $k0, $k0, 0x3f -/* 356C 8000296C 0348D024 */ and $k0, $k0, $t0 -/* 3570 80002970 037AD825 */ or $k1, $k1, $k0 -.L80002974: -/* 3574 80002974 10800003 */ beqz $a0, .L80002984 -/* 3578 80002978 ACBB0128 */ sw $k1, 0x128($a1) -/* 357C 8000297C 0C000A63 */ jal __osEnqueueThread -/* 3580 80002980 00000000 */ nop -.L80002984: -/* 3584 80002984 08000A79 */ j __osDispatchThread -/* 3588 80002988 00000000 */ nop -endlabel __osEnqueueAndYield - -glabel __osEnqueueThread -/* 358C 8000298C 8C980000 */ lw $t8, ($a0) -/* 3590 80002990 8CAF0004 */ lw $t7, 4($a1) -/* 3594 80002994 0080C825 */ or $t9, $a0, $zero -/* 3598 80002998 8F0E0004 */ lw $t6, 4($t8) -/* 359C 8000299C 01CF082A */ slt $at, $t6, $t7 -/* 35A0 800029A0 54200008 */ bnel $at, $zero, .L800029C4 -/* 35A4 800029A4 8F380000 */ lw $t8, ($t9) -/* 35A8 800029A8 0300C825 */ or $t9, $t8, $zero -.L800029AC: -/* 35AC 800029AC 8F180000 */ lw $t8, ($t8) -/* 35B0 800029B0 8F0E0004 */ lw $t6, 4($t8) -/* 35B4 800029B4 01CF082A */ slt $at, $t6, $t7 -/* 35B8 800029B8 5020FFFC */ beql $at, $zero, .L800029AC -/* 35BC 800029BC 0300C825 */ or $t9, $t8, $zero -/* 35C0 800029C0 8F380000 */ lw $t8, ($t9) -.L800029C4: -/* 35C4 800029C4 ACB80000 */ sw $t8, ($a1) -/* 35C8 800029C8 AF250000 */ sw $a1, ($t9) -/* 35CC 800029CC 03E00008 */ jr $ra -/* 35D0 800029D0 ACA40008 */ sw $a0, 8($a1) -endlabel __osEnqueueThread - -glabel __osPopThread -/* 35D4 800029D4 8C820000 */ lw $v0, ($a0) -/* 35D8 800029D8 8C590000 */ lw $t9, ($v0) -/* 35DC 800029DC 03E00008 */ jr $ra -/* 35E0 800029E0 AC990000 */ sw $t9, ($a0) -endlabel __osPopThread - -glabel __osDispatchThread -/* 35E4 800029E4 3C048000 */ lui $a0, %hi(__osRunQueue) -/* 35E8 800029E8 0C000A75 */ jal __osPopThread -/* 35EC 800029EC 24845128 */ addiu $a0, $a0, %lo(__osRunQueue) -/* 35F0 800029F0 3C018000 */ lui $at, %hi(__osRunningThread) -/* 35F4 800029F4 AC225130 */ sw $v0, %lo(__osRunningThread)($at) -/* 35F8 800029F8 24080004 */ addiu $t0, $zero, 4 -/* 35FC 800029FC A4480010 */ sh $t0, 0x10($v0) -/* 3600 80002A00 0040D025 */ or $k0, $v0, $zero -/* 3604 80002A04 3C088000 */ lui $t0, %hi(__OSGlobalIntMask) -/* 3608 80002A08 8F5B0118 */ lw $k1, 0x118($k0) -/* 360C 80002A0C 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* 3610 80002A10 8D080000 */ lw $t0, ($t0) -/* 3614 80002A14 3C01FFFF */ lui $at, 0xffff -/* 3618 80002A18 3369FF00 */ andi $t1, $k1, 0xff00 -/* 361C 80002A1C 342100FF */ ori $at, $at, 0xff -/* 3620 80002A20 3108FF00 */ andi $t0, $t0, 0xff00 -/* 3624 80002A24 01284824 */ and $t1, $t1, $t0 -/* 3628 80002A28 0361D824 */ and $k1, $k1, $at -/* 362C 80002A2C 0369D825 */ or $k1, $k1, $t1 -/* 3630 80002A30 409B6000 */ mtc0 $k1, $12 -/* 3634 80002A34 DF5B0108 */ ld $k1, 0x108($k0) -/* 3638 80002A38 DF410020 */ ld $at, 0x20($k0) -/* 363C 80002A3C DF420028 */ ld $v0, 0x28($k0) -/* 3640 80002A40 03600013 */ mtlo $k1 -/* 3644 80002A44 DF5B0110 */ ld $k1, 0x110($k0) -/* 3648 80002A48 DF430030 */ ld $v1, 0x30($k0) -/* 364C 80002A4C DF440038 */ ld $a0, 0x38($k0) -/* 3650 80002A50 DF450040 */ ld $a1, 0x40($k0) -/* 3654 80002A54 DF460048 */ ld $a2, 0x48($k0) -/* 3658 80002A58 DF470050 */ ld $a3, 0x50($k0) -/* 365C 80002A5C DF480058 */ ld $t0, 0x58($k0) -/* 3660 80002A60 DF490060 */ ld $t1, 0x60($k0) -/* 3664 80002A64 DF4A0068 */ ld $t2, 0x68($k0) -/* 3668 80002A68 DF4B0070 */ ld $t3, 0x70($k0) -/* 366C 80002A6C DF4C0078 */ ld $t4, 0x78($k0) -/* 3670 80002A70 DF4D0080 */ ld $t5, 0x80($k0) -/* 3674 80002A74 DF4E0088 */ ld $t6, 0x88($k0) -/* 3678 80002A78 DF4F0090 */ ld $t7, 0x90($k0) -/* 367C 80002A7C DF500098 */ ld $s0, 0x98($k0) -/* 3680 80002A80 DF5100A0 */ ld $s1, 0xa0($k0) -/* 3684 80002A84 DF5200A8 */ ld $s2, 0xa8($k0) -/* 3688 80002A88 DF5300B0 */ ld $s3, 0xb0($k0) -/* 368C 80002A8C DF5400B8 */ ld $s4, 0xb8($k0) -/* 3690 80002A90 DF5500C0 */ ld $s5, 0xc0($k0) -/* 3694 80002A94 DF5600C8 */ ld $s6, 0xc8($k0) -/* 3698 80002A98 DF5700D0 */ ld $s7, 0xd0($k0) -/* 369C 80002A9C DF5800D8 */ ld $t8, 0xd8($k0) -/* 36A0 80002AA0 DF5900E0 */ ld $t9, 0xe0($k0) -/* 36A4 80002AA4 DF5C00E8 */ ld $gp, 0xe8($k0) -/* 36A8 80002AA8 03600011 */ mthi $k1 -/* 36AC 80002AAC DF5D00F0 */ ld $sp, 0xf0($k0) -/* 36B0 80002AB0 DF5E00F8 */ ld $fp, 0xf8($k0) -/* 36B4 80002AB4 DF5F0100 */ ld $ra, 0x100($k0) -/* 36B8 80002AB8 8F5B011C */ lw $k1, 0x11c($k0) -/* 36BC 80002ABC 409B7000 */ mtc0 $k1, $14 -/* 36C0 80002AC0 8F5B0018 */ lw $k1, 0x18($k0) -/* 36C4 80002AC4 13600013 */ beqz $k1, .L80002B14 -/* 36C8 80002AC8 00000000 */ nop -/* 36CC 80002ACC 8F5B012C */ lw $k1, 0x12c($k0) -/* 36D0 80002AD0 44DBF800 */ ctc1 $k1, $31 -/* 36D4 80002AD4 D7400130 */ ldc1 $f0, 0x130($k0) -/* 36D8 80002AD8 D7420138 */ ldc1 $f2, 0x138($k0) -/* 36DC 80002ADC D7440140 */ ldc1 $f4, 0x140($k0) -/* 36E0 80002AE0 D7460148 */ ldc1 $f6, 0x148($k0) -/* 36E4 80002AE4 D7480150 */ ldc1 $f8, 0x150($k0) -/* 36E8 80002AE8 D74A0158 */ ldc1 $f10, 0x158($k0) -/* 36EC 80002AEC D74C0160 */ ldc1 $f12, 0x160($k0) -/* 36F0 80002AF0 D74E0168 */ ldc1 $f14, 0x168($k0) -/* 36F4 80002AF4 D7500170 */ ldc1 $f16, 0x170($k0) -/* 36F8 80002AF8 D7520178 */ ldc1 $f18, 0x178($k0) -/* 36FC 80002AFC D7540180 */ ldc1 $f20, 0x180($k0) -/* 3700 80002B00 D7560188 */ ldc1 $f22, 0x188($k0) -/* 3704 80002B04 D7580190 */ ldc1 $f24, 0x190($k0) -/* 3708 80002B08 D75A0198 */ ldc1 $f26, 0x198($k0) -/* 370C 80002B0C D75C01A0 */ ldc1 $f28, 0x1a0($k0) -/* 3710 80002B10 D75E01A8 */ ldc1 $f30, 0x1a8($k0) -.L80002B14: -/* 3714 80002B14 8F5B0128 */ lw $k1, 0x128($k0) -/* 3718 80002B18 3C1A8000 */ lui $k0, %hi(__OSGlobalIntMask) -/* 371C 80002B1C 275A50F0 */ addiu $k0, $k0, %lo(__OSGlobalIntMask) -/* 3720 80002B20 8F5A0000 */ lw $k0, ($k0) -/* 3724 80002B24 001AD402 */ srl $k0, $k0, 0x10 -/* 3728 80002B28 037AD824 */ and $k1, $k1, $k0 -/* 372C 80002B2C 001BD840 */ sll $k1, $k1, 1 -/* 3730 80002B30 3C1A8000 */ lui $k0, %hi(__osRcpImTable) -/* 3734 80002B34 275A51D0 */ addiu $k0, $k0, %lo(__osRcpImTable) -/* 3738 80002B38 037AD821 */ addu $k1, $k1, $k0 -/* 373C 80002B3C 977B0000 */ lhu $k1, ($k1) -/* 3740 80002B40 3C1AA430 */ lui $k0, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) -/* 3744 80002B44 275A000C */ addiu $k0, $k0, %lo(PHYS_TO_K1(MI_INTR_MASK_REG)) -/* 3748 80002B48 AF5B0000 */ sw $k1, ($k0) -/* 374C 80002B4C 00000000 */ nop -/* 3750 80002B50 00000000 */ nop -/* 3754 80002B54 00000000 */ nop -/* 3758 80002B58 00000000 */ nop -/* 375C 80002B5C 42000018 */ eret -endlabel __osDispatchThread - -glabel __osCleanupThread -/* 3760 80002B60 0C000EB4 */ jal osDestroyThread -/* 3764 80002B64 00002025 */ or $a0, $zero, $zero -/* 3768 80002B68 00000000 */ nop -/* 376C 80002B6C 00000000 */ nop -endlabel __osCleanupThread diff --git a/asm/ultra/parameters.s b/asm/ultra/parameters.s deleted file mode 100644 index 450af31b..00000000 --- a/asm/ultra/parameters.s +++ /dev/null @@ -1,17 +0,0 @@ -#include "PR/R4300.h" -#include "sys/asm.h" -#include "sys/regdef.h" - -.text -ABS(leoBootID, 0x800001a0) -ABS(osTvType, 0x80000300) -ABS(osRomType, 0x80000304) -ABS(osRomBase, 0x80000308) -ABS(osResetType, 0x8000030c) -ABS(osCicId, 0x80000310) -ABS(osVersion, 0x80000314) -ABS(osMemSize, 0x80000318) -ABS(osAppNMIBuffer, 0x8000031c) - -.space 0x60 -/* padded to 0x60 in the object file */ diff --git a/asm/ultra/setintmask.s b/asm/ultra/setintmask.s deleted file mode 100644 index c5c891d8..00000000 --- a/asm/ultra/setintmask.s +++ /dev/null @@ -1,136 +0,0 @@ -#include -#include -.include "macro.inc" -# assembler directives -.set noat # allow manual use of $at -.set gp=64 # allow use of 64-bit general purpose registers - -.rdata - -#define MI_INTR_MASK 0x3f -#define CLR_SP 0x0001 -#define SET_SP 0x0002 -#define CLR_SI 0x0004 -#define SET_SI 0x0008 -#define CLR_AI 0x0010 -#define SET_AI 0x0020 -#define CLR_VI 0x0040 -#define SET_VI 0x0080 -#define CLR_PI 0x0100 -#define SET_PI 0x0200 -#define CLR_DP 0x0400 -#define SET_DP 0x0800 - -EXPORT(__osRcpImTable) -/* LUT to convert between MI_INTR and MI_INTR_MASK */ -/* MI_INTR is status for each interrupt whereas */ -/* MI_INTR_MASK has seperate bits for set/clr */ -.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP -.half SET_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP -.half CLR_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP -.half SET_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | CLR_DP -.half CLR_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP -.half SET_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP -.half CLR_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP -.half SET_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | CLR_DP -.half CLR_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP -.half SET_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP -.half CLR_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP -.half SET_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | CLR_DP -.half CLR_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | CLR_DP -.half SET_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | CLR_DP -.half CLR_SP | SET_SI | SET_AI | SET_VI | CLR_PI | CLR_DP -.half SET_SP | SET_SI | SET_AI | SET_VI | CLR_PI | CLR_DP -.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP -.half SET_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP -.half CLR_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP -.half SET_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | CLR_DP -.half CLR_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | CLR_DP -.half SET_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | CLR_DP -.half CLR_SP | SET_SI | SET_AI | CLR_VI | SET_PI | CLR_DP -.half SET_SP | SET_SI | SET_AI | CLR_VI | SET_PI | CLR_DP -.half CLR_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | CLR_DP -.half SET_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | CLR_DP -.half CLR_SP | SET_SI | CLR_AI | SET_VI | SET_PI | CLR_DP -.half SET_SP | SET_SI | CLR_AI | SET_VI | SET_PI | CLR_DP -.half CLR_SP | CLR_SI | SET_AI | SET_VI | SET_PI | CLR_DP -.half SET_SP | CLR_SI | SET_AI | SET_VI | SET_PI | CLR_DP -.half CLR_SP | SET_SI | SET_AI | SET_VI | SET_PI | CLR_DP -.half SET_SP | SET_SI | SET_AI | SET_VI | SET_PI | CLR_DP -.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP -.half SET_SP | CLR_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP -.half CLR_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP -.half SET_SP | SET_SI | CLR_AI | CLR_VI | CLR_PI | SET_DP -.half CLR_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | SET_DP -.half SET_SP | CLR_SI | SET_AI | CLR_VI | CLR_PI | SET_DP -.half CLR_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | SET_DP -.half SET_SP | SET_SI | SET_AI | CLR_VI | CLR_PI | SET_DP -.half CLR_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | SET_DP -.half SET_SP | CLR_SI | CLR_AI | SET_VI | CLR_PI | SET_DP -.half CLR_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | SET_DP -.half SET_SP | SET_SI | CLR_AI | SET_VI | CLR_PI | SET_DP -.half CLR_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | SET_DP -.half SET_SP | CLR_SI | SET_AI | SET_VI | CLR_PI | SET_DP -.half CLR_SP | SET_SI | SET_AI | SET_VI | CLR_PI | SET_DP -.half SET_SP | SET_SI | SET_AI | SET_VI | CLR_PI | SET_DP -.half CLR_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | SET_DP -.half SET_SP | CLR_SI | CLR_AI | CLR_VI | SET_PI | SET_DP -.half CLR_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | SET_DP -.half SET_SP | SET_SI | CLR_AI | CLR_VI | SET_PI | SET_DP -.half CLR_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | SET_DP -.half SET_SP | CLR_SI | SET_AI | CLR_VI | SET_PI | SET_DP -.half CLR_SP | SET_SI | SET_AI | CLR_VI | SET_PI | SET_DP -.half SET_SP | SET_SI | SET_AI | CLR_VI | SET_PI | SET_DP -.half CLR_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | SET_DP -.half SET_SP | CLR_SI | CLR_AI | SET_VI | SET_PI | SET_DP -.half CLR_SP | SET_SI | CLR_AI | SET_VI | SET_PI | SET_DP -.half SET_SP | SET_SI | CLR_AI | SET_VI | SET_PI | SET_DP -.half CLR_SP | CLR_SI | SET_AI | SET_VI | SET_PI | SET_DP -.half SET_SP | CLR_SI | SET_AI | SET_VI | SET_PI | SET_DP -.half CLR_SP | SET_SI | SET_AI | SET_VI | SET_PI | SET_DP -.half SET_SP | SET_SI | SET_AI | SET_VI | SET_PI | SET_DP -.text -.set noreorder -glabel func_80003A30 -/* 4630 80003A30 400C6000 */ mfc0 $t4, $12 -/* 4634 80003A34 3182FF01 */ andi $v0, $t4, 0xff01 -/* 4638 80003A38 3C088000 */ lui $t0, %hi(__OSGlobalIntMask) -/* 463C 80003A3C 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) -/* 4640 80003A40 8D0B0000 */ lw $t3, ($t0) -/* 4644 80003A44 2401FFFF */ addiu $at, $zero, -1 -/* 4648 80003A48 01614026 */ xor $t0, $t3, $at -/* 464C 80003A4C 3108FF00 */ andi $t0, $t0, 0xff00 -/* 4650 80003A50 00481025 */ or $v0, $v0, $t0 -/* 4654 80003A54 3C0AA430 */ lui $t2, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) -/* 4658 80003A58 8D4A000C */ lw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t2) -/* 465C 80003A5C 11400005 */ beqz $t2, .L80003A74 -/* 4660 80003A60 000B4C02 */ srl $t1, $t3, 0x10 -/* 4664 80003A64 2401FFFF */ addiu $at, $zero, -1 -/* 4668 80003A68 01214826 */ xor $t1, $t1, $at -/* 466C 80003A6C 3129003F */ andi $t1, $t1, 0x3f -/* 4670 80003A70 01495025 */ or $t2, $t2, $t1 -.L80003A74: -/* 4674 80003A74 000A5400 */ sll $t2, $t2, 0x10 -/* 4678 80003A78 004A1025 */ or $v0, $v0, $t2 -/* 467C 80003A7C 3C01003F */ lui $at, 0x3f -/* 4680 80003A80 00814024 */ and $t0, $a0, $at -/* 4684 80003A84 010B4024 */ and $t0, $t0, $t3 -/* 4688 80003A88 000843C2 */ srl $t0, $t0, 0xf -/* 468C 80003A8C 3C0A8000 */ lui $t2, %hi(__osRcpImTable) -/* 4690 80003A90 01485021 */ addu $t2, $t2, $t0 -/* 4694 80003A94 954A51D0 */ lhu $t2, %lo(__osRcpImTable)($t2) -/* 4698 80003A98 3C01A430 */ lui $at, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) -/* 469C 80003A9C AC2A000C */ sw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($at) -/* 46A0 80003AA0 3088FF01 */ andi $t0, $a0, 0xff01 -/* 46A4 80003AA4 3169FF00 */ andi $t1, $t3, 0xff00 -/* 46A8 80003AA8 01094024 */ and $t0, $t0, $t1 -/* 46AC 80003AAC 3C01FFFF */ lui $at, 0xffff -/* 46B0 80003AB0 342100FF */ ori $at, $at, 0xff -/* 46B4 80003AB4 01816024 */ and $t4, $t4, $at -/* 46B8 80003AB8 01886025 */ or $t4, $t4, $t0 -/* 46BC 80003ABC 408C6000 */ mtc0 $t4, $12 -/* 46C0 80003AC0 00000000 */ nop -/* 46C4 80003AC4 00000000 */ nop -/* 46C8 80003AC8 03E00008 */ jr $ra -/* 46CC 80003ACC 00000000 */ nop -endlabel func_80003A30 diff --git a/decompressed.pal.yaml b/decompressed.pal.yaml index 82f31d1a..2fad65b0 100644 --- a/decompressed.pal.yaml +++ b/decompressed.pal.yaml @@ -16,6 +16,7 @@ options: target_path: decompressed.pal.z64 asset_path: bin build_path: build/pal + lib_path: build/pal libultra_symbols: True hardware_regs: True ld_sections_allowlist: @@ -41,78 +42,79 @@ segments: subsegments: - [0x1000, hasm, entry] - name: boot/bk_boot + dir: boot type: code start: 0x1050 vram: 0x80000450 subsegments: - - [0x1050, c, done/bk_boot_1050] - - [0x1150, c, done/rarezip] - - [0x12B0, c, done/inflate] - - [0x27F0, c, done/overlays] - - [0x2970, c, done/initialize] - - [0x2C00, c, done/pirawdma] - - [0x2CE0, c, done/pigetstat] - - [0x2CF0, hasm, bzero] - - [0x2D90, hasm, setsr] - - [0x2DA0, hasm, getsr] - - [0x2DB0, hasm, setfpccsr] - - [0x2DC0, c, done/sirawread] - - [0x2E10, c, done/sirawwrite] - - [0x2E60, hasm, ultra/exceptasm] - - [0x3770, hasm, writebackdcache] - - [0x37F0, hasm, invalicache] - - [0x3870, hasm, maptlbrdb] - - [0x38D0, c, done/pirawread] - - [0x3930, c, done/ll] - - [0x3BF0, hasm, ultra/parameters] - - [0x3C50, c, done/virtualtophysical] - - [0x3CD0, c, done/si] - - [0x3D00, c, done/thread] - - [0x3D40, c, done/leointerrupt] - - [0x45C0, c, done/seteventmesg] - - [0x4630, hasm, ultra/setintmask] - - [0x46D0, c, done/destroythread] - - [0x47D0, hasm, probetlb] - - [0x4890, c, done/leodiskinit] - - [0x4990, c, done/epirawdma] - - [0x4BC0, hasm, interrupt] - - [0x4C00, c, done/pimgr] - - [0x4D90, c, done/cartrominit] - - [0x4E90, c, done/createmesgqueue] - - [0x4EC0, c, done/piacs] - - [0x4F80, c, done/getthreadpri] - - [0x4FA0, c, done/setthreadpri] - - [0x5080, c, done/createthread] - - [0x51D0, c, done/devmgr] - - [0x5660, c, done/startthread] - - [0x57B0, c, done/sendmesg] - - [0x5900, c, done/recvmesg] - - [0x5A40, c, done/resetglobalintmask] - - [0x5AA0, c, done/epirawwrite] - - [0x5AF0, c, done/epirawread] - - [0x5B40, c, done/setglobalintmask] - - [0x5B90, c, done/yieldthread] - - [0x5BE0, c, done/kdebugserver] - - [0x5BE0, .data, done/inflate] - - [0x5CE0, .data, done/initialize] - - [0x5D00, .data, ultra/exceptasm] - - [0x5D20, .data, done/thread] - - [0x5D40, .data, done/pimgr] - - [0x5D70, .data, done/piacs] - - [0x5D80, .rodata, ultra/exceptasm] - - [0x5DD0, .rodata, ultra/setintmask] - - [0x5E50, .rodata, done/devmgr] - - [0x5E70, .bss, done/bk_boot_1050] - - [0x5E70, .bss, done/rarezip] - - [0x5E70, .bss, done/inflate] - - [0x5E70, .bss, done/initialize] - - [0x5E70, .bss, done/kdebugserver] - - [0x5E70, .bss, done/leointerrupt] - - [0x5E70, .bss, done/seteventmesg] - - [0x5E70, .bss, done/leodiskinit] - - [0x5E70, .bss, done/pimgr] - - [0x5E70, .bss, done/cartrominit] - - [0x5E70, .bss, done/piacs] + - [0x1050, c, bk_boot_1050] + - [0x1150, c, rarezip] + - [0x12B0, c, inflate] + - [0x27F0, c, overlays] + - [0x2970, lib, libultra_rom_boot, initialize, .text] + - [0x2C00, lib, libultra_rom_boot, pirawdma, .text] + - [0x2CE0, lib, libultra_rom_boot, pigetstat, .text] + - [0x2CF0, lib, libultra_rom_boot, bzero, .text] + - [0x2D90, lib, libultra_rom_boot, setsr, .text] + - [0x2DA0, lib, libultra_rom_boot, getsr, .text] + - [0x2DB0, lib, libultra_rom_boot, setfpccsr, .text] + - [0x2DC0, lib, libultra_rom_boot, sirawread, .text] + - [0x2E10, lib, libultra_rom_boot, sirawwrite, .text] + - [0x2E60, lib, libultra_rom_boot, exceptasm, .text] + - [0x3770, lib, libultra_rom_boot, writebackdcache, .text] + - [0x37F0, lib, libultra_rom_boot, invalicache, .text] + - [0x3870, lib, libultra_rom_boot, maptlbrdb, .text] + - [0x38D0, lib, libultra_rom_boot, pirawread, .text] + - [0x3930, lib, libultra_rom_boot, ll, .text] + - [0x3BF0, lib, libultra_rom_boot, parameters, .text] + - [0x3C50, lib, libultra_rom_boot, virtualtophysical, .text] + - [0x3CD0, lib, libultra_rom_boot, si, .text] + - [0x3D00, lib, libultra_rom_boot, thread, .text] + - [0x3D40, lib, libultra_rom_boot, leointerrupt, .text] + - [0x45C0, lib, libultra_rom_boot, seteventmesg, .text] + - [0x4630, lib, libultra_rom_boot, setintmask, .text] + - [0x46D0, lib, libultra_rom_boot, destroythread, .text] + - [0x47D0, lib, libultra_rom_boot, probetlb, .text] + - [0x4890, lib, libultra_rom_boot, leodiskinit, .text] + - [0x4990, lib, libultra_rom_boot, epirawdma, .text] + - [0x4BC0, lib, libultra_rom_boot, interrupt, .text] + - [0x4C00, lib, libultra_rom_boot, pimgr, .text] + - [0x4D90, lib, libultra_rom_boot, cartrominit, .text] + - [0x4E90, lib, libultra_rom_boot, createmesgqueue, .text] + - [0x4EC0, lib, libultra_rom_boot, piacs, .text] + - [0x4F80, lib, libultra_rom_boot, getthreadpri, .text] + - [0x4FA0, lib, libultra_rom_boot, setthreadpri, .text] + - [0x5080, lib, libultra_rom_boot, createthread, .text] + - [0x51D0, lib, libultra_rom_boot, devmgr, .text] + - [0x5660, lib, libultra_rom_boot, startthread, .text] + - [0x57B0, lib, libultra_rom_boot, sendmesg, .text] + - [0x5900, lib, libultra_rom_boot, recvmesg, .text] + - [0x5A40, lib, libultra_rom_boot, resetglobalintmask, .text] + - [0x5AA0, lib, libultra_rom_boot, epirawwrite, .text] + - [0x5AF0, lib, libultra_rom_boot, epirawread, .text] + - [0x5B40, lib, libultra_rom_boot, setglobalintmask, .text] + - [0x5B90, lib, libultra_rom_boot, yieldthread, .text] + - [0x5BE0, lib, libultra_rom_boot, kdebugserver, .text] + - [0x5BE0, .data, inflate] + - [0x5CE0, lib, libultra_rom_boot, initialize, .data] + - [0x5D00, lib, libultra_rom_boot, exceptasm, .data] + - [0x5D20, lib, libultra_rom_boot, thread, .data] + - [0x5D40, lib, libultra_rom_boot, pimgr, .data] + - [0x5D70, lib, libultra_rom_boot, piacs, .data] + - [0x5D80, lib, libultra_rom_boot, exceptasm, .rodata] + - [0x5DD0, lib, libultra_rom_boot, setintmask, .rodata] + - [0x5E50, lib, libultra_rom_boot, devmgr, .rodata] + - [0x5E70, .bss, bk_boot_1050] + - [0x5E70, .bss, rarezip] + - [0x5E70, .bss, inflate] + - [0x5E70, lib, libultra_rom_boot, initialize, .bss] + - [0x5E70, lib, libultra_rom_boot, kdebugserver, .bss] + - [0x5E70, lib, libultra_rom_boot, leointerrupt, .bss] + - [0x5E70, lib, libultra_rom_boot, seteventmesg, .bss] + - [0x5E70, lib, libultra_rom_boot, leodiskinit, .bss] + - [0x5E70, lib, libultra_rom_boot, pimgr, .bss] + - [0x5E70, lib, libultra_rom_boot, cartrominit, .bss] + - [0x5E70, lib, libultra_rom_boot, piacs, .bss] - name: crc type: bin start: 0x5E70 @@ -187,175 +189,176 @@ segments: - [0xF5AD30, c, sns] - [0xF5B0B0, c, crccalc] - [0xF5B1F0, hasm, code_1E820] - - [0xF5B290, c, audio/n_sl] - - [0xF5B320, c, audio/n_synthesizer] - - [0xF5BD00, c, audio/event] - - [0xF5BFE0, c, audio/n_synaddplayer] - - [0xF5C1B0, c, audio/n_synallocvoice] - - [0xF5C3B0, c, audio/n_synsetvol] - - [0xF5C450, c, audio/n_synstartvoice] - - [0xF5C4D0, c, audio/n_synsetpan] - - [0xF5C550, c, audio/n_synsetpitch] - - [0xF5C5D0, c, audio/n_synsetfxmix] - - [0xF5C660, c, audio/n_synstopvoice] - - [0xF5C6D0, c, audio/n_synfreevoice] - - [0xF5C770, c, audio/n_csplayer] - - [0xF5DBE0, c, audio/cspsetbank] - - [0xF5DC20, c, audio/cspstop] - - [0xF5DC50, c, audio/n_csq] - - [0xF5E2F0, c, audio/cspsetseq] - - [0xF5E330, c, audio/cspplay] - - [0xF5E360, c, audio/cspsetvol] - - [0xF5E3A0, c, audio/code_219D0] - - [0xF5E3E0, c, audio/cspsettempo] - - [0xF5E450, c, audio/code_21A80] - - [0xF5E480, c, audio/cspgettempo] - - [0xF5E4C0, c, audio/code_21AF0] - - [0xF5E520, c, audio/code_21B50] - - [0xF5E5C0, c, audio/n_syndelete] - - [0xF5E620, c, audio/n_synallocfx] - - [0xF5E680, c, audio/n_reverb] - - [0xF5F110, c, audio/n_auxbus] - - [0xF5F1C0, c, audio/n_drvrNew] - - [0xF5F720, c, audio/n_save] - - [0xF5F770, c, audio/n_envresample] - - [0xF5F810, c, audio/n_env] - - [0xF601C0, c, audio/n_seqplayer] - - [0xF61D30, c, audio/n_synstartvoiceparam] - - [0xF61E10, c, audio/n_mainbus] - - [0xF61E90, c, audio/n_load] - - [0xF62050, c, audio/n_adpcm] - - [0xF62610, c, audio/n_resample] - - [0xF627F0, c, audio/n_seq] - - [0xF62AE0, c, audio/n_synsetpriority] - - [0xF62AF0, asm, os/invaldcache] - - [0xF62B90, asm, os/writebackdcacheall] - - [0xF62BC0, c, os/initialize] - - [0xF62E50, hasm, ultra/parameters] - - [0xF62EB0, c, os/createthread] - - [0xF63000, c, gu/sinf] - - [0xF631C0, c, audio/cents2ratio] - - [0xF63210, c, audio/heapinit] - - [0xF63250, c, os/createmesgqueue] - - [0xF63280, c, io/aisetfreq] - - [0xF633E0, c, audio/sl] - - [0xF634A0, c, audio/heapalloc] - - [0xF63500, c, os/recvmesg] - - [0xF63640, c, io/aigetlen] - - [0xF63650, c, os/virtualtophysical] - - [0xF636D0, c, io/aisetnextbuf] - - [0xF63780, c, os/pidma] - - [0xF63890, c, os/stopthread] - - [0xF63950, c, os/startthread] - - [0xF63AA0, hasm, os/writebackdcache] - - [0xF63B20, hasm, invaldcache] - - [0xF63BD0, c, io/pimgr] - - [0xF63D60, c, os/destroythread] - - [0xF63E60, c, os/sendmesg] - - [0xF63FB0, c, os/settreadpri] - - [0xF64090, c, gu/mtxutil] - - [0xF64300, c, gu/sqrtf] - - [0xF64310, c, gu/cosf] - - [0xF64480, hasm, ultra/setintmask] - - [0xF64520, c, io/dpsetstat] - - [0xF64530, c, io/sptask] - - [0xF64820, c, io/dpgetstat] - - [0xF64830, c, io/vigetcurrframebuf] - - [0xF64870, c, os/stoptimer] - - [0xF64960, c, os/settimer] - - [0xF64A40, c, ll_cvt] - - [0xF64C50, c, io/sptaskyielded] - - [0xF64CD0, c, io/sptaskyield] - - [0xF64CF0, c, io/visetmode] - - [0xF64D60, c, os/seteventmesg] - - [0xF64DD0, c, io/vimgr] - - [0xF65130, c, io/visetspecial] - - [0xF652F0, c, io/viswapbuf] - - [0xF65340, c, io/visetevent] - - [0xF653B0, c, io/vigetnextframebuf] - - [0xF653F0, c, io/viblack] - - [0xF65460, c, gu/ortho] - - [0xF65620, c, gu/translate] - - [0xF656C0, c, gu/rotate] - - [0xF658B0, c, io/contreaddata] - - [0xF65B10, c, io/controller] - - [0xF65ED0, c, io/contsetch] - - [0xF65F40, c, audio/bnkf] - - [0xF66190, c, os/gettime] - - [0xF66220, c, audio/cseq] - - [0xF66CE0, c, io/motor] - - [0xF67300, c, io/pfsinit] - - [0xF673C0, hasm, invalicache] - - [0xF67440, c, io/conteeplongwrite] - - [0xF67570, c, io/conteeplongread] - - [0xF67600, c, io/piread] - - [0xF67640, c, audio/copy] - - [0xF676C0, c, audio/drvrNew] - - [0xF67AB0, c, audio/reverb] - - [0xF67E60, c, syncprintf] - - [0xF67EA0, c, audio/seq] - - [0xF69110, hasm, setsr] - - [0xF69120, hasm, getsr] - - [0xF69130, hasm, setfpccsr] - - [0xF69140, c, io/sirawread] - - [0xF69190, c, io/sirawwrite] - - [0xF691E0, hasm, ultra/exceptasm] - - [0xF69B50, c, io/pirawread] - - [0xF69BB0, c, ll] - - [0xF69E70, hasm, interrupt] - - [0xF69EB0, c, os/thread] - - [0xF69EF0, c, audio/synthesizer] - - [0xF6A5D0, c, audio/syndelete] - - [0xF6A5E0, hasm, probetlb] - - [0xF6A6A0, c, io/ai] - - [0xF6A6D0, c, os/jammesg] - - [0xF6A720, c, io/pigetcmdq] - - [0xF6A750, c, io/cartrominit] - - [0xF6A950, c, io/leodiskinit] - - [0xF6AA50, c, io/piacs] - - [0xF6AB10, c, os/getthreadpri] - - [0xF6AB30, c, io/pirawdma] - - [0xF6AC10, c, io/epirawdma] - - [0xF6AE40, c, io/devmgr] - - [0xF6B2D0, hasm, bcopy] - - [0xF6B5E0, c, io/spsetstat] - - [0xF6B5F0, c, io/spsetpc] - - [0xF6B630, c, io/sprawdma] - - [0xF6B6C0, c, io/sp] - - [0xF6B6F0, c, io/vi] - - [0xF6B830, c, os/timerintr] - - [0xF6BC30, hasm, setcompare] - - [0xF6BC40, c, io/spgetstat] - - [0xF6BC50, c, io/vigetcurrcontext] - - [0xF6BC60, c, io/viswapcontext] - - [0xF6BFC0, hasm, getcount] - - [0xF6BFD0, c, gu/normalize] - - [0xF6C060, c, io/siacs] - - [0xF6C120, c, io/sirawdma] - - [0xF6C1D0, c, io/pfsisplug] - - [0xF6C540, c, io/crc] - - [0xF6C6C0, c, io/contramwrite] - - [0xF6CA40, c, io/contramread] - - [0xF6CE80, c, io/pfsgetstatus] - - [0xF6CEE0, c, io/contpfs] - - [0xF6DC40, c, io/pfschecker] - - [0xF6E6A0, c, io/conteepwrite] - - [0xF6EBF0, c, io/conteepread] - - [0xF6EF50, c, audio/filter] - - [0xF6EF70, c, audio/env] - - [0xF6FAF0, c, audio/load] - - [0xF70640, c, audio/resample] - - [0xF70840, c, audio/auxbus] - - [0xF70940, c, audio/mainbus] - - [0xF70A90, c, audio/save] - - [0xF70B50, c, io/si] - - [0xF70B80, c, io/leointerrupt] - - [0xF71400, c, audio/synallocfx] - - [0xF715B0, c, os/resetglobalintmask] - - [0xF71610, c, io/epirawwrite] - - [0xF71660, c, io/epirawread] - - [0xF716B0, c, os/setglobalintmask] - - [0xF71700, c, os/yieldthread] + - [0xF5B290, c, n_audio/n_sl] + - [0xF5B320, c, n_audio/n_synthesizer] + - [0xF5BD00, lib, libultra_rom, event, .text] + - [0xF5BFE0, c, n_audio/n_synaddplayer] + - [0xF5C1B0, c, n_audio/n_synallocvoice] + - [0xF5C3B0, c, n_audio/n_synsetvol] + - [0xF5C450, c, n_audio/n_synstartvoice] + - [0xF5C4D0, c, n_audio/n_synsetpan] + - [0xF5C550, c, n_audio/n_synsetpitch] + - [0xF5C5D0, c, n_audio/n_synsetfxmix] + - [0xF5C660, c, n_audio/n_synstopvoice] + - [0xF5C6D0, c, n_audio/n_synfreevoice] + - [0xF5C770, c, n_audio/n_csplayer] + - [0xF5DBE0, lib, libultra_rom, cspsetbank, .text] + - [0xF5DC20, lib, libultra_rom, cspstop, .text] + - [0xF5DC50, c, n_audio/n_csq] + - [0xF5E2F0, lib, libultra_rom, cspsetseq, .text] + - [0xF5E330, lib, libultra_rom, cspplay, .text] + - [0xF5E360, lib, libultra_rom, cspsetvol, .text] + - [0xF5E3A0, c, ultra/audio/code_219D0] + - [0xF5E3E0, lib, libultra_rom, cspsettempo, .text] + - [0xF5E450, c, n_audio/code_21A80] + - [0xF5E480, lib, libultra_rom, cspgettempo, .text] + - [0xF5E4C0, c, ultra/audio/code_21AF0] + - [0xF5E520, c, n_audio/code_21B50] + - [0xF5E5C0, c, n_audio/n_syndelete] + - [0xF5E620, c, n_audio/n_synallocfx] + - [0xF5E680, c, n_audio/n_reverb] + - [0xF5F110, c, n_audio/n_auxbus] + - [0xF5F1C0, c, n_audio/n_drvrNew] + - [0xF5F720, c, n_audio/n_save] + - [0xF5F770, c, n_audio/n_envresample] + - [0xF5F810, c, n_audio/n_env] + - [0xF601C0, c, n_audio/n_seqplayer] + - [0xF61D30, c, n_audio/n_synstartvoiceparam] + - [0xF61E10, c, n_audio/n_mainbus] + - [0xF61E90, c, n_audio/n_load] + - [0xF62050, c, n_audio/n_adpcm] + - [0xF62610, c, n_audio/n_resample] + - [0xF627F0, c, n_audio/n_seq] + - [0xF62AE0, c, n_audio/n_synsetpriority] + - [0xF62AF0, lib, libultra_rom, bzero, .text] + - [0xF62B90, lib, libultra_rom, writebackdcacheall, .text] + - [0xF62BC0, lib, libultra_rom, initialize, .text] + - [0xF62E50, lib, libultra_rom, parameters, .text] + - [0xF62EB0, lib, libultra_rom, createthread, .text] + - [0xF63000, lib, libultra_rom, sinf, .text] + - [0xF631C0, lib, libultra_rom, cents2ratio, .text] + - [0xF63210, lib, libultra_rom, heapinit, .text] + - [0xF63250, lib, libultra_rom, createmesgqueue, .text] + - [0xF63280, lib, libultra_rom, aisetfreq, .text] + - [0xF633E0, lib, libultra_rom, sl, .text] + - [0xF634A0, lib, libultra_rom, heapalloc, .text] + - [0xF63500, lib, libultra_rom, recvmesg, .text] + - [0xF63640, lib, libultra_rom, aigetlen, .text] + - [0xF63650, lib, libultra_rom, virtualtophysical, .text] + - [0xF636D0, lib, libultra_rom, aisetnextbuf, .text] + - [0xF63780, lib, libultra_rom, pidma, .text] + - [0xF63890, lib, libultra_rom, stopthread, .text] + - [0xF63950, lib, libultra_rom, startthread, .text] + - [0xF63AA0, lib, libultra_rom, writebackdcache, .text] + - [0xF63B20, lib, libultra_rom, invaldcache, .text] + - [0xF63BD0, lib, libultra_rom, pimgr, .text] + - [0xF63D60, lib, libultra_rom, destroythread, .text] + - [0xF63E60, lib, libultra_rom, sendmesg, .text] + - [0xF63FB0, lib, libultra_rom, setthreadpri, .text] + - [0xF64090, lib, libultra_rom, mtxutil, .text] + - [0xF64300, lib, libultra_rom, sqrtf, .text] + - [0xF64310, lib, libultra_rom, cosf, .text] + - [0xF64480, lib, libultra_rom, setintmask, .text] + - [0xF64520, lib, libultra_rom, dpsetstat, .text] + - [0xF64530, lib, libultra_rom, sptask, .text] + - [0xF64820, lib, libultra_rom, dpgetstat, .text] + - [0xF64830, lib, libultra_rom, vigetcurrframebuf, .text] + - [0xF64870, lib, libultra_rom, stoptimer, .text] + - [0xF64960, lib, libultra_rom, settimer, .text] + - [0xF64A40, lib, libultra_rom, llcvt, .text] + - [0xF64C50, lib, libultra_rom, sptaskyielded, .text] + - [0xF64CD0, lib, libultra_rom, sptaskyield, .text] + - [0xF64CF0, lib, libultra_rom, visetmode, .text] + - [0xF64D60, lib, libultra_rom, seteventmesg, .text] + - [0xF64DD0, lib, libultra_rom, vimgr, .text] + - [0xF65130, lib, libultra_rom, visetspecial, .text] + - [0xF652F0, lib, libultra_rom, viswapbuf, .text] + - [0xF65340, lib, libultra_rom, visetevent, .text] + - [0xF653B0, lib, libultra_rom, vigetnextframebuf, .text] + - [0xF653F0, lib, libultra_rom, viblack, .text] + - [0xF65460, lib, libultra_rom, ortho, .text] + - [0xF65620, lib, libultra_rom, translate, .text] + - [0xF656C0, lib, libultra_rom, rotate, .text] + - [0xF658B0, lib, libultra_rom, contreaddata, .text] + - [0xF65B10, lib, libultra_rom, controller, .text] + - [0xF65ED0, lib, libultra_rom, contsetch, .text] + - [0xF65F40, lib, libultra_rom, bnkf, .text] + - [0xF66190, lib, libultra_rom, gettime, .text] + - [0xF66220, lib, libultra_rom, cseq, .text] + - [0xF66CE0, lib, libultra_rom, motor, .text] + - [0xF67300, lib, libultra_rom, pfsinit, .text] + - [0xF673C0, lib, libultra_rom, invalicache, .text] + - [0xF67440, lib, libultra_rom, conteeplongwrite, .text] + - [0xF67570, lib, libultra_rom, conteeplongread, .text] + - [0xF67600, lib, libultra_rom, piread, .text] + - [0xF67640, lib, libultra_rom, copy, .text] + - [0xF676C0, lib, libultra_rom, drvrnew, .text] + - [0xF67AB0, lib, libultra_rom, reverb, .text] + - [0xF67E60, lib, libultra_rom, syncprintf, .text] + - [0xF67EA0, lib, libultra_rom, seq, .text] + - [0xF69110, lib, libultra_rom, setsr, .text] + - [0xF69120, lib, libultra_rom, getsr, .text] + - [0xF69130, lib, libultra_rom, setfpccsr, .text] + - [0xF69140, lib, libultra_rom, sirawread, .text] + - [0xF69190, lib, libultra_rom, sirawwrite, .text] + - [0xF691E0, lib, libultra_rom, exceptasm, .text] + - [0xF69AF0, lib, libultra_rom, maptlbrdb, .text] + - [0xF69B50, lib, libultra_rom, pirawread, .text] + - [0xF69BB0, lib, libultra_rom, ll, .text] + - [0xF69E70, lib, libultra_rom, interrupt, .text] + - [0xF69EB0, lib, libultra_rom, thread, .text] + - [0xF69EF0, lib, libultra_rom, synthesizer, .text] + - [0xF6A5D0, lib, libultra_rom, syndelete, .text] + - [0xF6A5E0, lib, libultra_rom, probetlb, .text] + - [0xF6A6A0, lib, libultra_rom, ai, .text] + - [0xF6A6D0, lib, libultra_rom, jammesg, .text] + - [0xF6A720, lib, libultra_rom, pigetcmdq, .text] + - [0xF6A750, lib, libultra_rom, cartrominit, .text] + - [0xF6A950, lib, libultra_rom, leodiskinit, .text] + - [0xF6AA50, lib, libultra_rom, piacs, .text] + - [0xF6AB10, lib, libultra_rom, getthreadpri, .text] + - [0xF6AB30, lib, libultra_rom, pirawdma, .text] + - [0xF6AC10, lib, libultra_rom, epirawdma, .text] + - [0xF6AE40, lib, libultra_rom, devmgr, .text] + - [0xF6B2D0, lib, libultra_rom, bcopy, .text] + - [0xF6B5E0, lib, libultra_rom, spsetstat, .text] + - [0xF6B5F0, lib, libultra_rom, spsetpc, .text] + - [0xF6B630, lib, libultra_rom, sprawdma, .text] + - [0xF6B6C0, lib, libultra_rom, sp, .text] + - [0xF6B6F0, lib, libultra_rom, vi, .text] + - [0xF6B830, lib, libultra_rom, timerintr, .text] + - [0xF6BC30, lib, libultra_rom, setcompare, .text] + - [0xF6BC40, lib, libultra_rom, spgetstat, .text] + - [0xF6BC50, lib, libultra_rom, vigetcurrcontext, .text] + - [0xF6BC60, lib, libultra_rom, viswapcontext, .text] + - [0xF6BFC0, lib, libultra_rom, getcount, .text] + - [0xF6BFD0, lib, libultra_rom, normalize, .text] + - [0xF6C060, lib, libultra_rom, siacs, .text] + - [0xF6C120, lib, libultra_rom, sirawdma, .text] + - [0xF6C1D0, lib, libultra_rom, pfsisplug, .text] + - [0xF6C540, lib, libultra_rom, crc, .text] + - [0xF6C6C0, lib, libultra_rom, contramwrite, .text] + - [0xF6CA40, lib, libultra_rom, contramread, .text] + - [0xF6CE80, lib, libultra_rom, pfsgetstatus, .text] + - [0xF6CEE0, lib, libultra_rom, contpfs, .text] + - [0xF6DC40, lib, libultra_rom, pfschecker, .text] + - [0xF6E6A0, lib, libultra_rom, conteepwrite, .text] + - [0xF6EBF0, lib, libultra_rom, conteepread, .text] + - [0xF6EF50, lib, libultra_rom, filter, .text] + - [0xF6EF70, lib, libultra_rom, env, .text] + - [0xF6FAF0, lib, libultra_rom, load, .text] + - [0xF70640, lib, libultra_rom, resample, .text] + - [0xF70840, lib, libultra_rom, auxbus, .text] + - [0xF70940, lib, libultra_rom, mainbus, .text] + - [0xF70A90, lib, libultra_rom, save, .text] + - [0xF70B50, lib, libultra_rom, si, .text] + - [0xF70B80, lib, libultra_rom, leointerrupt, .text] + - [0xF71400, lib, libultra_rom, synallocfx, .text] + - [0xF715B0, lib, libultra_rom, resetglobalintmask, .text] + - [0xF71610, lib, libultra_rom, epirawwrite, .text] + - [0xF71660, lib, libultra_rom, epirawread, .text] + - [0xF716B0, lib, libultra_rom, setglobalintmask, .text] + - [0xF71700, lib, libultra_rom, yieldthread, .text] - [0xF71750, textbin, pal/n_aspMain] - [0xF723B0, textbin, pal/gSPF3DEX_fifo] - [0xF737E0, textbin, pal/gSPL3DEX_fifo] @@ -388,26 +391,26 @@ segments: - [0xF75EF0, .data, code_1D5D0] - [0xF75F10, .data, sns] - [0xF75F20, .data, data_1E820] - - [0xF75F30, .data, audio/n_sl] - - [0xF75F40, .data, audio/n_drvrNew] - - [0xF760D0, .data, audio/n_env] - - [0xF761D0, .data, os/initialize] - - [0xF761F0, .data, audio/sl] - - [0xF76200, .data, io/aisetnextbuf] - - [0xF76210, .data, io/pimgr] - - [0xF76240, .data, io/vimgr] - - [0xF76260, .data, io/controller] - - [0xF76270, .data, audio/drvrNew] - - [0xF76400, .data, ultra/exceptasm] - - [0xF76420, .data, os/thread] - - [0xF76440, .data, io/piacs] - - [0xF76450, .data, io/vi] - - [0xF764C0, .data, os/timerintr] - - [0xF764D0, .data, io/siacs] - - [0xF764E0, .data, audio/env] - - [0xF765E0, .data, io/vimodepallan1] - - [0xF76630, .data, io/vimodempallan1] - - [0xF76680, .data, io/vimodentsclan1] + - [0xF75F30, .data, n_audio/n_sl] + - [0xF75F40, .data, n_audio/n_drvrNew] + - [0xF760D0, .data, n_audio/n_env] + - [0xF761D0, lib, libultra_rom, initialize, .data] + - [0xF761F0, lib, libultra_rom, sl, .data] + - [0xF76200, lib, libultra_rom, aisetnextbuf, .data] + - [0xF76210, lib, libultra_rom, pimgr, .data] + - [0xF76240, lib, libultra_rom, vimgr, .data] + - [0xF76260, lib, libultra_rom, controller, .data] + - [0xF76270, lib, libultra_rom, drvrnew, .data] + - [0xF76400, lib, libultra_rom, exceptasm, .data] + - [0xF76420, lib, libultra_rom, thread, .data] + - [0xF76440, lib, libultra_rom, piacs, .data] + - [0xF76450, lib, libultra_rom, vi, .data] + - [0xF764C0, lib, libultra_rom, timerintr, .data] + - [0xF764D0, lib, libultra_rom, siacs, .data] + - [0xF764E0, lib, libultra_rom, env, .data] + - [0xF765E0, lib, libultra_rom, vimodepallan1, .data] + - [0xF76630, lib, libultra_rom, vimodempallan1, .data] + - [0xF76680, lib, libultra_rom, vimodentsclan1, .data] - [0xF766D0, .rodata, code_1D00] - [0xF766F0, .rodata, code_3250] - [0xF76700, .rodata, stub_3A70] @@ -424,30 +427,29 @@ segments: - [0xF772D0, .rodata, ml] - [0xF773D0, .rodata, musicplayer] - [0xF77400, .rodata, code_1D5D0] - - [0xF77460, .rodata, audio/n_synthesizer] - - [0xF77470, .rodata, audio/n_csplayer] - - [0xF777E0, .rodata, audio/n_reverb] - - [0xF77810, .rodata, audio/n_drvrNew] - - [0xF77830, .rodata, audio/n_env] - - [0xF77880, .rodata, audio/n_seqplayer] - - [0xF77C30, .rodata, audio/n_resample] - - [0xF77C40, .rodata, gu/sinf] - - [0xF77C90, .rodata, audio/cents2ratio] - - [0xF77CA0, .rodata, gu/cosf] - - [0xF77CF0, .rodata, ultra/setintmask] - - [0xF77D70, .rodata, ll_cvt] - - [0xF77D80, .rodata, gu/rotate] - - [0xF77D90, .rodata, audio/cseq] - - [0xF77DA0, .rodata, audio/drvrNew] - - [0xF77DC0, .rodata, audio/reverb] - - [0xF77DF0, .rodata, audio/seq] - - [0xF77E00, .rodata, ultra/exceptasm] - - [0xF77E50, hasm, ultra/libm_vals] # Nothing in this file, just here so splat sees it's ASM - - [0xF77E50, .rodata, ultra/libm_vals] - - [0xF77E60, .rodata, audio/synthesizer] - - [0xF77E70, .rodata, io/devmgr] - - [0xF77E90, .rodata, audio/env] - - [0xF77EE0, .rodata, audio/resample] + - [0xF77460, .rodata, n_audio/n_synthesizer] + - [0xF77470, .rodata, n_audio/n_csplayer] + - [0xF777E0, .rodata, n_audio/n_reverb] + - [0xF77810, .rodata, n_audio/n_drvrNew] + - [0xF77830, .rodata, n_audio/n_env] + - [0xF77880, .rodata, n_audio/n_seqplayer] + - [0xF77C30, .rodata, n_audio/n_resample] + - [0xF77C40, lib, libultra_rom, sinf, .rodata] + - [0xF77C90, lib, libultra_rom, cents2ratio, .rodata] + - [0xF77CA0, lib, libultra_rom, cosf, .rodata] + - [0xF77CF0, lib, libultra_rom, setintmask, .rodata] + - [0xF77D70, lib, libultra_rom, llcvt, .rodata] + - [0xF77D80, lib, libultra_rom, rotate, .rodata] + - [0xF77D90, lib, libultra_rom, cseq, .rodata] + - [0xF77DA0, lib, libultra_rom, drvrnew, .rodata] + - [0xF77DC0, lib, libultra_rom, reverb, .rodata] + - [0xF77DF0, lib, libultra_rom, seq, .rodata] + - [0xF77E00, lib, libultra_rom, exceptasm, .rodata] + - [0xF77E50, lib, libultra_rom, libm_vals, .rodata] + - [0xF77E60, lib, libultra_rom, synthesizer, .rodata] + - [0xF77E70, lib, libultra_rom, devmgr, .rodata] + - [0xF77E90, lib, libultra_rom, env, .rodata] + - [0xF77EE0, lib, libultra_rom, resample, .rodata] - [0xF77F20, rodatabin, pal/n_aspMain] - [0xF781D0, rodatabin, pal/gSPF3DEX_fifo] - [0xF789D0, rodatabin, pal/gSPL3DEX_fifo] @@ -478,23 +480,23 @@ segments: - [0xF791D0, .bss, ucode] - [0xF791D0, .bss, code_1D5D0] - [0xF791D0, .bss, sns] - - [0xF791D0, .bss, os/initialize] - - [0xF791D0, .bss, io/pimgr] - - [0xF791D0, .bss, io/sptask] - - [0xF791D0, .bss, os/seteventmesg] - - [0xF791D0, .bss, io/vimgr] - - [0xF791D0, .bss, gu/rotate] - - [0xF791D0, .bss, io/controller] - - [0xF791D0, .bss, io/motor] - - [0xF791D0, .bss, io/cartrominit] - - [0xF791D0, .bss, io/leodiskinit] - - [0xF791D0, .bss, io/piacs] - - [0xF791D0, .bss, os/timerintr] - - [0xF791D0, .bss, io/siacs] - - [0xF791D0, .bss, io/pfsisplug] - - [0xF791D0, .bss, io/conteepread] - - [0xF791D0, .bss, os/kdebugserver] - - [0xF791D0, .bss, io/leointerrupt] + - [0xF791D0, lib, libultra_rom, initialize, .bss] + - [0xF791D0, lib, libultra_rom, pimgr, .bss] + - [0xF791D0, lib, libultra_rom, sptask, .bss] + - [0xF791D0, lib, libultra_rom, seteventmesg, .bss] + - [0xF791D0, lib, libultra_rom, vimgr, .bss] + - [0xF791D0, lib, libultra_rom, rotate, .bss] + - [0xF791D0, lib, libultra_rom, controller, .bss] + - [0xF791D0, lib, libultra_rom, motor, .bss] + - [0xF791D0, lib, libultra_rom, cartrominit, .bss] + - [0xF791D0, lib, libultra_rom, leodiskinit, .bss] + - [0xF791D0, lib, libultra_rom, piacs, .bss] + - [0xF791D0, lib, libultra_rom, timerintr, .bss] + - [0xF791D0, lib, libultra_rom, siacs, .bss] + - [0xF791D0, lib, libultra_rom, pfsisplug, .bss] + - [0xF791D0, lib, libultra_rom, conteepread, .bss] + - [0xF791D0, lib, libultra_rom, kdebugserver, .bss] + - [0xF791D0, lib, libultra_rom, leointerrupt, .bss] - name: core2 dir: core2 type: code @@ -826,7 +828,7 @@ segments: # - [0x100D480, c, coords] #DONE # - [0x100D8A0, c, code_B7F40] #DONE # - [0x100D980, c, code_B8020] #DONE - # - [0x100D9D0, c, code_B8070] #DONE + # - [0x100D9D0, c, ultra/debug/assert] #DONE # - [0x100D9E0, c, code_B8080] #DONE # - [0x100E1C0, c, code_B8860] #DONE # - [0x100E9F0, c, code_B9090] #DONE diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index 68315e62..db2d2168 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -16,6 +16,7 @@ options: target_path: decompressed.us.v10.z64 asset_path: bin build_path: build/us.v10 + lib_path: build/us.v10 libultra_symbols: True hardware_regs: True ld_sections_allowlist: @@ -41,78 +42,79 @@ segments: subsegments: - [0x1000, hasm, entry] - name: boot/bk_boot + dir: boot type: code start: 0x1050 vram: 0x80000450 subsegments: - - [0x1050, c, done/bk_boot_1050] - - [0x1150, c, done/rarezip] - - [0x12B0, c, done/inflate] - - [0x27F0, c, done/overlays] - - [0x2970, c, done/initialize] - - [0x2C00, c, done/pirawdma] - - [0x2CE0, c, done/pigetstat] - - [0x2CF0, hasm, bzero] - - [0x2D90, hasm, setsr] - - [0x2DA0, hasm, getsr] - - [0x2DB0, hasm, setfpccsr] - - [0x2DC0, c, done/sirawread] - - [0x2E10, c, done/sirawwrite] - - [0x2E60, hasm, ultra/exceptasm] - - [0x3770, hasm, writebackdcache] - - [0x37F0, hasm, invalicache] - - [0x3870, hasm, maptlbrdb] - - [0x38D0, c, done/pirawread] - - [0x3930, c, done/ll] - - [0x3BF0, hasm, ultra/parameters] - - [0x3C50, c, done/virtualtophysical] - - [0x3CD0, c, done/si] - - [0x3D00, c, done/thread] - - [0x3D40, c, done/leointerrupt] - - [0x45C0, c, done/seteventmesg] - - [0x4630, hasm, ultra/setintmask] - - [0x46D0, c, done/destroythread] - - [0x47D0, hasm, probetlb] - - [0x4890, c, done/leodiskinit] - - [0x4990, c, done/epirawdma] - - [0x4BC0, hasm, interrupt] - - [0x4C00, c, done/pimgr] - - [0x4D90, c, done/cartrominit] - - [0x4E90, c, done/createmesgqueue] - - [0x4EC0, c, done/piacs] - - [0x4F80, c, done/getthreadpri] - - [0x4FA0, c, done/setthreadpri] - - [0x5080, c, done/createthread] - - [0x51D0, c, done/devmgr] - - [0x5660, c, done/startthread] - - [0x57B0, c, done/sendmesg] - - [0x5900, c, done/recvmesg] - - [0x5A40, c, done/resetglobalintmask] - - [0x5AA0, c, done/epirawwrite] - - [0x5AF0, c, done/epirawread] - - [0x5B40, c, done/setglobalintmask] - - [0x5B90, c, done/yieldthread] - - [0x5BE0, c, done/kdebugserver] - - [0x5BE0, .data, done/inflate] - - [0x5CE0, .data, done/initialize] - - [0x5D00, .data, ultra/exceptasm] - - [0x5D20, .data, done/thread] - - [0x5D40, .data, done/pimgr] - - [0x5D70, .data, done/piacs] - - [0x5D80, .rodata, ultra/exceptasm] - - [0x5DD0, .rodata, ultra/setintmask] - - [0x5E50, .rodata, done/devmgr] - - [0x5E70, .bss, done/bk_boot_1050] - - [0x5E70, .bss, done/rarezip] - - [0x5E70, .bss, done/inflate] - - [0x5E70, .bss, done/initialize] - - [0x5E70, .bss, done/kdebugserver] - - [0x5E70, .bss, done/leointerrupt] - - [0x5E70, .bss, done/seteventmesg] - - [0x5E70, .bss, done/leodiskinit] - - [0x5E70, .bss, done/pimgr] - - [0x5E70, .bss, done/cartrominit] - - [0x5E70, .bss, done/piacs] + - [0x1050, c, bk_boot_1050] + - [0x1150, c, rarezip] + - [0x12B0, c, inflate] + - [0x27F0, c, overlays] + - [0x2970, lib, libultra_rom_boot, initialize, .text] + - [0x2C00, lib, libultra_rom_boot, pirawdma, .text] + - [0x2CE0, lib, libultra_rom_boot, pigetstat, .text] + - [0x2CF0, lib, libultra_rom_boot, bzero, .text] + - [0x2D90, lib, libultra_rom_boot, setsr, .text] + - [0x2DA0, lib, libultra_rom_boot, getsr, .text] + - [0x2DB0, lib, libultra_rom_boot, setfpccsr, .text] + - [0x2DC0, lib, libultra_rom_boot, sirawread, .text] + - [0x2E10, lib, libultra_rom_boot, sirawwrite, .text] + - [0x2E60, lib, libultra_rom_boot, exceptasm, .text] + - [0x3770, lib, libultra_rom_boot, writebackdcache, .text] + - [0x37F0, lib, libultra_rom_boot, invalicache, .text] + - [0x3870, lib, libultra_rom_boot, maptlbrdb, .text] + - [0x38D0, lib, libultra_rom_boot, pirawread, .text] + - [0x3930, lib, libultra_rom_boot, ll, .text] + - [0x3BF0, lib, libultra_rom_boot, parameters, .text] + - [0x3C50, lib, libultra_rom_boot, virtualtophysical, .text] + - [0x3CD0, lib, libultra_rom_boot, si, .text] + - [0x3D00, lib, libultra_rom_boot, thread, .text] + - [0x3D40, lib, libultra_rom_boot, leointerrupt, .text] + - [0x45C0, lib, libultra_rom_boot, seteventmesg, .text] + - [0x4630, lib, libultra_rom_boot, setintmask, .text] + - [0x46D0, lib, libultra_rom_boot, destroythread, .text] + - [0x47D0, lib, libultra_rom_boot, probetlb, .text] + - [0x4890, lib, libultra_rom_boot, leodiskinit, .text] + - [0x4990, lib, libultra_rom_boot, epirawdma, .text] + - [0x4BC0, lib, libultra_rom_boot, interrupt, .text] + - [0x4C00, lib, libultra_rom_boot, pimgr, .text] + - [0x4D90, lib, libultra_rom_boot, cartrominit, .text] + - [0x4E90, lib, libultra_rom_boot, createmesgqueue, .text] + - [0x4EC0, lib, libultra_rom_boot, piacs, .text] + - [0x4F80, lib, libultra_rom_boot, getthreadpri, .text] + - [0x4FA0, lib, libultra_rom_boot, setthreadpri, .text] + - [0x5080, lib, libultra_rom_boot, createthread, .text] + - [0x51D0, lib, libultra_rom_boot, devmgr, .text] + - [0x5660, lib, libultra_rom_boot, startthread, .text] + - [0x57B0, lib, libultra_rom_boot, sendmesg, .text] + - [0x5900, lib, libultra_rom_boot, recvmesg, .text] + - [0x5A40, lib, libultra_rom_boot, resetglobalintmask, .text] + - [0x5AA0, lib, libultra_rom_boot, epirawwrite, .text] + - [0x5AF0, lib, libultra_rom_boot, epirawread, .text] + - [0x5B40, lib, libultra_rom_boot, setglobalintmask, .text] + - [0x5B90, lib, libultra_rom_boot, yieldthread, .text] + - [0x5BE0, lib, libultra_rom_boot, kdebugserver, .text] + - [0x5BE0, .data, inflate] + - [0x5CE0, lib, libultra_rom_boot, initialize, .data] + - [0x5D00, lib, libultra_rom_boot, exceptasm, .data] + - [0x5D20, lib, libultra_rom_boot, thread, .data] + - [0x5D40, lib, libultra_rom_boot, pimgr, .data] + - [0x5D70, lib, libultra_rom_boot, piacs, .data] + - [0x5D80, lib, libultra_rom_boot, exceptasm, .rodata] + - [0x5DD0, lib, libultra_rom_boot, setintmask, .rodata] + - [0x5E50, lib, libultra_rom_boot, devmgr, .rodata] + - [0x5E70, .bss, bk_boot_1050] + - [0x5E70, .bss, rarezip] + - [0x5E70, .bss, inflate] + - [0x5E70, lib, libultra_rom_boot, initialize, .bss] + - [0x5E70, lib, libultra_rom_boot, kdebugserver, .bss] + - [0x5E70, lib, libultra_rom_boot, leointerrupt, .bss] + - [0x5E70, lib, libultra_rom_boot, seteventmesg, .bss] + - [0x5E70, lib, libultra_rom_boot, leodiskinit, .bss] + - [0x5E70, lib, libultra_rom_boot, pimgr, .bss] + - [0x5E70, lib, libultra_rom_boot, cartrominit, .bss] + - [0x5E70, lib, libultra_rom_boot, piacs, .bss] - name: crc type: bin start: 0x5E70 @@ -188,174 +190,175 @@ segments: - [0xF375B0, c, sns] - [0xF37930, c, crccalc] - [0xF37A70, hasm, code_1E820] - - [0xF37B10, c, audio/n_sl] - - [0xF37BA0, c, audio/n_synthesizer] - - [0xF38580, c, audio/event] - - [0xF38860, c, audio/n_synaddplayer] - - [0xF38A30, c, audio/n_synallocvoice] - - [0xF38C30, c, audio/n_synsetvol] - - [0xF38CD0, c, audio/n_synstartvoice] - - [0xF38D50, c, audio/n_synsetpan] - - [0xF38DD0, c, audio/n_synsetpitch] - - [0xF38E50, c, audio/n_synsetfxmix] - - [0xF38EE0, c, audio/n_synstopvoice] - - [0xF38F50, c, audio/n_synfreevoice] - - [0xF38FF0, c, audio/n_csplayer] - - [0xF3A460, c, audio/cspsetbank] - - [0xF3A4A0, c, audio/cspstop] - - [0xF3A4D0, c, audio/n_csq] - - [0xF3AB70, c, audio/cspsetseq] - - [0xF3ABB0, c, audio/cspplay] - - [0xF3ABE0, c, audio/cspsetvol] - - [0xF3AC20, c, audio/code_219D0] - - [0xF3AC60, c, audio/cspsettempo] - - [0xF3ACD0, c, audio/code_21A80] - - [0xF3AD00, c, audio/cspgettempo] - - [0xF3AD40, c, audio/code_21AF0] - - [0xF3ADA0, c, audio/code_21B50] - - [0xF3AE40, c, audio/n_syndelete] - - [0xF3AEA0, c, audio/n_synallocfx] - - [0xF3AF00, c, audio/n_reverb] - - [0xF3B990, c, audio/n_auxbus] - - [0xF3BA40, c, audio/n_drvrNew] - - [0xF3BFA0, c, audio/n_save] - - [0xF3BFF0, c, audio/n_envresample] - - [0xF3C090, c, audio/n_env] - - [0xF3CA40, c, audio/n_seqplayer] - - [0xF3E5B0, c, audio/n_synstartvoiceparam] - - [0xF3E690, c, audio/n_mainbus] - - [0xF3E710, c, audio/n_load] - - [0xF3E8D0, c, audio/n_adpcm] - - [0xF3EE90, c, audio/n_resample] - - [0xF3F070, c, audio/n_seq] - - [0xF3F360, c, audio/n_synsetpriority] - - [0xF3F370, asm, os/invaldcache] - - [0xF3F410, asm, os/writebackdcacheall] - - [0xF3F440, c, os/initialize] - - [0xF3F6D0, c, os/createthread] - - [0xF3F820, c, gu/sinf] - - [0xF3F9E0, c, audio/cents2ratio] - - [0xF3FA30, c, audio/heapinit] - - [0xF3FA70, hasm, ultra/parameters] - - [0xF3FAD0, c, os/createmesgqueue] - - [0xF3FB00, c, io/aisetfreq] - - [0xF3FC60, c, audio/sl] - - [0xF3FD20, c, audio/heapalloc] - - [0xF3FD80, c, os/recvmesg] - - [0xF3FEC0, c, io/aigetlen] - - [0xF3FED0, c, os/virtualtophysical] - - [0xF3FF50, c, io/aisetnextbuf] - - [0xF40000, c, os/pidma] - - [0xF40110, c, os/stopthread] - - [0xF401D0, c, os/startthread] - - [0xF40320, hasm, os/writebackdcache] - - [0xF403A0, hasm, invaldcache] - - [0xF40450, c, io/pimgr] - - [0xF405E0, c, os/destroythread] - - [0xF406E0, c, os/sendmesg] - - [0xF40830, c, os/settreadpri] - - [0xF40910, c, gu/mtxutil] - - [0xF40B80, c, gu/sqrtf] - - [0xF40B90, c, gu/cosf] - - [0xF40D00, hasm, ultra/setintmask] - - [0xF40DA0, c, io/dpsetstat] - - [0xF40DB0, c, io/sptask] - - [0xF410A0, c, io/dpgetstat] - - [0xF410A0, c, io/vigetcurrframebuf] - - [0xF410F0, c, os/stoptimer] - - [0xF411E0, c, os/settimer] - - [0xF412C0, c, ll] - - [0xF41580, c, io/sptaskyielded] - - [0xF41600, c, io/sptaskyield] - - [0xF41620, c, io/visetmode] - - [0xF41690, c, os/seteventmesg] - - [0xF41700, c, io/vimgr] - - [0xF41A60, c, io/visetspecial] - - [0xF41C20, c, io/viswapbuf] - - [0xF41C70, c, io/visetevent] - - [0xF41CE0, c, io/vigetnextframebuf] - - [0xF41D20, c, io/viblack] - - [0xF41D90, c, gu/ortho] - - [0xF41F50, c, gu/translate] - - [0xF41FF0, c, gu/rotate] - - [0xF421E0, c, io/contreaddata] - - [0xF42440, c, io/controller] - - [0xF42800, c, io/contsetch] - - [0xF42870, c, audio/bnkf] - - [0xF42AC0, c, os/gettime] - - [0xF42B50, c, audio/cseq] - - [0xF43610, c, io/motor] - - [0xF43C30, c, io/pfsinit] - - [0xF43CF0, hasm, invalicache] - - [0xF43D70, c, io/conteeplongwrite] - - [0xF43EA0, c, io/conteeplongread] - - [0xF43F30, c, io/piread] - - [0xF43F70, c, audio/copy] - - [0xF43FF0, c, audio/drvrNew] - - [0xF44790, c, audio/reverb] - - [0xF453E0, c, syncprintf] - - [0xF45420, c, audio/seq] - - [0xF45A40, hasm, setsr] - - [0xF45A50, hasm, getsr] - - [0xF45A60, hasm, setfpccsr] - - [0xF45A70, c, io/sirawread] - - [0xF45AC0, c, io/sirawwrite] - - [0xF45B10, hasm, ultra/exceptasm] - - [0xF46480, c, io/pirawread] - - [0xF464E0, hasm, interrupt] - - [0xF46520, c, os/thread] - - [0xF46560, c, audio/synthesizer] - - [0xF46C40, c, audio/syndelete] - - [0xF46C50, hasm, probetlb] - - [0xF46D10, c, io/ai] - - [0xF46D40, c, os/jammesg] - - [0xF46E90, c, io/pigetcmdq] - - [0xF46EC0, c, io/cartrominit] - - [0xF46FC0, c, io/leodiskinit] - - [0xF470C0, c, io/piacs] - - [0xF47180, c, os/getthreadpri] - - [0xF471A0, c, io/pirawdma] - - [0xF47280, c, io/epirawdma] - - [0xF474B0, c, io/devmgr] - - [0xF47940, hasm, bcopy] - - [0xF47C50, c, io/spsetstat] - - [0xF47C60, c, io/spsetpc] - - [0xF47CA0, c, io/sprawdma] - - [0xF47D30, c, io/sp] - - [0xF47D60, c, io/vi] - - [0xF47EA0, c, os/timerintr] - - [0xF482A0, hasm, setcompare] - - [0xF482B0, c, io/spgetstat] - - [0xF482C0, c, io/vigetcurrcontext] - - [0xF482D0, c, io/viswapcontext] - - [0xF48630, hasm, getcount] - - [0xF48640, c, gu/normalize] - - [0xF486D0, c, io/siacs] - - [0xF48790, c, io/sirawdma] - - [0xF48840, c, io/pfsisplug] - - [0xF48BB0, c, io/crc] - - [0xF48D30, c, io/contramwrite] - - [0xF490B0, c, io/contramread] - - [0xF49440, c, io/pfsgetstatus] - - [0xF49550, c, io/contpfs] - - [0xF4A2B0, c, io/pfschecker] - - [0xF4AD10, c, io/conteepwrite] - - [0xF4B260, c, io/conteepread] - - [0xF4B5C0, c, audio/filter] - - [0xF4B5E0, c, audio/env] - - [0xF4C160, c, audio/load] - - [0xF4CCB0, c, audio/resample] - - [0xF4CFB0, c, audio/auxbus] - - [0xF4D0C0, c, audio/mainbus] - - [0xF4D210, c, audio/save] - - [0xF4D2D0, c, io/si] - - [0xF4D300, c, io/leointerrupt] - - [0xF4DB80, c, audio/synallocfx] - - [0xF4DC20, c, os/resetglobalintmask] - - [0xF4DC80, c, io/epirawwrite] - - [0xF4DCD0, c, io/epirawread] - - [0xF4DD20, c, os/setglobalintmask] - - [0xF4DD70, c, os/yieldthread] + - [0xF37B10, c, n_audio/n_sl] + - [0xF37BA0, c, n_audio/n_synthesizer] + - [0xF38580, lib, libultra_rom, event, .text] + - [0xF38860, c, n_audio/n_synaddplayer] + - [0xF38A30, c, n_audio/n_synallocvoice] + - [0xF38C30, c, n_audio/n_synsetvol] + - [0xF38CD0, c, n_audio/n_synstartvoice] + - [0xF38D50, c, n_audio/n_synsetpan] + - [0xF38DD0, c, n_audio/n_synsetpitch] + - [0xF38E50, c, n_audio/n_synsetfxmix] + - [0xF38EE0, c, n_audio/n_synstopvoice] + - [0xF38F50, c, n_audio/n_synfreevoice] + - [0xF38FF0, c, n_audio/n_csplayer] + - [0xF3A460, lib, libultra_rom, cspsetbank, .text] + - [0xF3A4A0, lib, libultra_rom, cspstop, .text] + - [0xF3A4D0, c, n_audio/n_csq] + - [0xF3AB70, lib, libultra_rom, cspsetseq, .text] + - [0xF3ABB0, lib, libultra_rom, cspplay, .text] + - [0xF3ABE0, lib, libultra_rom, cspsetvol, .text] + - [0xF3AC20, c, ultra/audio/code_219D0] + - [0xF3AC60, lib, libultra_rom, cspsettempo, .text] + - [0xF3ACD0, c, n_audio/code_21A80] + - [0xF3AD00, lib, libultra_rom, cspgettempo, .text] + - [0xF3AD40, c, ultra/audio/code_21AF0] + - [0xF3ADA0, c, n_audio/code_21B50] + - [0xF3AE40, c, n_audio/n_syndelete] + - [0xF3AEA0, c, n_audio/n_synallocfx] + - [0xF3AF00, c, n_audio/n_reverb] + - [0xF3B990, c, n_audio/n_auxbus] + - [0xF3BA40, c, n_audio/n_drvrNew] + - [0xF3BFA0, c, n_audio/n_save] + - [0xF3BFF0, c, n_audio/n_envresample] + - [0xF3C090, c, n_audio/n_env] + - [0xF3CA40, c, n_audio/n_seqplayer] + - [0xF3E5B0, c, n_audio/n_synstartvoiceparam] + - [0xF3E690, c, n_audio/n_mainbus] + - [0xF3E710, c, n_audio/n_load] + - [0xF3E8D0, c, n_audio/n_adpcm] + - [0xF3EE90, c, n_audio/n_resample] + - [0xF3F070, c, n_audio/n_seq] + - [0xF3F360, c, n_audio/n_synsetpriority] + - [0xF3F370, lib, libultra_rom, bzero, .text] + - [0xF3F410, lib, libultra_rom, writebackdcacheall, .text] + - [0xF3F440, lib, libultra_rom, initialize, .text] + - [0xF3F6D0, lib, libultra_rom, createthread, .text] + - [0xF3F820, lib, libultra_rom, sinf, .text] + - [0xF3F9E0, lib, libultra_rom, cents2ratio, .text] + - [0xF3FA30, lib, libultra_rom, heapinit, .text] + - [0xF3FA70, lib, libultra_rom, parameters, .text] + - [0xF3FAD0, lib, libultra_rom, createmesgqueue, .text] + - [0xF3FB00, lib, libultra_rom, aisetfreq, .text] + - [0xF3FC60, lib, libultra_rom, sl, .text] + - [0xF3FD20, lib, libultra_rom, heapalloc, .text] + - [0xF3FD80, lib, libultra_rom, recvmesg, .text] + - [0xF3FEC0, lib, libultra_rom, aigetlen, .text] + - [0xF3FED0, lib, libultra_rom, virtualtophysical, .text] + - [0xF3FF50, lib, libultra_rom, aisetnextbuf, .text] + - [0xF40000, lib, libultra_rom, pidma, .text] + - [0xF40110, lib, libultra_rom, stopthread, .text] + - [0xF401D0, lib, libultra_rom, startthread, .text] + - [0xF40320, lib, libultra_rom, writebackdcache, .text] + - [0xF403A0, lib, libultra_rom, invaldcache, .text] + - [0xF40450, lib, libultra_rom, pimgr, .text] + - [0xF405E0, lib, libultra_rom, destroythread, .text] + - [0xF406E0, lib, libultra_rom, sendmesg, .text] + - [0xF40830, lib, libultra_rom, setthreadpri, .text] + - [0xF40910, lib, libultra_rom, mtxutil, .text] + - [0xF40B80, lib, libultra_rom, sqrtf, .text] + - [0xF40B90, lib, libultra_rom, cosf, .text] + - [0xF40D00, lib, libultra_rom, setintmask, .text] + - [0xF40DA0, lib, libultra_rom, dpsetstat, .text] + - [0xF40DB0, lib, libultra_rom, sptask, .text] + - [0xF410A0, lib, libultra_rom, dpgetstat, .text] + - [0xF410A0, lib, libultra_rom, vigetcurrframebuf, .text] + - [0xF410F0, lib, libultra_rom, stoptimer, .text] + - [0xF411E0, lib, libultra_rom, settimer, .text] + - [0xF412C0, lib, libultra_rom, ll, .text] + - [0xF41580, lib, libultra_rom, sptaskyielded, .text] + - [0xF41600, lib, libultra_rom, sptaskyield, .text] + - [0xF41620, lib, libultra_rom, visetmode, .text] + - [0xF41690, lib, libultra_rom, seteventmesg, .text] + - [0xF41700, lib, libultra_rom, vimgr, .text] + - [0xF41A60, lib, libultra_rom, visetspecial, .text] + - [0xF41C20, lib, libultra_rom, viswapbuf, .text] + - [0xF41C70, lib, libultra_rom, visetevent, .text] + - [0xF41CE0, lib, libultra_rom, vigetnextframebuf, .text] + - [0xF41D20, lib, libultra_rom, viblack, .text] + - [0xF41D90, lib, libultra_rom, ortho, .text] + - [0xF41F50, lib, libultra_rom, translate, .text] + - [0xF41FF0, lib, libultra_rom, rotate, .text] + - [0xF421E0, lib, libultra_rom, contreaddata, .text] + - [0xF42440, lib, libultra_rom, controller, .text] + - [0xF42800, lib, libultra_rom, contsetch, .text] + - [0xF42870, lib, libultra_rom, bnkf, .text] + - [0xF42AC0, lib, libultra_rom, gettime, .text] + - [0xF42B50, lib, libultra_rom, cseq, .text] + - [0xF43610, lib, libultra_rom, motor, .text] + - [0xF43C30, lib, libultra_rom, pfsinit, .text] + - [0xF43CF0, lib, libultra_rom, invalicache, .text] + - [0xF43D70, lib, libultra_rom, conteeplongwrite, .text] + - [0xF43EA0, lib, libultra_rom, conteeplongread, .text] + - [0xF43F30, lib, libultra_rom, piread, .text] + - [0xF43F70, lib, libultra_rom, copy, .text] + - [0xF43FF0, lib, libultra_rom, drvrnew, .text] + - [0xF44790, lib, libultra_rom, reverb, .text] + - [0xF453E0, lib, libultra_rom, syncprintf, .text] + - [0xF45420, lib, libultra_rom, seq, .text] + - [0xF45A40, lib, libultra_rom, setsr, .text] + - [0xF45A50, lib, libultra_rom, getsr, .text] + - [0xF45A60, lib, libultra_rom, setfpccsr, .text] + - [0xF45A70, lib, libultra_rom, sirawread, .text] + - [0xF45AC0, lib, libultra_rom, sirawwrite, .text] + - [0xF45B10, lib, libultra_rom, exceptasm, .text] + - [0xF46420, lib, libultra_rom, maptlbrdb, .text] + - [0xF46480, lib, libultra_rom, pirawread, .text] + - [0xF464E0, lib, libultra_rom, interrupt, .text] + - [0xF46520, lib, libultra_rom, thread, .text] + - [0xF46560, lib, libultra_rom, synthesizer, .text] + - [0xF46C40, lib, libultra_rom, syndelete, .text] + - [0xF46C50, lib, libultra_rom, probetlb, .text] + - [0xF46D10, lib, libultra_rom, ai, .text] + - [0xF46D40, lib, libultra_rom, jammesg, .text] + - [0xF46E90, lib, libultra_rom, pigetcmdq, .text] + - [0xF46EC0, lib, libultra_rom, cartrominit, .text] + - [0xF46FC0, lib, libultra_rom, leodiskinit, .text] + - [0xF470C0, lib, libultra_rom, piacs, .text] + - [0xF47180, lib, libultra_rom, getthreadpri, .text] + - [0xF471A0, lib, libultra_rom, pirawdma, .text] + - [0xF47280, lib, libultra_rom, epirawdma, .text] + - [0xF474B0, lib, libultra_rom, devmgr, .text] + - [0xF47940, lib, libultra_rom, bcopy, .text] + - [0xF47C50, lib, libultra_rom, spsetstat, .text] + - [0xF47C60, lib, libultra_rom, spsetpc, .text] + - [0xF47CA0, lib, libultra_rom, sprawdma, .text] + - [0xF47D30, lib, libultra_rom, sp, .text] + - [0xF47D60, lib, libultra_rom, vi, .text] + - [0xF47EA0, lib, libultra_rom, timerintr, .text] + - [0xF482A0, lib, libultra_rom, setcompare, .text] + - [0xF482B0, lib, libultra_rom, spgetstat, .text] + - [0xF482C0, lib, libultra_rom, vigetcurrcontext, .text] + - [0xF482D0, lib, libultra_rom, viswapcontext, .text] + - [0xF48630, lib, libultra_rom, getcount, .text] + - [0xF48640, lib, libultra_rom, normalize, .text] + - [0xF486D0, lib, libultra_rom, siacs, .text] + - [0xF48790, lib, libultra_rom, sirawdma, .text] + - [0xF48840, lib, libultra_rom, pfsisplug, .text] + - [0xF48BB0, lib, libultra_rom, crc, .text] + - [0xF48D30, lib, libultra_rom, contramwrite, .text] + - [0xF490B0, lib, libultra_rom, contramread, .text] + - [0xF49440, lib, libultra_rom, pfsgetstatus, .text] + - [0xF49550, lib, libultra_rom, contpfs, .text] + - [0xF4A2B0, lib, libultra_rom, pfschecker, .text] + - [0xF4AD10, lib, libultra_rom, conteepwrite, .text] + - [0xF4B260, lib, libultra_rom, conteepread, .text] + - [0xF4B5C0, lib, libultra_rom, filter, .text] + - [0xF4B5E0, lib, libultra_rom, env, .text] + - [0xF4C160, lib, libultra_rom, load, .text] + - [0xF4CCB0, lib, libultra_rom, resample, .text] + - [0xF4CFB0, lib, libultra_rom, auxbus, .text] + - [0xF4D0C0, lib, libultra_rom, mainbus, .text] + - [0xF4D210, lib, libultra_rom, save, .text] + - [0xF4D2D0, lib, libultra_rom, si, .text] + - [0xF4D300, lib, libultra_rom, leointerrupt, .text] + - [0xF4DB80, lib, libultra_rom, synallocfx, .text] + - [0xF4DC20, lib, libultra_rom, resetglobalintmask, .text] + - [0xF4DC80, lib, libultra_rom, epirawwrite, .text] + - [0xF4DCD0, lib, libultra_rom, epirawread, .text] + - [0xF4DD20, lib, libultra_rom, setglobalintmask, .text] + - [0xF4DD70, lib, libultra_rom, yieldthread, .text] - [0xF4DDC0, textbin, us.v10/n_aspMain] - [0xF4EA20, textbin, us.v10/gSPF3DEX_fifo] - [0xF4FE50, textbin, us.v10/gSPL3DEX_fifo] @@ -389,26 +392,26 @@ segments: - [0xF52670, .data, code_1D5D0] - [0xF52690, .data, sns] - [0xF526A0, .data, data_1E820] - - [0xF526B0, .data, audio/n_sl] - - [0xF526C0, .data, audio/n_drvrNew] - - [0xF52850, .data, audio/n_env] - - [0xF52950, .data, os/initialize] - - [0xF52970, .data, audio/sl] - - [0xF52980, .data, io/aisetnextbuf] - - [0xF52990, .data, io/pimgr] - - [0xF529C0, .data, io/vimgr] - - [0xF529E0, .data, io/controller] - - [0xF529F0, .data, audio/drvrNew] - - [0xF52B80, .data, ultra/exceptasm] - - [0xF52BA0, .data, os/thread] - - [0xF52BC0, .data, io/piacs] - - [0xF52BD0, .data, io/vi] - - [0xF52C40, .data, os/timerintr] - - [0xF52C50, .data, io/siacs] - - [0xF52C60, .data, audio/env] - - [0xF52D60, .data, io/vimodepallan1] - - [0xF52DB0, .data, io/vimodempallan1] - - [0xF52DB0, .data, io/vimodentsclan1] + - [0xF526B0, .data, n_audio/n_sl] + - [0xF526C0, .data, n_audio/n_drvrNew] + - [0xF52850, .data, n_audio/n_env] + - [0xF52950, lib, libultra_rom, initialize, .data] + - [0xF52970, lib, libultra_rom, sl, .data] + - [0xF52980, lib, libultra_rom, aisetnextbuf, .data] + - [0xF52990, lib, libultra_rom, pimgr, .data] + - [0xF529C0, lib, libultra_rom, vimgr, .data] + - [0xF529E0, lib, libultra_rom, controller, .data] + - [0xF529F0, lib, libultra_rom, drvrnew, .data] + - [0xF52B80, lib, libultra_rom, exceptasm, .data] + - [0xF52BA0, lib, libultra_rom, thread, .data] + - [0xF52BC0, lib, libultra_rom, piacs, .data] + - [0xF52BD0, lib, libultra_rom, vi, .data] + - [0xF52C40, lib, libultra_rom, timerintr, .data] + - [0xF52C50, lib, libultra_rom, siacs, .data] + - [0xF52C60, lib, libultra_rom, env, .data] + - [0xF52D60, lib, libultra_rom, vimodepallan1, .data] + - [0xF52DB0, lib, libultra_rom, vimodempallan1, .data] + - [0xF52DB0, lib, libultra_rom, vimodentsclan1, .data] - [0xF52E50, .rodata, code_1D00] - [0xF52E70, .rodata, code_3250] - [0xF52E80, .rodata, stub_3A70] @@ -426,29 +429,28 @@ segments: - [0xF53A70, .rodata, ml] - [0xF53B70, .rodata, musicplayer] - [0xF53BA0, .rodata, code_1D5D0] - - [0xF53C00, .rodata, audio/n_synthesizer] - - [0xF53C10, .rodata, audio/n_csplayer] - - [0xF53F80, .rodata, audio/n_reverb] - - [0xF53FB0, .rodata, audio/n_drvrNew] - - [0xF53FD0, .rodata, audio/n_env] - - [0xF54020, .rodata, audio/n_seqplayer] - - [0xF543D0, .rodata, audio/n_resample] - - [0xF543E0, .rodata, gu/sinf] - - [0xF54430, .rodata, audio/cents2ratio] - - [0xF54440, .rodata, gu/cosf] - - [0xF54490, .rodata, ultra/setintmask] - - [0xF54510, .rodata, gu/rotate] - - [0xF54520, .rodata, audio/cseq] - - [0xF54530, .rodata, audio/drvrNew] - - [0xF54550, .rodata, audio/reverb] - - [0xF54580, .rodata, audio/seq] - - [0xF54590, .rodata, ultra/exceptasm] - - [0xF545E0, hasm, ultra/libm_vals] # Nothing in this file, just here so splat sees it's ASM - - [0xF545E0, .rodata, ultra/libm_vals] - - [0xF545F0, .rodata, audio/synthesizer] - - [0xF54600, .rodata, io/devmgr] - - [0xF54620, .rodata, audio/env] - - [0xF54670, .rodata, audio/resample] + - [0xF53C00, .rodata, n_audio/n_synthesizer] + - [0xF53C10, .rodata, n_audio/n_csplayer] + - [0xF53F80, .rodata, n_audio/n_reverb] + - [0xF53FB0, .rodata, n_audio/n_drvrNew] + - [0xF53FD0, .rodata, n_audio/n_env] + - [0xF54020, .rodata, n_audio/n_seqplayer] + - [0xF543D0, .rodata, n_audio/n_resample] + - [0xF543E0, lib, libultra_rom, sinf, .rodata] + - [0xF54430, lib, libultra_rom, cents2ratio, .rodata] + - [0xF54440, lib, libultra_rom, cosf, .rodata] + - [0xF54490, lib, libultra_rom, setintmask, .rodata] + - [0xF54510, lib, libultra_rom, rotate, .rodata] + - [0xF54520, lib, libultra_rom, cseq, .rodata] + - [0xF54530, lib, libultra_rom, drvrnew, .rodata] + - [0xF54550, lib, libultra_rom, reverb, .rodata] + - [0xF54580, lib, libultra_rom, seq, .rodata] + - [0xF54590, lib, libultra_rom, exceptasm, .rodata] + - [0xF545E0, lib, libultra_rom, libm_vals, .rodata] + - [0xF545F0, lib, libultra_rom, synthesizer, .rodata] + - [0xF54600, lib, libultra_rom, devmgr, .rodata] + - [0xF54620, lib, libultra_rom, env, .rodata] + - [0xF54670, lib, libultra_rom, resample, .rodata] - [0xF546B0, rodatabin, us.v10/n_aspMain] - [0xF54960, rodatabin, us.v10/gSPF3DEX_fifo] - [0xF55160, rodatabin, us.v10/gSPL3DEX_fifo] @@ -479,23 +481,23 @@ segments: - [0xF55960, .bss, ucode] - [0xF55960, .bss, code_1D5D0] - [0xF55960, .bss, sns] - - [0xF55960, .bss, os/initialize] - - [0xF55960, .bss, io/pimgr] - - [0xF55960, .bss, io/sptask] - - [0xF55960, .bss, os/seteventmesg] - - [0xF55960, .bss, io/vimgr] - - [0xF55960, .bss, gu/rotate] - - [0xF55960, .bss, io/controller] - - [0xF55960, .bss, io/motor] - - [0xF55960, .bss, io/cartrominit] - - [0xF55960, .bss, io/leodiskinit] - - [0xF55960, .bss, io/piacs] - - [0xF55960, .bss, os/timerintr] - - [0xF55960, .bss, io/siacs] - - [0xF55960, .bss, io/pfsisplug] - - [0xF55960, .bss, io/conteepread] - - [0xF55960, .bss, os/kdebugserver] - - [0xF55960, .bss, io/leointerrupt] + - [0xF55960, lib, libultra_rom, initialize, .bss] + - [0xF55960, lib, libultra_rom, pimgr, .bss] + - [0xF55960, lib, libultra_rom, sptask, .bss] + - [0xF55960, lib, libultra_rom, seteventmesg, .bss] + - [0xF55960, lib, libultra_rom, vimgr, .bss] + - [0xF55960, lib, libultra_rom, rotate, .bss] + - [0xF55960, lib, libultra_rom, controller, .bss] + - [0xF55960, lib, libultra_rom, motor, .bss] + - [0xF55960, lib, libultra_rom, cartrominit, .bss] + - [0xF55960, lib, libultra_rom, leodiskinit, .bss] + - [0xF55960, lib, libultra_rom, piacs, .bss] + - [0xF55960, lib, libultra_rom, timerintr, .bss] + - [0xF55960, lib, libultra_rom, siacs, .bss] + - [0xF55960, lib, libultra_rom, pfsisplug, .bss] + - [0xF55960, lib, libultra_rom, conteepread, .bss] + - [0xF55960, lib, libultra_rom, kdebugserver, .bss] + - [0xF55960, lib, libultra_rom, leointerrupt, .bss] - name: core2 dir: core2 type: code @@ -826,7 +828,7 @@ segments: - [0x100D480, c, coords] - [0x100D8A0, c, code_B7F40] - [0x100D980, c, code_B8020] - - [0x100D9D0, c, code_B8070] + - [0x100D9D0, c, ultra/debug/assert] - [0x100D9E0, c, code_B8080] - [0x100E1C0, c, code_B8860] - [0x100E9F0, c, code_B9090] diff --git a/include/2.0L/PR/PRimage.h b/include/2.0L/PR/PRimage.h deleted file mode 100644 index aacc6567..00000000 --- a/include/2.0L/PR/PRimage.h +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************** - * - * $Revision: 1.4 $ - * $Date: 1997/11/26 00:30:50 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/PRimage.h,v $ - * - **************************************************************************/ - -#ifndef __GL_IMAGE_H__ -#define __GL_IMAGE_H__ -#ifdef __cplusplus -extern "C" { -#endif - - -/* - * Defines for image files . . . . - * - * Paul Haeberli - 1984 - * Look in /usr/people/4Dgifts/iristools/imgtools for example code! - * - */ - -#include - -#define IMAGIC 0732 - -/* colormap of images */ -#define CM_NORMAL 0 /* file contains rows of values which - * are either RGB values (zsize == 3) - * or greyramp values (zsize == 1) */ -#define CM_DITHERED 1 -#define CM_SCREEN 2 /* file contains data which is a screen - * image; getrow returns buffer which - * can be displayed directly with - * writepixels */ -#define CM_COLORMAP 3 /* a colormap file */ - -#define TYPEMASK 0xff00 -#define BPPMASK 0x00ff -#define ITYPE_VERBATIM 0x0000 -#define ITYPE_RLE 0x0100 -#define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE) -#define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM) -#define BPP(type) ((type) & BPPMASK) -#define RLE(bpp) (ITYPE_RLE | (bpp)) -#define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp)) -#define IBUFSIZE(pixels) (((pixels)+((pixels)>>6))<<2) -#define RLE_NOP 0x00 - -#define ierror(p) (((p)->flags&_IOERR)!=0) -#define ifileno(p) ((p)->file) -#define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p)) -#define putpix(p,x) (--(p)->cnt>=0 \ - ? ((int)(*(p)->ptr++=(unsigned)(x))) \ - : iflsbuf(p,(unsigned)(x))) - -typedef struct { - unsigned short imagic; /* stuff saved on disk . . */ - unsigned short type; - unsigned short dim; - unsigned short xsize; - unsigned short ysize; - unsigned short zsize; - unsigned long min; - unsigned long max; - unsigned long wastebytes; - char name[80]; - unsigned long colormap; - - long file; /* stuff used in core only */ - unsigned short flags; - short dorev; - short x; - short y; - short z; - short cnt; - unsigned short *ptr; - unsigned short *base; - unsigned short *tmpbuf; - unsigned long offset; - unsigned long rleend; /* for rle images */ - unsigned long *rowstart; /* for rle images */ - long *rowsize; /* for rle images */ -} IMAGE; - -IMAGE *icreate(); -/* - * IMAGE *iopen(char *file, char *mode, unsigned int type, unsigned int dim, - * unsigned int xsize, unsigned int ysize, unsigned int zsize); - * IMAGE *fiopen(int f, char *mode, unsigned int type, unsigned int dim, - * unsigned int xsize, unsigned int ysize, unsigned int zsize); - * - * ...while iopen and fiopen can take an extended set of parameters, the - * last five are optional, so a more correct prototype would be: - * - */ -IMAGE *iopen(char *file, char *mode, ...); -IMAGE *fiopen(int f, char *mode, ...); - -/* - * - * unsigned short *ibufalloc(IMAGE *image); - * int ifilbuf(IMAGE *image); - * int iflush(IMAGE *image); - * unsigned int iflsbuf(IMAGE *image, unsigned int c); - * void isetname(IMAGE *image, char *name); - * void isetcolormap(IMAGE *image, int colormap); - */ - -int iclose(IMAGE *image); -int putrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z); -int getrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z); - -/* -IMAGE *iopen(); -IMAGE *icreate(); -*/ - -unsigned short *ibufalloc(); - -#define IMAGEDEF /* for backwards compatibility */ -#ifdef __cplusplus -} -#endif -#endif /* !__GL_IMAGE_H__ */ diff --git a/include/2.0L/PR/R4300.h b/include/2.0L/PR/R4300.h deleted file mode 100644 index fd70d07f..00000000 --- a/include/2.0L/PR/R4300.h +++ /dev/null @@ -1,453 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * $Revision: 1.13 $ - * $Date: 1997/02/11 08:15:34 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/R4300.h,v $ - * - **************************************************************************/ - -#ifndef __R4300_H__ -#define __R4300_H__ - -#include - -/* - * Segment base addresses and sizes - */ -#define KUBASE 0 -#define KUSIZE 0x80000000 -#define K0BASE 0x80000000 -#define K0SIZE 0x20000000 -#define K1BASE 0xA0000000 -#define K1SIZE 0x20000000 -#define K2BASE 0xC0000000 -#define K2SIZE 0x20000000 - -/* - * Exception vectors - */ -#define SIZE_EXCVEC 0x80 /* Size of an exc. vec */ -#define UT_VEC K0BASE /* utlbmiss vector */ -#define R_VEC (K1BASE+0x1fc00000) /* reset vector */ -#define XUT_VEC (K0BASE+0x80) /* extended address tlbmiss */ -#define ECC_VEC (K0BASE+0x100) /* Ecc exception vector */ -#define E_VEC (K0BASE+0x180) /* Gen. exception vector */ - -/* - * Address conversion macros - */ -#ifdef _LANGUAGE_ASSEMBLY - -#define K0_TO_K1(x) ((x)|0xA0000000) /* kseg0 to kseg1 */ -#define K1_TO_K0(x) ((x)&0x9FFFFFFF) /* kseg1 to kseg0 */ -#define K0_TO_PHYS(x) ((x)&0x1FFFFFFF) /* kseg0 to physical */ -#define K1_TO_PHYS(x) ((x)&0x1FFFFFFF) /* kseg1 to physical */ -#define KDM_TO_PHYS(x) ((x)&0x1FFFFFFF) /* direct mapped to physical */ -#define PHYS_TO_K0(x) ((x)|0x80000000) /* physical to kseg0 */ -#define PHYS_TO_K1(x) ((x)|0xA0000000) /* physical to kseg1 */ - -#else /* _LANGUAGE_C */ - -#define K0_TO_K1(x) ((u32)(x)|0xA0000000) /* kseg0 to kseg1 */ -#define K1_TO_K0(x) ((u32)(x)&0x9FFFFFFF) /* kseg1 to kseg0 */ -#define K0_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg0 to physical */ -#define K1_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg1 to physical */ -#define KDM_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* direct mapped to physical */ -#define PHYS_TO_K0(x) ((u32)(x)|0x80000000) /* physical to kseg0 */ -#define PHYS_TO_K1(x) ((u32)(x)|0xA0000000) /* physical to kseg1 */ - -#endif /* _LANGUAGE_ASSEMBLY */ - -/* - * Address predicates - */ -#define IS_KSEG0(x) ((u32)(x) >= K0BASE && (u32)(x) < K1BASE) -#define IS_KSEG1(x) ((u32)(x) >= K1BASE && (u32)(x) < K2BASE) -#define IS_KSEGDM(x) ((u32)(x) >= K0BASE && (u32)(x) < K2BASE) -#define IS_KSEG2(x) ((u32)(x) >= K2BASE && (u32)(x) < KPTE_SHDUBASE) -#define IS_KPTESEG(x) ((u32)(x) >= KPTE_SHDUBASE) -#define IS_KUSEG(x) ((u32)(x) < K0BASE) - -/* - * TLB size constants - */ - -#define NTLBENTRIES 31 /* entry 31 is reserved by rdb */ - -#define TLBHI_VPN2MASK 0xffffe000 -#define TLBHI_VPN2SHIFT 13 -#define TLBHI_PIDMASK 0xff -#define TLBHI_PIDSHIFT 0 -#define TLBHI_NPID 255 /* 255 to fit in 8 bits */ - -#define TLBLO_PFNMASK 0x3fffffc0 -#define TLBLO_PFNSHIFT 6 -#define TLBLO_CACHMASK 0x38 /* cache coherency algorithm */ -#define TLBLO_CACHSHIFT 3 -#define TLBLO_UNCACHED 0x10 /* not cached */ -#define TLBLO_NONCOHRNT 0x18 /* Cacheable non-coherent */ -#define TLBLO_EXLWR 0x28 /* Exclusive write */ -#define TLBLO_D 0x4 /* writeable */ -#define TLBLO_V 0x2 /* valid bit */ -#define TLBLO_G 0x1 /* global access bit */ - -#define TLBINX_PROBE 0x80000000 -#define TLBINX_INXMASK 0x3f -#define TLBINX_INXSHIFT 0 - -#define TLBRAND_RANDMASK 0x3f -#define TLBRAND_RANDSHIFT 0 - -#define TLBWIRED_WIREDMASK 0x3f - -#define TLBCTXT_BASEMASK 0xff800000 -#define TLBCTXT_BASESHIFT 23 -#define TLBCTXT_BASEBITS 9 - -#define TLBCTXT_VPNMASK 0x7ffff0 -#define TLBCTXT_VPNSHIFT 4 - -#define TLBPGMASK_4K 0x0 -#define TLBPGMASK_16K 0x6000 -#define TLBPGMASK_64K 0x1e000 - -/* - * Status register - */ -#define SR_CUMASK 0xf0000000 /* coproc usable bits */ - -#define SR_CU3 0x80000000 /* Coprocessor 3 usable */ -#define SR_CU2 0x40000000 /* Coprocessor 2 usable */ -#define SR_CU1 0x20000000 /* Coprocessor 1 usable */ -#define SR_CU0 0x10000000 /* Coprocessor 0 usable */ -#define SR_RP 0x08000000 /* Reduced power (quarter speed) */ -#define SR_FR 0x04000000 /* MIPS III FP register mode */ -#define SR_RE 0x02000000 /* Reverse endian */ -#define SR_ITS 0x01000000 /* Instruction trace support */ -#define SR_BEV 0x00400000 /* Use boot exception vectors */ -#define SR_TS 0x00200000 /* TLB shutdown */ -#define SR_SR 0x00100000 /* Soft reset occured */ -#define SR_CH 0x00040000 /* Cache hit for last 'cache' op */ -#define SR_CE 0x00020000 /* Create ECC */ -#define SR_DE 0x00010000 /* ECC of parity does not cause error */ - -/* - * Interrupt enable bits - * (NOTE: bits set to 1 enable the corresponding level interrupt) - */ -#define SR_IMASK 0x0000ff00 /* Interrupt mask */ -#define SR_IMASK8 0x00000000 /* mask level 8 */ -#define SR_IMASK7 0x00008000 /* mask level 7 */ -#define SR_IMASK6 0x0000c000 /* mask level 6 */ -#define SR_IMASK5 0x0000e000 /* mask level 5 */ -#define SR_IMASK4 0x0000f000 /* mask level 4 */ -#define SR_IMASK3 0x0000f800 /* mask level 3 */ -#define SR_IMASK2 0x0000fc00 /* mask level 2 */ -#define SR_IMASK1 0x0000fe00 /* mask level 1 */ -#define SR_IMASK0 0x0000ff00 /* mask level 0 */ - -#define SR_IBIT8 0x00008000 /* bit level 8 */ -#define SR_IBIT7 0x00004000 /* bit level 7 */ -#define SR_IBIT6 0x00002000 /* bit level 6 */ -#define SR_IBIT5 0x00001000 /* bit level 5 */ -#define SR_IBIT4 0x00000800 /* bit level 4 */ -#define SR_IBIT3 0x00000400 /* bit level 3 */ -#define SR_IBIT2 0x00000200 /* bit level 2 */ -#define SR_IBIT1 0x00000100 /* bit level 1 */ - -#define SR_IMASKSHIFT 8 - -#define SR_KX 0x00000080 /* extended-addr TLB vec in kernel */ -#define SR_SX 0x00000040 /* xtended-addr TLB vec supervisor */ -#define SR_UX 0x00000020 /* xtended-addr TLB vec in user mode */ -#define SR_KSU_MASK 0x00000018 /* mode mask */ -#define SR_KSU_USR 0x00000010 /* user mode */ -#define SR_KSU_SUP 0x00000008 /* supervisor mode */ -#define SR_KSU_KER 0x00000000 /* kernel mode */ -#define SR_ERL 0x00000004 /* Error level, 1=>cache error */ -#define SR_EXL 0x00000002 /* Exception level, 1=>exception */ -#define SR_IE 0x00000001 /* interrupt enable, 1=>enable */ - -/* - * Cause Register - */ -#define CAUSE_BD 0x80000000 /* Branch delay slot */ -#define CAUSE_CEMASK 0x30000000 /* coprocessor error */ -#define CAUSE_CESHIFT 28 - -/* Interrupt pending bits */ -#define CAUSE_IP8 0x00008000 /* External level 8 pending - COMPARE */ -#define CAUSE_IP7 0x00004000 /* External level 7 pending - INT4 */ -#define CAUSE_IP6 0x00002000 /* External level 6 pending - INT3 */ -#define CAUSE_IP5 0x00001000 /* External level 5 pending - INT2 */ -#define CAUSE_IP4 0x00000800 /* External level 4 pending - INT1 */ -#define CAUSE_IP3 0x00000400 /* External level 3 pending - INT0 */ -#define CAUSE_SW2 0x00000200 /* Software level 2 pending */ -#define CAUSE_SW1 0x00000100 /* Software level 1 pending */ - -#define CAUSE_IPMASK 0x0000FF00 /* Pending interrupt mask */ -#define CAUSE_IPSHIFT 8 - -#define CAUSE_EXCMASK 0x0000007C /* Cause code bits */ - -#define CAUSE_EXCSHIFT 2 - -/* Cause register exception codes */ - -#define EXC_CODE(x) ((x)<<2) - -/* Hardware exception codes */ -#define EXC_INT EXC_CODE(0) /* interrupt */ -#define EXC_MOD EXC_CODE(1) /* TLB mod */ -#define EXC_RMISS EXC_CODE(2) /* Read TLB Miss */ -#define EXC_WMISS EXC_CODE(3) /* Write TLB Miss */ -#define EXC_RADE EXC_CODE(4) /* Read Address Error */ -#define EXC_WADE EXC_CODE(5) /* Write Address Error */ -#define EXC_IBE EXC_CODE(6) /* Instruction Bus Error */ -#define EXC_DBE EXC_CODE(7) /* Data Bus Error */ -#define EXC_SYSCALL EXC_CODE(8) /* SYSCALL */ -#define EXC_BREAK EXC_CODE(9) /* BREAKpoint */ -#define EXC_II EXC_CODE(10) /* Illegal Instruction */ -#define EXC_CPU EXC_CODE(11) /* CoProcessor Unusable */ -#define EXC_OV EXC_CODE(12) /* OVerflow */ -#define EXC_TRAP EXC_CODE(13) /* Trap exception */ -#define EXC_VCEI EXC_CODE(14) /* Virt. Coherency on Inst. fetch */ -#define EXC_FPE EXC_CODE(15) /* Floating Point Exception */ -#define EXC_WATCH EXC_CODE(23) /* Watchpoint reference */ -#define EXC_VCED EXC_CODE(31) /* Virt. Coherency on data read */ - -/* C0_PRID Defines */ -#define C0_IMPMASK 0xff00 -#define C0_IMPSHIFT 8 -#define C0_REVMASK 0xff -#define C0_MAJREVMASK 0xf0 -#define C0_MAJREVSHIFT 4 -#define C0_MINREVMASK 0xf - -/* - * Coprocessor 0 operations - */ -#define C0_READI 0x1 /* read ITLB entry addressed by C0_INDEX */ -#define C0_WRITEI 0x2 /* write ITLB entry addressed by C0_INDEX */ -#define C0_WRITER 0x6 /* write ITLB entry addressed by C0_RAND */ -#define C0_PROBE 0x8 /* probe for ITLB entry addressed by TLBHI */ -#define C0_RFE 0x10 /* restore for exception */ - -/* - * 'cache' instruction definitions - */ - -/* Target cache */ -#define CACH_PI 0x0 /* specifies primary inst. cache */ -#define CACH_PD 0x1 /* primary data cache */ -#define CACH_SI 0x2 /* secondary instruction cache */ -#define CACH_SD 0x3 /* secondary data cache */ - -/* Cache operations */ -#define C_IINV 0x0 /* index invalidate (inst, 2nd inst) */ -#define C_IWBINV 0x0 /* index writeback inval (d, sd) */ -#define C_ILT 0x4 /* index load tag (all) */ -#define C_IST 0x8 /* index store tag (all) */ -#define C_CDX 0xc /* create dirty exclusive (d, sd) */ -#define C_HINV 0x10 /* hit invalidate (all) */ -#define C_HWBINV 0x14 /* hit writeback inv. (d, sd) */ -#define C_FILL 0x14 /* fill (i) */ -#define C_HWB 0x18 /* hit writeback (i, d, sd) */ -#define C_HSV 0x1c /* hit set virt. (si, sd) */ - -/* - * Cache size definitions - */ -#define ICACHE_SIZE 0x4000 /* 16K */ -#define ICACHE_LINESIZE 32 /* 8 words */ -#define ICACHE_LINEMASK (ICACHE_LINESIZE-1) - -#define DCACHE_SIZE 0x2000 /* 8K */ -#define DCACHE_LINESIZE 16 /* 4 words */ -#define DCACHE_LINEMASK (DCACHE_LINESIZE-1) - -/* - * C0_CONFIG register definitions - */ -#define CONFIG_CM 0x80000000 /* 1 == Master-Checker enabled */ -#define CONFIG_EC 0x70000000 /* System Clock ratio */ -#define CONFIG_EC_1_1 0x6 /* System Clock ratio 1 :1 */ -#define CONFIG_EC_3_2 0x7 /* System Clock ratio 1.5 :1 */ -#define CONFIG_EC_2_1 0x0 /* System Clock ratio 2 :1 */ -#define CONFIG_EC_3_1 0x1 /* System Clock ratio 3 :1 */ -#define CONFIG_EP 0x0f000000 /* Transmit Data Pattern */ -#define CONFIG_SB 0x00c00000 /* Secondary cache block size */ - -#define CONFIG_SS 0x00200000 /* Split scache: 0 == I&D combined */ -#define CONFIG_SW 0x00100000 /* scache port: 0==128, 1==64 */ -#define CONFIG_EW 0x000c0000 /* System Port width: 0==64, 1==32 */ -#define CONFIG_SC 0x00020000 /* 0 -> 2nd cache present */ -#define CONFIG_SM 0x00010000 /* 0 -> Dirty Shared Coherency enabled*/ -#define CONFIG_BE 0x00008000 /* Endian-ness: 1 --> BE */ -#define CONFIG_EM 0x00004000 /* 1 -> ECC mode, 0 -> parity */ -#define CONFIG_EB 0x00002000 /* Block order:1->sequent,0->subblock */ - -#define CONFIG_IC 0x00000e00 /* Primary Icache size */ -#define CONFIG_DC 0x000001c0 /* Primary Dcache size */ -#define CONFIG_IB 0x00000020 /* Icache block size */ -#define CONFIG_DB 0x00000010 /* Dcache block size */ -#define CONFIG_CU 0x00000008 /* Update on Store-conditional */ -#define CONFIG_K0 0x00000007 /* K0SEG Coherency algorithm */ - -#define CONFIG_UNCACHED 0x00000002 /* K0 is uncached */ -#define CONFIG_NONCOHRNT 0x00000003 -#define CONFIG_COHRNT_EXLWR 0x00000005 -#define CONFIG_SB_SHFT 22 /* shift SB to bit position 0 */ -#define CONFIG_IC_SHFT 9 /* shift IC to bit position 0 */ -#define CONFIG_DC_SHFT 6 /* shift DC to bit position 0 */ -#define CONFIG_BE_SHFT 15 /* shift BE to bit position 0 */ - -/* - * C0_TAGLO definitions for setting/getting cache states and physaddr bits - */ -#define SADDRMASK 0xFFFFE000 /* 31..13 -> scache paddr bits 35..17 */ -#define SVINDEXMASK 0x00000380 /* 9..7: prim virt index bits 14..12 */ -#define SSTATEMASK 0x00001c00 /* bits 12..10 hold scache line state */ -#define SINVALID 0x00000000 /* invalid --> 000 == state 0 */ -#define SCLEANEXCL 0x00001000 /* clean exclusive --> 100 == state 4 */ -#define SDIRTYEXCL 0x00001400 /* dirty exclusive --> 101 == state 5 */ -#define SECC_MASK 0x0000007f /* low 7 bits are ecc for the tag */ -#define SADDR_SHIFT 4 /* shift STagLo (31..13) to 35..17 */ - -#define PADDRMASK 0xFFFFFF00 /* PTagLo31..8->prim paddr bits35..12 */ -#define PADDR_SHIFT 4 /* roll bits 35..12 down to 31..8 */ -#define PSTATEMASK 0x00C0 /* bits 7..6 hold primary line state */ -#define PINVALID 0x0000 /* invalid --> 000 == state 0 */ -#define PCLEANEXCL 0x0080 /* clean exclusive --> 10 == state 2 */ -#define PDIRTYEXCL 0x00C0 /* dirty exclusive --> 11 == state 3 */ -#define PPARITY_MASK 0x0001 /* low bit is parity bit (even). */ - -/* - * C0_CACHE_ERR definitions. - */ -#define CACHERR_ER 0x80000000 /* 0: inst ref, 1: data ref */ -#define CACHERR_EC 0x40000000 /* 0: primary, 1: secondary */ -#define CACHERR_ED 0x20000000 /* 1: data error */ -#define CACHERR_ET 0x10000000 /* 1: tag error */ -#define CACHERR_ES 0x08000000 /* 1: external ref, e.g. snoop*/ -#define CACHERR_EE 0x04000000 /* error on SysAD bus */ -#define CACHERR_EB 0x02000000 /* complicated, see spec. */ -#define CACHERR_EI 0x01000000 /* complicated, see spec. */ -#define CACHERR_SIDX_MASK 0x003ffff8 /* secondary cache index */ -#define CACHERR_PIDX_MASK 0x00000007 /* primary cache index */ -#define CACHERR_PIDX_SHIFT 12 /* bits 2..0 are paddr14..12 */ - -/* R4000 family supports hardware watchpoints: - * C0_WATCHLO: - * bits 31..3 are bits 31..3 of physaddr to watch - * bit 2: reserved; must be written as 0. - * bit 1: when set causes a watchpoint trap on load accesses to paddr. - * bit 0: when set traps on stores to paddr; - * C0_WATCHHI - * bits 31..4 are reserved and must be written as zeros. - * bits 3..0 are bits 35..32 of the physaddr to watch - */ -#define WATCHLO_WTRAP 0x00000001 -#define WATCHLO_RTRAP 0x00000002 -#define WATCHLO_ADDRMASK 0xfffffff8 -#define WATCHLO_VALIDMASK 0xfffffffb -#define WATCHHI_VALIDMASK 0x0000000f - -/* - * Coprocessor 0 registers - */ -#ifdef _LANGUAGE_ASSEMBLY -#define C0_INX $0 -#define C0_RAND $1 -#define C0_ENTRYLO0 $2 -#define C0_ENTRYLO1 $3 -#define C0_CONTEXT $4 -#define C0_PAGEMASK $5 /* page mask */ -#define C0_WIRED $6 /* # wired entries in tlb */ -#define C0_BADVADDR $8 -#define C0_COUNT $9 /* free-running counter */ -#define C0_ENTRYHI $10 -#define C0_SR $12 -#define C0_CAUSE $13 -#define C0_EPC $14 -#define C0_PRID $15 /* revision identifier */ -#define C0_COMPARE $11 /* counter comparison reg. */ -#define C0_CONFIG $16 /* hardware configuration */ -#define C0_LLADDR $17 /* load linked address */ -#define C0_WATCHLO $18 /* watchpoint */ -#define C0_WATCHHI $19 /* watchpoint */ -#define C0_ECC $26 /* S-cache ECC and primary parity */ -#define C0_CACHE_ERR $27 /* cache error status */ -#define C0_TAGLO $28 /* cache operations */ -#define C0_TAGHI $29 /* cache operations */ -#define C0_ERROR_EPC $30 /* ECC error prg. counter */ - -# else /* ! _LANGUAGE_ASSEMBLY */ - -#define C0_INX 0 -#define C0_RAND 1 -#define C0_ENTRYLO0 2 -#define C0_ENTRYLO1 3 -#define C0_CONTEXT 4 -#define C0_PAGEMASK 5 /* page mask */ -#define C0_WIRED 6 /* # wired entries in tlb */ -#define C0_BADVADDR 8 -#define C0_COUNT 9 /* free-running counter */ -#define C0_ENTRYHI 10 -#define C0_SR 12 -#define C0_CAUSE 13 -#define C0_EPC 14 -#define C0_PRID 15 /* revision identifier */ -#define C0_COMPARE 11 /* counter comparison reg. */ -#define C0_CONFIG 16 /* hardware configuration */ -#define C0_LLADDR 17 /* load linked address */ -#define C0_WATCHLO 18 /* watchpoint */ -#define C0_WATCHHI 19 /* watchpoint */ -#define C0_ECC 26 /* S-cache ECC and primary parity */ -#define C0_CACHE_ERR 27 /* cache error status */ -#define C0_TAGLO 28 /* cache operations */ -#define C0_TAGHI 29 /* cache operations */ -#define C0_ERROR_EPC 30 /* ECC error prg. counter */ - -#endif /* _LANGUAGE_ASSEMBLY */ - -/* - * floating-point status register - */ -#define FPCSR_FS 0x01000000 /* flush denorm to zero */ -#define FPCSR_C 0x00800000 /* condition bit */ -#define FPCSR_CE 0x00020000 /* cause: unimplemented operation */ -#define FPCSR_CV 0x00010000 /* cause: invalid operation */ -#define FPCSR_CZ 0x00008000 /* cause: division by zero */ -#define FPCSR_CO 0x00004000 /* cause: overflow */ -#define FPCSR_CU 0x00002000 /* cause: underflow */ -#define FPCSR_CI 0x00001000 /* cause: inexact operation */ -#define FPCSR_EV 0x00000800 /* enable: invalid operation */ -#define FPCSR_EZ 0x00000400 /* enable: division by zero */ -#define FPCSR_EO 0x00000200 /* enable: overflow */ -#define FPCSR_EU 0x00000100 /* enable: underflow */ -#define FPCSR_EI 0x00000080 /* enable: inexact operation */ -#define FPCSR_FV 0x00000040 /* flag: invalid operation */ -#define FPCSR_FZ 0x00000020 /* flag: division by zero */ -#define FPCSR_FO 0x00000010 /* flag: overflow */ -#define FPCSR_FU 0x00000008 /* flag: underflow */ -#define FPCSR_FI 0x00000004 /* flag: inexact operation */ -#define FPCSR_RM_MASK 0x00000003 /* rounding mode mask */ -#define FPCSR_RM_RN 0x00000000 /* round to nearest */ -#define FPCSR_RM_RZ 0x00000001 /* round to zero */ -#define FPCSR_RM_RP 0x00000002 /* round to positive infinity */ -#define FPCSR_RM_RM 0x00000003 /* round to negative infinity */ - -#endif /* __R4300_H */ diff --git a/include/2.0L/PR/abi.h b/include/2.0L/PR/abi.h deleted file mode 100644 index e1215260..00000000 --- a/include/2.0L/PR/abi.h +++ /dev/null @@ -1,410 +0,0 @@ -#ifndef _ABI_H_ -#define _ABI_H_ - -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * $Revision: 1.32 $ - * $Date: 1997/02/11 08:16:37 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/abi.h,v $ - * - **************************************************************************/ - -/* - * Header file for the Audio Binary Interface. - * This is included in the Media Binary Interface file - * mbi.h. - * - * This file follows the framework used for graphics. - * - */ - -/* Audio commands: */ -#define A_SPNOOP 0 -#define A_ADPCM 1 -#define A_CLEARBUFF 2 -#define A_ENVMIXER 3 -#define A_LOADBUFF 4 -#define A_RESAMPLE 5 -#define A_SAVEBUFF 6 -#define A_SEGMENT 7 -#define A_SETBUFF 8 -#define A_SETVOL 9 -#define A_DMEMMOVE 10 -#define A_LOADADPCM 11 -#define A_MIXER 12 -#define A_INTERLEAVE 13 -#define A_POLEF 14 -#define A_SETLOOP 15 - -#define ACMD_SIZE 32 -/* - * Audio flags - */ - -#define A_INIT 0x01 -#define A_CONTINUE 0x00 -#define A_LOOP 0x02 -#define A_OUT 0x02 -#define A_LEFT 0x02 -#define A_RIGHT 0x00 -#define A_VOL 0x04 -#define A_RATE 0x00 -#define A_AUX 0x08 -#define A_NOAUX 0x00 -#define A_MAIN 0x00 -#define A_MIX 0x10 - -/* - * BEGIN C-specific section: (typedef's) - */ -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* - * Data Structures. - */ - -typedef struct { - unsigned int cmd:8; - unsigned int flags:8; - unsigned int gain:16; - unsigned int addr; -} Aadpcm; - -typedef struct { - unsigned int cmd:8; - unsigned int flags:8; - unsigned int gain:16; - unsigned int addr; -} Apolef; - -typedef struct { - unsigned int cmd:8; - unsigned int flags:8; - unsigned int pad1:16; - unsigned int addr; -} Aenvelope; - -typedef struct { - unsigned int cmd:8; - unsigned int pad1:8; - unsigned int dmem:16; - unsigned int pad2:16; - unsigned int count:16; -} Aclearbuff; - -typedef struct { - unsigned int cmd:8; - unsigned int pad1:8; - unsigned int pad2:16; - unsigned int inL:16; - unsigned int inR:16; -} Ainterleave; - -typedef struct { - unsigned int cmd:8; - unsigned int pad1:24; - unsigned int addr; -} Aloadbuff; - -typedef struct { - unsigned int cmd:8; - unsigned int flags:8; - unsigned int pad1:16; - unsigned int addr; -} Aenvmixer; - -typedef struct { - unsigned int cmd:8; - unsigned int flags:8; - unsigned int gain:16; - unsigned int dmemi:16; - unsigned int dmemo:16; -} Amixer; - -typedef struct { - unsigned int cmd:8; - unsigned int flags:8; - unsigned int dmem2:16; - unsigned int addr; -} Apan; - -typedef struct { - unsigned int cmd:8; - unsigned int flags:8; - unsigned int pitch:16; - unsigned int addr; -} Aresample; - -typedef struct { - unsigned int cmd:8; - unsigned int flags:8; - unsigned int pad1:16; - unsigned int addr; -} Areverb; - -typedef struct { - unsigned int cmd:8; - unsigned int pad1:24; - unsigned int addr; -} Asavebuff; - -typedef struct { - unsigned int cmd:8; - unsigned int pad1:24; - unsigned int pad2:2; - unsigned int number:4; - unsigned int base:24; -} Asegment; - -typedef struct { - unsigned int cmd:8; - unsigned int flags:8; - unsigned int dmemin:16; - unsigned int dmemout:16; - unsigned int count:16; -} Asetbuff; - -typedef struct { - unsigned int cmd:8; - unsigned int flags:8; - unsigned int vol:16; - unsigned int voltgt:16; - unsigned int volrate:16; -} Asetvol; - -typedef struct { - unsigned int cmd:8; - unsigned int pad1:8; - unsigned int dmemin:16; - unsigned int dmemout:16; - unsigned int count:16; -} Admemmove; - -typedef struct { - unsigned int cmd:8; - unsigned int pad1:8; - unsigned int count:16; - unsigned int addr; -} Aloadadpcm; - -typedef struct { - unsigned int cmd:8; - unsigned int pad1:8; - unsigned int pad2:16; - unsigned int addr; -} Asetloop; - -/* - * Generic Acmd Packet - */ - -typedef struct { - unsigned int w0; - unsigned int w1; -} Awords; - -typedef union { - Awords words; - Aadpcm adpcm; - Apolef polef; - Aclearbuff clearbuff; - Aenvelope envelope; - Ainterleave interleave; - Aloadbuff loadbuff; - Aenvmixer envmixer; - Aresample resample; - Areverb reverb; - Asavebuff savebuff; - Asegment segment; - Asetbuff setbuff; - Asetvol setvol; - Admemmove dmemmove; - Aloadadpcm loadadpcm; - Amixer mixer; - Asetloop setloop; - long long int force_union_align; /* dummy, force alignment */ -} Acmd; - -/* - * ADPCM State - */ -#define ADPCMVSIZE 8 -#define ADPCMFSIZE 16 -typedef short ADPCM_STATE[ADPCMFSIZE]; - -/* - * Pole filter state - */ -typedef short POLEF_STATE[4]; - -/* - * Resampler state - */ -typedef short RESAMPLE_STATE[16]; - -/* - * Resampler constants - */ -#define UNITY_PITCH 0x8000 -#define MAX_RATIO 1.99996 /* within .03 cents of +1 octave */ - -/* - * Enveloper/Mixer state - */ -typedef short ENVMIX_STATE[40]; - -/* - * Macros to assemble the audio command list - */ - -#define aADPCMdec(pkt, f, s) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = _SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(f, 16, 8); \ - _a->words.w1 = (unsigned int)(s); \ -} - -#define aPoleFilter(pkt, f, g, s) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \ - _SHIFTL(g, 0, 16)); \ - _a->words.w1 = (unsigned int)(s); \ -} - -#define aClearBuffer(pkt, d, c) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = _SHIFTL(A_CLEARBUFF, 24, 8) | _SHIFTL(d, 0, 24); \ - _a->words.w1 = (unsigned int)(c); \ -} - -#define aEnvMixer(pkt, f, s) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = _SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8); \ - _a->words.w1 = (unsigned int)(s); \ -} - -#define aInterleave(pkt, l, r) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \ - _a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \ -} - -#define aLoadBuffer(pkt, s) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \ - _a->words.w1 = (unsigned int)(s); \ -} - -#define aMix(pkt, f, g, i, o) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL(f, 16, 8) | \ - _SHIFTL(g, 0, 16)); \ - _a->words.w1 = _SHIFTL(i,16, 16) | _SHIFTL(o, 0, 16); \ -} - -#define aPan(pkt, f, d, s) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = (_SHIFTL(A_PAN, 24, 8) | _SHIFTL(f, 16, 8) | \ - _SHIFTL(d, 0, 16)); \ - _a->words.w1 = (unsigned int)(s); \ -} - -#define aResample(pkt, f, p, s) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(f, 16, 8) |\ - _SHIFTL(p, 0, 16)); \ - _a->words.w1 = (unsigned int)(s); \ -} - -#define aSaveBuffer(pkt, s) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8); \ - _a->words.w1 = (unsigned int)(s); \ -} - -#define aSegment(pkt, s, b) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = _SHIFTL(A_SEGMENT, 24, 8); \ - _a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \ -} - -#define aSetBuffer(pkt, f, i, o, c) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | \ - _SHIFTL(i, 0, 16)); \ - _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \ -} - -#define aSetVolume(pkt, f, v, t, r) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \ - _SHIFTL(v, 0, 16)); \ - _a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \ -} - -#define aSetLoop(pkt, a) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - _a->words.w0 = _SHIFTL(A_SETLOOP, 24, 8); \ - _a->words.w1 = (unsigned int)(a); \ -} - -#define aDMEMMove(pkt, i, o, c) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = _SHIFTL(A_DMEMMOVE, 24, 8) | _SHIFTL(i, 0, 24); \ - _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \ -} - -#define aLoadADPCM(pkt, c, d) \ -{ \ - Acmd *_a = (Acmd *)pkt; \ - \ - _a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \ - _a->words.w1 = (unsigned int) d; \ -} - -#endif /* _LANGUAGE_C */ - -#endif /* !_ABI_H_ */ - - - diff --git a/include/2.0L/PR/gbi.h b/include/2.0L/PR/gbi.h deleted file mode 100644 index 80ba6023..00000000 --- a/include/2.0L/PR/gbi.h +++ /dev/null @@ -1,4572 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ -/************************************************************************** - * - * $Revision: 1.141 $ - * $Date: 1999/09/03 03:43:08 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/gbi.h,v $ - * - **************************************************************************/ - -#ifndef _GBI_H_ -#define _GBI_H_ - -#include - -/* - * To use the F3DEX ucodes, define F3DEX_GBI before include this file. - * - * #define F3DEX_GBI - * #include - * - * or - * - * cc -c -DF3DEX_GBI -I.... foo.c - * - */ - -/************************************************************************** - * - * Graphics Binary Interface - * - **************************************************************************/ - -/* - * Graphics Commands, 'xxx' parts may be generated from ucode - * - * The command format is - * - * |00xxxxxx| = DMA 0,..,127 - * |10xxxxxx| = Immediate Mode -65,..,-128 - * |11xxxxxx| = RDP cmds -1,..,-64 - * - * Note: in order for the RSP microcode to process RDP commands opaquely, - * we need to further identify those RDP commands that need DRAM address - * "fixup". To do this, we have the dummy command G_RDP_ADDR_FIXUP, and - * all |RDP commands| less than this are commands with embedded DRAM - * addresses. Further, the format of these commands should be similar so - * only one fixup routine is needed. - * - * Further explanation: - * The names of the commands are somewhat misleading. Here is clarification: - * - * - a 'DMA' type command has a pointer to additional data and - * causes a DMA transfer to bring that into DMEM. - * - * - an 'Immediate' type command isn't really 'immediate', in the - * traditional sense. This just means that the entire command fits - * in the 64-bit word, and the ucode can execute it 'immediately' - * without additional memory transfers. - * - * - an 'RDP' command is identified as such because the RDP - * commands can be passed-thru the RSP and sent to the RDP - * directly. One further confusing thing, is that some 'DP' - * macros below actually generate immediate commands, not - * not direct DP commands. - * - * IMPLEMENTATION NOTE: - * There is another group of RDP commands that includes the triangle commands - * generated by the RSP code. These are the raw commands the rasterizer - * hardware chews on, with slope info, etc. They will follow the RDP - * ordering... - * - * IMPLEMENTATION NOTE: - * The RDP hardware has some of these bit patterns wired up. If the hardware - * changes, we must adjust this table, likewise we can't change/add things - * once the hardware is frozen. (actually, the RDP hardware only looks at - * the lower 6 bits of the command byte) - * - */ - -#ifdef F3DEX_GBI_2 -# ifndef F3DEX_GBI -# define F3DEX_GBI -# endif -#define G_NOOP 0x00 -#define G_RDPHALF_2 0xf1 -#define G_SETOTHERMODE_H 0xe3 -#define G_SETOTHERMODE_L 0xe2 -#define G_RDPHALF_1 0xe1 -#define G_SPNOOP 0xe0 -#define G_ENDDL 0xdf -#define G_DL 0xde -#define G_LOAD_UCODE 0xdd -#define G_MOVEMEM 0xdc -#define G_MOVEWORD 0xdb -#define G_MTX 0xda -#define G_GEOMETRYMODE 0xd9 -#define G_POPMTX 0xd8 -#define G_TEXTURE 0xd7 -#define G_DMA_IO 0xd6 -#define G_SPECIAL_1 0xd5 -#define G_SPECIAL_2 0xd4 -#define G_SPECIAL_3 0xd3 - -#define G_VTX 0x01 -#define G_MODIFYVTX 0x02 -#define G_CULLDL 0x03 -#define G_BRANCH_Z 0x04 -#define G_TRI1 0x05 -#define G_TRI2 0x06 -#define G_QUAD 0x07 -#define G_LINE3D 0x08 -#else /* F3DEX_GBI_2 */ - -/* DMA commands: */ -#define G_SPNOOP 0 /* handle 0 gracefully */ -#define G_MTX 1 -#define G_RESERVED0 2 /* not implemeted */ -#define G_MOVEMEM 3 /* move a block of memory (up to 4 words) to dmem */ -#define G_VTX 4 -#define G_RESERVED1 5 /* not implemeted */ -#define G_DL 6 -#define G_RESERVED2 7 /* not implemeted */ -#define G_RESERVED3 8 /* not implemeted */ -#define G_SPRITE2D_BASE 9 /* sprite command */ - -/* IMMEDIATE commands: */ -#define G_IMMFIRST -65 -#define G_TRI1 (G_IMMFIRST-0) -#define G_CULLDL (G_IMMFIRST-1) -#define G_POPMTX (G_IMMFIRST-2) -#define G_MOVEWORD (G_IMMFIRST-3) -#define G_TEXTURE (G_IMMFIRST-4) -#define G_SETOTHERMODE_H (G_IMMFIRST-5) -#define G_SETOTHERMODE_L (G_IMMFIRST-6) -#define G_ENDDL (G_IMMFIRST-7) -#define G_SETGEOMETRYMODE (G_IMMFIRST-8) -#define G_CLEARGEOMETRYMODE (G_IMMFIRST-9) -#define G_LINE3D (G_IMMFIRST-10) -#define G_RDPHALF_1 (G_IMMFIRST-11) -#define G_RDPHALF_2 (G_IMMFIRST-12) -#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)) -# define G_MODIFYVTX (G_IMMFIRST-13) -# define G_TRI2 (G_IMMFIRST-14) -# define G_BRANCH_Z (G_IMMFIRST-15) -# define G_LOAD_UCODE (G_IMMFIRST-16) -#else -# define G_RDPHALF_CONT (G_IMMFIRST-13) -#endif - -/* We are overloading 2 of the immediate commands - to keep the byte alignment of dmem the same */ - -#define G_SPRITE2D_SCALEFLIP (G_IMMFIRST-1) -#define G_SPRITE2D_DRAW (G_IMMFIRST-2) - -/* RDP commands: */ -#define G_NOOP 0xc0 /* 0 */ - -#endif /* F3DEX_GBI_2 */ - -/* RDP commands: */ -#define G_SETCIMG 0xff /* -1 */ -#define G_SETZIMG 0xfe /* -2 */ -#define G_SETTIMG 0xfd /* -3 */ -#define G_SETCOMBINE 0xfc /* -4 */ -#define G_SETENVCOLOR 0xfb /* -5 */ -#define G_SETPRIMCOLOR 0xfa /* -6 */ -#define G_SETBLENDCOLOR 0xf9 /* -7 */ -#define G_SETFOGCOLOR 0xf8 /* -8 */ -#define G_SETFILLCOLOR 0xf7 /* -9 */ -#define G_FILLRECT 0xf6 /* -10 */ -#define G_SETTILE 0xf5 /* -11 */ -#define G_LOADTILE 0xf4 /* -12 */ -#define G_LOADBLOCK 0xf3 /* -13 */ -#define G_SETTILESIZE 0xf2 /* -14 */ -#define G_LOADTLUT 0xf0 /* -16 */ -#define G_RDPSETOTHERMODE 0xef /* -17 */ -#define G_SETPRIMDEPTH 0xee /* -18 */ -#define G_SETSCISSOR 0xed /* -19 */ -#define G_SETCONVERT 0xec /* -20 */ -#define G_SETKEYR 0xeb /* -21 */ -#define G_SETKEYGB 0xea /* -22 */ -#define G_RDPFULLSYNC 0xe9 /* -23 */ -#define G_RDPTILESYNC 0xe8 /* -24 */ -#define G_RDPPIPESYNC 0xe7 /* -25 */ -#define G_RDPLOADSYNC 0xe6 /* -26 */ -#define G_TEXRECTFLIP 0xe5 /* -27 */ -#define G_TEXRECT 0xe4 /* -28 */ - - -/* - * The following commands are the "generated" RDP commands; the user - * never sees them, the RSP microcode generates them. - * - * The layout of the bits is magical, to save work in the ucode. - * These id's are -56, -52, -54, -50, -55, -51, -53, -49, ... - * edge, shade, texture, zbuff bits: estz - */ -#define G_TRI_FILL 0xc8 /* fill triangle: 11001000 */ -#define G_TRI_SHADE 0xcc /* shade triangle: 11001100 */ -#define G_TRI_TXTR 0xca /* texture triangle: 11001010 */ -#define G_TRI_SHADE_TXTR 0xce /* shade, texture triangle: 11001110 */ -#define G_TRI_FILL_ZBUFF 0xc9 /* fill, zbuff triangle: 11001001 */ -#define G_TRI_SHADE_ZBUFF 0xcd /* shade, zbuff triangle: 11001101 */ -#define G_TRI_TXTR_ZBUFF 0xcb /* texture, zbuff triangle: 11001011 */ -#define G_TRI_SHADE_TXTR_ZBUFF 0xcf /* shade, txtr, zbuff trngl: 11001111 */ - -/* - * A TRI_FILL triangle is just the edges. You need to set the DP - * to use primcolor, in order to see anything. (it is NOT a triangle - * that gets rendered in 'fill mode'. Triangles can't be rendered - * in 'fill mode') - * - * A TRI_SHADE is a gouraud triangle that has colors interpolated. - * Flat-shaded triangles (from the software) are still gouraud shaded, - * it's just the colors are all the same and the deltas are 0. - * - * Other triangle types, and combinations are more obvious. - */ - -/* masks to build RDP triangle commands: */ -#define G_RDP_TRI_FILL_MASK 0x08 -#define G_RDP_TRI_SHADE_MASK 0x04 -#define G_RDP_TRI_TXTR_MASK 0x02 -#define G_RDP_TRI_ZBUFF_MASK 0x01 - -/* - * HACK: - * This is a dreadful hack. For version 1.0 hardware, there are still - * some 'bowtie' hangs. This parameter can be increased to avoid - * the hangs. Every increase of 4 chops one scanline off of every - * triangle. Values of 4,8,12 should be sufficient to avoid any - * bowtie hang. - * - * Change this value, then recompile ALL of your program (including static - * display lists!) - * - * THIS WILL BE REMOVED FOR HARDWARE VERSION 2.0! - */ -#define BOWTIE_VAL 0 - - -/* gets added to RDP command, in order to test for addres fixup: */ -#define G_RDP_ADDR_FIXUP 3 /* |RDP cmds| <= this, do addr fixup */ -#ifdef _LANGUAGE_ASSEMBLY -#define G_RDP_TEXRECT_CHECK ((-1*G_TEXRECTFLIP)& 0xff) -#endif - -/* macros for command parsing: */ -#define GDMACMD(x) (x) -#define GIMMCMD(x) (G_IMMFIRST-(x)) -#define GRDPCMD(x) (0xff-(x)) - -#define G_DMACMDSIZ 128 -#define G_IMMCMDSIZ 64 -#define G_RDPCMDSIZ 64 - -/* - * Coordinate shift values, number of bits of fraction - */ -#define G_TEXTURE_IMAGE_FRAC 2 -#define G_TEXTURE_SCALE_FRAC 16 -#define G_SCALE_FRAC 8 -#define G_ROTATE_FRAC 16 - -/* - * Parameters to graphics commands - */ - -/* - * Data packing macros - */ - -/* - * Maximum z-buffer value, used to initialize the z-buffer. - * Note : this number is NOT the viewport z-scale constant. - * See the comment next to G_MAXZ for more info. - */ -#define G_MAXFBZ 0x3fff /* 3b exp, 11b mantissa */ - -#define GPACK_RGBA5551(r, g, b, a) ((((r)<<8) & 0xf800) | \ - (((g)<<3) & 0x7c0) | \ - (((b)>>2) & 0x3e) | ((a) & 0x1)) -#define GPACK_ZDZ(z, dz) ((z) << 2 | (dz)) - -/* - * G_MTX: parameter flags - */ -#ifdef F3DEX_GBI_2 -# define G_MTX_MODELVIEW 0x00 /* matrix types */ -# define G_MTX_PROJECTION 0x04 -# define G_MTX_MUL 0x00 /* concat or load */ -# define G_MTX_LOAD 0x02 -# define G_MTX_NOPUSH 0x00 /* push or not */ -# define G_MTX_PUSH 0x01 -#else /* F3DEX_GBI_2 */ -# define G_MTX_MODELVIEW 0x00 /* matrix types */ -# define G_MTX_PROJECTION 0x01 -# define G_MTX_MUL 0x00 /* concat or load */ -# define G_MTX_LOAD 0x02 -# define G_MTX_NOPUSH 0x00 /* push or not */ -# define G_MTX_PUSH 0x04 -#endif /* F3DEX_GBI_2 */ - -/* - * flags for G_SETGEOMETRYMODE - * (this rendering state is maintained in RSP) - * - * DO NOT USE THE LOW 8 BITS OF GEOMETRYMODE: - * The weird bit-ordering is for the micro-code: the lower byte - * can be OR'd in with G_TRI_SHADE (11001100) to construct - * the triangle command directly. Don't break it... - * - * DO NOT USE THE HIGH 8 BITS OF GEOMETRYMODE: - * The high byte is OR'd with 0x703 to form the clip code mask. - * If it is set to 0x04, this will cause near clipping to occur. - * If it is zero, near clipping will not occur. - * - * Further explanation: - * G_SHADE is necessary in order to see the color that you passed - * down with the vertex. If G_SHADE isn't set, you need to set the DP - * appropriately and use primcolor to see anything. - * - * G_SHADING_SMOOTH enabled means use all 3 colors of the triangle. - * If it is not set, then do 'flat shading', where only one vertex color - * is used (and all 3 vertices are set to that same color by the ucode) - * See the man page for gSP1Triangle(). - * - */ -#define G_ZBUFFER 0x00000001 -#define G_SHADE 0x00000004 /* enable Gouraud interp */ -/* rest of low byte reserved for setup ucode */ -#ifdef F3DEX_GBI_2 -# define G_TEXTURE_ENABLE 0x00000000 /* Ignored */ -# define G_SHADING_SMOOTH 0x00200000 /* flat or smooth shaded */ -# define G_CULL_FRONT 0x00000200 -# define G_CULL_BACK 0x00000400 -# define G_CULL_BOTH 0x00000600 /* To make code cleaner */ -#else -# define G_TEXTURE_ENABLE 0x00000002 /* Microcode use only */ -# define G_SHADING_SMOOTH 0x00000200 /* flat or smooth shaded */ -# define G_CULL_FRONT 0x00001000 -# define G_CULL_BACK 0x00002000 -# define G_CULL_BOTH 0x00003000 /* To make code cleaner */ -#endif -#define G_FOG 0x00010000 -#define G_LIGHTING 0x00020000 -#define G_TEXTURE_GEN 0x00040000 -#define G_TEXTURE_GEN_LINEAR 0x00080000 -#define G_LOD 0x00100000 /* NOT IMPLEMENTED */ -#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)) -# define G_CLIPPING 0x00800000 -#else -# define G_CLIPPING 0x00000000 -#endif - -#ifdef _LANGUAGE_ASSEMBLY -#define G_FOG_H (G_FOG/0x10000) -#define G_LIGHTING_H (G_LIGHTING/0x10000) -#define G_TEXTURE_GEN_H (G_TEXTURE_GEN/0x10000) -#define G_TEXTURE_GEN_LINEAR_H (G_TEXTURE_GEN_LINEAR/0x10000) -#define G_LOD_H (G_LOD/0x10000) /* NOT IMPLEMENTED */ -#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)) -# define G_CLIPPING_H (G_CLIPPING/0x10000) -#endif -#endif - -/* Need these defined for Sprite Microcode */ -#ifdef _LANGUAGE_ASSEMBLY -#define G_TX_LOADTILE 7 -#define G_TX_RENDERTILE 0 - -#define G_TX_NOMIRROR 0 -#define G_TX_WRAP 0 -#define G_TX_MIRROR 0x1 -#define G_TX_CLAMP 0x2 -#define G_TX_NOMASK 0 -#define G_TX_NOLOD 0 -#endif - -/* - * G_SETIMG fmt: set image formats - */ -#define G_IM_FMT_RGBA 0 -#define G_IM_FMT_YUV 1 -#define G_IM_FMT_CI 2 -#define G_IM_FMT_IA 3 -#define G_IM_FMT_I 4 - -/* - * G_SETIMG siz: set image pixel size - */ -#define G_IM_SIZ_4b 0 -#define G_IM_SIZ_8b 1 -#define G_IM_SIZ_16b 2 -#define G_IM_SIZ_32b 3 -#define G_IM_SIZ_DD 5 - -#define G_IM_SIZ_4b_BYTES 0 -#define G_IM_SIZ_4b_TILE_BYTES G_IM_SIZ_4b_BYTES -#define G_IM_SIZ_4b_LINE_BYTES G_IM_SIZ_4b_BYTES - -#define G_IM_SIZ_8b_BYTES 1 -#define G_IM_SIZ_8b_TILE_BYTES G_IM_SIZ_8b_BYTES -#define G_IM_SIZ_8b_LINE_BYTES G_IM_SIZ_8b_BYTES - -#define G_IM_SIZ_16b_BYTES 2 -#define G_IM_SIZ_16b_TILE_BYTES G_IM_SIZ_16b_BYTES -#define G_IM_SIZ_16b_LINE_BYTES G_IM_SIZ_16b_BYTES - -#define G_IM_SIZ_32b_BYTES 4 -#define G_IM_SIZ_32b_TILE_BYTES 2 -#define G_IM_SIZ_32b_LINE_BYTES 2 - -#define G_IM_SIZ_4b_LOAD_BLOCK G_IM_SIZ_16b -#define G_IM_SIZ_8b_LOAD_BLOCK G_IM_SIZ_16b -#define G_IM_SIZ_16b_LOAD_BLOCK G_IM_SIZ_16b -#define G_IM_SIZ_32b_LOAD_BLOCK G_IM_SIZ_32b - -#define G_IM_SIZ_4b_SHIFT 2 -#define G_IM_SIZ_8b_SHIFT 1 -#define G_IM_SIZ_16b_SHIFT 0 -#define G_IM_SIZ_32b_SHIFT 0 - -#define G_IM_SIZ_4b_INCR 3 -#define G_IM_SIZ_8b_INCR 1 -#define G_IM_SIZ_16b_INCR 0 -#define G_IM_SIZ_32b_INCR 0 - -/* - * G_SETCOMBINE: color combine modes - */ -/* Color combiner constants: */ -#define G_CCMUX_COMBINED 0 -#define G_CCMUX_TEXEL0 1 -#define G_CCMUX_TEXEL1 2 -#define G_CCMUX_PRIMITIVE 3 -#define G_CCMUX_SHADE 4 -#define G_CCMUX_ENVIRONMENT 5 -#define G_CCMUX_CENTER 6 -#define G_CCMUX_SCALE 6 -#define G_CCMUX_COMBINED_ALPHA 7 -#define G_CCMUX_TEXEL0_ALPHA 8 -#define G_CCMUX_TEXEL1_ALPHA 9 -#define G_CCMUX_PRIMITIVE_ALPHA 10 -#define G_CCMUX_SHADE_ALPHA 11 -#define G_CCMUX_ENV_ALPHA 12 -#define G_CCMUX_LOD_FRACTION 13 -#define G_CCMUX_PRIM_LOD_FRAC 14 -#define G_CCMUX_NOISE 7 -#define G_CCMUX_K4 7 -#define G_CCMUX_K5 15 -#define G_CCMUX_1 6 -#define G_CCMUX_0 31 - -/* Alpha combiner constants: */ -#define G_ACMUX_COMBINED 0 -#define G_ACMUX_TEXEL0 1 -#define G_ACMUX_TEXEL1 2 -#define G_ACMUX_PRIMITIVE 3 -#define G_ACMUX_SHADE 4 -#define G_ACMUX_ENVIRONMENT 5 -#define G_ACMUX_LOD_FRACTION 0 -#define G_ACMUX_PRIM_LOD_FRAC 6 -#define G_ACMUX_1 6 -#define G_ACMUX_0 7 - -/* typical CC cycle 1 modes */ -#define G_CC_PRIMITIVE 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE -#define G_CC_SHADE 0, 0, 0, SHADE, 0, 0, 0, SHADE -#define G_CC_MODULATEI TEXEL0, 0, SHADE, 0, 0, 0, 0, SHADE -#define G_CC_MODULATEIA TEXEL0, 0, SHADE, 0, TEXEL0, 0, SHADE, 0 -#define G_CC_MODULATEIDECALA TEXEL0, 0, SHADE, 0, 0, 0, 0, TEXEL0 -#define G_CC_MODULATERGB G_CC_MODULATEI -#define G_CC_MODULATERGBA G_CC_MODULATEIA -#define G_CC_MODULATERGBDECALA G_CC_MODULATEIDECALA -#define G_CC_MODULATEI_PRIM TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE -#define G_CC_MODULATEIA_PRIM TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0 -#define G_CC_MODULATEIDECALA_PRIM TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, TEXEL0 -#define G_CC_MODULATERGB_PRIM G_CC_MODULATEI_PRIM -#define G_CC_MODULATERGBA_PRIM G_CC_MODULATEIA_PRIM -#define G_CC_MODULATERGBDECALA_PRIM G_CC_MODULATEIDECALA_PRIM -#define G_CC_DECALRGB 0, 0, 0, TEXEL0, 0, 0, 0, SHADE -#define G_CC_DECALRGBA 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0 -#define G_CC_BLENDI ENVIRONMENT, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE -#define G_CC_BLENDIA ENVIRONMENT, SHADE, TEXEL0, SHADE, TEXEL0, 0, SHADE, 0 -#define G_CC_BLENDIDECALA ENVIRONMENT, SHADE, TEXEL0, SHADE, 0, 0, 0, TEXEL0 -#define G_CC_BLENDRGBA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, SHADE -#define G_CC_BLENDRGBDECALA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, TEXEL0 -#define G_CC_ADDRGB 1, 0, TEXEL0, SHADE, 0, 0, 0, SHADE -#define G_CC_ADDRGBDECALA 1, 0, TEXEL0, SHADE, 0, 0, 0, TEXEL0 -#define G_CC_REFLECTRGB ENVIRONMENT, 0, TEXEL0, SHADE, 0, 0, 0, SHADE -#define G_CC_REFLECTRGBDECALA ENVIRONMENT, 0, TEXEL0, SHADE, 0, 0, 0, TEXEL0 -#define G_CC_HILITERGB PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE -#define G_CC_HILITERGBA PRIMITIVE, SHADE, TEXEL0, SHADE, PRIMITIVE, SHADE, TEXEL0, SHADE -#define G_CC_HILITERGBDECALA PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, TEXEL0 -#define G_CC_SHADEDECALA 0, 0, 0, SHADE, 0, 0, 0, TEXEL0 -#define G_CC_BLENDPE PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, SHADE, 0 -#define G_CC_BLENDPEDECALA PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, TEXEL0 - -/* oddball modes */ -#define _G_CC_BLENDPE ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, SHADE, 0 -#define _G_CC_BLENDPEDECALA ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, 0, 0, 0, TEXEL0 -#define _G_CC_TWOCOLORTEX PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE -/* used for 1-cycle sparse mip-maps, primitive color has color of lowest LOD */ -#define _G_CC_SPARSEST PRIMITIVE, TEXEL0, LOD_FRACTION, TEXEL0, PRIMITIVE, TEXEL0, LOD_FRACTION, TEXEL0 -#define G_CC_TEMPLERP TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0 - -/* typical CC cycle 1 modes, usually followed by other cycle 2 modes */ -#define G_CC_TRILERP TEXEL1, TEXEL0, LOD_FRACTION, TEXEL0, TEXEL1, TEXEL0, LOD_FRACTION, TEXEL0 -#define G_CC_INTERFERENCE TEXEL0, 0, TEXEL1, 0, TEXEL0, 0, TEXEL1, 0 - -/* - * One-cycle color convert operation - */ -#define G_CC_1CYUV2RGB TEXEL0, K4, K5, TEXEL0, 0, 0, 0, SHADE - -/* - * NOTE: YUV2RGB expects TF step1 color conversion to occur in 2nd clock. - * Therefore, CC looks for step1 results in TEXEL1 - */ -#define G_CC_YUV2RGB TEXEL1, K4, K5, TEXEL1, 0, 0, 0, 0 - -/* typical CC cycle 2 modes */ -#define G_CC_PASS2 0, 0, 0, COMBINED, 0, 0, 0, COMBINED -#define G_CC_MODULATEI2 COMBINED, 0, SHADE, 0, 0, 0, 0, SHADE -#define G_CC_MODULATEIA2 COMBINED, 0, SHADE, 0, COMBINED, 0, SHADE, 0 -#define G_CC_MODULATERGB2 G_CC_MODULATEI2 -#define G_CC_MODULATERGBA2 G_CC_MODULATEIA2 -#define G_CC_MODULATEI_PRIM2 COMBINED, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE -#define G_CC_MODULATEIA_PRIM2 COMBINED, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0 -#define G_CC_MODULATERGB_PRIM2 G_CC_MODULATEI_PRIM2 -#define G_CC_MODULATERGBA_PRIM2 G_CC_MODULATEIA_PRIM2 -#define G_CC_DECALRGB2 0, 0, 0, COMBINED, 0, 0, 0, SHADE -/* - * ? -#define G_CC_DECALRGBA2 COMBINED, SHADE, COMBINED_ALPHA, SHADE, 0, 0, 0, SHADE -*/ -#define G_CC_BLENDI2 ENVIRONMENT, SHADE, COMBINED, SHADE, 0, 0, 0, SHADE -#define G_CC_BLENDIA2 ENVIRONMENT, SHADE, COMBINED, SHADE, COMBINED, 0, SHADE, 0 -#define G_CC_CHROMA_KEY2 TEXEL0, CENTER, SCALE, 0, 0, 0, 0, 0 -#define G_CC_HILITERGB2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, SHADE -#define G_CC_HILITERGBA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, ENVIRONMENT, COMBINED, TEXEL0, COMBINED -#define G_CC_HILITERGBDECALA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, TEXEL0 -#define G_CC_HILITERGBPASSA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, COMBINED - -/* - * G_SETOTHERMODE_L sft: shift count - */ -#define G_MDSFT_ALPHACOMPARE 0 -#define G_MDSFT_ZSRCSEL 2 -#define G_MDSFT_RENDERMODE 3 -#define G_MDSFT_BLENDER 16 - -/* - * G_SETOTHERMODE_H sft: shift count - */ -#define G_MDSFT_BLENDMASK 0 /* unsupported */ -#define G_MDSFT_ALPHADITHER 4 -#define G_MDSFT_RGBDITHER 6 - -#define G_MDSFT_COMBKEY 8 -#define G_MDSFT_TEXTCONV 9 -#define G_MDSFT_TEXTFILT 12 -#define G_MDSFT_TEXTLUT 14 -#define G_MDSFT_TEXTLOD 16 -#define G_MDSFT_TEXTDETAIL 17 -#define G_MDSFT_TEXTPERSP 19 -#define G_MDSFT_CYCLETYPE 20 -#define G_MDSFT_COLORDITHER 22 /* unsupported in HW 2.0 */ -#define G_MDSFT_PIPELINE 23 - -/* G_SETOTHERMODE_H gPipelineMode */ -#define G_PM_1PRIMITIVE (1 << G_MDSFT_PIPELINE) -#define G_PM_NPRIMITIVE (0 << G_MDSFT_PIPELINE) - -/* G_SETOTHERMODE_H gSetCycleType */ -#define G_CYC_1CYCLE (0 << G_MDSFT_CYCLETYPE) -#define G_CYC_2CYCLE (1 << G_MDSFT_CYCLETYPE) -#define G_CYC_COPY (2 << G_MDSFT_CYCLETYPE) -#define G_CYC_FILL (3 << G_MDSFT_CYCLETYPE) - -/* G_SETOTHERMODE_H gSetTexturePersp */ -#define G_TP_NONE (0 << G_MDSFT_TEXTPERSP) -#define G_TP_PERSP (1 << G_MDSFT_TEXTPERSP) - -/* G_SETOTHERMODE_H gSetTextureDetail */ -#define G_TD_CLAMP (0 << G_MDSFT_TEXTDETAIL) -#define G_TD_SHARPEN (1 << G_MDSFT_TEXTDETAIL) -#define G_TD_DETAIL (2 << G_MDSFT_TEXTDETAIL) - -/* G_SETOTHERMODE_H gSetTextureLOD */ -#define G_TL_TILE (0 << G_MDSFT_TEXTLOD) -#define G_TL_LOD (1 << G_MDSFT_TEXTLOD) - -/* G_SETOTHERMODE_H gSetTextureLUT */ -#define G_TT_NONE (0 << G_MDSFT_TEXTLUT) -#define G_TT_RGBA16 (2 << G_MDSFT_TEXTLUT) -#define G_TT_IA16 (3 << G_MDSFT_TEXTLUT) - -/* G_SETOTHERMODE_H gSetTextureFilter */ -#define G_TF_POINT (0 << G_MDSFT_TEXTFILT) -#define G_TF_AVERAGE (3 << G_MDSFT_TEXTFILT) -#define G_TF_BILERP (2 << G_MDSFT_TEXTFILT) - -/* G_SETOTHERMODE_H gSetTextureConvert */ -#define G_TC_CONV (0 << G_MDSFT_TEXTCONV) -#define G_TC_FILTCONV (5 << G_MDSFT_TEXTCONV) -#define G_TC_FILT (6 << G_MDSFT_TEXTCONV) - -/* G_SETOTHERMODE_H gSetCombineKey */ -#define G_CK_NONE (0 << G_MDSFT_COMBKEY) -#define G_CK_KEY (1 << G_MDSFT_COMBKEY) - -/* G_SETOTHERMODE_H gSetColorDither */ -#define G_CD_MAGICSQ (0 << G_MDSFT_RGBDITHER) -#define G_CD_BAYER (1 << G_MDSFT_RGBDITHER) -#define G_CD_NOISE (2 << G_MDSFT_RGBDITHER) - -#ifndef _HW_VERSION_1 -#define G_CD_DISABLE (3 << G_MDSFT_RGBDITHER) -#define G_CD_ENABLE G_CD_NOISE /* HW 1.0 compatibility mode */ -#else -#define G_CD_ENABLE (1 << G_MDSFT_COLORDITHER) -#define G_CD_DISABLE (0 << G_MDSFT_COLORDITHER) -#endif - -/* G_SETOTHERMODE_H gSetAlphaDither */ -#define G_AD_PATTERN (0 << G_MDSFT_ALPHADITHER) -#define G_AD_NOTPATTERN (1 << G_MDSFT_ALPHADITHER) -#define G_AD_NOISE (2 << G_MDSFT_ALPHADITHER) -#define G_AD_DISABLE (3 << G_MDSFT_ALPHADITHER) - -/* G_SETOTHERMODE_L gSetAlphaCompare */ -#define G_AC_NONE (0 << G_MDSFT_ALPHACOMPARE) -#define G_AC_THRESHOLD (1 << G_MDSFT_ALPHACOMPARE) -#define G_AC_DITHER (3 << G_MDSFT_ALPHACOMPARE) - -/* G_SETOTHERMODE_L gSetDepthSource */ -#define G_ZS_PIXEL (0 << G_MDSFT_ZSRCSEL) -#define G_ZS_PRIM (1 << G_MDSFT_ZSRCSEL) - -/* G_SETOTHERMODE_L gSetRenderMode */ -#define AA_EN 0x8 -#define Z_CMP 0x10 -#define Z_UPD 0x20 -#define IM_RD 0x40 -#define CLR_ON_CVG 0x80 -#define CVG_DST_CLAMP 0 -#define CVG_DST_WRAP 0x100 -#define CVG_DST_FULL 0x200 -#define CVG_DST_SAVE 0x300 -#define ZMODE_OPA 0 -#define ZMODE_INTER 0x400 -#define ZMODE_XLU 0x800 -#define ZMODE_DEC 0xc00 -#define CVG_X_ALPHA 0x1000 -#define ALPHA_CVG_SEL 0x2000 -#define FORCE_BL 0x4000 -#define TEX_EDGE 0x0000 /* used to be 0x8000 */ - -#define G_BL_CLR_IN 0 -#define G_BL_CLR_MEM 1 -#define G_BL_CLR_BL 2 -#define G_BL_CLR_FOG 3 -#define G_BL_1MA 0 -#define G_BL_A_MEM 1 -#define G_BL_A_IN 0 -#define G_BL_A_FOG 1 -#define G_BL_A_SHADE 2 -#define G_BL_1 2 -#define G_BL_0 3 - -#define GBL_c1(m1a, m1b, m2a, m2b) \ - (m1a) << 30 | (m1b) << 26 | (m2a) << 22 | (m2b) << 18 -#define GBL_c2(m1a, m1b, m2a, m2b) \ - (m1a) << 28 | (m1b) << 24 | (m2a) << 20 | (m2b) << 16 - -#define RM_AA_ZB_OPA_SURF(clk) \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ - ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_RA_ZB_OPA_SURF(clk) \ - AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | \ - ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_AA_ZB_XLU_SURF(clk) \ - AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \ - FORCE_BL | ZMODE_XLU | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_ZB_OPA_DECAL(clk) \ - AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | ALPHA_CVG_SEL | \ - ZMODE_DEC | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_RA_ZB_OPA_DECAL(clk) \ - AA_EN | Z_CMP | CVG_DST_WRAP | ALPHA_CVG_SEL | \ - ZMODE_DEC | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_AA_ZB_XLU_DECAL(clk) \ - AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \ - FORCE_BL | ZMODE_DEC | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_ZB_OPA_INTER(clk) \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ - ALPHA_CVG_SEL | ZMODE_INTER | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_RA_ZB_OPA_INTER(clk) \ - AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | \ - ALPHA_CVG_SEL | ZMODE_INTER | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_AA_ZB_XLU_INTER(clk) \ - AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \ - FORCE_BL | ZMODE_INTER | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_ZB_XLU_LINE(clk) \ - AA_EN | Z_CMP | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | FORCE_BL | ZMODE_XLU | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_ZB_DEC_LINE(clk) \ - AA_EN | Z_CMP | IM_RD | CVG_DST_SAVE | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | FORCE_BL | ZMODE_DEC | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_ZB_TEX_EDGE(clk) \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_AA_ZB_TEX_INTER(clk) \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_INTER | TEX_EDGE | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_AA_ZB_SUB_SURF(clk) \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | \ - ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_AA_ZB_PCL_SURF(clk) \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ - ZMODE_OPA | G_AC_DITHER | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_ZB_OPA_TERR(clk) \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ - ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_ZB_TEX_TERR(clk) \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_ZB_SUB_TERR(clk) \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | \ - ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - - -#define RM_AA_OPA_SURF(clk) \ - AA_EN | IM_RD | CVG_DST_CLAMP | \ - ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_RA_OPA_SURF(clk) \ - AA_EN | CVG_DST_CLAMP | \ - ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_AA_XLU_SURF(clk) \ - AA_EN | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | FORCE_BL | \ - ZMODE_OPA | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_XLU_LINE(clk) \ - AA_EN | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | FORCE_BL | ZMODE_OPA | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_DEC_LINE(clk) \ - AA_EN | IM_RD | CVG_DST_FULL | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | FORCE_BL | ZMODE_OPA | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_TEX_EDGE(clk) \ - AA_EN | IM_RD | CVG_DST_CLAMP | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_AA_SUB_SURF(clk) \ - AA_EN | IM_RD | CVG_DST_FULL | \ - ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_AA_PCL_SURF(clk) \ - AA_EN | IM_RD | CVG_DST_CLAMP | \ - ZMODE_OPA | G_AC_DITHER | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_OPA_TERR(clk) \ - AA_EN | IM_RD | CVG_DST_CLAMP | \ - ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_TEX_TERR(clk) \ - AA_EN | IM_RD | CVG_DST_CLAMP | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_AA_SUB_TERR(clk) \ - AA_EN | IM_RD | CVG_DST_FULL | \ - ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - - -#define RM_ZB_OPA_SURF(clk) \ - Z_CMP | Z_UPD | CVG_DST_FULL | ALPHA_CVG_SEL | \ - ZMODE_OPA | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_ZB_XLU_SURF(clk) \ - Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_XLU | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_ZB_OPA_DECAL(clk) \ - Z_CMP | CVG_DST_FULL | ALPHA_CVG_SEL | ZMODE_DEC | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) - -#define RM_ZB_XLU_DECAL(clk) \ - Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_DEC | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_ZB_CLD_SURF(clk) \ - Z_CMP | IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_XLU | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_ZB_OVL_SURF(clk) \ - Z_CMP | IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_DEC | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_ZB_PCL_SURF(clk) \ - Z_CMP | Z_UPD | CVG_DST_FULL | ZMODE_OPA | \ - G_AC_DITHER | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) - - -#define RM_OPA_SURF(clk) \ - CVG_DST_CLAMP | FORCE_BL | ZMODE_OPA | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) - -#define RM_XLU_SURF(clk) \ - IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_OPA | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_TEX_EDGE(clk) \ - CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL |\ - ZMODE_OPA | TEX_EDGE | AA_EN | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) - -#define RM_CLD_SURF(clk) \ - IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_OPA | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define RM_PCL_SURF(clk) \ - CVG_DST_FULL | FORCE_BL | ZMODE_OPA | \ - G_AC_DITHER | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) - -#define RM_ADD(clk) \ - IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_OPA | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_1) - -#define RM_NOOP(clk) \ - GBL_c##clk(0, 0, 0, 0) - -#define RM_VISCVG(clk) \ - IM_RD | FORCE_BL | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_BL, G_BL_A_MEM) - -/* for rendering to an 8-bit framebuffer */ -#define RM_OPA_CI(clk) \ - CVG_DST_CLAMP | ZMODE_OPA | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) - - - -#define G_RM_AA_ZB_OPA_SURF RM_AA_ZB_OPA_SURF(1) -#define G_RM_AA_ZB_OPA_SURF2 RM_AA_ZB_OPA_SURF(2) -#define G_RM_AA_ZB_XLU_SURF RM_AA_ZB_XLU_SURF(1) -#define G_RM_AA_ZB_XLU_SURF2 RM_AA_ZB_XLU_SURF(2) -#define G_RM_AA_ZB_OPA_DECAL RM_AA_ZB_OPA_DECAL(1) -#define G_RM_AA_ZB_OPA_DECAL2 RM_AA_ZB_OPA_DECAL(2) -#define G_RM_AA_ZB_XLU_DECAL RM_AA_ZB_XLU_DECAL(1) -#define G_RM_AA_ZB_XLU_DECAL2 RM_AA_ZB_XLU_DECAL(2) -#define G_RM_AA_ZB_OPA_INTER RM_AA_ZB_OPA_INTER(1) -#define G_RM_AA_ZB_OPA_INTER2 RM_AA_ZB_OPA_INTER(2) -#define G_RM_AA_ZB_XLU_INTER RM_AA_ZB_XLU_INTER(1) -#define G_RM_AA_ZB_XLU_INTER2 RM_AA_ZB_XLU_INTER(2) -#define G_RM_AA_ZB_XLU_LINE RM_AA_ZB_XLU_LINE(1) -#define G_RM_AA_ZB_XLU_LINE2 RM_AA_ZB_XLU_LINE(2) -#define G_RM_AA_ZB_DEC_LINE RM_AA_ZB_DEC_LINE(1) -#define G_RM_AA_ZB_DEC_LINE2 RM_AA_ZB_DEC_LINE(2) -#define G_RM_AA_ZB_TEX_EDGE RM_AA_ZB_TEX_EDGE(1) -#define G_RM_AA_ZB_TEX_EDGE2 RM_AA_ZB_TEX_EDGE(2) -#define G_RM_AA_ZB_TEX_INTER RM_AA_ZB_TEX_INTER(1) -#define G_RM_AA_ZB_TEX_INTER2 RM_AA_ZB_TEX_INTER(2) -#define G_RM_AA_ZB_SUB_SURF RM_AA_ZB_SUB_SURF(1) -#define G_RM_AA_ZB_SUB_SURF2 RM_AA_ZB_SUB_SURF(2) -#define G_RM_AA_ZB_PCL_SURF RM_AA_ZB_PCL_SURF(1) -#define G_RM_AA_ZB_PCL_SURF2 RM_AA_ZB_PCL_SURF(2) -#define G_RM_AA_ZB_OPA_TERR RM_AA_ZB_OPA_TERR(1) -#define G_RM_AA_ZB_OPA_TERR2 RM_AA_ZB_OPA_TERR(2) -#define G_RM_AA_ZB_TEX_TERR RM_AA_ZB_TEX_TERR(1) -#define G_RM_AA_ZB_TEX_TERR2 RM_AA_ZB_TEX_TERR(2) -#define G_RM_AA_ZB_SUB_TERR RM_AA_ZB_SUB_TERR(1) -#define G_RM_AA_ZB_SUB_TERR2 RM_AA_ZB_SUB_TERR(2) - -#define G_RM_RA_ZB_OPA_SURF RM_RA_ZB_OPA_SURF(1) -#define G_RM_RA_ZB_OPA_SURF2 RM_RA_ZB_OPA_SURF(2) -#define G_RM_RA_ZB_OPA_DECAL RM_RA_ZB_OPA_DECAL(1) -#define G_RM_RA_ZB_OPA_DECAL2 RM_RA_ZB_OPA_DECAL(2) -#define G_RM_RA_ZB_OPA_INTER RM_RA_ZB_OPA_INTER(1) -#define G_RM_RA_ZB_OPA_INTER2 RM_RA_ZB_OPA_INTER(2) - -#define G_RM_AA_OPA_SURF RM_AA_OPA_SURF(1) -#define G_RM_AA_OPA_SURF2 RM_AA_OPA_SURF(2) -#define G_RM_AA_XLU_SURF RM_AA_XLU_SURF(1) -#define G_RM_AA_XLU_SURF2 RM_AA_XLU_SURF(2) -#define G_RM_AA_XLU_LINE RM_AA_XLU_LINE(1) -#define G_RM_AA_XLU_LINE2 RM_AA_XLU_LINE(2) -#define G_RM_AA_DEC_LINE RM_AA_DEC_LINE(1) -#define G_RM_AA_DEC_LINE2 RM_AA_DEC_LINE(2) -#define G_RM_AA_TEX_EDGE RM_AA_TEX_EDGE(1) -#define G_RM_AA_TEX_EDGE2 RM_AA_TEX_EDGE(2) -#define G_RM_AA_SUB_SURF RM_AA_SUB_SURF(1) -#define G_RM_AA_SUB_SURF2 RM_AA_SUB_SURF(2) -#define G_RM_AA_PCL_SURF RM_AA_PCL_SURF(1) -#define G_RM_AA_PCL_SURF2 RM_AA_PCL_SURF(2) -#define G_RM_AA_OPA_TERR RM_AA_OPA_TERR(1) -#define G_RM_AA_OPA_TERR2 RM_AA_OPA_TERR(2) -#define G_RM_AA_TEX_TERR RM_AA_TEX_TERR(1) -#define G_RM_AA_TEX_TERR2 RM_AA_TEX_TERR(2) -#define G_RM_AA_SUB_TERR RM_AA_SUB_TERR(1) -#define G_RM_AA_SUB_TERR2 RM_AA_SUB_TERR(2) - -#define G_RM_RA_OPA_SURF RM_RA_OPA_SURF(1) -#define G_RM_RA_OPA_SURF2 RM_RA_OPA_SURF(2) - -#define G_RM_ZB_OPA_SURF RM_ZB_OPA_SURF(1) -#define G_RM_ZB_OPA_SURF2 RM_ZB_OPA_SURF(2) -#define G_RM_ZB_XLU_SURF RM_ZB_XLU_SURF(1) -#define G_RM_ZB_XLU_SURF2 RM_ZB_XLU_SURF(2) -#define G_RM_ZB_OPA_DECAL RM_ZB_OPA_DECAL(1) -#define G_RM_ZB_OPA_DECAL2 RM_ZB_OPA_DECAL(2) -#define G_RM_ZB_XLU_DECAL RM_ZB_XLU_DECAL(1) -#define G_RM_ZB_XLU_DECAL2 RM_ZB_XLU_DECAL(2) -#define G_RM_ZB_CLD_SURF RM_ZB_CLD_SURF(1) -#define G_RM_ZB_CLD_SURF2 RM_ZB_CLD_SURF(2) -#define G_RM_ZB_OVL_SURF RM_ZB_OVL_SURF(1) -#define G_RM_ZB_OVL_SURF2 RM_ZB_OVL_SURF(2) -#define G_RM_ZB_PCL_SURF RM_ZB_PCL_SURF(1) -#define G_RM_ZB_PCL_SURF2 RM_ZB_PCL_SURF(2) - -#define G_RM_OPA_SURF RM_OPA_SURF(1) -#define G_RM_OPA_SURF2 RM_OPA_SURF(2) -#define G_RM_XLU_SURF RM_XLU_SURF(1) -#define G_RM_XLU_SURF2 RM_XLU_SURF(2) -#define G_RM_CLD_SURF RM_CLD_SURF(1) -#define G_RM_CLD_SURF2 RM_CLD_SURF(2) -#define G_RM_TEX_EDGE RM_TEX_EDGE(1) -#define G_RM_TEX_EDGE2 RM_TEX_EDGE(2) -#define G_RM_PCL_SURF RM_PCL_SURF(1) -#define G_RM_PCL_SURF2 RM_PCL_SURF(2) -#define G_RM_ADD RM_ADD(1) -#define G_RM_ADD2 RM_ADD(2) -#define G_RM_NOOP RM_NOOP(1) -#define G_RM_NOOP2 RM_NOOP(2) -#define G_RM_VISCVG RM_VISCVG(1) -#define G_RM_VISCVG2 RM_VISCVG(2) -#define G_RM_OPA_CI RM_OPA_CI(1) -#define G_RM_OPA_CI2 RM_OPA_CI(2) - - -#define G_RM_FOG_SHADE_A GBL_c1(G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA) -#define G_RM_FOG_PRIM_A GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_IN, G_BL_1MA) -#define G_RM_PASS GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) - -/* - * G_SETCONVERT: K0-5 - */ -#define G_CV_K0 175 -#define G_CV_K1 -43 -#define G_CV_K2 -89 -#define G_CV_K3 222 -#define G_CV_K4 114 -#define G_CV_K5 42 - -/* - * G_SETSCISSOR: interlace mode - */ -#define G_SC_NON_INTERLACE 0 -#define G_SC_ODD_INTERLACE 3 -#define G_SC_EVEN_INTERLACE 2 - -/* flags to inhibit pushing of the display list (on branch) */ -#define G_DL_PUSH 0x00 -#define G_DL_NOPUSH 0x01 - -/* - * BEGIN C-specific section: (typedef's) - */ -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* - * Data Structures - * - * NOTE: - * The DMA transfer hardware requires 64-bit aligned, 64-bit multiple- - * sized transfers. This important hardware optimization is unfortunately - * reflected in the programming interface, with some structures - * padded and alignment enforced. - * - * Since structures are aligned to the boundary of the "worst-case" - * element, we can't depend on the C compiler to align things - * properly. - * - * 64-bit structure alignment is enforced by wrapping structures with - * unions that contain a dummy "long long int". Why this works is - * explained in the ANSI C Spec, or on page 186 of the second edition - * of K&R, "The C Programming Language". - * - * The price we pay for this is a little awkwardness referencing the - * structures through the union. There is no memory penalty, since - * all the structures are at least 64-bits the dummy alignment field - * does not increase the size of the union. - * - * Static initialization of these union structures works because - * the ANSI C spec states that static initialization for unions - * works by using the first union element. We put the dummy alignment - * field last for this reason. - * - * (it's possible a newer 64-bit compiler from MIPS might make this - * easier with a flag, but we can't wait for it...) - * - */ - -/* - * Vertex (set up for use with colors) - */ -typedef struct { - short ob[3]; /* x, y, z */ - unsigned short flag; - short tc[2]; /* texture coord */ - unsigned char cn[4]; /* color & alpha */ -} Vtx_t; - -/* - * Vertex (set up for use with normals) - */ -typedef struct { - short ob[3]; /* x, y, z */ - unsigned short flag; - short tc[2]; /* texture coord */ - signed char n[3]; /* normal */ - unsigned char a; /* alpha */ -} Vtx_tn; - -typedef union { - Vtx_t v; /* Use this one for colors */ - Vtx_tn n; /* Use this one for normals */ - long long int force_structure_alignment; -} Vtx; - -/* - * Sprite structure - */ - -typedef struct { - void *SourceImagePointer; - void *TlutPointer; - short Stride; - short SubImageWidth; - short SubImageHeight; - char SourceImageType; - char SourceImageBitSize; - short SourceImageOffsetS; - short SourceImageOffsetT; - /* 20 bytes for above */ - - /* padding to bring structure size to 64 bit allignment */ - char dummy[4]; - -} uSprite_t; - -typedef union { - uSprite_t s; - - /* Need to make sure this is 64 bit aligned */ - long long int force_structure_allignment[3]; -} uSprite; - -/* - * Triangle face - */ -typedef struct { - unsigned char flag; - unsigned char v[3]; -} Tri; - -/* - * 4x4 matrix, fixed point s15.16 format. - * First 8 words are integer portion of the 4x4 matrix - * Last 8 words are the fraction portion of the 4x4 matrix - */ -typedef long Mtx_t[4][4]; - -typedef union { - Mtx_t m; - long long int force_structure_alignment; -} Mtx; - -/* - * Viewport - */ - -/* - * - * This magic value is the maximum INTEGER z-range of the hardware - * (there are also 16-bits of fraction, which are introduced during - * any transformations). This is not just a good idea, it's the law. - * Feeding the hardware eventual z-coordinates (after any transforms - * or scaling) bigger than this, will not work. - * - * This number is DIFFERENT than G_MAXFBZ, which is the maximum value - * you want to use to initialize the z-buffer. - * - * The reason these are different is mildly interesting, but too long - * to explain here. It is basically the result of optimizations in the - * hardware. A more generic API might hide this detail from the users, - * but we don't have the ucode to do that... - * - */ -#define G_MAXZ 0x03ff /* 10 bits of integer screen-Z precision */ - -/* - * The viewport structure elements have 2 bits of fraction, necessary - * to accomodate the sub-pixel positioning scaling for the hardware. - * This can also be exploited to handle odd-sized viewports. - * - * Accounting for these fractional bits, using the default projection - * and viewing matrices, the viewport structure is initialized thusly: - * - * (SCREEN_WD/2)*4, (SCREEN_HT/2)*4, G_MAXZ, 0, - * (SCREEN_WD/2)*4, (SCREEN_HT/2)*4, 0, 0, - */ -typedef struct { - short vscale[4]; /* scale, 2 bits fraction */ - short vtrans[4]; /* translate, 2 bits fraction */ - /* both the above arrays are padded to 64-bit boundary */ -} Vp_t; - -typedef union { - Vp_t vp; - long long int force_structure_alignment; -} Vp; - -/* - * MOVEMEM indices - * - * Each of these indexes an entry in a dmem table - * which points to a 1-4 word block of dmem in - * which to store a 1-4 word DMA. - * - */ -#ifdef F3DEX_GBI_2 -/* 0,4 are reserved by G_MTX */ -# define G_MV_MMTX 2 -# define G_MV_PMTX 6 -# define G_MV_VIEWPORT 8 -# define G_MV_LIGHT 10 -# define G_MV_POINT 12 -# define G_MV_MATRIX 14 /* NOTE: this is in moveword table */ -# define G_MVO_LOOKATX (0*24) -# define G_MVO_LOOKATY (1*24) -# define G_MVO_L0 (2*24) -# define G_MVO_L1 (3*24) -# define G_MVO_L2 (4*24) -# define G_MVO_L3 (5*24) -# define G_MVO_L4 (6*24) -# define G_MVO_L5 (7*24) -# define G_MVO_L6 (8*24) -# define G_MVO_L7 (9*24) -#else /* F3DEX_GBI_2 */ -# define G_MV_VIEWPORT 0x80 -# define G_MV_LOOKATY 0x82 -# define G_MV_LOOKATX 0x84 -# define G_MV_L0 0x86 -# define G_MV_L1 0x88 -# define G_MV_L2 0x8a -# define G_MV_L3 0x8c -# define G_MV_L4 0x8e -# define G_MV_L5 0x90 -# define G_MV_L6 0x92 -# define G_MV_L7 0x94 -# define G_MV_TXTATT 0x96 -# define G_MV_MATRIX_1 0x9e /* NOTE: this is in moveword table */ -# define G_MV_MATRIX_2 0x98 -# define G_MV_MATRIX_3 0x9a -# define G_MV_MATRIX_4 0x9c -#endif /* F3DEX_GBI_2 */ - -/* - * MOVEWORD indices - * - * Each of these indexes an entry in a dmem table - * which points to a word in dmem in dmem where - * an immediate word will be stored. - * - */ -#define G_MW_MATRIX 0x00 /* NOTE: also used by movemem */ -#define G_MW_NUMLIGHT 0x02 -#define G_MW_CLIP 0x04 -#define G_MW_SEGMENT 0x06 -#define G_MW_FOG 0x08 -#define G_MW_LIGHTCOL 0x0a -#ifdef F3DEX_GBI_2 -# define G_MW_FORCEMTX 0x0c -#else /* F3DEX_GBI_2 */ -# define G_MW_POINTS 0x0c -#endif /* F3DEX_GBI_2 */ -#define G_MW_PERSPNORM 0x0e - -/* - * These are offsets from the address in the dmem table - */ -#define G_MWO_NUMLIGHT 0x00 -#define G_MWO_CLIP_RNX 0x04 -#define G_MWO_CLIP_RNY 0x0c -#define G_MWO_CLIP_RPX 0x14 -#define G_MWO_CLIP_RPY 0x1c -#define G_MWO_SEGMENT_0 0x00 -#define G_MWO_SEGMENT_1 0x01 -#define G_MWO_SEGMENT_2 0x02 -#define G_MWO_SEGMENT_3 0x03 -#define G_MWO_SEGMENT_4 0x04 -#define G_MWO_SEGMENT_5 0x05 -#define G_MWO_SEGMENT_6 0x06 -#define G_MWO_SEGMENT_7 0x07 -#define G_MWO_SEGMENT_8 0x08 -#define G_MWO_SEGMENT_9 0x09 -#define G_MWO_SEGMENT_A 0x0a -#define G_MWO_SEGMENT_B 0x0b -#define G_MWO_SEGMENT_C 0x0c -#define G_MWO_SEGMENT_D 0x0d -#define G_MWO_SEGMENT_E 0x0e -#define G_MWO_SEGMENT_F 0x0f -#define G_MWO_FOG 0x00 -#define G_MWO_aLIGHT_1 0x00 -#define G_MWO_bLIGHT_1 0x04 -#ifdef F3DEX_GBI_2 -#define G_MWO_aLIGHT_2 0x18 -#define G_MWO_bLIGHT_2 0x1c -#define G_MWO_aLIGHT_3 0x30 -#define G_MWO_bLIGHT_3 0x34 -#define G_MWO_aLIGHT_4 0x48 -#define G_MWO_bLIGHT_4 0x4c -#define G_MWO_aLIGHT_5 0x60 -#define G_MWO_bLIGHT_5 0x64 -#define G_MWO_aLIGHT_6 0x78 -#define G_MWO_bLIGHT_6 0x7c -#define G_MWO_aLIGHT_7 0x90 -#define G_MWO_bLIGHT_7 0x94 -#define G_MWO_aLIGHT_8 0xa8 -#define G_MWO_bLIGHT_8 0xac -#else -#define G_MWO_aLIGHT_2 0x20 -#define G_MWO_bLIGHT_2 0x24 -#define G_MWO_aLIGHT_3 0x40 -#define G_MWO_bLIGHT_3 0x44 -#define G_MWO_aLIGHT_4 0x60 -#define G_MWO_bLIGHT_4 0x64 -#define G_MWO_aLIGHT_5 0x80 -#define G_MWO_bLIGHT_5 0x84 -#define G_MWO_aLIGHT_6 0xa0 -#define G_MWO_bLIGHT_6 0xa4 -#define G_MWO_aLIGHT_7 0xc0 -#define G_MWO_bLIGHT_7 0xc4 -#define G_MWO_aLIGHT_8 0xe0 -#define G_MWO_bLIGHT_8 0xe4 -#endif -#define G_MWO_MATRIX_XX_XY_I 0x00 -#define G_MWO_MATRIX_XZ_XW_I 0x04 -#define G_MWO_MATRIX_YX_YY_I 0x08 -#define G_MWO_MATRIX_YZ_YW_I 0x0c -#define G_MWO_MATRIX_ZX_ZY_I 0x10 -#define G_MWO_MATRIX_ZZ_ZW_I 0x14 -#define G_MWO_MATRIX_WX_WY_I 0x18 -#define G_MWO_MATRIX_WZ_WW_I 0x1c -#define G_MWO_MATRIX_XX_XY_F 0x20 -#define G_MWO_MATRIX_XZ_XW_F 0x24 -#define G_MWO_MATRIX_YX_YY_F 0x28 -#define G_MWO_MATRIX_YZ_YW_F 0x2c -#define G_MWO_MATRIX_ZX_ZY_F 0x30 -#define G_MWO_MATRIX_ZZ_ZW_F 0x34 -#define G_MWO_MATRIX_WX_WY_F 0x38 -#define G_MWO_MATRIX_WZ_WW_F 0x3c -#define G_MWO_POINT_RGBA 0x10 -#define G_MWO_POINT_ST 0x14 -#define G_MWO_POINT_XYSCREEN 0x18 -#define G_MWO_POINT_ZSCREEN 0x1c - -/* - * Light structure. - * - * Note: only directional (infinite) lights are currently supported. - * - * Note: the weird order is for the DMEM alignment benefit of - * the microcode. - * - */ - -typedef struct { - unsigned char col[3]; /* diffuse light value (rgba) */ - char pad1; - unsigned char colc[3]; /* copy of diffuse light value (rgba) */ - char pad2; - signed char dir[3]; /* direction of light (normalized) */ - char pad3; -} Light_t; - -typedef struct { - unsigned char col[3]; /* ambient light value (rgba) */ - char pad1; - unsigned char colc[3]; /* copy of ambient light value (rgba) */ - char pad2; -} Ambient_t; - -typedef struct { - int x1,y1,x2,y2; /* texture offsets for highlight 1/2 */ -} Hilite_t; - -typedef union { - Light_t l; - long long int force_structure_alignment[2]; -} Light; - -typedef union { - Ambient_t l; - long long int force_structure_alignment[1]; -} Ambient; - -typedef struct { - Ambient a; - Light l[7]; -} Lightsn; - -typedef struct { - Ambient a; - Light l[1]; -} Lights0; - -typedef struct { - Ambient a; - Light l[1]; -} Lights1; - -typedef struct { - Ambient a; - Light l[2]; -} Lights2; - -typedef struct { - Ambient a; - Light l[3]; -} Lights3; - -typedef struct { - Ambient a; - Light l[4]; -} Lights4; - -typedef struct { - Ambient a; - Light l[5]; -} Lights5; - -typedef struct { - Ambient a; - Light l[6]; -} Lights6; - -typedef struct { - Ambient a; - Light l[7]; -} Lights7; - -typedef struct { - Light l[2]; -} LookAt; - -typedef union { - Hilite_t h; - long int force_structure_alignment[4]; -} Hilite; - -#define gdSPDefLights0(ar,ag,ab) \ - { {{ {ar,ag,ab},0,{ar,ag,ab},0}}, \ - {{{ { 0, 0, 0},0,{ 0, 0, 0},0,{ 0, 0, 0},0}}} } -#define gdSPDefLights1(ar,ag,ab,r1,g1,b1,x1,y1,z1) \ - { {{ {ar,ag,ab},0,{ar,ag,ab},0}}, \ - {{{ {r1,g1,b1},0,{r1,g1,b1},0,{x1,y1,z1},0}}} } -#define gdSPDefLights2(ar,ag,ab,r1,g1,b1,x1,y1,z1,r2,g2,b2,x2,y2,z2) \ - { {{ {ar,ag,ab},0,{ar,ag,ab},0}}, \ - {{{ {r1,g1,b1},0,{r1,g1,b1},0,{x1,y1,z1},0}}, \ - {{ {r2,g2,b2},0,{r2,g2,b2},0,{x2,y2,z2},0}}} } -#define gdSPDefLights3(ar,ag,ab,r1,g1,b1,x1,y1,z1,r2,g2,b2,x2,y2,z2,r3,g3,b3,x3,y3,z3) \ - { {{ {ar,ag,ab},0,{ar,ag,ab},0}}, \ - {{{ {r1,g1,b1},0,{r1,g1,b1},0,{x1,y1,z1},0}}, \ - {{ {r2,g2,b2},0,{r2,g2,b2},0,{x2,y2,z2},0}}, \ - {{ {r3,g3,b3},0,{r3,g3,b3},0,{x3,y3,z3},0}}} } -#define gdSPDefLights4(ar,ag,ab,r1,g1,b1,x1,y1,z1,r2,g2,b2,x2,y2,z2,r3,g3,b3,x3,y3,z3,r4,g4,b4,x4,y4,z4) \ - { {{ {ar,ag,ab},0,{ar,ag,ab},0}}, \ - {{{ {r1,g1,b1},0,{r1,g1,b1},0,{x1,y1,z1},0}}, \ - {{ {r2,g2,b2},0,{r2,g2,b2},0,{x2,y2,z2},0}}, \ - {{ {r3,g3,b3},0,{r3,g3,b3},0,{x3,y3,z3},0}}, \ - {{ {r4,g4,b4},0,{r4,g4,b4},0,{x4,y4,z4},0}}} } -#define gdSPDefLights5(ar,ag,ab,r1,g1,b1,x1,y1,z1,r2,g2,b2,x2,y2,z2,r3,g3,b3,x3,y3,z3,r4,g4,b4,x4,y4,z4,r5,g5,b5,x5,y5,z5) \ - { {{ {ar,ag,ab},0,{ar,ag,ab},0}}, \ - {{{ {r1,g1,b1},0,{r1,g1,b1},0,{x1,y1,z1},0}}, \ - {{ {r2,g2,b2},0,{r2,g2,b2},0,{x2,y2,z2},0}}, \ - {{ {r3,g3,b3},0,{r3,g3,b3},0,{x3,y3,z3},0}}, \ - {{ {r4,g4,b4},0,{r4,g4,b4},0,{x4,y4,z4},0}}, \ - {{ {r5,g5,b5},0,{r5,g5,b5},0,{x5,y5,z5},0}}} } - - -#define gdSPDefLights6(ar,ag,ab,r1,g1,b1,x1,y1,z1,r2,g2,b2,x2,y2,z2,r3,g3,b3,x3,y3,z3,r4,g4,b4,x4,y4,z4,r5,g5,b5,x5,y5,z5,r6,g6,b6,x6,y6,z6) \ - { {{ {ar,ag,ab},0,{ar,ag,ab},0}}, \ - {{{ {r1,g1,b1},0,{r1,g1,b1},0,{x1,y1,z1},0}}, \ - {{ {r2,g2,b2},0,{r2,g2,b2},0,{x2,y2,z2},0}}, \ - {{ {r3,g3,b3},0,{r3,g3,b3},0,{x3,y3,z3},0}}, \ - {{ {r4,g4,b4},0,{r4,g4,b4},0,{x4,y4,z4},0}}, \ - {{ {r5,g5,b5},0,{r5,g5,b5},0,{x5,y5,z5},0}}, \ - {{ {r6,g6,b6},0,{r6,g6,b6},0,{x6,y6,z6},0}}} } - - -#define gdSPDefLights7(ar,ag,ab,r1,g1,b1,x1,y1,z1,r2,g2,b2,x2,y2,z2,r3,g3,b3,x3,y3,z3,r4,g4,b4,x4,y4,z4,r5,g5,b5,x5,y5,z5,r6,g6,b6,x6,y6,z6,r7,g7,b7,x7,y7,z7) \ - { {{ {ar,ag,ab},0,{ar,ag,ab},0}}, \ - {{{ {r1,g1,b1},0,{r1,g1,b1},0,{x1,y1,z1},0}}, \ - {{ {r2,g2,b2},0,{r2,g2,b2},0,{x2,y2,z2},0}}, \ - {{ {r3,g3,b3},0,{r3,g3,b3},0,{x3,y3,z3},0}}, \ - {{ {r4,g4,b4},0,{r4,g4,b4},0,{x4,y4,z4},0}}, \ - {{ {r5,g5,b5},0,{r5,g5,b5},0,{x5,y5,z5},0}}, \ - {{ {r6,g6,b6},0,{r6,g6,b6},0,{x6,y6,z6},0}}, \ - {{ {r7,g7,b7},0,{r7,g7,b7},0,{x7,y7,z7},0}}} } - - -#define gdSPDefLookAt(rightx,righty,rightz,upx,upy,upz) \ - { {{ {{0,0,0},0,{0,0,0},0,{rightx,righty,rightz},0}}, \ - { {{0,0x80,0},0,{0,0x80,0},0,{upx,upy,upz},0}}} } - -/* - * Graphics DMA Packet - */ -typedef struct { - int cmd:8; - unsigned int par:8; - unsigned int len:16; - unsigned int addr; -} Gdma; - -/* - * Graphics Immediate Mode Packet types - */ -typedef struct { - int cmd:8; - int pad:24; - Tri tri; -} Gtri; - -typedef struct { - int cmd:8; - int pad1:24; - int pad2:24; - unsigned char param:8; -} Gpopmtx; - -/* - * typedef struct { - * int cmd:8; - * int pad0:24; - * int pad1:4; - * int number:4; - * int base:24; - * } Gsegment; - */ -typedef struct { - int cmd:8; - int pad0:8; - int mw_index:8; - int number:8; - int pad1:8; - int base:24; -} Gsegment; - -typedef struct { - int cmd:8; - int pad0:8; - int sft:8; - int len:8; - unsigned int data:32; -} GsetothermodeL; - -typedef struct { - int cmd:8; - int pad0:8; - int sft:8; - int len:8; - unsigned int data:32; -} GsetothermodeH; - -typedef struct { - unsigned char cmd; - unsigned char lodscale; - unsigned char tile; - unsigned char on; - unsigned short s; - unsigned short t; -} Gtexture; - -typedef struct { - int cmd:8; - int pad:24; - Tri line; -} Gline3D; - -typedef struct { - int cmd:8; - int pad1:24; - short int pad2; - short int scale; -} Gperspnorm; - - -/* - * RDP Packet types - */ -typedef struct { - int cmd:8; - unsigned int fmt:3; - unsigned int siz:2; - unsigned int pad:7; - unsigned int wd:12; /* really only 10 bits, extra */ - unsigned int dram; /* to account for 1024 */ -} Gsetimg; - -typedef struct { - int cmd:8; - unsigned int muxs0:24; - unsigned int muxs1:32; -} Gsetcombine; - -typedef struct { - int cmd:8; - unsigned char pad; - unsigned char prim_min_level; - unsigned char prim_level; - unsigned long color; -} Gsetcolor; - -typedef struct { - int cmd:8; - int x0:10; - int x0frac:2; - int y0:10; - int y0frac:2; - unsigned int pad:8; - int x1:10; - int x1frac:2; - int y1:10; - int y1frac:2; -} Gfillrect; - -typedef struct { - int cmd:8; - unsigned int fmt:3; - unsigned int siz:2; - unsigned int pad0:1; - unsigned int line:9; - unsigned int tmem:9; - unsigned int pad1:5; - unsigned int tile:3; - unsigned int palette:4; - unsigned int ct:1; - unsigned int mt:1; - unsigned int maskt:4; - unsigned int shiftt:4; - unsigned int cs:1; - unsigned int ms:1; - unsigned int masks:4; - unsigned int shifts:4; -} Gsettile; - -typedef struct { - int cmd:8; - unsigned int sl:12; - unsigned int tl:12; - int pad:5; - unsigned int tile:3; - unsigned int sh:12; - unsigned int th:12; -} Gloadtile; - -typedef Gloadtile Gloadblock; - -typedef Gloadtile Gsettilesize; - -typedef Gloadtile Gloadtlut; - -typedef struct { - unsigned int cmd:8; /* command */ - unsigned int xl:12; /* X coordinate of upper left */ - unsigned int yl:12; /* Y coordinate of upper left */ - unsigned int pad1:5; /* Padding */ - unsigned int tile:3; /* Tile descriptor index */ - unsigned int xh:12; /* X coordinate of lower right */ - unsigned int yh:12; /* Y coordinate of lower right */ - unsigned int s:16; /* S texture coord at top left */ - unsigned int t:16; /* T texture coord at top left */ - unsigned int dsdx:16;/* Change in S per change in X */ - unsigned int dtdy:16;/* Change in T per change in Y */ -} Gtexrect; - -#define MakeTexRect(xh,yh,flip,tile,xl,yl,s,t,dsdx,dtdy) \ - G_TEXRECT, xh, yh, 0, flip, 0, tile, xl, yl, s, t, dsdx, dtdy - -/* - * Textured rectangles are 128 bits not 64 bits - */ -typedef struct { - unsigned long w0; - unsigned long w1; - unsigned long w2; - unsigned long w3; -} TexRect; - -/* - * Generic Gfx Packet - */ -typedef struct { - unsigned int w0; - unsigned int w1; -} Gwords; - -/* - * This union is the fundamental type of the display list. - * It is, by law, exactly 64 bits in size. - */ -typedef union { - Gwords words; - Gdma dma; - Gtri tri; - Gline3D line; - Gpopmtx popmtx; - Gsegment segment; - GsetothermodeH setothermodeH; - GsetothermodeL setothermodeL; - Gtexture texture; - Gperspnorm perspnorm; - Gsetimg setimg; - Gsetcombine setcombine; - Gsetcolor setcolor; - Gfillrect fillrect; /* use for setscissor also */ - Gsettile settile; - Gloadtile loadtile; /* use for loadblock also, th is dxt */ - Gsettilesize settilesize; - Gloadtlut loadtlut; - long long int force_structure_alignment; -} Gfx; - -/* - * Macros to assemble the graphics display list - */ - -/* - * DMA macros - */ -#define gDma0p(pkt, c, s, l) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24); \ - _g->words.w1 = (unsigned int)(s); \ -} - -#define gsDma0p(c, s, l) \ -{{ \ - _SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24), (unsigned int)(s) \ -}} - -#define gDma1p(pkt, c, s, l, p) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL((c), 24, 8) | _SHIFTL((p), 16, 8) | \ - _SHIFTL((l), 0, 16)); \ - _g->words.w1 = (unsigned int)(s); \ -} - -#define gsDma1p(c, s, l, p) \ -{{ \ - (_SHIFTL((c), 24, 8) | _SHIFTL((p), 16, 8) | \ - _SHIFTL((l), 0, 16)), \ - (unsigned int)(s) \ -}} - -#define gDma2p(pkt, c, adrs, len, idx, ofs) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = (_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \ - _SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)); \ - _g->words.w1 = (unsigned int)(adrs); \ -} -#define gsDma2p(c, adrs, len, idx, ofs) \ -{{ \ - (_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \ - _SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)), \ - (unsigned int)(adrs) \ -}} - -#define gSPNoOp(pkt) gDma0p(pkt, G_SPNOOP, 0, 0) -#define gsSPNoOp() gsDma0p(G_SPNOOP, 0, 0) - -#ifdef F3DEX_GBI_2 -# define gSPMatrix(pkt, m, p) \ - gDma2p((pkt),G_MTX,(m),sizeof(Mtx),(p)^G_MTX_PUSH,0) -# define gsSPMatrix(m, p) \ - gsDma2p( G_MTX,(m),sizeof(Mtx),(p)^G_MTX_PUSH,0) -#else /* F3DEX_GBI_2 */ -# define gSPMatrix(pkt, m, p) gDma1p(pkt, G_MTX, m, sizeof(Mtx), p) -# define gsSPMatrix(m, p) gsDma1p(G_MTX, m, sizeof(Mtx), p) -#endif /* F3DEX_GBI_2 */ - -#if defined(F3DEX_GBI_2) -/* - * F3DEX_GBI_2: G_VTX GBI format was changed. - * - * +--------+----+---+---+----+------+-+ - * G_VTX | cmd:8 |0000| n:8 |0000|v0+n:7|0| - * +-+---+--+----+---+---+----+------+-+ - * | |seg| address | - * +-+---+-----------------------------+ - */ -# define gSPVertex(pkt, v, n, v0) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = \ - _SHIFTL(G_VTX,24,8)|_SHIFTL((n),12,8)|_SHIFTL((v0)+(n),1,7); \ - _g->words.w1 = (unsigned int)(v); \ -} -# define gsSPVertex(v, n, v0) \ -{{ \ - (_SHIFTL(G_VTX,24,8)|_SHIFTL((n),12,8)|_SHIFTL((v0)+(n),1,7)), \ - (unsigned int)(v) \ -}} -#elif (defined(F3DEX_GBI)||defined(F3DLP_GBI)) -/* - * F3DEX_GBI: G_VTX GBI format was changed to support 64 vertice. - * - * +--------+--------+------+----------+ - * G_VTX | cmd:8 | v0:8 | n:6 |length:10 | - * +-+---+--+--------+------+----------+ - * | |seg| address | - * +-+---+-----------------------------+ - */ -# define gSPVertex(pkt, v, n, v0) \ - gDma1p((pkt),G_VTX,(v),((n)<<10)|(sizeof(Vtx)*(n)-1),(v0)*2) -# define gsSPVertex(v, n, v0) \ - gsDma1p(G_VTX,(v),((n)<<10)|(sizeof(Vtx)*(n)-1),(v0)*2) -#else -# define gSPVertex(pkt, v, n, v0) \ - gDma1p(pkt, G_VTX, v, sizeof(Vtx)*(n),((n)-1)<<4|(v0)) -# define gsSPVertex(v, n, v0) \ - gsDma1p(G_VTX, v, sizeof(Vtx)*(n), ((n)-1)<<4|(v0)) -#endif - - -#ifdef F3DEX_GBI_2 -# define gSPViewport(pkt, v) \ - gDma2p((pkt), G_MOVEMEM, (v), sizeof(Vp), G_MV_VIEWPORT, 0) -# define gsSPViewport(v) \ - gsDma2p( G_MOVEMEM, (v), sizeof(Vp), G_MV_VIEWPORT, 0) -#else /* F3DEX_GBI_2 */ -# define gSPViewport(pkt,v) \ - gDma1p((pkt), G_MOVEMEM, (v), sizeof(Vp), G_MV_VIEWPORT) -# define gsSPViewport(v) \ - gsDma1p( G_MOVEMEM, (v), sizeof(Vp), G_MV_VIEWPORT) -#endif /* F3DEX_GBI_2 */ - -#define gSPDisplayList(pkt,dl) gDma1p(pkt,G_DL,dl,0,G_DL_PUSH) -#define gsSPDisplayList( dl) gsDma1p( G_DL,dl,0,G_DL_PUSH) - -#define gSPBranchList(pkt,dl) gDma1p(pkt,G_DL,dl,0,G_DL_NOPUSH) -#define gsSPBranchList( dl) gsDma1p( G_DL,dl,0,G_DL_NOPUSH) - -#define gSPSprite2DBase(pkt, s) gDma1p(pkt, G_SPRITE2D_BASE, s, sizeof(uSprite), 0) -#define gsSPSprite2DBase(s) gsDma1p(G_SPRITE2D_BASE, s, sizeof(uSprite), 0) - -/* - * RSP short command (no DMA required) macros - */ -#define gImmp0(pkt, c) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL((c), 24, 8); \ -} - -#define gsImmp0(c) \ -{{ \ - _SHIFTL((c), 24, 8) \ -}} - -#define gImmp1(pkt, c, p0) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL((c), 24, 8); \ - _g->words.w1 = (unsigned int)(p0); \ -} - -#define gsImmp1(c, p0) \ -{{ \ - _SHIFTL((c), 24, 8), (unsigned int)(p0) \ -}} - -#define gImmp2(pkt, c, p0, p1) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL((c), 24, 8); \ - _g->words.w1 = _SHIFTL((p0), 16, 16) | _SHIFTL((p1), 8, 8); \ -} - -#define gsImmp2(c, p0, p1) \ -{{ \ - _SHIFTL((c), 24, 8), _SHIFTL((p0), 16, 16) | _SHIFTL((p1), 8, 8)\ -}} - -#define gImmp3(pkt, c, p0, p1, p2) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL((c), 24, 8); \ - _g->words.w1 = (_SHIFTL((p0), 16, 16) | _SHIFTL((p1), 8, 8) | \ - _SHIFTL((p2), 0, 8)); \ -} - -#define gsImmp3(c, p0, p1, p2) \ -{{ \ - _SHIFTL((c), 24, 8), (_SHIFTL((p0), 16, 16) | \ - _SHIFTL((p1), 8, 8) | _SHIFTL((p2), 0, 8))\ -}} - -#define gImmp21(pkt, c, p0, p1, dat) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL((c), 24, 8) | _SHIFTL((p0), 8, 16) | \ - _SHIFTL((p1), 0, 8)); \ - _g->words.w1 = (unsigned int) (dat); \ -} - -#define gsImmp21(c, p0, p1, dat) \ -{{ \ - _SHIFTL((c), 24, 8) | _SHIFTL((p0), 8, 16) | _SHIFTL((p1), 0, 8),\ - (unsigned int) (dat) \ -}} - -#ifdef F3DEX_GBI_2 -#define gMoveWd(pkt, index, offset, data) \ - gDma1p((pkt), G_MOVEWORD, data, offset, index) -#define gsMoveWd( index, offset, data) \ - gsDma1p( G_MOVEWORD, data, offset, index) -#else /* F3DEX_GBI_2 */ -#define gMoveWd(pkt, index, offset, data) \ - gImmp21((pkt), G_MOVEWORD, offset, index, data) -#define gsMoveWd( index, offset, data) \ - gsImmp21( G_MOVEWORD, offset, index, data) -#endif /* F3DEX_GBI_2 */ - -/* Sprite immediate macros, there is also a sprite dma macro above */ - -#define gSPSprite2DScaleFlip(pkt, sx, sy, fx, fy) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_SPRITE2D_SCALEFLIP, 24, 8) | \ - _SHIFTL((fx), 8, 8) | \ - _SHIFTL((fy), 0, 8)); \ - _g->words.w1 = (_SHIFTL((sx), 16, 16) | \ - _SHIFTL((sy), 0, 16)); \ -} - -#define gsSPSprite2DScaleFlip(sx, sy, fx, fy) \ -{{ \ - (_SHIFTL(G_SPRITE2D_SCALEFLIP, 24, 8) | \ - _SHIFTL((fx), 8, 8) | \ - _SHIFTL((fy), 0, 8)), \ - (_SHIFTL((sx), 16, 16) | \ - _SHIFTL((sy), 0, 16)) \ -}} - -#define gSPSprite2DDraw(pkt, px, py) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_SPRITE2D_DRAW, 24, 8)); \ - _g->words.w1 = (_SHIFTL((px), 16, 16) | \ - _SHIFTL((py), 0, 16)); \ -} - -#define gsSPSprite2DDraw(px, py) \ -{{ \ - (_SHIFTL(G_SPRITE2D_DRAW, 24, 8)), \ - (_SHIFTL((px), 16, 16) | \ - _SHIFTL((py), 0, 16)) \ -}} - - -/* - * Note: the SP1Triangle() and line macros multiply the vertex indices - * by 10, this is an optimization for the microcode. - */ -#if (defined(F3DLP_GBI)||defined(F3DEX_GBI)) -# define __gsSP1Triangle_w1(v0, v1, v2) \ - (_SHIFTL((v0)*2,16,8)|_SHIFTL((v1)*2,8,8)|_SHIFTL((v2)*2,0,8)) -# define __gsSP1Triangle_w1f(v0, v1, v2, flag) \ - (((flag) == 0) ? __gsSP1Triangle_w1(v0, v1, v2): \ - ((flag) == 1) ? __gsSP1Triangle_w1(v1, v2, v0): \ - __gsSP1Triangle_w1(v2, v0, v1)) -# define __gsSPLine3D_w1(v0, v1, wd) \ - (_SHIFTL((v0)*2,16,8)|_SHIFT((v1)*2,8,8)|_SHIFT((wd),0,8)) -# define __gsSPLine3D_w1f(v0, v1, wd, flag) \ - (((flag) == 0) ? __gsSPLine3D_w1(v0, v1, wd): \ - __gsSPLine3D_w1(v1, v0, wd)) -# define __gsSP1Quadrangle_w1f(v0, v1, v2, v3, flag) \ - (((flag) == 0) ? __gsSP1Triangle_w1(v0, v1, v2): \ - ((flag) == 1) ? __gsSP1Triangle_w1(v1, v2, v3): \ - ((flag) == 2) ? __gsSP1Triangle_w1(v2, v3, v0): \ - __gsSP1Triangle_w1(v3, v0, v1)) -# define __gsSP1Quadrangle_w2f(v0, v1, v2, v3, flag) \ - (((flag) == 0) ? __gsSP1Triangle_w1(v0, v2, v3): \ - ((flag) == 1) ? __gsSP1Triangle_w1(v1, v3, v0): \ - ((flag) == 2) ? __gsSP1Triangle_w1(v2, v0, v1): \ - __gsSP1Triangle_w1(v3, v1, v2)) -#else -# define __gsSP1Triangle_w1f(v0, v1, v2, flag) \ - (_SHIFTL((flag), 24,8)|_SHIFTL((v0)*10,16,8)| \ - _SHIFTL((v1)*10, 8,8)|_SHIFTL((v2)*10, 0,8)) -# define __gsSPLine3D_w1f(v0, v1, wd, flag) \ - (_SHIFTL((flag), 24,8)|_SHIFTL((v0)*10,16,8)| \ - _SHIFTL((v1)*10, 8,8)|_SHIFTL((wd), 0,8)) -#endif - -#ifdef F3DEX_GBI_2 -/*** - *** 1 Triangle - ***/ -#define gSP1Triangle(pkt, v0, v1, v2, flag) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_TRI1, 24, 8)| \ - __gsSP1Triangle_w1f(v0, v1, v2, flag); \ - _g->words.w1 = 0; \ -} -#define gsSP1Triangle(v0, v1, v2, flag) \ -{{ \ - _SHIFTL(G_TRI1, 24, 8)|__gsSP1Triangle_w1f(v0, v1, v2, flag), \ - 0 \ -}} - -/*** - *** Line - ***/ -#define gSPLine3D(pkt, v0, v1, flag) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_LINE3D, 24, 8)| \ - __gsSPLine3D_w1f(v0, v1, 0, flag); \ - _g->words.w1 = 0; \ -} -#define gsSPLine3D(v0, v1, flag) \ -{{ \ - _SHIFTL(G_LINE3D, 24, 8)|__gsSPLine3D_w1f(v0, v1, 0, flag), \ - 0 \ -}} - -/*** - *** LineW - ***/ -/* these macros are the same as SPLine3D, except they have an - * additional parameter for width. The width is added to the "minimum" - * thickness, which is 1.5 pixels. The units for width are in - * half-pixel units, so a width of 1 translates to (.5 + 1.5) or - * a 2.0 pixels wide line. - */ -#define gSPLineW3D(pkt, v0, v1, wd, flag) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_LINE3D, 24, 8)| \ - __gsSPLine3D_w1f(v0, v1, wd, flag); \ - _g->words.w1 = 0; \ -} -#define gsSPLineW3D(v0, v1, wd, flag) \ -{{ \ - _SHIFTL(G_LINE3D, 24, 8)|__gsSPLine3D_w1f(v0, v1, wd, flag), \ - 0 \ -}} - -/*** - *** 1 Quadrangle - ***/ -#define gSP1Quadrangle(pkt, v0, v1, v2, v3, flag) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_QUAD, 24, 8)| \ - __gsSP1Quadrangle_w1f(v0, v1, v2, v3, flag)); \ - _g->words.w1 = __gsSP1Quadrangle_w2f(v0, v1, v2, v3, flag); \ -} - -#define gsSP1Quadrangle(v0, v1, v2, v3, flag) \ -{{ \ - (_SHIFTL(G_QUAD, 24, 8)| \ - __gsSP1Quadrangle_w1f(v0, v1, v2, v3, flag)), \ - __gsSP1Quadrangle_w2f(v0, v1, v2, v3, flag) \ -}} -#else /* F3DEX_GBI_2 */ - -/*** - *** 1 Triangle - ***/ -#define gSP1Triangle(pkt, v0, v1, v2, flag) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_TRI1, 24, 8); \ - _g->words.w1 = __gsSP1Triangle_w1f(v0, v1, v2, flag); \ -} -#define gsSP1Triangle(v0, v1, v2, flag) \ -{{ \ - _SHIFTL(G_TRI1, 24, 8), \ - __gsSP1Triangle_w1f(v0, v1, v2, flag) \ -}} - -/*** - *** Line - ***/ -#define gSPLine3D(pkt, v0, v1, flag) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_LINE3D, 24, 8); \ - _g->words.w1 = __gsSPLine3D_w1f(v0, v1, 0, flag); \ -} -#define gsSPLine3D(v0, v1, flag) \ -{{ \ - _SHIFTL(G_LINE3D, 24, 8), \ - __gsSPLine3D_w1f(v0, v1, 0, flag) \ -}} - -/*** - *** LineW - ***/ -/* these macros are the same as SPLine3D, except they have an - * additional parameter for width. The width is added to the "minimum" - * thickness, which is 1.5 pixels. The units for width are in - * half-pixel units, so a width of 1 translates to (.5 + 1.5) or - * a 2.0 pixels wide line. - */ -#define gSPLineW3D(pkt, v0, v1, wd, flag) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_LINE3D, 24, 8); \ - _g->words.w1 = __gsSPLine3D_w1f(v0, v1, wd, flag); \ -} -#define gsSPLineW3D(v0, v1, wd, flag) \ -{{ \ - _SHIFTL(G_LINE3D, 24, 8), \ - __gsSPLine3D_w1f(v0, v1, wd, flag) \ -}} - -/*** - *** 1 Quadrangle - ***/ -#define gSP1Quadrangle(pkt, v0, v1, v2, v3, flag) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_TRI2, 24, 8)| \ - __gsSP1Quadrangle_w1f(v0, v1, v2, v3, flag)); \ - _g->words.w1 = __gsSP1Quadrangle_w2f(v0, v1, v2, v3, flag); \ -} - -#define gsSP1Quadrangle(v0, v1, v2, v3, flag) \ -{{ \ - (_SHIFTL(G_TRI2, 24, 8)| \ - __gsSP1Quadrangle_w1f(v0, v1, v2, v3, flag)), \ - __gsSP1Quadrangle_w2f(v0, v1, v2, v3, flag) \ -}} -#endif /* F3DEX_GBI_2 */ - -#if (defined(F3DLP_GBI)||defined(F3DEX_GBI)) -/*** - *** 2 Triangles - ***/ -#define gSP2Triangles(pkt, v00, v01, v02, flag0, v10, v11, v12, flag1) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_TRI2, 24, 8)| \ - __gsSP1Triangle_w1f(v00, v01, v02, flag0)); \ - _g->words.w1 = __gsSP1Triangle_w1f(v10, v11, v12, flag1); \ -} - -#define gsSP2Triangles(v00, v01, v02, flag0, v10, v11, v12, flag1) \ -{{ \ - (_SHIFTL(G_TRI2, 24, 8)| \ - __gsSP1Triangle_w1f(v00, v01, v02, flag0)), \ - __gsSP1Triangle_w1f(v10, v11, v12, flag1) \ -}} - -#endif /* F3DEX_GBI/F3DLP_GBI */ - -#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)) -#define gSPCullDisplayList(pkt,vstart,vend) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_CULLDL, 24, 8) | \ - _SHIFTL((vstart)*2, 0, 16); \ - _g->words.w1 = _SHIFTL((vend)*2, 0, 16); \ -} - -#define gsSPCullDisplayList(vstart,vend) \ -{{ \ - _SHIFTL(G_CULLDL, 24, 8) | _SHIFTL((vstart)*2, 0, 16), \ - _SHIFTL((vend)*2, 0, 16) \ -}} - -#else -#define gSPCullDisplayList(pkt,vstart,vend) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_CULLDL, 24, 8) | \ - ((0x0f & (vstart))*40); \ - _g->words.w1 = (unsigned int)((0x0f & ((vend)+1))*40); \ -} - -#define gsSPCullDisplayList(vstart,vend) \ -{{ \ - _SHIFTL(G_CULLDL, 24, 8) | ((0x0f & (vstart))*40), \ - ((0x0f & ((vend)+1))*40) \ -}} -#endif - -#define gSPSegment(pkt, segment, base) \ - gMoveWd(pkt, G_MW_SEGMENT, (segment)*4, base) -#define gsSPSegment(segment, base) \ - gsMoveWd( G_MW_SEGMENT, (segment)*4, base) - -/* - * Clipping Macros - */ -#define FR_NEG_FRUSTRATIO_1 0x00000001 -#define FR_POS_FRUSTRATIO_1 0x0000ffff -#define FR_NEG_FRUSTRATIO_2 0x00000002 -#define FR_POS_FRUSTRATIO_2 0x0000fffe -#define FR_NEG_FRUSTRATIO_3 0x00000003 -#define FR_POS_FRUSTRATIO_3 0x0000fffd -#define FR_NEG_FRUSTRATIO_4 0x00000004 -#define FR_POS_FRUSTRATIO_4 0x0000fffc -#define FR_NEG_FRUSTRATIO_5 0x00000005 -#define FR_POS_FRUSTRATIO_5 0x0000fffb -#define FR_NEG_FRUSTRATIO_6 0x00000006 -#define FR_POS_FRUSTRATIO_6 0x0000fffa -/* - * r should be one of: FRUSTRATIO_1, FRUSTRATIO_2, FRUSTRATIO_3, ... FRUSTRATIO_6 - */ -#define gSPClipRatio(pkt, r) \ -{ \ - gMoveWd(pkt, G_MW_CLIP, G_MWO_CLIP_RNX, FR_NEG_##r); \ - gMoveWd(pkt, G_MW_CLIP, G_MWO_CLIP_RNY, FR_NEG_##r); \ - gMoveWd(pkt, G_MW_CLIP, G_MWO_CLIP_RPX, FR_POS_##r); \ - gMoveWd(pkt, G_MW_CLIP, G_MWO_CLIP_RPY, FR_POS_##r); \ -} - -#define gsSPClipRatio(r) \ - gsMoveWd(G_MW_CLIP, G_MWO_CLIP_RNX, FR_NEG_##r), \ - gsMoveWd(G_MW_CLIP, G_MWO_CLIP_RNY, FR_NEG_##r), \ - gsMoveWd(G_MW_CLIP, G_MWO_CLIP_RPX, FR_POS_##r), \ - gsMoveWd(G_MW_CLIP, G_MWO_CLIP_RPY, FR_POS_##r) - -/* - * Insert values into Matrix - * - * where = element of matrix (byte offset) - * num = new element (32 bit value replacing 2 int or 2 frac matrix - * componants - */ -#ifdef F3DEX_GBI_2 -#define gSPInsertMatrix(pkt, where, num) \ - ERROR!! gSPInsertMatrix is no longer supported. -#define gsSPInsertMatrix(where, num) \ - ERROR!! gsSPInsertMatrix is no longer supported. -#else -#define gSPInsertMatrix(pkt, where, num) \ - gMoveWd(pkt, G_MW_MATRIX, where, num) -#define gsSPInsertMatrix(where, num) \ - gsMoveWd(G_MW_MATRIX, where, num) -#endif - -/* - * Load new matrix directly - * - * mptr = pointer to matrix - */ -#ifdef F3DEX_GBI_2 -#define gSPForceMatrix(pkt, mptr) \ -{ gDma2p((pkt),G_MOVEMEM,(mptr),sizeof(Mtx),G_MV_MATRIX,0); \ - gMoveWd((pkt), G_MW_FORCEMTX,0,0x00010000); \ -} -#define gsSPForceMatrix(mptr) \ - gsDma2p(G_MOVEMEM,(mptr),sizeof(Mtx),G_MV_MATRIX,0), \ - gsMoveWd(G_MW_FORCEMTX,0,0x00010000) - -#else /* F3DEX_GBI_2 */ -#define gSPForceMatrix(pkt, mptr) \ -{ \ - gDma1p(pkt, G_MOVEMEM, mptr, 16, G_MV_MATRIX_1); \ - gDma1p(pkt, G_MOVEMEM, (char *)(mptr)+16, 16, G_MV_MATRIX_2); \ - gDma1p(pkt, G_MOVEMEM, (char *)(mptr)+32, 16, G_MV_MATRIX_3); \ - gDma1p(pkt, G_MOVEMEM, (char *)(mptr)+48, 16, G_MV_MATRIX_4); \ -} -#define gsSPForceMatrix(mptr) \ - gsDma1p( G_MOVEMEM, mptr, 16, G_MV_MATRIX_1), \ - gsDma1p( G_MOVEMEM, (char *)(mptr)+16, 16, G_MV_MATRIX_2), \ - gsDma1p( G_MOVEMEM, (char *)(mptr)+32, 16, G_MV_MATRIX_3), \ - gsDma1p( G_MOVEMEM, (char *)(mptr)+48, 16, G_MV_MATRIX_4) -#endif /* F3DEX_GBI_2 */ - -/* - * Insert values into Points - * - * point = point number 0-15 - * where = which element of point to modify (byte offset into point) - * num = new value (32 bit) - */ -#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)) -# define gSPModifyVertex(pkt, vtx, where, val) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = (_SHIFTL(G_MODIFYVTX,24,8)| \ - _SHIFTL((where),16,8)|_SHIFTL((vtx)*2,0,16)); \ - _g->words.w1 = (unsigned int)(val); \ -} -# define gsSPModifyVertex(vtx, where, val) \ -{{ \ - _SHIFTL(G_MODIFYVTX,24,8)| \ - _SHIFTL((where),16,8)|_SHIFTL((vtx)*2,0,16), \ - (unsigned int)(val) \ -}} -#else -# define gSPModifyVertex(pkt, vtx, where, val) \ - gMoveWd(pkt, G_MW_POINTS, (vtx)*40+(where), val) -# define gsSPModifyVertex(vtx, where, val) \ - gsMoveWd(G_MW_POINTS, (vtx)*40+(where), val) -#endif - -#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)) -/* - * gSPBranchLessZ Branch DL if (vtx.z) less than or equal (zval). - * - * dl = DL branch to - * vtx = Vertex - * zval = Screen depth - * near = Near plane - * far = Far plane - * flag = G_BZ_PERSP or G_BZ_ORTHO - */ - -#define G_BZ_PERSP 0 -#define G_BZ_ORTHO 1 - -#define G_DEPTOZSrg(zval, near, far, flag, zmin, zmax) \ -(((unsigned int)FTOFIX32(((flag) == G_BZ_PERSP ? \ - (1.0f-(float)(near)/(float)(zval)) / \ - (1.0f-(float)(near)/(float)(far )) : \ - ((float)(zval) - (float)(near)) / \ - ((float)(far ) - (float)(near))))) * \ - (((int)((zmax) - (zmin)))&~1) + (int)FTOFIX32(zmin)) - -#define G_DEPTOZS(zval, near, far, flag) \ - G_DEPTOZSrg(zval, near, far, flag, 0, G_MAXZ) - -#define gSPBranchLessZrg(pkt, dl, vtx, zval, near, far, flag, zmin, zmax) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \ - _g->words.w1 = (unsigned int)(dl); \ - _g = (Gfx *)(pkt); \ - _g->words.w0 = (_SHIFTL(G_BRANCH_Z,24,8)| \ - _SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12)); \ - _g->words.w1 = G_DEPTOZSrg(zval, near, far, flag, zmin, zmax); \ -} - -#define gsSPBranchLessZrg(dl, vtx, zval, near, far, flag, zmin, zmax) \ -{{ _SHIFTL(G_RDPHALF_1,24,8), \ - (unsigned int)(dl), }}, \ -{{ _SHIFTL(G_BRANCH_Z,24,8)|_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12),\ - G_DEPTOZSrg(zval, near, far, flag, zmin, zmax), }} - -#define gSPBranchLessZ(pkt, dl, vtx, zval, near, far, flag) \ - gSPBranchLessZrg(pkt, dl, vtx, zval, near, far, flag, 0, G_MAXZ) -#define gsSPBranchLessZ(dl, vtx, zval, near, far, flag) \ - gsSPBranchLessZrg(dl, vtx, zval, near, far, flag, 0, G_MAXZ) - -/* - * gSPBranchLessZraw Branch DL if (vtx.z) less than or equal (raw zval). - * - * dl = DL branch to - * vtx = Vertex - * zval = Raw value of screen depth - */ -#define gSPBranchLessZraw(pkt, dl, vtx, zval) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \ - _g->words.w1 = (unsigned int)(dl); \ - _g = (Gfx *)(pkt); \ - _g->words.w0 = (_SHIFTL(G_BRANCH_Z,24,8)| \ - _SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12)); \ - _g->words.w1 = (unsigned int)(zval); \ -} - -#define gsSPBranchLessZraw(dl, vtx, zval) \ -{{ _SHIFTL(G_RDPHALF_1,24,8), \ - (unsigned int)(dl), }}, \ -{{ _SHIFTL(G_BRANCH_Z,24,8)|_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12),\ - (unsigned int)(zval), }} - -/* - * gSPLoadUcode RSP loads specified ucode. - * - * uc_start = ucode text section start - * uc_dstart = ucode data section start - */ -#define gSPLoadUcodeEx(pkt, uc_start, uc_dstart, uc_dsize) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \ - _g->words.w1 = (unsigned int)(uc_dstart); \ - _g = (Gfx *)(pkt); \ - _g->words.w0 = (_SHIFTL(G_LOAD_UCODE,24,8)| \ - _SHIFTL((int)(uc_dsize)-1,0,16)); \ - _g->words.w1 = (unsigned int)(uc_start); \ -} - -#define gsSPLoadUcodeEx(uc_start, uc_dstart, uc_dsize) \ -{{ _SHIFTL(G_RDPHALF_1,24,8), \ - (unsigned int)(uc_dstart), }}, \ -{{ _SHIFTL(G_LOAD_UCODE,24,8)| \ - _SHIFTL((int)(uc_dsize)-1,0,16), \ - (unsigned int)(uc_start), }} - -#define gSPLoadUcode(pkt, uc_start, uc_dstart) \ - gSPLoadUcodeEx((pkt), (uc_start), (uc_dstart), SP_UCODE_DATA_SIZE) -#define gsSPLoadUcode(uc_start, uc_dstart) \ - gsSPLoadUcodeEx((uc_start), (uc_dstart), SP_UCODE_DATA_SIZE) - -#define gSPLoadUcodeL(pkt, ucode) \ - gSPLoadUcode((pkt), OS_K0_TO_PHYSICAL(&##ucode##TextStart), \ - OS_K0_TO_PHYSICAL(&##ucode##DataStart)) -#define gsSPLoadUcodeL(ucode) \ - gsSPLoadUcode(OS_K0_TO_PHYSICAL(&##ucode##TextStart), \ - OS_K0_TO_PHYSICAL(&##ucode##DataStart)) -#endif - -#ifdef F3DEX_GBI_2 -/* - * gSPDma_io DMA to/from DMEM/IMEM for DEBUG. - */ -#define gSPDma_io(pkt, flag, dmem, dram, size) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = _SHIFTL(G_DMA_IO,24,8)|_SHIFTL((flag),23,1)| \ - _SHIFTL((dmem)/8,13,10)|_SHIFTL((size)-1,0,12); \ - _g->words.w1 = (unsigned int)(dram); \ -} - -#define gsSPDma_io(flag, dmem, dram, size) \ -{{ \ - _SHIFTL(G_DMA_IO,24,8)|_SHIFTL((flag),23,1)| \ - _SHIFTL((dmem)/8,13,10)|_SHIFTL((size)-1,0,12), \ - (unsigned int)(dram) \ -}} - -#define gSPDmaRead(pkt,dmem,dram,size) gSPDma_io((pkt),0,(dmem),(dram),(size)) -#define gsSPDmaRead(dmem,dram,size) gsSPDma_io(0,(dmem),(dram),(size)) -#define gSPDmaWrite(pkt,dmem,dram,size) gSPDma_io((pkt),1,(dmem),(dram),(size)) -#define gsSPDmaWrite(dmem,dram,size) gsSPDma_io(1,(dmem),(dram),(size)) -#endif - -/* - * Lighting Macros - */ -#ifdef F3DEX_GBI_2 -# define NUML(n) ((n)*24) -#else -# define NUML(n) (((n)+1)*32 + 0x80000000) -#endif -#define NUMLIGHTS_0 1 -#define NUMLIGHTS_1 1 -#define NUMLIGHTS_2 2 -#define NUMLIGHTS_3 3 -#define NUMLIGHTS_4 4 -#define NUMLIGHTS_5 5 -#define NUMLIGHTS_6 6 -#define NUMLIGHTS_7 7 -/* - * n should be one of: NUMLIGHTS_0, NUMLIGHTS_1, ..., NUMLIGHTS_7 - * NOTE: in addition to the number of directional lights specified, - * there is always 1 ambient light - */ -#define gSPNumLights(pkt, n) \ - gMoveWd(pkt, G_MW_NUMLIGHT, G_MWO_NUMLIGHT, NUML(n)) -#define gsSPNumLights(n) \ - gsMoveWd( G_MW_NUMLIGHT, G_MWO_NUMLIGHT, NUML(n)) - -#define LIGHT_1 1 -#define LIGHT_2 2 -#define LIGHT_3 3 -#define LIGHT_4 4 -#define LIGHT_5 5 -#define LIGHT_6 6 -#define LIGHT_7 7 -#define LIGHT_8 8 -/* - * l should point to a Light struct - * n should be one of: LIGHT_1, LIGHT_2, ..., LIGHT_8 - * NOTE: the highest numbered light is always the ambient light (eg if there are - * 3 directional lights defined: gsSPNumLights(NUMLIGHTS_3), then lights - * LIGHT_1 through LIGHT_3 will be the directional lights and light - * LIGHT_4 will be the ambient light. - */ -#ifdef F3DEX_GBI_2 -# define gSPLight(pkt, l, n) \ - gDma2p((pkt),G_MOVEMEM,(l),sizeof(Light),G_MV_LIGHT,(n)*24+24) -# define gsSPLight(l, n) \ - gsDma2p( G_MOVEMEM,(l),sizeof(Light),G_MV_LIGHT,(n)*24+24) -#else /* F3DEX_GBI_2 */ -# define gSPLight(pkt, l, n) \ - gDma1p(pkt, G_MOVEMEM, l, sizeof(Light),((n)-1)*2+G_MV_L0) -# define gsSPLight(l, n) \ - gsDma1p( G_MOVEMEM, l, sizeof(Light),((n)-1)*2+G_MV_L0) -#endif /* F3DEX_GBI_2 */ - -/* - * gSPLightColor changes color of light without recalculating light direction - * col is a 32 bit word with r,g,b,a (alpha is ignored) - * n should be one of LIGHT_1, LIGHT_2, ..., LIGHT_8 - */ -#define gSPLightColor(pkt, n, col) \ -{ \ - gMoveWd(pkt, G_MW_LIGHTCOL, G_MWO_a##n, col); \ - gMoveWd(pkt, G_MW_LIGHTCOL, G_MWO_b##n, col); \ -} -#define gsSPLightColor(n, col) \ - gsMoveWd(G_MW_LIGHTCOL, G_MWO_a##n, col), \ - gsMoveWd(G_MW_LIGHTCOL, G_MWO_b##n, col) - -/* These macros use a structure "name" which is init'd with the gdSPDefLights macros*/ - -#define gSPSetLights0(pkt,name) \ -{ \ - gSPNumLights(pkt,NUMLIGHTS_0); \ - gSPLight(pkt,&name.l[0],1); \ - gSPLight(pkt,&name.a,2); \ -} -#define gsSPSetLights0(name) \ - gsSPNumLights(NUMLIGHTS_0), \ - gsSPLight(&name.l[0],1), \ - gsSPLight(&name.a,2) - -#define gSPSetLights1(pkt,name) \ -{ \ - gSPNumLights(pkt,NUMLIGHTS_1); \ - gSPLight(pkt,&name.l[0],1); \ - gSPLight(pkt,&name.a,2); \ -} -#define gsSPSetLights1(name) \ - gsSPNumLights(NUMLIGHTS_1), \ - gsSPLight(&name.l[0],1), \ - gsSPLight(&name.a,2) - -#define gSPSetLights2(pkt,name) \ -{ \ - gSPNumLights(pkt,NUMLIGHTS_2); \ - gSPLight(pkt,&name.l[0],1); \ - gSPLight(pkt,&name.l[1],2); \ - gSPLight(pkt,&name.a,3); \ -} -#define gsSPSetLights2(name) \ - gsSPNumLights(NUMLIGHTS_2), \ - gsSPLight(&name.l[0],1), \ - gsSPLight(&name.l[1],2), \ - gsSPLight(&name.a,3) - -#define gSPSetLights3(pkt,name) \ -{ \ - gSPNumLights(pkt,NUMLIGHTS_3); \ - gSPLight(pkt,&name.l[0],1); \ - gSPLight(pkt,&name.l[1],2); \ - gSPLight(pkt,&name.l[2],3); \ - gSPLight(pkt,&name.a,4); \ -} -#define gsSPSetLights3(name) \ - gsSPNumLights(NUMLIGHTS_3), \ - gsSPLight(&name.l[0],1), \ - gsSPLight(&name.l[1],2), \ - gsSPLight(&name.l[2],3), \ - gsSPLight(&name.a,4) - -#define gSPSetLights4(pkt,name) \ -{ \ - gSPNumLights(pkt,NUMLIGHTS_4); \ - gSPLight(pkt,&name.l[0],1); \ - gSPLight(pkt,&name.l[1],2); \ - gSPLight(pkt,&name.l[2],3); \ - gSPLight(pkt,&name.l[3],4); \ - gSPLight(pkt,&name.a,5); \ -} -#define gsSPSetLights4(name) \ - gsSPNumLights(NUMLIGHTS_4), \ - gsSPLight(&name.l[0],1), \ - gsSPLight(&name.l[1],2), \ - gsSPLight(&name.l[2],3), \ - gsSPLight(&name.l[3],4), \ - gsSPLight(&name.a,5) - -#define gSPSetLights5(pkt,name) \ -{ \ - gSPNumLights(pkt,NUMLIGHTS_5); \ - gSPLight(pkt,&name.l[0],1); \ - gSPLight(pkt,&name.l[1],2); \ - gSPLight(pkt,&name.l[2],3); \ - gSPLight(pkt,&name.l[3],4); \ - gSPLight(pkt,&name.l[4],5); \ - gSPLight(pkt,&name.a,6); \ -} - -#define gsSPSetLights5(name) \ - gsSPNumLights(NUMLIGHTS_5), \ - gsSPLight(&name.l[0],1), \ - gsSPLight(&name.l[1],2), \ - gsSPLight(&name.l[2],3), \ - gsSPLight(&name.l[3],4), \ - gsSPLight(&name.l[4],5), \ - gsSPLight(&name.a,6) - -#define gSPSetLights6(pkt,name) \ -{ \ - gSPNumLights(pkt,NUMLIGHTS_6); \ - gSPLight(pkt,&name.l[0],1); \ - gSPLight(pkt,&name.l[1],2); \ - gSPLight(pkt,&name.l[2],3); \ - gSPLight(pkt,&name.l[3],4); \ - gSPLight(pkt,&name.l[4],5); \ - gSPLight(pkt,&name.l[5],6); \ - gSPLight(pkt,&name.a,7); \ -} - -#define gsSPSetLights6(name) \ - gsSPNumLights(NUMLIGHTS_6), \ - gsSPLight(&name.l[0],1), \ - gsSPLight(&name.l[1],2), \ - gsSPLight(&name.l[2],3), \ - gsSPLight(&name.l[3],4), \ - gsSPLight(&name.l[4],5), \ - gsSPLight(&name.l[5],6), \ - gsSPLight(&name.a,7) - -#define gSPSetLights7(pkt,name) \ -{ \ - gSPNumLights(pkt,NUMLIGHTS_7); \ - gSPLight(pkt,&name.l[0],1); \ - gSPLight(pkt,&name.l[1],2); \ - gSPLight(pkt,&name.l[2],3); \ - gSPLight(pkt,&name.l[3],4); \ - gSPLight(pkt,&name.l[4],5); \ - gSPLight(pkt,&name.l[5],6); \ - gSPLight(pkt,&name.l[6],7); \ - gSPLight(pkt,&name.a,8); \ -} - -#define gsSPSetLights7(name) \ - gsSPNumLights(NUMLIGHTS_7), \ - gsSPLight(&name.l[0],1), \ - gsSPLight(&name.l[1],2), \ - gsSPLight(&name.l[2],3), \ - gsSPLight(&name.l[3],4), \ - gsSPLight(&name.l[4],5), \ - gsSPLight(&name.l[5],6), \ - gsSPLight(&name.l[6],7), \ - gsSPLight(&name.a,8) - -/* - * Reflection/Hiliting Macros - */ -#ifdef F3DEX_GBI_2 -# define gSPLookAtX(pkt, l) \ - gDma2p((pkt),G_MOVEMEM,(l),sizeof(Light),G_MV_LIGHT,G_MVO_LOOKATX) -# define gsSPLookAtX(l) \ - gsDma2p( G_MOVEMEM,(l),sizeof(Light),G_MV_LIGHT,G_MVO_LOOKATX) -# define gSPLookAtY(pkt, l) \ - gDma2p((pkt),G_MOVEMEM,(l),sizeof(Light),G_MV_LIGHT,G_MVO_LOOKATY) -# define gsSPLookAtY(l) \ - gsDma2p( G_MOVEMEM,(l),sizeof(Light),G_MV_LIGHT,G_MVO_LOOKATY) -#else /* F3DEX_GBI_2 */ -# define gSPLookAtX(pkt, l) \ - gDma1p(pkt, G_MOVEMEM, l, sizeof(Light),G_MV_LOOKATX) -# define gsSPLookAtX(l) \ - gsDma1p( G_MOVEMEM, l, sizeof(Light),G_MV_LOOKATX) -# define gSPLookAtY(pkt, l) \ - gDma1p(pkt, G_MOVEMEM, l, sizeof(Light),G_MV_LOOKATY) -# define gsSPLookAtY(l) \ - gsDma1p( G_MOVEMEM, l, sizeof(Light),G_MV_LOOKATY) -#endif /* F3DEX_GBI_2 */ - -#define gSPLookAt(pkt, la) \ -{ \ - gSPLookAtX(pkt,la) \ - gSPLookAtY(pkt,(char *)(la)+16) \ -} -#define gsSPLookAt(la) \ - gsSPLookAtX(la), \ - gsSPLookAtY((char *)(la)+16) - -#define gDPSetHilite1Tile(pkt, tile, hilite, width, height) \ - gDPSetTileSize(pkt, tile, (hilite)->h.x1 & 0xfff, (hilite)->h.y1 & 0xfff, \ - ((((width)-1)*4)+(hilite)->h.x1) & 0xfff, ((((height)-1)*4)+(hilite)->h.y1) & 0xfff) - -#define gDPSetHilite2Tile(pkt, tile, hilite, width, height) \ - gDPSetTileSize(pkt, tile, (hilite)->h.x2 & 0xfff, (hilite)->h.y2 & 0xfff, \ - ((((width)-1)*4)+(hilite)->h.x2) & 0xfff, ((((height)-1)*4)+(hilite)->h.y2) & 0xfff) - - -/* - * FOG macros - * fm = z multiplier - * fo = z offset - * FOG FORMULA: alpha(fog) = (eyespace z) * fm + fo CLAMPED 0 to 255 - * note: (eyespace z) ranges -1 to 1 - * - * Alternate method of setting fog: - * min, max: range 0 to 1000: 0=nearplane, 1000=farplane - * min is where fog begins (usually less than max and often 0) - * max is where fog is thickest (usually 1000) - * - */ -#define gSPFogFactor(pkt, fm, fo) \ - gMoveWd(pkt, G_MW_FOG, G_MWO_FOG, \ - (_SHIFTL(fm,16,16) | _SHIFTL(fo,0,16))) - -#define gsSPFogFactor(fm, fo) \ - gsMoveWd(G_MW_FOG, G_MWO_FOG, \ - (_SHIFTL(fm,16,16) | _SHIFTL(fo,0,16))) - -#define gSPFogPosition(pkt, min, max) \ - gMoveWd(pkt, G_MW_FOG, G_MWO_FOG, \ - (_SHIFTL((128000/((max)-(min))),16,16) | \ - _SHIFTL(((500-(min))*256/((max)-(min))),0,16))) - -#define gsSPFogPosition(min, max) \ - gsMoveWd(G_MW_FOG, G_MWO_FOG, \ - (_SHIFTL((128000/((max)-(min))),16,16) | \ - _SHIFTL(((500-(min))*256/((max)-(min))),0,16))) - -#ifdef F3DEX_GBI_2 -/* - * Macros to turn texture on/off - */ -# define gSPTexture(pkt, s, t, level, tile, on) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_TEXTURE,24,8) | \ - _SHIFTL(BOWTIE_VAL,16,8) | \ - _SHIFTL((level),11,3) | _SHIFTL((tile),8,3) | \ - _SHIFTL((on),1,7)); \ - _g->words.w1 = (_SHIFTL((s),16,16) | _SHIFTL((t),0,16)); \ -} -# define gsSPTexture(s, t, level, tile, on) \ -{{ \ - (_SHIFTL(G_TEXTURE,24,8) | _SHIFTL(BOWTIE_VAL,16,8) | \ - _SHIFTL((level),11,3) | _SHIFTL((tile),8,3) | _SHIFTL((on),1,7)),\ - (_SHIFTL((s),16,16) | _SHIFTL((t),0,16)) \ -}} -/* - * Different version of SPTexture macro, has an additional parameter - * which is currently reserved in the microcode. - */ -# define gSPTextureL(pkt, s, t, level, xparam, tile, on) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_TEXTURE,24,8) | \ - _SHIFTL((xparam),16,8) | \ - _SHIFTL((level),11,3) | _SHIFTL((tile),8,3) | \ - _SHIFTL((on),1,7)); \ - _g->words.w1 = (_SHIFTL((s),16,16) | _SHIFTL((t),0,16)); \ -} -# define gsSPTextureL(s, t, level, xparam, tile, on) \ -{{ \ - (_SHIFTL(G_TEXTURE,24,8) | _SHIFTL((xparam),16,8) | \ - _SHIFTL((level),11,3) | _SHIFTL((tile),8,3) | _SHIFTL((on),1,7)),\ - (_SHIFTL((s),16,16) | _SHIFTL((t),0,16)) \ -}} -#else -/* - * Macros to turn texture on/off - */ -# define gSPTexture(pkt, s, t, level, tile, on) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_TEXTURE,24,8)|_SHIFTL(BOWTIE_VAL,16,8)|\ - _SHIFTL((level),11,3)|_SHIFTL((tile),8,3)| \ - _SHIFTL((on),0,8)); \ - _g->words.w1 = (_SHIFTL((s),16,16)|_SHIFTL((t),0,16)); \ -} -# define gsSPTexture(s, t, level, tile, on) \ -{{ \ - (_SHIFTL(G_TEXTURE,24,8)|_SHIFTL(BOWTIE_VAL,16,8)| \ - _SHIFTL((level),11,3)|_SHIFTL((tile),8,3)|_SHIFTL((on),0,8)), \ - (_SHIFTL((s),16,16)|_SHIFTL((t),0,16)) \ -}} -/* - * Different version of SPTexture macro, has an additional parameter - * which is currently reserved in the microcode. - */ -# define gSPTextureL(pkt, s, t, level, xparam, tile, on) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_TEXTURE,24,8)|_SHIFTL((xparam),16,8)| \ - _SHIFTL((level),11,3)|_SHIFTL((tile),8,3)| \ - _SHIFTL((on),0,8)); \ - _g->words.w1 = (_SHIFTL((s),16,16)|_SHIFTL((t),0,16)); \ -} -# define gsSPTextureL(s, t, level, xparam, tile, on) \ -{{ \ - (_SHIFTL(G_TEXTURE,24,8)|_SHIFTL((xparam),16,8)| \ - _SHIFTL((level),11,3)|_SHIFTL((tile),8,3)|_SHIFTL((on),0,8)), \ - (_SHIFTL((s),16,16)|_SHIFTL((t),0,16)) \ -}} -#endif - -#define gSPPerspNormalize(pkt, s) gMoveWd(pkt, G_MW_PERSPNORM, 0, (s)) -#define gsSPPerspNormalize(s) gsMoveWd( G_MW_PERSPNORM, 0, (s)) - -#ifdef F3DEX_GBI_2 -# define gSPPopMatrixN(pkt, n, num) gDma2p((pkt),G_POPMTX,(num)*64,64,2,0) -# define gsSPPopMatrixN(n, num) gsDma2p( G_POPMTX,(num)*64,64,2,0) -# define gSPPopMatrix(pkt, n) gSPPopMatrixN((pkt), (n), 1) -# define gsSPPopMatrix(n) gsSPPopMatrixN( (n), 1) -#else /* F3DEX_GBI_2 */ -# define gSPPopMatrix(pkt, n) gImmp1(pkt, G_POPMTX, n) -# define gsSPPopMatrix(n) gsImmp1( G_POPMTX, n) -#endif /* F3DEX_GBI_2 */ - -#define gSPEndDisplayList(pkt) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_ENDDL, 24, 8); \ - _g->words.w1 = 0; \ -} - -#define gsSPEndDisplayList() \ -{{ \ - _SHIFTL(G_ENDDL, 24, 8), 0 \ -}} - -#ifdef F3DEX_GBI_2 -/* - * One gSPGeometryMode(pkt,c,s) GBI is equal to these two GBIs. - * - * gSPClearGeometryMode(pkt,c) - * gSPSetGeometryMode(pkt,s) - * - * gSPLoadGeometryMode(pkt, word) sets GeometryMode directly. - */ -#define gSPGeometryMode(pkt, c, s) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = _SHIFTL(G_GEOMETRYMODE,24,8)|_SHIFTL(~(u32)(c),0,24);\ - _g->words.w1 = (u32)(s); \ -} - -#define gsSPGeometryMode(c, s) \ -{{ \ - (_SHIFTL(G_GEOMETRYMODE,24,8)|_SHIFTL(~(u32)(c),0,24)),(u32)(s) \ -}} -#define gSPSetGeometryMode(pkt, word) gSPGeometryMode((pkt),0,(word)) -#define gsSPSetGeometryMode(word) gsSPGeometryMode(0,(word)) -#define gSPClearGeometryMode(pkt, word) gSPGeometryMode((pkt),(word),0) -#define gsSPClearGeometryMode(word) gsSPGeometryMode((word),0) -#define gSPLoadGeometryMode(pkt, word) gSPGeometryMode((pkt),-1,(word)) -#define gsSPLoadGeometryMode(word) gsSPGeometryMode(-1,(word)) - -#else /* F3DEX_GBI_2 */ -#define gSPSetGeometryMode(pkt, word) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_SETGEOMETRYMODE, 24, 8); \ - _g->words.w1 = (unsigned int)(word); \ -} - -#define gsSPSetGeometryMode(word) \ -{{ \ - _SHIFTL(G_SETGEOMETRYMODE, 24, 8), (unsigned int)(word) \ -}} - -#define gSPClearGeometryMode(pkt, word) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_CLEARGEOMETRYMODE, 24, 8); \ - _g->words.w1 = (unsigned int)(word); \ -} - -#define gsSPClearGeometryMode(word) \ -{{ \ - _SHIFTL(G_CLEARGEOMETRYMODE, 24, 8), (unsigned int)(word) \ -}} -#endif /* F3DEX_GBI_2 */ - -#ifdef F3DEX_GBI_2 -#define gSPSetOtherMode(pkt, cmd, sft, len, data) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - _g->words.w0 = (_SHIFTL(cmd,24,8)|_SHIFTL(32-(sft)-(len),8,8)| \ - _SHIFTL((len)-1,0,8)); \ - _g->words.w1 = (unsigned int)(data); \ -} - -#define gsSPSetOtherMode(cmd, sft, len, data) \ -{{ \ - _SHIFTL(cmd,24,8)|_SHIFTL(32-(sft)-(len),8,8)|_SHIFTL((len)-1,0,8), \ - (unsigned int)(data) \ -}} -#else -#define gSPSetOtherMode(pkt, cmd, sft, len, data) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(cmd, 24, 8) | _SHIFTL(sft, 8, 8) | \ - _SHIFTL(len, 0, 8)); \ - _g->words.w1 = (unsigned int)(data); \ -} - -#define gsSPSetOtherMode(cmd, sft, len, data) \ -{{ \ - _SHIFTL(cmd, 24, 8) | _SHIFTL(sft, 8, 8) | _SHIFTL(len, 0, 8), \ - (unsigned int)(data) \ -}} -#endif - -/* - * RDP setothermode register commands - register shadowed in RSP - */ -#define gDPPipelineMode(pkt, mode) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_PIPELINE, 1, mode) -#define gsDPPipelineMode(mode) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_PIPELINE, 1, mode) - -#define gDPSetCycleType(pkt, type) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_CYCLETYPE, 2, type) -#define gsDPSetCycleType(type) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_CYCLETYPE, 2, type) - -#define gDPSetTexturePersp(pkt, type) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTPERSP, 1, type) -#define gsDPSetTexturePersp(type) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_TEXTPERSP, 1, type) - -#define gDPSetTextureDetail(pkt, type) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTDETAIL, 2, type) -#define gsDPSetTextureDetail(type) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_TEXTDETAIL, 2, type) - -#define gDPSetTextureLOD(pkt, type) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTLOD, 1, type) -#define gsDPSetTextureLOD(type) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_TEXTLOD, 1, type) - -#define gDPSetTextureLUT(pkt, type) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTLUT, 2, type) -#define gsDPSetTextureLUT(type) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_TEXTLUT, 2, type) - -#define gDPSetTextureFilter(pkt, type) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTFILT, 2, type) -#define gsDPSetTextureFilter(type) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_TEXTFILT, 2, type) - -#define gDPSetTextureConvert(pkt, type) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTCONV, 3, type) -#define gsDPSetTextureConvert(type) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_TEXTCONV, 3, type) - -#define gDPSetCombineKey(pkt, type) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_COMBKEY, 1, type) -#define gsDPSetCombineKey(type) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_COMBKEY, 1, type) - -#ifndef _HW_VERSION_1 -#define gDPSetColorDither(pkt, mode) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_RGBDITHER, 2, mode) -#define gsDPSetColorDither(mode) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_RGBDITHER, 2, mode) -#else -#define gDPSetColorDither(pkt, mode) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_COLORDITHER, 1, mode) -#define gsDPSetColorDither(mode) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_COLORDITHER, 1, mode) -#endif - -#ifndef _HW_VERSION_1 -#define gDPSetAlphaDither(pkt, mode) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 2, mode) -#define gsDPSetAlphaDither(mode) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 2, mode) -#endif - -/* 'blendmask' is not supported anymore. - * The bits are reserved for future use. - * Fri May 26 13:45:55 PDT 1995 - */ -#define gDPSetBlendMask(pkt, mask) gDPNoOp(pkt) -#define gsDPSetBlendMask(mask) gsDPNoOp() - -#define gDPSetAlphaCompare(pkt, type) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_L, G_MDSFT_ALPHACOMPARE, 2, type) -#define gsDPSetAlphaCompare(type) \ - gsSPSetOtherMode(G_SETOTHERMODE_L, G_MDSFT_ALPHACOMPARE, 2, type) - -#define gDPSetDepthSource(pkt, src) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_L, G_MDSFT_ZSRCSEL, 1, src) -#define gsDPSetDepthSource(src) \ - gsSPSetOtherMode(G_SETOTHERMODE_L, G_MDSFT_ZSRCSEL, 1, src) - -#define gDPSetRenderMode(pkt, c0, c1) \ - gSPSetOtherMode(pkt, G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, \ - (c0) | (c1)) -#define gsDPSetRenderMode(c0, c1) \ - gsSPSetOtherMode(G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, \ - (c0) | (c1)) - -#define gSetImage(pkt, cmd, fmt, siz, width, i) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(cmd, 24, 8) | _SHIFTL(fmt, 21, 3) | \ - _SHIFTL(siz, 19, 2) | _SHIFTL((width)-1, 0, 12); \ - _g->words.w1 = (unsigned int)(i); \ -} - -#define gsSetImage(cmd, fmt, siz, width, i) \ -{{ \ - _SHIFTL(cmd, 24, 8) | _SHIFTL(fmt, 21, 3) | \ - _SHIFTL(siz, 19, 2) | _SHIFTL((width)-1, 0, 12), \ - (unsigned int)(i) \ -}} - -#define gDPSetColorImage(pkt, f, s, w, i) gSetImage(pkt, G_SETCIMG, f, s, w, i) -#define gsDPSetColorImage(f, s, w, i) gsSetImage(G_SETCIMG, f, s, w, i) - - -/* use these for new code */ -#define gDPSetDepthImage(pkt, i) gSetImage(pkt, G_SETZIMG, 0, 0, 1, i) -#define gsDPSetDepthImage(i) gsSetImage(G_SETZIMG, 0, 0, 1, i) -/* kept for compatibility */ -#define gDPSetMaskImage(pkt, i) gDPSetDepthImage(pkt, i) -#define gsDPSetMaskImage(i) gsDPSetDepthImage(i) - -#define gDPSetTextureImage(pkt, f, s, w, i) gSetImage(pkt, G_SETTIMG, f, s, w, i) -#define gsDPSetTextureImage(f, s, w, i) gsSetImage(G_SETTIMG, f, s, w, i) - -/* - * RDP macros - */ - -#define gDPSetCombine(pkt, muxs0, muxs1) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_SETCOMBINE, 24, 8) | _SHIFTL(muxs0, 0, 24);\ - _g->words.w1 = (unsigned int)(muxs1); \ -} - -#define gsDPSetCombine(muxs0, muxs1) \ -{{ \ - _SHIFTL(G_SETCOMBINE, 24, 8) | _SHIFTL(muxs0, 0, 24), \ - (unsigned int)(muxs1) \ -}} - -#define GCCc0w0(saRGB0, mRGB0, saA0, mA0) \ - (_SHIFTL((saRGB0), 20, 4) | _SHIFTL((mRGB0), 15, 5) | \ - _SHIFTL((saA0), 12, 3) | _SHIFTL((mA0), 9, 3)) - -#define GCCc1w0(saRGB1, mRGB1) \ - (_SHIFTL((saRGB1), 5, 4) | _SHIFTL((mRGB1), 0, 5)) - -#define GCCc0w1(sbRGB0, aRGB0, sbA0, aA0) \ - (_SHIFTL((sbRGB0), 28, 4) | _SHIFTL((aRGB0), 15, 3) | \ - _SHIFTL((sbA0), 12, 3) | _SHIFTL((aA0), 9, 3)) - -#define GCCc1w1(sbRGB1, saA1, mA1, aRGB1, sbA1, aA1) \ - (_SHIFTL((sbRGB1), 24, 4) | _SHIFTL((saA1), 21, 3) | \ - _SHIFTL((mA1), 18, 3) | _SHIFTL((aRGB1), 6, 3) | \ - _SHIFTL((sbA1), 3, 3) | _SHIFTL((aA1), 0, 3)) - -#define gDPSetCombineLERP(pkt, a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, \ - a1, b1, c1, d1, Aa1, Ab1, Ac1, Ad1) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_SETCOMBINE, 24, 8) | \ - _SHIFTL(GCCc0w0(G_CCMUX_##a0, G_CCMUX_##c0, \ - G_ACMUX_##Aa0, G_ACMUX_##Ac0) | \ - GCCc1w0(G_CCMUX_##a1, G_CCMUX_##c1), \ - 0, 24); \ - _g->words.w1 = (unsigned int)(GCCc0w1(G_CCMUX_##b0, \ - G_CCMUX_##d0, \ - G_ACMUX_##Ab0, \ - G_ACMUX_##Ad0) | \ - GCCc1w1(G_CCMUX_##b1, \ - G_ACMUX_##Aa1, \ - G_ACMUX_##Ac1, \ - G_CCMUX_##d1, \ - G_ACMUX_##Ab1, \ - G_ACMUX_##Ad1)); \ -} - -#define gsDPSetCombineLERP(a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, \ - a1, b1, c1, d1, Aa1, Ab1, Ac1, Ad1) \ -{{ \ - _SHIFTL(G_SETCOMBINE, 24, 8) | \ - _SHIFTL(GCCc0w0(G_CCMUX_##a0, G_CCMUX_##c0, \ - G_ACMUX_##Aa0, G_ACMUX_##Ac0) | \ - GCCc1w0(G_CCMUX_##a1, G_CCMUX_##c1), 0, 24), \ - (unsigned int)(GCCc0w1(G_CCMUX_##b0, G_CCMUX_##d0, \ - G_ACMUX_##Ab0, G_ACMUX_##Ad0) | \ - GCCc1w1(G_CCMUX_##b1, G_ACMUX_##Aa1, \ - G_ACMUX_##Ac1, G_CCMUX_##d1, \ - G_ACMUX_##Ab1, G_ACMUX_##Ad1)) \ -}} - -/* - * SetCombineMode macros are NOT redunant. It allow the C preprocessor - * to substitute single parameter which includes commas in the token and - * rescan for higher parameter count macro substitution. - * - * eg. gsDPSetCombineMode(G_CC_MODULATE, G_CC_MODULATE) turns into - * gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, TEXEL0, 0, SHADE, 0, - * TEXEL0, 0, SHADE, 0, TEXEL0, 0, SHADE, 0) - */ - -#define gDPSetCombineMode(pkt, a, b) gDPSetCombineLERP(pkt, a, b) -#define gsDPSetCombineMode(a, b) gsDPSetCombineLERP(a, b) - -#define gDPSetColor(pkt, c, d) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(c, 24, 8); \ - _g->words.w1 = (unsigned int)(d); \ -} - -#define gsDPSetColor(c, d) \ -{{ \ - _SHIFTL(c, 24, 8), (unsigned int)(d) \ -}} - -#define DPRGBColor(pkt, cmd, r, g, b, a) \ - gDPSetColor(pkt, cmd, \ - (_SHIFTL(r, 24, 8) | _SHIFTL(g, 16, 8) | \ - _SHIFTL(b, 8, 8) | _SHIFTL(a, 0, 8))) -#define sDPRGBColor(cmd, r, g, b, a) \ - gsDPSetColor(cmd, \ - (_SHIFTL(r, 24, 8) | _SHIFTL(g, 16, 8) | \ - _SHIFTL(b, 8, 8) | _SHIFTL(a, 0, 8))) - -#define gDPSetEnvColor(pkt, r, g, b, a) \ - DPRGBColor(pkt, G_SETENVCOLOR, r,g,b,a) -#define gsDPSetEnvColor(r, g, b, a) \ - sDPRGBColor(G_SETENVCOLOR, r,g,b,a) -#define gDPSetBlendColor(pkt, r, g, b, a) \ - DPRGBColor(pkt, G_SETBLENDCOLOR, r,g,b,a) -#define gsDPSetBlendColor(r, g, b, a) \ - sDPRGBColor(G_SETBLENDCOLOR, r,g,b,a) -#define gDPSetFogColor(pkt, r, g, b, a) \ - DPRGBColor(pkt, G_SETFOGCOLOR, r,g,b,a) -#define gsDPSetFogColor(r, g, b, a) \ - sDPRGBColor(G_SETFOGCOLOR, r,g,b,a) -#define gDPSetFillColor(pkt, d) \ - gDPSetColor(pkt, G_SETFILLCOLOR, (d)) -#define gsDPSetFillColor(d) \ - gsDPSetColor(G_SETFILLCOLOR, (d)) - -#define gDPSetPrimDepth(pkt, z, dz) \ - gDPSetColor(pkt, G_SETPRIMDEPTH, \ - _SHIFTL(z, 16, 16) | _SHIFTL(dz, 0, 16)) -#define gsDPSetPrimDepth(z, dz) \ - gsDPSetColor(G_SETPRIMDEPTH, _SHIFTL(z, 16, 16) | \ - _SHIFTL(dz, 0, 16)) - -#define gDPSetPrimColor(pkt, m, l, r, g, b, a) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | \ - _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \ - _g->words.w1 = (_SHIFTL(r, 24, 8) | _SHIFTL(g, 16, 8) | \ - _SHIFTL(b, 8, 8) | _SHIFTL(a, 0, 8)); \ -} - -#define gsDPSetPrimColor(m, l, r, g, b, a) \ -{{ \ - (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | _SHIFTL(m, 8, 8) | \ - _SHIFTL(l, 0, 8)), \ - (_SHIFTL(r, 24, 8) | _SHIFTL(g, 16, 8) | _SHIFTL(b, 8, 8) | \ - _SHIFTL(a, 0, 8)) \ -}} - -/* - * gDPSetOtherMode (This is for expert user.) - * - * This command makes all othermode parameters set. - * Do not use this command in the same DL with another g*SPSetOtherMode DLs. - * - * [Usage] - * gDPSetOtherMode(pkt, modeA, modeB) - * - * 'modeA' is described all parameters of GroupA GBI command. - * 'modeB' is also described all parameters of GroupB GBI command. - * - * GroupA: - * gDPPipelineMode, gDPSetCycleType, gSPSetTexturePersp, - * gDPSetTextureDetail, gDPSetTextureLOD, gDPSetTextureLUT, - * gDPSetTextureFilter, gDPSetTextureConvert, gDPSetCombineKey, - * gDPSetColorDither, gDPSetAlphaDither - * - * GroupB: - * gDPSetAlphaCompare, gDPSetDepthSource, gDPSetRenderMode - * - * Use 'OR' operation to get modeA and modeB. - * - * modeA = G_PM_* | G_CYC_* | G_TP_* | G_TD_* | G_TL_* | G_TT_* | G_TF_* - * G_TC_* | G_CK_* | G_CD_* | G_AD_*; - * - * modeB = G_AC_* | G_ZS_* | G_RM_* | G_RM_*2; - */ -#define gDPSetOtherMode(pkt, mode0, mode1) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_RDPSETOTHERMODE,24,8)|_SHIFTL(mode0,0,24);\ - _g->words.w1 = (unsigned int)(mode1); \ -} - -#define gsDPSetOtherMode(mode0, mode1) \ -{{ \ - _SHIFTL(G_RDPSETOTHERMODE,24,8)|_SHIFTL(mode0,0,24), \ - (unsigned int)(mode1) \ -}} - -/* - * Texturing macros - */ - -/* These are also defined defined above for Sprite Microcode */ - -#define G_TX_LOADTILE 7 -#define G_TX_RENDERTILE 0 - -#define G_TX_NOMIRROR 0 -#define G_TX_WRAP 0 -#define G_TX_MIRROR 0x1 -#define G_TX_CLAMP 0x2 -#define G_TX_NOMASK 0 -#define G_TX_NOLOD 0 - - -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif -/* - * Dxt is the inverse of the number of 64-bit words in a line of - * the texture being loaded using the load_block command. If - * there are any 1's to the right of the 11th fractional bit, - * dxt should be rounded up. The following macros accomplish - * this. The 4b macros are a special case since 4-bit textures - * are loaded as 8-bit textures. Dxt is fixed point 1.11. RJM - */ -#define G_TX_DXT_FRAC 11 - -/* - * For RCP 2.0, the maximum number of texels that can be loaded - * using a load_block command is 2048. In order to load the total - * 4kB of Tmem, change the texel size when loading to be G_IM_SIZ_16b, - * then change the tile to the proper texel size after the load. - * The g*DPLoadTextureBlock macros already do this, so this change - * will be transparent if you use these macros. If you use - * the g*DPLoadBlock macros directly, you will need to handle this - * tile manipulation yourself. RJM. - */ -#ifdef _HW_VERSION_1 -#define G_TX_LDBLK_MAX_TXL 4095 -#else -#define G_TX_LDBLK_MAX_TXL 2047 -#endif /* _HW_VERSION_1 */ - -#define TXL2WORDS(txls, b_txl) MAX(1, ((txls)*(b_txl)/8)) -#define CALC_DXT(width, b_txl) \ - (((1 << G_TX_DXT_FRAC) + TXL2WORDS(width, b_txl) - 1) / \ - TXL2WORDS(width, b_txl)) - -#define TXL2WORDS_4b(txls) MAX(1, ((txls)/16)) -#define CALC_DXT_4b(width) \ - (((1 << G_TX_DXT_FRAC) + TXL2WORDS_4b(width) - 1) / \ - TXL2WORDS_4b(width)) - -#define gDPLoadTileGeneric(pkt, c, tile, uls, ult, lrs, lrt) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(c, 24, 8) | _SHIFTL(uls, 12, 12) | \ - _SHIFTL(ult, 0, 12); \ - _g->words.w1 = _SHIFTL(tile, 24, 3) | _SHIFTL(lrs, 12, 12) | \ - _SHIFTL(lrt, 0, 12); \ -} - -#define gsDPLoadTileGeneric(c, tile, uls, ult, lrs, lrt) \ -{{ \ - _SHIFTL(c, 24, 8) | _SHIFTL(uls, 12, 12) | _SHIFTL(ult, 0, 12), \ - _SHIFTL(tile, 24, 3) | _SHIFTL(lrs, 12, 12) | _SHIFTL(lrt, 0, 12)\ -}} - -#define gDPSetTileSize(pkt, t, uls, ult, lrs, lrt) \ - gDPLoadTileGeneric(pkt, G_SETTILESIZE, t, uls, ult, lrs, lrt) -#define gsDPSetTileSize(t, uls, ult, lrs, lrt) \ - gsDPLoadTileGeneric(G_SETTILESIZE, t, uls, ult, lrs, lrt) -#define gDPLoadTile(pkt, t, uls, ult, lrs, lrt) \ - gDPLoadTileGeneric(pkt, G_LOADTILE, t, uls, ult, lrs, lrt) -#define gsDPLoadTile(t, uls, ult, lrs, lrt) \ - gsDPLoadTileGeneric(G_LOADTILE, t, uls, ult, lrs, lrt) - -#define gDPSetTile(pkt, fmt, siz, line, tmem, tile, palette, cmt, \ - maskt, shiftt, cms, masks, shifts) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_SETTILE, 24, 8) | _SHIFTL(fmt, 21, 3) |\ - _SHIFTL(siz, 19, 2) | _SHIFTL(line, 9, 9) | \ - _SHIFTL(tmem, 0, 9); \ - _g->words.w1 = _SHIFTL(tile, 24, 3) | _SHIFTL(palette, 20, 4) | \ - _SHIFTL(cmt, 18, 2) | _SHIFTL(maskt, 14, 4) | \ - _SHIFTL(shiftt, 10, 4) |_SHIFTL(cms, 8, 2) | \ - _SHIFTL(masks, 4, 4) | _SHIFTL(shifts, 0, 4); \ -} - -#define gsDPSetTile(fmt, siz, line, tmem, tile, palette, cmt, \ - maskt, shiftt, cms, masks, shifts) \ -{{ \ - (_SHIFTL(G_SETTILE, 24, 8) | _SHIFTL(fmt, 21, 3) | \ - _SHIFTL(siz, 19, 2) | _SHIFTL(line, 9, 9) | _SHIFTL(tmem, 0, 9)),\ - (_SHIFTL(tile, 24, 3) | _SHIFTL(palette, 20, 4) | \ - _SHIFTL(cmt, 18, 2) | _SHIFTL(maskt, 14, 4) | \ - _SHIFTL(shiftt, 10, 4) | _SHIFTL(cms, 8, 2) | \ - _SHIFTL(masks, 4, 4) | _SHIFTL(shifts, 0, 4)) \ -}} - -/* - * For RCP 2.0, the maximum number of texels that can be loaded - * using a load_block command is 2048. In order to load the total - * 4kB of Tmem, change the texel size when loading to be G_IM_SIZ_16b, - * then change the tile to the proper texel size after the load. - * The g*DPLoadTextureBlock macros already do this, so this change - * will be transparent if you use these macros. If you use - * the g*DPLoadBlock macros directly, you will need to handle this - * tile manipulation yourself. RJM. - */ -#define gDPLoadBlock(pkt, tile, uls, ult, lrs, dxt) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_LOADBLOCK, 24, 8) | \ - _SHIFTL(uls, 12, 12) | _SHIFTL(ult, 0, 12)); \ - _g->words.w1 = (_SHIFTL(tile, 24, 3) | \ - _SHIFTL((MIN(lrs,G_TX_LDBLK_MAX_TXL)), 12, 12) |\ - _SHIFTL(dxt, 0, 12)); \ -} - -#define gsDPLoadBlock(tile, uls, ult, lrs, dxt) \ -{{ \ - (_SHIFTL(G_LOADBLOCK, 24, 8) | _SHIFTL(uls, 12, 12) | \ - _SHIFTL(ult, 0, 12)), \ - (_SHIFTL(tile, 24, 3) | \ - _SHIFTL((MIN(lrs,G_TX_LDBLK_MAX_TXL)), 12, 12) | \ - _SHIFTL(dxt, 0, 12)) \ -}} - -#define gDPLoadTLUTCmd(pkt, tile, count) \ -{ \ - Gfx *_g = (Gfx *)pkt; \ - \ - _g->words.w0 = _SHIFTL(G_LOADTLUT, 24, 8); \ - _g->words.w1 = _SHIFTL((tile), 24, 3) | _SHIFTL((count), 14, 10);\ -} - -#define gsDPLoadTLUTCmd(tile, count) \ -{{ \ - _SHIFTL(G_LOADTLUT, 24, 8), \ - _SHIFTL((tile), 24, 3) | _SHIFTL((count), 14, 10) \ -}} - -#define gDPLoadTextureBlock(pkt, timg, fmt, siz, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ - gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ - 0 , cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT) -1, \ - CALC_DXT(width, siz##_BYTES)); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, siz, \ - (((width) * siz##_LINE_BYTES)+7)>>3, 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -#define gDPLoadTextureBlockYuv(pkt, timg, fmt, siz, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ - gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ - 0 , cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT) -1, \ - CALC_DXT(width, siz##_BYTES)); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, siz, \ - (((width) * 1)+7)>>3, 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -/* Load fix rww 27jun95 */ -/* The S at the end means odd lines are already word Swapped */ - -#define gDPLoadTextureBlockS(pkt, timg, fmt, siz, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ - gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ - 0 , cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1,0); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, siz, \ - (((width) * siz##_LINE_BYTES)+7)>>3, 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -/* - * Allow tmem address and render tile to be specified. - * The S at the end means odd lines are already word Swapped - */ -#define gDPLoadMultiBlockS(pkt, timg, tmem, rtile, fmt, siz, width, \ - height, pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ - gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, tmem, G_TX_LOADTILE, \ - 0 , cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1,0); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, siz, \ - (((width) * siz##_LINE_BYTES)+7)>>3, tmem, \ - rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, rtile, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - - -#define gDPLoadTextureBlockYuvS(pkt, timg, fmt, siz, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ - gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ - 0 , cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1,0); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, siz, \ - (((width) * 1)+7)>>3, 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -/* - * allows tmem address to be specified - */ -#define _gDPLoadTextureBlock(pkt, timg, tmem, fmt, siz, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ - gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, tmem, G_TX_LOADTILE, \ - 0, cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1, \ - CALC_DXT(width, siz##_BYTES)); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, siz, (((width) * siz##_LINE_BYTES)+7)>>3, \ - tmem, G_TX_RENDERTILE, pal, cmt, \ - maskt, shiftt, cms, masks, shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -/* - * allows tmem address and render tile to be specified - */ -#define _gDPLoadTextureBlockTile(pkt, timg, tmem, rtile, fmt, siz, width, \ - height, pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ - gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, tmem, G_TX_LOADTILE, 0,\ - cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1, \ - CALC_DXT(width, siz##_BYTES)); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, siz, (((width) * siz##_LINE_BYTES)+7)>>3, \ - tmem, rtile, pal, cmt, \ - maskt, shiftt, cms, masks, shifts); \ - gDPSetTileSize(pkt, rtile, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -/* - * allows tmem address and render tile to be specified - */ -#define gDPLoadMultiBlock(pkt, timg, tmem, rtile, fmt, siz, width, \ - height, pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ - gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, tmem, G_TX_LOADTILE, 0,\ - cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1, \ - CALC_DXT(width, siz##_BYTES)); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, siz, (((width) * siz##_LINE_BYTES)+7)>>3, \ - tmem, rtile, pal, cmt, \ - maskt, shiftt, cms, masks, shifts); \ - gDPSetTileSize(pkt, rtile, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -#define gsDPLoadTextureBlock(timg, fmt, siz, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ - gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, 0, \ - G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, \ - masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1, \ - CALC_DXT(width, siz##_BYTES)), \ - gsDPPipeSync(), \ - gsDPSetTile(fmt, siz, ((((width) * siz##_LINE_BYTES)+7)>>3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - -/* Here is the static form of the pre-swapped texture block loading */ -/* See gDPLoadTextureBlockS() for reference. Basically, just don't - calculate DxT, use 0 */ - -#define gsDPLoadTextureBlockS(timg, fmt, siz, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ - gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, 0 , \ - cmt, maskt,shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1, 0 ),\ - gsDPPipeSync(), \ - gsDPSetTile(fmt, siz, ((((width) * siz##_LINE_BYTES)+7)>>3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - -/* - * Allow tmem address to be specified - */ -#define _gsDPLoadTextureBlock(timg, tmem, fmt, siz, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ - gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, tmem, G_TX_LOADTILE, \ - 0 , cmt, maskt, shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1, \ - CALC_DXT(width, siz##_BYTES)), \ - gsDPPipeSync(), \ - gsDPSetTile(fmt, siz, \ - ((((width) * siz##_LINE_BYTES)+7)>>3), tmem, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - - -/* - * Allow tmem address and render_tile to be specified - */ -#define _gsDPLoadTextureBlockTile(timg, tmem, rtile, fmt, siz, width, \ - height, pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ - gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, tmem, G_TX_LOADTILE, \ - 0 , cmt, maskt, shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1, \ - CALC_DXT(width, siz##_BYTES)), \ - gsDPPipeSync(), \ - gsDPSetTile(fmt, siz, \ - ((((width) * siz##_LINE_BYTES)+7)>>3), tmem, \ - rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(rtile, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - - -/* - * Allow tmem address and render_tile to be specified, useful when loading - * mutilple tiles at a time. - */ -#define gsDPLoadMultiBlock(timg, tmem, rtile, fmt, siz, width, \ - height, pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ - gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, tmem, G_TX_LOADTILE, \ - 0 , cmt, maskt, shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1, \ - CALC_DXT(width, siz##_BYTES)), \ - gsDPPipeSync(), \ - gsDPSetTile(fmt, siz, \ - ((((width) * siz##_LINE_BYTES)+7)>>3), tmem, \ - rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(rtile, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - -/* - * Allows tmem and render tile to be specified. Useful when loading - * several tiles at a time. - * - * Here is the static form of the pre-swapped texture block loading - * See gDPLoadTextureBlockS() for reference. Basically, just don't - * calculate DxT, use 0 - */ - -#define gsDPLoadMultiBlockS(timg, tmem, rtile, fmt, siz, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ - gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, tmem, G_TX_LOADTILE, 0 , \ - cmt, maskt,shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ - (((width)*(height) + siz##_INCR) >> siz##_SHIFT)-1, 0 ),\ - gsDPPipeSync(), \ - gsDPSetTile(fmt, siz, ((((width) * siz##_LINE_BYTES)+7)>>3), tmem,\ - rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(rtile, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - - -#define gDPLoadTextureBlock_4b(pkt, timg, fmt, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, \ - cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height)+3)>>2)-1, \ - CALC_DXT_4b(width)); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -/* Load fix rww 27jun95 */ -/* The S at the end means odd lines are already word Swapped */ - -#define gDPLoadTextureBlock_4bS(pkt, timg, fmt, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, \ - cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height)+3)>>2)-1, 0 ); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -/* - * 4-bit load block. Useful when loading multiple tiles - */ -#define gDPLoadMultiBlock_4b(pkt, timg, tmem, rtile, fmt, width, height,\ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, tmem, G_TX_LOADTILE, 0, \ - cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height)+3)>>2)-1, \ - CALC_DXT_4b(width)); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), tmem, \ - rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, rtile, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -/* - * 4-bit load block. Allows tmem and render tile to be specified. Useful when - * loading multiple tiles. The S means odd lines are already word swapped. - */ -#define gDPLoadMultiBlock_4bS(pkt, timg, tmem, rtile, fmt, width, height,\ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, tmem, G_TX_LOADTILE, 0, \ - cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height)+3)>>2)-1, 0 ); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), tmem, \ - rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, rtile, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - - -#define _gDPLoadTextureBlock_4b(pkt, timg, tmem, fmt, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, tmem, G_TX_LOADTILE, 0, \ - cmt, maskt, shiftt, cms, masks, shifts); \ - gDPLoadSync(pkt); \ - gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ - (((width)*(height)+3)>>2)-1, \ - CALC_DXT_4b(width)); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), tmem, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) \ -} - -#define gsDPLoadTextureBlock_4b(timg, fmt, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, G_IM_SIZ_16b, 1, timg), \ - gsDPSetTile(fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0 , cmt, \ - maskt, shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, (((width)*(height)+3)>>2)-1, \ - CALC_DXT_4b(width)), \ - gsDPPipeSync(), \ - gsDPSetTile(fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - -#define gsDPLoadTextureBlock_4bS(timg, fmt, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, G_IM_SIZ_16b, 1, timg), \ - gsDPSetTile(fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0 , cmt, \ - maskt, shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, (((width)*(height)+3)>>2)-1,0),\ - gsDPPipeSync(), \ - gsDPSetTile(fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - -/* - * 4-bit load block. Allows tmem address and render tile to be specified. - * Useful when loading multiple tiles. - */ -#define gsDPLoadMultiBlock_4b(timg, tmem, rtile, fmt, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, G_IM_SIZ_16b, 1, timg), \ - gsDPSetTile(fmt, G_IM_SIZ_16b, 0, tmem, G_TX_LOADTILE, 0 , cmt, \ - maskt, shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, (((width)*(height)+3)>>2)-1, \ - CALC_DXT_4b(width)), \ - gsDPPipeSync(), \ - gsDPSetTile(fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), tmem, \ - rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(rtile, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - - -/* - * 4-bit load block. Allows tmem address and render tile to be specified. - * Useful when loading multiple tiles. S means odd lines are already swapped. - */ -#define gsDPLoadMultiBlock_4bS(timg, tmem, rtile, fmt, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, G_IM_SIZ_16b, 1, timg), \ - gsDPSetTile(fmt, G_IM_SIZ_16b, 0, tmem, G_TX_LOADTILE, 0 , cmt, \ - maskt, shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, (((width)*(height)+3)>>2)-1,0),\ - gsDPPipeSync(), \ - gsDPSetTile(fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), tmem, \ - rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(rtile, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - - -/* - * Allows tmem address to be specified - */ -#define _gsDPLoadTextureBlock_4b(timg, tmem, fmt, width, height, \ - pal, cms, cmt, masks, maskt, shifts, shiftt) \ - \ - gsDPSetTextureImage(fmt, G_IM_SIZ_16b, 1, timg), \ - gsDPSetTile(fmt, G_IM_SIZ_16b, 0, tmem, G_TX_LOADTILE, 0 , cmt, \ - maskt, shiftt, cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, (((width)*(height)+3)>>2)-1, \ - CALC_DXT_4b(width)), \ - gsDPPipeSync(), \ - gsDPSetTile(fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), tmem, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ - ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ - ((height)-1) << G_TEXTURE_IMAGE_FRAC) - -#ifndef _HW_VERSION_1 - -#define gDPLoadTextureTile(pkt, timg, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ - gDPSetTextureImage(pkt, fmt, siz, width, timg); \ - gDPSetTile(pkt, fmt, siz, \ - (((((lrs)-(uls)+1) * siz##_TILE_BYTES)+7)>>3), 0, \ - G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPLoadSync(pkt); \ - gDPLoadTile( pkt, G_TX_LOADTILE, \ - (uls)<>3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, \ - (uls)<>3), tmem, \ - G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPLoadSync(pkt); \ - gDPLoadTile( pkt, G_TX_LOADTILE, \ - (uls)<>3), tmem, \ - rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, rtile, \ - (uls)<>3), 0, \ - G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPLoadSync(), \ - gsDPLoadTile( G_TX_LOADTILE, \ - (uls)<>3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks,\ - shifts), \ - gsDPSetTileSize(G_TX_RENDERTILE, \ - (uls)<>3), \ - tmem, G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, \ - masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadTile( G_TX_LOADTILE, \ - (uls)<>3), \ - tmem, rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(rtile, \ - (uls)<>1), timg); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_8b, \ - (((((lrs)-(uls)+1)>>1)+7)>>3), 0, \ - G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPLoadSync(pkt); \ - gDPLoadTile( pkt, G_TX_LOADTILE, \ - (uls)<<(G_TEXTURE_IMAGE_FRAC-1), \ - (ult)<<(G_TEXTURE_IMAGE_FRAC), \ - (lrs)<<(G_TEXTURE_IMAGE_FRAC-1), \ - (lrt)<<(G_TEXTURE_IMAGE_FRAC)); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \ - (((((lrs)-(uls)+1)>>1)+7)>>3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, \ - masks, shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, \ - (uls)<>1), timg); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_8b, \ - (((((lrs)-(uls)+1)>>1)+7)>>3), tmem, \ - G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPLoadSync(pkt); \ - gDPLoadTile( pkt, G_TX_LOADTILE, \ - (uls)<<(G_TEXTURE_IMAGE_FRAC-1), \ - (ult)<<(G_TEXTURE_IMAGE_FRAC), \ - (lrs)<<(G_TEXTURE_IMAGE_FRAC-1), \ - (lrt)<<(G_TEXTURE_IMAGE_FRAC)); \ - gDPPipeSync(pkt); \ - gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \ - (((((lrs)-(uls)+1)>>1)+7)>>3), tmem, \ - rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPSetTileSize(pkt, rtile, \ - (uls)<>1), timg), \ - gsDPSetTile(fmt, G_IM_SIZ_8b, (((((lrs)-(uls)+1)>>1)+7)>>3), 0, \ - G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPLoadSync(), \ - gsDPLoadTile( G_TX_LOADTILE, \ - (uls)<<(G_TEXTURE_IMAGE_FRAC-1), \ - (ult)<<(G_TEXTURE_IMAGE_FRAC), \ - (lrs)<<(G_TEXTURE_IMAGE_FRAC-1), \ - (lrt)<<(G_TEXTURE_IMAGE_FRAC)), \ - gsDPPipeSync(), \ - gsDPSetTile(fmt, G_IM_SIZ_4b, (((((lrs)-(uls)+1)>>1)+7)>>3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(G_TX_RENDERTILE, \ - (uls)<>1), timg), \ - gsDPSetTile(fmt, G_IM_SIZ_8b, (((((lrs)-(uls)+1)>>1)+7)>>3), \ - tmem, G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, \ - masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadTile( G_TX_LOADTILE, \ - (uls)<<(G_TEXTURE_IMAGE_FRAC-1), \ - (ult)<<(G_TEXTURE_IMAGE_FRAC), \ - (lrs)<<(G_TEXTURE_IMAGE_FRAC-1), \ - (lrt)<<(G_TEXTURE_IMAGE_FRAC)), \ - gsDPPipeSync(), \ - gsDPSetTile(fmt, G_IM_SIZ_4b, (((((lrs)-(uls)+1)>>1)+7)>>3), \ - tmem, rtile, pal, cmt, maskt, shiftt, cms, masks, \ - shifts), \ - gsDPSetTileSize(rtile, \ - (uls)<words.w0 = _SHIFTL(G_SETSCISSOR, 24, 8) | \ - _SHIFTL((int)((float)(ulx)*4.0F), 12, 12) | \ - _SHIFTL((int)((float)(uly)*4.0F), 0, 12); \ - _g->words.w1 = _SHIFTL(mode, 24, 2) | \ - _SHIFTL((int)((float)(lrx)*4.0F), 12, 12) | \ - _SHIFTL((int)((float)(lry)*4.0F), 0, 12); \ -} - - -#define gDPSetScissorFrac(pkt, mode, ulx, uly, lrx, lry) \ -{ \ - Gfx *_g = (Gfx *)pkt; \ - \ - _g->words.w0 = _SHIFTL(G_SETSCISSOR, 24, 8) | \ - _SHIFTL((int)((ulx)), 12, 12) | \ - _SHIFTL((int)((uly)), 0, 12); \ - _g->words.w1 = _SHIFTL(mode, 24, 2) | \ - _SHIFTL((int)((lrx)), 12, 12) | \ - _SHIFTL((int)((lry)), 0, 12); \ -} - -#define gsDPSetScissor(mode, ulx, uly, lrx, lry) \ -{{ \ - _SHIFTL(G_SETSCISSOR, 24, 8) | \ - _SHIFTL((int)((float)(ulx)*4.0F), 12, 12) | \ - _SHIFTL((int)((float)(uly)*4.0F), 0, 12), \ - _SHIFTL(mode, 24, 2) | \ - _SHIFTL((int)((float)(lrx)*4.0F), 12, 12) | \ - _SHIFTL((int)((float)(lry)*4.0F), 0, 12) \ -}} - -#define gsDPSetScissorFrac(mode, ulx, uly, lrx, lry) \ -{{ \ - _SHIFTL(G_SETSCISSOR, 24, 8) | \ - _SHIFTL((int)((ulx)), 12, 12) | \ - _SHIFTL((int)((uly)), 0, 12), \ - _SHIFTL(mode, 24, 2) | \ - _SHIFTL((int)(lrx), 12, 12) | \ - _SHIFTL((int)(lry), 0, 12) \ -}} - -/* Fraction never used in fill */ -#define gDPFillRectangle(pkt, ulx, uly, lrx, lry) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_FILLRECT, 24, 8) | \ - _SHIFTL((lrx), 14, 10) | _SHIFTL((lry), 2, 10));\ - _g->words.w1 = (_SHIFTL((ulx), 14, 10) | _SHIFTL((uly), 2, 10));\ -} - -#define gsDPFillRectangle(ulx, uly, lrx, lry) \ -{{ \ - (_SHIFTL(G_FILLRECT, 24, 8) | _SHIFTL((lrx), 14, 10) | \ - _SHIFTL((lry), 2, 10)), \ - (_SHIFTL((ulx), 14, 10) | _SHIFTL((uly), 2, 10)) \ -}} - -/* like gDPFillRectangle but accepts negative arguments */ -#define gDPScisFillRectangle(pkt, ulx, uly, lrx, lry) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_FILLRECT, 24, 8) | \ - _SHIFTL(MAX((lrx),0), 14, 10) | \ - _SHIFTL(MAX((lry),0), 2, 10)); \ - _g->words.w1 = (_SHIFTL(MAX((ulx),0), 14, 10) | \ - _SHIFTL(MAX((uly),0), 2, 10)); \ -} - -#define gDPSetConvert(pkt, k0, k1, k2, k3, k4, k5) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_SETCONVERT, 24, 8) | \ - _SHIFTL(k0, 13, 9) | _SHIFTL(k1, 4, 9) | \ - _SHIFTR(k2, 5, 4)); \ - _g->words.w1 = (_SHIFTL(k2, 27, 5) | _SHIFTL(k3, 18, 9) | \ - _SHIFTL(k4, 9, 9) | _SHIFTL(k5, 0, 9)); \ -} - -#define gsDPSetConvert(k0, k1, k2, k3, k4, k5) \ -{{ \ - (_SHIFTL(G_SETCONVERT, 24, 8) | \ - _SHIFTL(k0, 13, 9) | _SHIFTL(k1, 4, 9) | _SHIFTR(k2, 5, 4)), \ - (_SHIFTL(k2, 27, 5) | _SHIFTL(k3, 18, 9) | _SHIFTL(k4, 9, 9) | \ - _SHIFTL(k5, 0, 9)) \ -}} - -#define gDPSetKeyR(pkt, cR, sR, wR) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_SETKEYR, 24, 8); \ - _g->words.w1 = (_SHIFTL(wR, 16, 12) | _SHIFTL(cR, 8, 8) | \ - _SHIFTL(sR, 0, 8)); \ -} - -#define gsDPSetKeyR(cR, sR, wR) \ -{{ \ - _SHIFTL(G_SETKEYR, 24, 8), \ - _SHIFTL(wR, 16, 12) | _SHIFTL(cR, 8, 8) | _SHIFTL(sR, 0, 8) \ -}} - -#define gDPSetKeyGB(pkt, cG, sG, wG, cB, sB, wB) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_SETKEYGB, 24, 8) | \ - _SHIFTL(wG, 12, 12) | _SHIFTL(wB, 0, 12)); \ - _g->words.w1 = (_SHIFTL(cG, 24, 8) | _SHIFTL(sG, 16, 8) | \ - _SHIFTL(cB, 8, 8) | _SHIFTL(sB, 0, 8)); \ -} - -#define gsDPSetKeyGB(cG, sG, wG, cB, sB, wB) \ -{{ \ - (_SHIFTL(G_SETKEYGB, 24, 8) | _SHIFTL(wG, 12, 12) | \ - _SHIFTL(wB, 0, 12)), \ - (_SHIFTL(cG, 24, 8) | _SHIFTL(sG, 16, 8) | _SHIFTL(cB, 8, 8) | \ - _SHIFTL(sB, 0, 8)) \ -}} - -#define gDPNoParam(pkt, cmd) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(cmd, 24, 8); \ - _g->words.w1 = 0; \ -} - -#define gsDPNoParam(cmd) \ -{{ \ - _SHIFTL(cmd, 24, 8), 0 \ -}} - -#define gDPParam(pkt, cmd, param) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(cmd, 24, 8); \ - _g->words.w1 = (param); \ -} - -#define gsDPParam(cmd, param) \ -{{ \ - _SHIFTL(cmd, 24, 8), (param) \ -}} - -/* Notice that textured rectangles are 128-bit commands, therefore - * gsDPTextureRectangle() should not be used in display lists - * under normal circumstances (use gsSPTextureRectangle()). - * That is also why there is no gDPTextureRectangle() macros. - */ -#define gsDPTextureRectangle(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ -{{ \ - (_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | \ - _SHIFTL(yh, 0, 12)), \ - (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12)), \ -}}, \ -{{ \ - _SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16), \ - _SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16) \ -}} - -#define gDPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - if (pkt); \ - _g->words.w0 = (_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | \ - _SHIFTL(yh, 0, 12)); \ - _g->words.w1 = (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | \ - _SHIFTL(yl, 0, 12)); \ - _g ++; \ - _g->words.w0 = (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16)); \ - _g->words.w1 = (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)); \ -} - -#define gsDPTextureRectangleFlip(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ -{{ \ - (_SHIFTL(G_TEXRECTFLIP, 24, 8) | _SHIFTL(xh, 12, 12) | \ - _SHIFTL(yh, 0, 12)), \ - (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12)), \ -}}, \ -{{ \ - _SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16), \ - _SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16) \ -}} - -#define gDPTextureRectangleFlip(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - if (pkt); \ - _g->words.w0 = (_SHIFTL(G_TEXRECTFLIP, 24, 8) | _SHIFTL(xh, 12, 12) | \ - _SHIFTL(yh, 0, 12)); \ - _g->words.w1 = (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | \ - _SHIFTL(yl, 0, 12)); \ - _g ++; \ - _g->words.w0 = (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16)); \ - _g->words.w1 = (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)); \ -} - -#define gsSPTextureRectangle(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ - {{(_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | _SHIFTL(yh, 0, 12)),\ - (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12))}}, \ - gsImmp1(G_RDPHALF_1, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))), \ - gsImmp1(G_RDPHALF_2, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16))) - -#define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | \ - _SHIFTL(yh, 0, 12)); \ - _g->words.w1 = (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | \ - _SHIFTL(yl, 0, 12)); \ - gImmp1(pkt, G_RDPHALF_1, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))); \ - gImmp1(pkt, G_RDPHALF_2, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)));\ -} - -/* like gSPTextureRectangle but accepts negative position arguments */ -#define gSPScisTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_TEXRECT, 24, 8) | \ - _SHIFTL(MAX((s16)(xh),0), 12, 12) | \ - _SHIFTL(MAX((s16)(yh),0), 0, 12)); \ - _g->words.w1 = (_SHIFTL((tile), 24, 3) | \ - _SHIFTL(MAX((s16)(xl),0), 12, 12) | \ - _SHIFTL(MAX((s16)(yl),0), 0, 12)); \ - gImmp1(pkt, G_RDPHALF_1, \ - (_SHIFTL(((s) - \ - (((s16)(xl) < 0) ? \ - (((s16)(dsdx) < 0) ? \ - (MAX((((s16)(xl)*(s16)(dsdx))>>7),0)) : \ - (MIN((((s16)(xl)*(s16)(dsdx))>>7),0))) : 0)), \ - 16, 16) | \ - _SHIFTL(((t) - \ - (((yl) < 0) ? \ - (((s16)(dtdy) < 0) ? \ - (MAX((((s16)(yl)*(s16)(dtdy))>>7),0)) : \ - (MIN((((s16)(yl)*(s16)(dtdy))>>7),0))) : 0)), \ - 0, 16))); \ - gImmp1(pkt, G_RDPHALF_2, (_SHIFTL((dsdx), 16, 16) | \ - _SHIFTL((dtdy), 0, 16))); \ -} - -#define gsSPTextureRectangleFlip(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ - {{(_SHIFTL(G_TEXRECTFLIP, 24, 8) | _SHIFTL(xh, 12, 12) | \ - _SHIFTL(yh, 0, 12)), \ - (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12))}}, \ - gsImmp1(G_RDPHALF_1, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))), \ - gsImmp1(G_RDPHALF_2, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16))) - -#define gSPTextureRectangleFlip(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_TEXRECTFLIP, 24, 8) | _SHIFTL(xh, 12, 12) |\ - _SHIFTL(yh, 0, 12)); \ - _g->words.w1 = (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | \ - _SHIFTL(yl, 0, 12)); \ - gImmp1(pkt, G_RDPHALF_1, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))); \ - gImmp1(pkt, G_RDPHALF_2, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16))); \ -} - -#define gsDPWord(wordhi, wordlo) \ - gsImmp1(G_RDPHALF_1, (unsigned int)(wordhi)), \ - gsImmp1(G_RDPHALF_2, (unsigned int)(wordlo)) - -#define gDPWord(pkt, wordhi, wordlo) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - gImmp1(pkt, G_RDPHALF_1, (unsigned int)(wordhi)); \ - gImmp1(pkt, G_RDPHALF_2, (unsigned int)(wordlo)); \ -} - -#define gDPFullSync(pkt) gDPNoParam(pkt, G_RDPFULLSYNC) -#define gsDPFullSync() gsDPNoParam(G_RDPFULLSYNC) -#define gDPTileSync(pkt) gDPNoParam(pkt, G_RDPTILESYNC) -#define gsDPTileSync() gsDPNoParam(G_RDPTILESYNC) -#define gDPPipeSync(pkt) gDPNoParam(pkt, G_RDPPIPESYNC) -#define gsDPPipeSync() gsDPNoParam(G_RDPPIPESYNC) -#define gDPLoadSync(pkt) gDPNoParam(pkt, G_RDPLOADSYNC) -#define gsDPLoadSync() gsDPNoParam(G_RDPLOADSYNC) -#define gDPNoOp(pkt) gDPNoParam(pkt, G_NOOP) -#define gsDPNoOp() gsDPNoParam(G_NOOP) -#define gDPNoOpTag(pkt, tag) gDPParam(pkt, G_NOOP, tag) -#define gsDPNoOpTag(tag) gsDPParam(G_NOOP, tag) - -#endif /* _LANGUAGE_C */ - - -#endif /* _GBI_H_ */ diff --git a/include/2.0L/PR/gs2dex.h b/include/2.0L/PR/gs2dex.h deleted file mode 100644 index ced46855..00000000 --- a/include/2.0L/PR/gs2dex.h +++ /dev/null @@ -1,392 +0,0 @@ -/*--------------------------------------------------------------------- - Copyright (C) 1997, Nintendo. - - File gs2dex.h - Coded by Yoshitaka Yasumoto. Jul 31, 1997. - Modified by - Comments Header file for S2DEX ucode. - - $Id: gs2dex.h,v 1.21 1998/05/28 00:14:49 has Exp $ - ---------------------------------------------------------------------*/ - -#ifndef _GS2DEX_H_ -#define _GS2DEX_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -/*===========================================================================* - * Macro - *===========================================================================*/ -#define GS_CALC_DXT(line) (((1<< G_TX_DXT_FRAC)-1)/(line)+1) -#define GS_PIX2TMEM(pix, siz) ((pix)>>(4-(siz))) -#define GS_PIX2DXT(pix, siz) GS_CALC_DXT(GS_PIX2TMEM((pix), (siz))) - -/*===========================================================================* - * Data structures for S2DEX microcode - *===========================================================================*/ - -/*---------------------------------------------------------------------------* - * Background - *---------------------------------------------------------------------------*/ -#define G_BGLT_LOADBLOCK 0x0033 -#define G_BGLT_LOADTILE 0xfff4 - -#define G_BG_FLAG_FLIPS 0x01 -#define G_BG_FLAG_FLIPT 0x10 - -/* Non scalable background plane */ -typedef struct { - u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */ - u16 imageW; /* width of the texture (u10.2) */ - s16 frameX; /* upper-left position of transferred frame (s10.2) */ - u16 frameW; /* width of transferred frame (u10.2) */ - - u16 imageY; /* y-coordinate of upper-left position of texture (u10.5) */ - u16 imageH; /* height of the texture (u10.2) */ - s16 frameY; /* upper-left position of transferred frame (s10.2) */ - u16 frameH; /* height of transferred frame (u10.2) */ - - u64 *imagePtr; /* texture source address on DRAM */ - u16 imageLoad; /* which to use, LoadBlock or LoadTile */ - u8 imageFmt; /* format of texel - G_IM_FMT_* */ - u8 imageSiz; /* size of texel - G_IM_SIZ_* */ - u16 imagePal; /* pallet number */ - u16 imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */ - - /* The following is set in the initialization routine guS2DInitBg(). There is no need for the user to set it. */ - u16 tmemW; /* TMEM width and Word size of frame 1 line. - At LoadBlock, GS_PIX2TMEM(imageW/4,imageSiz) - At LoadTile GS_PIX2TMEM(frameW/4,imageSiz)+1 */ - u16 tmemH; /* height of TMEM loadable at a time (s13.2) 4 times value - When the normal texture, 512/tmemW*4 - When the CI texture, 256/tmemW*4 */ - u16 tmemLoadSH; /* SH value - At LoadBlock, tmemSize/2-1 - At LoadTile, tmemW*16-1 */ - u16 tmemLoadTH; /* TH value or Stride value - At LoadBlock, GS_CALC_DXT(tmemW) - At LoadTile, tmemH-1 */ - u16 tmemSizeW; /* skip value of imagePtr for image 1-line - At LoadBlock, tmemW*2 - At LoadTile, GS_PIX2TMEM(imageW/4,imageSiz)*2 */ - u16 tmemSize; /* skip value of imagePtr for 1-loading - = tmemSizeW*tmemH */ -} uObjBg_t; /* 40 bytes */ - -/* Scalable background plane */ -typedef struct { - u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */ - u16 imageW; /* width of texture (u10.2) */ - s16 frameX; /* upper-left position of transferred frame (s10.2) */ - u16 frameW; /* width of transferred frame (u10.2) */ - - u16 imageY; /* y-coordinate of upper-left position of texture (u10.5) */ - u16 imageH; /* height of texture (u10.2) */ - s16 frameY; /* upper-left position of transferred frame (s10.2) */ - u16 frameH; /* height of transferred frame (u10.2) */ - - u64 *imagePtr; /* texture source address on DRAM */ - u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */ - u8 imageFmt; /* format of texel - G_IM_FMT_* */ - u8 imageSiz; /* size of texel - G_IM_SIZ_* */ - u16 imagePal; /* pallet number */ - u16 imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */ - - u16 scaleW; /* scale value of X-direction (u5.10) */ - u16 scaleH; /* scale value of Y-direction (u5.10) */ - s32 imageYorig; /* start point of drawing on image (s20.5) */ - - u8 padding[4]; - -} uObjScaleBg_t; /* 40 bytes */ - -typedef union { - uObjBg_t b; - uObjScaleBg_t s; - long long int force_structure_alignment; -} uObjBg; - -/*---------------------------------------------------------------------------* - * 2D Objects - *---------------------------------------------------------------------------*/ -#define G_OBJ_FLAG_FLIPS 1<<0 /* inversion to S-direction */ -#define G_OBJ_FLAG_FLIPT 1<<4 /* nversion to T-direction */ - -typedef struct { - s16 objX; /* s10.2 OBJ x-coordinate of upper-left end */ - u16 scaleW; /* u5.10 Scaling of u5.10 width direction */ - u16 imageW; /* u10.5 width of u10.5 texture (length of S-direction) */ - u16 paddingX; /* Unused - Always 0 */ - s16 objY; /* s10.2 OBJ y-coordinate of s10.2 OBJ upper-left end */ - u16 scaleH; /* u5.10 Scaling of u5.10 height direction */ - u16 imageH; /* u10.5 height of u10.5 texture (length of T-direction) */ - u16 paddingY; /* Unused - Always 0 */ - u16 imageStride; /* folding width of texel (In units of 64bit word) */ - u16 imageAdrs; /* texture header position in TMEM (In units of 64bit word) */ - u8 imageFmt; /* format of texel - G_IM_FMT_* */ - u8 imageSiz; /* size of texel - G_IM_SIZ_* */ - u8 imagePal; /* pallet number (0-7) */ - u8 imageFlags; /* The display flag - G_OBJ_FLAG_FLIP* */ -} uObjSprite_t; /* 24 bytes */ - -typedef union { - uObjSprite_t s; - long long int force_structure_alignment; -} uObjSprite; - -/*---------------------------------------------------------------------------* - * 2D Matrix - *---------------------------------------------------------------------------*/ -typedef struct { - s32 A, B, C, D; /* s15.16 */ - s16 X, Y; /* s10.2 */ - u16 BaseScaleX; /* u5.10 */ - u16 BaseScaleY; /* u5.10 */ -} uObjMtx_t; /* 24 bytes */ - -typedef union { - uObjMtx_t m; - long long int force_structure_alignment; -} uObjMtx; - -typedef struct { - s16 X, Y; /* s10.2 */ - u16 BaseScaleX; /* u5.10 */ - u16 BaseScaleY; /* u5.10 */ -} uObjSubMtx_t; /* 8 bytes */ - -typedef union { - uObjSubMtx_t m; - long long int force_structure_alignment; -} uObjSubMtx; - -/*---------------------------------------------------------------------------* - * Loading into TMEM - *---------------------------------------------------------------------------*/ -#define G_OBJLT_TXTRBLOCK 0x00001033 -#define G_OBJLT_TXTRTILE 0x00fc1034 -#define G_OBJLT_TLUT 0x00000030 - -#define GS_TB_TSIZE(pix,siz) (GS_PIX2TMEM((pix),(siz))-1) -#define GS_TB_TLINE(pix,siz) (GS_CALC_DXT(GS_PIX2TMEM((pix),(siz)))) - -typedef struct { - u32 type; /* G_OBJLT_TXTRBLOCK divided into types */ - u64 *image; /* texture source address on DRAM */ - u16 tmem; /* loaded TMEM word address (8byteWORD) */ - u16 tsize; /* Texture size, Specified by macro GS_TB_TSIZE() */ - u16 tline; /* width of Texture 1-line, Specified by macro GS_TB_TLINE() */ - u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */ - u32 flag; /* STATE flag */ - u32 mask; /* STATE mask */ -} uObjTxtrBlock_t; /* 24 bytes */ - -#define GS_TT_TWIDTH(pix,siz) ((GS_PIX2TMEM((pix), (siz))<<2)-1) -#define GS_TT_THEIGHT(pix,siz) (((pix)<<2)-1) - -typedef struct { - u32 type; /* G_OBJLT_TXTRTILE divided into types */ - u64 *image; /* texture source address on DRAM */ - u16 tmem; /* loaded TMEM word address (8byteWORD)*/ - u16 twidth; /* width of Texture (Specified by macro GS_TT_TWIDTH()) */ - u16 theight; /* height of Texture (Specified by macro GS_TT_THEIGHT()) */ - u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */ - u32 flag; /* STATE flag */ - u32 mask; /* STATE mask */ -} uObjTxtrTile_t; /* 24 bytes */ - -#define GS_PAL_HEAD(head) ((head)+256) -#define GS_PAL_NUM(num) ((num)-1) - -typedef struct { - u32 type; /* G_OBJLT_TLUT divided into types */ - u64 *image; /* texture source address on DRAM */ - u16 phead; /* pallet number of load header (Between 256 and 511) */ - u16 pnum; /* loading pallet number -1 */ - u16 zero; /* Assign 0 all the time */ - u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12)*/ - u32 flag; /* STATE flag */ - u32 mask; /* STATE mask */ -} uObjTxtrTLUT_t; /* 24 bytes */ - -typedef union { - uObjTxtrBlock_t block; - uObjTxtrTile_t tile; - uObjTxtrTLUT_t tlut; - long long int force_structure_alignment; -} uObjTxtr; - -/*---------------------------------------------------------------------------* - * Loading into TMEM & 2D Objects - *---------------------------------------------------------------------------*/ -typedef struct { - uObjTxtr txtr; - uObjSprite sprite; -} uObjTxSprite; /* 48 bytes */ - -/*===========================================================================* - * GBI Commands for S2DEX microcode - *===========================================================================*/ -/* GBI Header */ -#ifdef F3DEX_GBI_2 -#define G_OBJ_RECTANGLE_R 0xda -#define G_OBJ_MOVEMEM 0xdc -#define G_RDPHALF_0 0xe4 -#define G_OBJ_RECTANGLE 0x01 -#define G_OBJ_SPRITE 0x02 -#define G_SELECT_DL 0x04 -#define G_OBJ_LOADTXTR 0x05 -#define G_OBJ_LDTX_SPRITE 0x06 -#define G_OBJ_LDTX_RECT 0x07 -#define G_OBJ_LDTX_RECT_R 0x08 -#define G_BG_1CYC 0x09 -#define G_BG_COPY 0x0a -#define G_OBJ_RENDERMODE 0x0b -#else -#define G_BG_1CYC 0x01 -#define G_BG_COPY 0x02 -#define G_OBJ_RECTANGLE 0x03 -#define G_OBJ_SPRITE 0x04 -#define G_OBJ_MOVEMEM 0x05 -#define G_SELECT_DL 0xb0 -#define G_OBJ_RENDERMODE 0xb1 -#define G_OBJ_RECTANGLE_R 0xb2 -#define G_OBJ_LOADTXTR 0xc1 -#define G_OBJ_LDTX_SPRITE 0xc2 -#define G_OBJ_LDTX_RECT 0xc3 -#define G_OBJ_LDTX_RECT_R 0xc4 -#define G_RDPHALF_0 0xe4 -#endif - -/*---------------------------------------------------------------------------* - * Background wrapped screen - *---------------------------------------------------------------------------*/ -#define gSPBgRectangle(pkt, m, mptr) gDma0p((pkt),(m),(mptr),0) -#define gsSPBgRectangle(m, mptr) gsDma0p( (m),(mptr),0) -#define gSPBgRectCopy(pkt, mptr) gSPBgRectangle((pkt), G_BG_COPY, (mptr)) -#define gsSPBgRectCopy(mptr) gsSPBgRectangle( G_BG_COPY, (mptr)) -#define gSPBgRect1Cyc(pkt, mptr) gSPBgRectangle((pkt), G_BG_1CYC, (mptr)) -#define gsSPBgRect1Cyc(mptr) gsSPBgRectangle( G_BG_1CYC, (mptr)) - -/*---------------------------------------------------------------------------* - * 2D Objects - *---------------------------------------------------------------------------*/ -#define gSPObjSprite(pkt, mptr) gDma0p((pkt),G_OBJ_SPRITE, (mptr),0) -#define gsSPObjSprite(mptr) gsDma0p( G_OBJ_SPRITE, (mptr),0) -#define gSPObjRectangle(pkt, mptr) gDma0p((pkt),G_OBJ_RECTANGLE, (mptr),0) -#define gsSPObjRectangle(mptr) gsDma0p( G_OBJ_RECTANGLE, (mptr),0) -#define gSPObjRectangleR(pkt, mptr) gDma0p((pkt),G_OBJ_RECTANGLE_R,(mptr),0) -#define gsSPObjRectangleR(mptr) gsDma0p( G_OBJ_RECTANGLE_R,(mptr),0) - -/*---------------------------------------------------------------------------* - * 2D Matrix - *---------------------------------------------------------------------------*/ -#define gSPObjMatrix(pkt, mptr) gDma1p((pkt),G_OBJ_MOVEMEM,(mptr),0,23) -#define gsSPObjMatrix(mptr) gsDma1p( G_OBJ_MOVEMEM,(mptr),0,23) -#define gSPObjSubMatrix(pkt, mptr) gDma1p((pkt),G_OBJ_MOVEMEM,(mptr),2, 7) -#define gsSPObjSubMatrix(mptr) gsDma1p( G_OBJ_MOVEMEM,(mptr),2, 7) - -/*---------------------------------------------------------------------------* - * Loading into TMEM - *---------------------------------------------------------------------------*/ -#define gSPObjLoadTxtr(pkt, tptr) gDma0p((pkt),G_OBJ_LOADTXTR, (tptr),23) -#define gsSPObjLoadTxtr(tptr) gsDma0p( G_OBJ_LOADTXTR, (tptr),23) -#define gSPObjLoadTxSprite(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_SPRITE,(tptr),47) -#define gsSPObjLoadTxSprite(tptr) gsDma0p( G_OBJ_LDTX_SPRITE,(tptr),47) -#define gSPObjLoadTxRect(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_RECT, (tptr),47) -#define gsSPObjLoadTxRect(tptr) gsDma0p( G_OBJ_LDTX_RECT, (tptr),47) -#define gSPObjLoadTxRectR(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_RECT_R,(tptr),47) -#define gsSPObjLoadTxRectR(tptr) gsDma0p( G_OBJ_LDTX_RECT_R,(tptr),47) - -/*---------------------------------------------------------------------------* - * Select Display List - *---------------------------------------------------------------------------*/ -#define gSPSelectDL(pkt, mptr, sid, flag, mask) \ -{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \ - gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); } -#define gsSPSelectDL(mptr, sid, flag, mask) \ -{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \ - gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); } -#define gSPSelectBranchDL(pkt, mptr, sid, flag, mask) \ -{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \ - gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); } -#define gsSPSelectBranchDL(mptr, sid, flag, mask) \ -{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \ - gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); } - -/*---------------------------------------------------------------------------* - * Set general status - *---------------------------------------------------------------------------*/ -#define G_MW_GENSTAT 0x08 /* Note that it is the same value of G_MW_FOG */ - -#define gSPSetStatus(pkt, sid, val) \ - gMoveWd((pkt), G_MW_GENSTAT, (sid), (val)) -#define gsSPSetStatus(sid, val) \ - gsMoveWd( G_MW_GENSTAT, (sid), (val)) - -/*---------------------------------------------------------------------------* - * Set Object Render Mode - *---------------------------------------------------------------------------*/ -#define G_OBJRM_NOTXCLAMP 0x01 -#define G_OBJRM_XLU 0x02 /* Ignored */ -#define G_OBJRM_ANTIALIAS 0x04 /* Ignored */ -#define G_OBJRM_BILERP 0x08 -#define G_OBJRM_SHRINKSIZE_1 0x10 -#define G_OBJRM_SHRINKSIZE_2 0x20 -#define G_OBJRM_WIDEN 0x40 - -#define gSPObjRenderMode(pkt, mode) gImmp1((pkt),G_OBJ_RENDERMODE,(mode)) -#define gsSPObjRenderMode(mode) gsImmp1( G_OBJ_RENDERMODE,(mode)) - -/*===========================================================================* - * Render Mode Macro - *===========================================================================*/ -#define RM_RA_SPRITE(clk) \ - AA_EN | CVG_DST_CLAMP | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \ - GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) - -#define G_RM_SPRITE G_RM_OPA_SURF -#define G_RM_SPRITE2 G_RM_OPA_SURF2 -#define G_RM_RA_SPRITE RM_RA_SPRITE(1) -#define G_RM_RA_SPRITE2 RM_RA_SPRITE(2) -#define G_RM_AA_SPRITE G_RM_AA_TEX_TERR -#define G_RM_AA_SPRITE2 G_RM_AA_TEX_TERR2 -#define G_RM_XLU_SPRITE G_RM_XLU_SURF -#define G_RM_XLU_SPRITE2 G_RM_XLU_SURF2 -#define G_RM_AA_XLU_SPRITE G_RM_AA_XLU_SURF -#define G_RM_AA_XLU_SPRITE2 G_RM_AA_XLU_SURF2 - -/*===========================================================================* - * External functions - *===========================================================================*/ -extern u64 gspS2DEX_fifoTextStart[], gspS2DEX_fifoTextEnd[]; -extern u64 gspS2DEX_fifoDataStart[], gspS2DEX_fifoDataEnd[]; -extern u64 gspS2DEX_fifo_dTextStart[], gspS2DEX_fifo_dTextEnd[]; -extern u64 gspS2DEX_fifo_dDataStart[], gspS2DEX_fifo_dDataEnd[]; -extern u64 gspS2DEX2_fifoTextStart[], gspS2DEX2_fifoTextEnd[]; -extern u64 gspS2DEX2_fifoDataStart[], gspS2DEX2_fifoDataEnd[]; -extern u64 gspS2DEX2_xbusTextStart[], gspS2DEX2_xbusTextEnd[]; -extern u64 gspS2DEX2_xbusDataStart[], gspS2DEX2_xbusDataEnd[]; -extern void guS2DInitBg(uObjBg *); - -#ifdef F3DEX_GBI_2 -# define guS2DEmuBgRect1Cyc guS2D2EmuBgRect1Cyc /*Wrapper*/ -# define guS2DEmuSetScissor guS2D2EmuSetScissor /*Wrapper*/ - extern void guS2D2EmuSetScissor(u32, u32, u32, u32, u8); - extern void guS2D2EmuBgRect1Cyc(Gfx **, uObjBg *); -#else - extern void guS2DEmuSetScissor(u32, u32, u32, u32, u8); - extern void guS2DEmuBgRect1Cyc(Gfx **, uObjBg *); -#endif - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif -#endif /* _GS2DEX_H_ */ - -/*======== End of gs2dex.h ========*/ diff --git a/include/2.0L/PR/gt.h b/include/2.0L/PR/gt.h deleted file mode 100644 index 09b6ba2d..00000000 --- a/include/2.0L/PR/gt.h +++ /dev/null @@ -1,365 +0,0 @@ - -/* - * Copyright 1995, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * - * UNPUBLISHED -- Rights reserved under the copyright laws of the United - * States. Use of a copyright notice is precautionary only and does not - * imply publication or disclosure. - * - * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to restrictions - * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or - * in similar or successor clauses in the FAR, or the DOD or NASA FAR - * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., - * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. - * - * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY - * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, - * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY - * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON - * GRAPHICS, INC. - * - */ - -/* - * File: gt.h - * Creator: hsa@sgi.com - * Create Date: Thu Oct 12 15:48:14 PDT 1995 - * - * This file defines the GBI for the TURBO 3D graphics microcode. - * The turbo microcode is a special FEATURE-LIMITED microcode designed - * for specific applications. It is not for general use. - * - * (see XXX for more information) - * - */ - -/************************************************************************** - * - * $Revision: 1.16 $ - * $Date: 1998/05/28 00:14:50 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/gt.h,v $ - * - **************************************************************************/ - -#ifndef _GT_H_ -#define _GT_H_ - -/* this file should be #included AFTER gbi.h */ - -#include "sptask.h" - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif /* _LANGUAGE_C_PLUS_PLUS */ - -#include - -/* the following #defines seem out of order, but we need them - * for the microcode. - */ - -/* - * object state field: rendState - * - * This flag word is built up out of the bits from a - * subset of the G_SETGEOMETRYMODE flags from gbi.h. - * - * When each of these bits is '1', the comments below explain - * the effect on the triangles. - */ -#define GT_ZBUFFER G_ZBUFFER -#define GT_TEXTURE G_TEXTURE_ENABLE /* texture ON */ -#define GT_CULL_BACK G_CULL_BACK /* reject backfaces */ -#define GT_SHADING_SMOOTH G_SHADING_SMOOTH /* smooth shade ON */ - -/* - * object state field: textureState - * - * The lower 3 bits of this flag word contain the texture tile number - * to be used. All triangles of an object are rendered with the same - * texture tile. - */ - -/* - * object state field: flag - * - * This is a group of what would be pad bits. We use them for some - * flag bits. - */ -#define GT_FLAG_NOMTX 0x01 /* don't load the matrix */ -#define GT_FLAG_NO_XFM 0x02 /* load vtx, use verbatim */ -#define GT_FLAG_XFM_ONLY 0x04 /* xform vtx, write to *TriN */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* turbo 3D ucode: */ -extern long long int gspTurbo3DTextStart[], gspTurbo3DTextEnd[]; -extern long long int gspTurbo3DDataStart[], gspTurbo3DDataEnd[]; -extern long long int gspTurbo3D_dramTextStart[], gspTurbo3D_dramTextEnd[]; -extern long long int gspTurbo3D_dramDataStart[], gspTurbo3D_dramDataEnd[]; -extern long long int gspTurbo3D_fifoTextStart[], gspTurbo3D_fifoTextEnd[]; -extern long long int gspTurbo3D_fifoDataStart[], gspTurbo3D_fifoDataEnd[]; - -/* - * This is the global state structure. It's definition carefully - * matches the ucode, so if this structure changes, you must also change - * the ucode. - */ -typedef struct { - u16 perspNorm; /* persp normalization */ - u16 pad0; - u32 flag; - Gfx rdpOthermode; - u32 segBases[16]; /* table of segment base addrs (SEE NOTE!) */ - Vp viewport; /* the viewport to use */ - Gfx *rdpCmds; /* block of RDP data, process if !NULL - * block terminated by gDPEndDisplayList() - * (This is a segment address) - */ -} gtGlobState_t; - -/* NOTE: - * Although there are 16 segment table entries, the first one (segment 0) - * is reserved for physical memory mapping. You should not segment 0 - * to anything other than 0x0. - */ - -typedef union { - gtGlobState_t sp; - long long int force_structure_alignment; -} gtGlobState; - - -/* - * This is the 'state' structure associated with each object - * to be rendered. It's definition carefully matches the - * ucode, so if this structure changes, you must also change - * the gtoff.c tool and the ucode. - */ -typedef struct { - u32 renderState; /* render state */ - u32 textureState; /* texture state */ - u8 vtxCount; /* how many verts? */ - u8 vtxV0; /* where to load verts? */ - u8 triCount; /* how many tris? */ - u8 flag; - Gfx *rdpCmds; /* ptr (segment address) to RDP DL */ - Gfx rdpOthermode; - Mtx transform; /* the transform matrix to use */ -} gtState_t; - -typedef union { - gtState_t sp; - long long int force_structure_alignment; -} gtState; - -/* gtStateLite : same as gtState, but no matrix (see flags below) */ -/* this structure must be identical to gtState! (bad) */ -typedef struct { - u32 renderState; /* render state */ - u32 textureState; /* texture state */ - u8 vtxCount; /* how many verts? */ - u8 vtxV0; /* where to load verts? */ - u8 triCount; /* how many tris? */ - u8 flag; - Gfx *rdpCmds; /* ptr (segment address) to RDP DL */ - Gfx rdpOthermode; -} gtStateL_t; - -typedef union { - gtStateL_t sp; - long long int force_structure_alignment; -} gtStateL; - -/* - * The vertex list for the turbo display list uses the - * Vtx struct in gbi.h - * - */ - - -/* - * This structure represents a single triangle, part of the - * triangle list of the object to be rendered. - * - * NOTE: The triangle list MUST be aligned to an 8-byte boundary. - * Since this structure is only 4 bytes, we are REQUIRING that - * this structure only be used as an array of triangles, and we - * depend on the MIPS C compiler (which always aligns arrays to - * 8-byte boundaries). THIS IS DANGEROUS!!!! - * - */ -typedef struct { - u8 v0, v1, v2, flag; /* flag is which one for flat shade */ -} gtTriN; - - -/* - * This structure represents the transformed points. It is the format - * of the points written out when GT_FLAG_XFM_ONLY is set, as well as - * the format expected when GT_FLAG_NO_XFM is used. - * - * NOTE: The size and layout of these points is very similar to Vtx, - * except the screen coordinates overwrite the x,y,z,pad fields. - * (we could consider adding to the Vtx union, but we want to keep - * turbo stuff out of gbi.h) - * - * NOTE: The z is a special format. It can be used to compare vertices - * for sorting, but it should not be used for other purposes. If modified, - * the z-buffer hardware might not understand the data. - * - */ -typedef struct { - short int xscrn; /* x,y screen coordinates are SSSS10.2 */ - short int yscrn; - int zscrn; /* z screen is S15.16 */ - - short int s; /* transformed texture coord, S10.5 */ - short int t; - - u8 r; /* color (or normal) */ - u8 g; - u8 b; - u8 a; -} gtVtxOut_t; - -/* see "Data Structure" comment in gbi.h for information about why - * we use this union. - */ -typedef union { - gtVtxOut_t v; - long long int force_structure_alignment; -} gtVtxOut; - - - -/* - * state field: rdpOthermode - * - * This is one of the trickier state fields. The turbo interface - * requires the RDP othermode command to be cached by the host, - * therefore we provide a different interface in libultra to help cache - * this in the gt state (this word is just bits, you could pack them - * on your own). - * - * gtStateSetOthermode() accomplishs this, taking as arguments - * the state, one of the following mode enums, and a piece of data - * (othermode parameters from gbi.h). - * - * By definition, the othermode word from the gt state structure is sent - * to the RDP *before* any RDP commands from the rdpCmds[] field. The - * othermode is *always* sent. - * - * Stated another way, NONE of the gbi RDP othermode commands equivalent - * to those listed here are allowed in the rdpCmd[] field of the - * gt state structure. - * - * Notice also that many of these commands do not make sense for - * the turbo ucode (they control features not supported, like mip-mapping). - * They are only included here for completeness. - * - */ -typedef enum { - GT_CLEAR, /* special gt mode, clears othermode state */ - GT_ALPHACOMPARE, - GT_ZSRCSEL, - GT_RENDERMODE, - GT_ALPHADITHER, - GT_RGBDITHER, - GT_COMBKEY, - GT_TEXTCONV, - GT_TEXTFILT, - GT_TEXTLUT, - GT_TEXTLOD, - GT_TEXTDETAIL, - GT_TEXTPERSP, - GT_CYCLETYPE, - GT_PIPELINE -} gtStateOthermode_t; - -/* - * This call builds up an othermode command word. The 'mode' is one of - * the above modes, the 'data' field comes from gbi.h, it is the data - * field for the equivalent gbi setothermode macro. - */ -extern void gtStateSetOthermode(Gfx *om, gtStateOthermode_t mode, int data); - -/* - * This call dumps a turbo display list for use with gbi2mem and RSPSIM - */ -#define GT_DUMPTURBO_HANGAFTER 64 -#define GT_DUMPTURBO_NOTEXTURES 128 -extern void gtDumpTurbo(OSTask *tp,u8 flags); - -/* - * Special macros to init othermode words to all 0's, a good default - * value. - */ -#define gDPClearOtherMode(pkt) \ -{ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = _SHIFTL(G_RDPSETOTHERMODE, 24, 8); \ - _g->words.w1 = 0x0; \ -} - -#define gsDPClearOtherMode() \ -{ \ - _SHIFTL(G_RDPSETOTHERMODE, 24, 8), 0x0 \ -} - -/* - * Special macros to end DP blocks (see above). These commands - * generate all 0's, which the turbo ucode looks for. They *aren't* - * real DP commands! - */ -#define gDPEndDisplayList(pkt) gSPNoOp(pkt) -#define gsDPEndDisplayList() gsSPNoOp() - -/* - * This structure is a turbo 'object', the turbo display list is - * simply a list of these. - * - * NOTE: All pointers are segment addresses - * - * NOTE: If (statep->flag & GT_FLAG_XFM_ONLY), the trip field is - * interpreted as a pointer to gtVtxOut[] that can be used to store - * the transformed points. (statep->triCount should be 0, else bad - * things could happen...) - * - * NOTE: If (statep->flag & GT_FLAG_NO_XFM), the vtxp field is - * interpreted as a pointer to gtVtxOut[] that can be used to load - * pre-transformed points. - * - */ -typedef struct { - gtGlobState *gstatep; /* global state, usually NULL */ - gtState *statep; /* if this is NULL, end object processing */ - Vtx *vtxp; /* if this is NULL, use points in buffer */ - gtTriN *trip; /* if this is NULL, use tris in buffer */ -} gtGfx_t; - -typedef union { - gtGfx_t obj; - long long int force_structure_alignment; -} gtGfx; - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_ASSEMBLY -#include -#endif /* _LANGUAGE_ASSEMBLY */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif /* _LANGUAGE_C_PLUS_PLUS */ - -#ifdef _LANGUAGE_MAKEROM -#endif /* _LANGUAGE_MAKEROM */ - -#endif /* _GT_H_ */ diff --git a/include/2.0L/PR/gu.h b/include/2.0L/PR/gu.h deleted file mode 100644 index 404088a8..00000000 --- a/include/2.0L/PR/gu.h +++ /dev/null @@ -1,269 +0,0 @@ -#ifndef _GU_H_ -#define _GU_H_ - -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * $Revision: 1.48 $ - * $Date: 1999/07/13 08:00:20 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/gu.h,v $ - * - **************************************************************************/ - -#include -#include -#include - -#ifndef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) -#endif -#ifndef MIN -#define MIN(a,b) (((a)<(b))?(a):(b)) -#endif - -#define M_PI 3.14159265358979323846 -#define M_DTOR (3.14159265358979323846/180.0) - -#define FTOFIX32(x) (long)((x) * (float)0x00010000) -#define FIX32TOF(x) ((float)(x) * (1.0f / (float)0x00010000)) -#define FTOFRAC8(x) ((int) MIN(((x) * (128.0)), 127.0) & 0xff) - -#define FILTER_WRAP 0 -#define FILTER_CLAMP 1 - -#define RAND(x) (guRandom()%x) /* random number between 0 to x */ - -/* - * Data Structures - */ -typedef struct { - unsigned char *base; - int fmt, siz; - int xsize, ysize; - int lsize; - /* current tile info */ - int addr; - int w, h; - int s, t; -} Image; - -typedef struct { - float col[3]; - float pos[3]; - float a1, a2; /* actual color = col/(a1*dist + a2) */ -} PositionalLight; - - -/* - * Function Prototypes - */ - -extern int guLoadTextureBlockMipMap(Gfx **glist, unsigned char *tbuf, Image *im, - unsigned char startTile, unsigned char pal, unsigned char cms, - unsigned char cmt, unsigned char masks, unsigned char maskt, - unsigned char shifts, unsigned char shiftt, unsigned char cfs, - unsigned char cft); - -extern int guGetDPLoadTextureTileSz (int ult, int lrt); -extern void guDPLoadTextureTile (Gfx *glistp, void *timg, - int texl_fmt, int texl_size, - int img_width, int img_height, - int uls, int ult, int lrs, int lrt, - int palette, - int cms, int cmt, - int masks, int maskt, - int shifts, int shiftt); - - -/* - * matrix operations: - * - * The 'F' version is floating point, in case the application wants - * to do matrix manipulations and convert to fixed-point at the last - * minute. - */ -extern void guMtxIdent(Mtx *m); -extern void guMtxIdentF(float mf[4][4]); -extern void guOrtho(Mtx *m, float l, float r, float b, float t, - float n, float f, float scale); -extern void guOrthoF(float mf[4][4], float l, float r, float b, float t, - float n, float f, float scale); -extern void guFrustum(Mtx *m, float l, float r, float b, float t, - float n, float f, float scale); -extern void guFrustumF(float mf[4][4], float l, float r, float b, float t, - float n, float f, float scale); -extern void guPerspective(Mtx *m, u16 *perspNorm, float fovy, - float aspect, float near, float far, float scale); -extern void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, - float aspect, float near, float far, float scale); -extern void guLookAt(Mtx *m, - float xEye, float yEye, float zEye, - float xAt, float yAt, float zAt, - float xUp, float yUp, float zUp); -extern void guLookAtF(float mf[4][4], float xEye, float yEye, float zEye, - float xAt, float yAt, float zAt, - float xUp, float yUp, float zUp); -extern void guLookAtReflect(Mtx *m, LookAt *l, - float xEye, float yEye, float zEye, - float xAt, float yAt, float zAt, - float xUp, float yUp, float zUp); -extern void guLookAtReflectF(float mf[4][4], LookAt *l, - float xEye, float yEye, float zEye, - float xAt, float yAt, float zAt, - float xUp, float yUp, float zUp); -extern void guLookAtHilite(Mtx *m, LookAt *l, Hilite *h, - float xEye, float yEye, float zEye, - float xAt, float yAt, float zAt, - float xUp, float yUp, float zUp, - float xl1, float yl1, float zl1, - float xl2, float yl2, float zl2, - int twidth, int theight); -extern void guLookAtHiliteF(float mf[4][4], LookAt *l, Hilite *h, - float xEye, float yEye, float zEye, - float xAt, float yAt, float zAt, - float xUp, float yUp, float zUp, - float xl1, float yl1, float zl1, - float xl2, float yl2, float zl2, - int twidth, int theight); -extern void guLookAtStereo(Mtx *m, - float xEye, float yEye, float zEye, - float xAt, float yAt, float zAt, - float xUp, float yUp, float zUp, - float eyedist); -extern void guLookAtStereoF(float mf[4][4], - float xEye, float yEye, float zEye, - float xAt, float yAt, float zAt, - float xUp, float yUp, float zUp, - float eyedist); -extern void guRotate(Mtx *m, float a, float x, float y, float z); -extern void guRotateF(float mf[4][4], float a, float x, float y, float z); -extern void guRotateRPY(Mtx *m, float r, float p, float y); -extern void guRotateRPYF(float mf[4][4], float r, float p, float h); -extern void guAlign(Mtx *m, float a, float x, float y, float z); -extern void guAlignF(float mf[4][4], float a, float x, float y, float z); -extern void guScale(Mtx *m, float x, float y, float z); -extern void guScaleF(float mf[4][4], float x, float y, float z); -extern void guTranslate(Mtx *m, float x, float y, float z); -extern void guTranslateF(float mf[4][4], float x, float y, float z); -extern void guPosition(Mtx *m, float r, float p, float h, float s, - float x, float y, float z); -extern void guPositionF(float mf[4][4], float r, float p, float h, float s, - float x, float y, float z); -extern void guMtxF2L(float mf[4][4], Mtx *m); -extern void guMtxL2F(float mf[4][4], Mtx *m); -extern void guMtxCatF(float m[4][4], float n[4][4], float r[4][4]); -extern void guMtxCatL(Mtx *m, Mtx *n, Mtx *res); -extern void guMtxXFMF(float mf[4][4], float x, float y, float z, - float *ox, float *oy, float *oz); -extern void guMtxXFML(Mtx *m, float x, float y, float z, - float *ox, float *oy, float *oz); - -/* vector utility: */ -extern void guNormalize(float *x, float *y, float *z); - -/* light utilities: */ -void guPosLight(PositionalLight *pl, Light *l, - float xOb, float yOb, float zOb); -void guPosLightHilite(PositionalLight *pl1, PositionalLight *pl2, - Light *l1, Light *l2, - LookAt *l, Hilite *h, - float xEye, float yEye, float zEye, - float xOb, float yOb, float zOb, - float xUp, float yUp, float zUp, - int twidth, int theight); -extern int guRandom(void); - -/* - * Math functions - */ -extern float sinf(float angle); -extern float cosf(float angle); -extern signed short sins (unsigned short angle); -extern signed short coss (unsigned short angle); -extern float sqrtf(float value); -#ifdef __sgi -#pragma intrinsic(sqrtf); -#endif - -/* - * Dump routines for low-level display lists - */ -/* flag values for guParseRdpDL() */ -#define GU_PARSERDP_VERBOSE 1 -#define GU_PARSERDP_PRAREA 2 -#define GU_PARSERDP_PRHISTO 4 -#define GU_PARSERDP_DUMPONLY 32 /* doesn't need to be same as */ - /* GU_PARSEGBI_DUMPOLNY, but this */ - /* allows app to use interchangeably */ - -extern void guParseRdpDL(u64 *rdp_dl, u64 nbytes, u8 flags); -extern void guParseString(char *StringPointer, u64 nbytes); - -/* - * NO LONGER SUPPORTED, - * use guParseRdpDL with GU_PARSERDP_DUMPONLY flags - */ -/* extern void guDumpRawRdpDL(u64 *rdp_dl, u64 nbytes); */ - -/* flag values for guBlinkRdpDL() */ -#define GU_BLINKRDP_HILITE 1 -#define GU_BLINKRDP_EXTRACT 2 - -extern void -guBlinkRdpDL(u64 *rdp_dl_in, u64 nbytes_in, - u64 *rdp_dl_out, u64 *nbytes_out, - u32 x, u32 y, u32 radius, - u8 red, u8 green, u8 blue, - u8 flags); - -/* flag values for guParseGbiDL() */ -#define GU_PARSEGBI_ROWMAJOR 1 -#define GU_PARSEGBI_NONEST 2 -#define GU_PARSEGBI_FLTMTX 4 -#define GU_PARSEGBI_SHOWDMA 8 -#define GU_PARSEGBI_ALLMTX 16 -#define GU_PARSEGBI_DUMPONLY 32 -/* -#define GU_PARSEGBI_HANGAFTER 64 -#define GU_PARSEGBI_NOTEXTURES 128 -*/ -extern void guParseGbiDL(u64 *gbi_dl, u32 nbytes, u8 flags); -extern void guDumpGbiDL(OSTask *tp,u8 flags); - -#define GU_PARSE_GBI_TYPE 1 -#define GU_PARSE_RDP_TYPE 2 -#define GU_PARSE_READY 3 -#define GU_PARSE_MEM_BLOCK 4 -#define GU_PARSE_ABI_TYPE 5 -#define GU_PARSE_STRING_TYPE 6 - -typedef struct { - int dataSize; - int dlType; - int flags; - u32 paddr; -} guDLPrintCB; - -void guSprite2DInit(uSprite *SpritePointer, - void *SourceImagePointer, - void *TlutPointer, - int Stride, - int SubImageWidth, - int SubImageHeight, - int SourceImageType, - int SourceImageBitSize, - int SourceImageOffsetS, - int SourceImageOffsetT); - -#endif /* !_GU_H_ */ diff --git a/include/2.0L/PR/leo.h b/include/2.0L/PR/leo.h deleted file mode 100644 index 96f2edd1..00000000 --- a/include/2.0L/PR/leo.h +++ /dev/null @@ -1,280 +0,0 @@ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. - - $RCSfile: leo.h,v $ - $Revision: 1.29 $ - $Date: 1998/12/21 07:30:15 $ - *---------------------------------------------------------------------*/ - -#ifndef _LEO_H_ -#define _LEO_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ -typedef u32 LEOError; - -typedef u8 LEOSpdlMode; - -typedef u8 LEOStatus; - -typedef struct -{ - u8 drive; /* version of hw */ - u8 driver; /* version of sw */ - u8 deviceType; /* dev type, always 00 */ - u8 ndevices; /* # of devices, always 01 */ -} LEOVersion; - -typedef struct -{ - u32 startLBA; - u32 endLBA; - u32 nbytes; -} LEOCapacity; - -typedef struct -{ - u8 pad; - u8 yearhi; - u8 yearlo; - u8 month; - u8 day; - u8 hour; - u8 minute; - u8 second; -} LEODiskTime; - -typedef struct -{ - u64 lineNumber; - LEODiskTime time; -} LEOSerialNum; - -typedef struct -{ - u8 gameName[4]; - u8 gameVersion; - u8 diskNumber; - u8 ramUsage; - u8 diskUsage; - LEOSerialNum serialNumber; - u8 company[2]; - u8 freeArea[6]; -} LEODiskID; - -typedef struct -{ - LEOCmdHeader header; - union - { - struct - { - u32 lba; - u32 xfer_blks; - void *buff_ptr; - u32 rw_bytes; -#ifdef _LONGCMD - u32 size; -#endif - } readwrite; - struct - { - u32 lba; - } seek; - struct - { - void *buffer_pointer; - } readdiskid; - LEODiskTime time; - struct - { - u8 reserve1; - u8 reserve2; - u8 standby_time; - u8 sleep_time; - u32 reserve3; - } modeselect; - - } data; - -} LEOCmd; - - -#define _nbytes readwrite.rw_bytes -#define _result header.status - - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ -#define LEO_SW_VERSION 6 /* This will be returned by */ - /* LeoInquiry command */ - -#define OS_PRIORITY_LEOMGR OS_PRIORITY_PIMGR - -/* - * Drive Rom offset address - */ -#define DDROM_FONT_START 0x000a0000 -#define DDROM_WAVEDATA_START 0x00140000 - -/* - * Definition for osLeoSpdlMotor() - */ -#define ACTIVE 0 -#define STANDBY 1 -#define SLEEP 2 -#define BRAKE 4 - -#define LEO_MOTOR_ACTIVE 0 -#define LEO_MOTOR_STANDBY 1 -#define LEO_MOTOR_SLEEP 2 -#define LEO_MOTOR_BRAKE 4 - -#define NUM_LBAS 4292 /* total number of LBAs */ - -#define BLK_SIZE_ZONE0 19720 -#define BLK_SIZE_ZONE1 18360 -#define BLK_SIZE_ZONE2 17680 -#define BLK_SIZE_ZONE3 16320 -#define BLK_SIZE_ZONE4 14960 -#define BLK_SIZE_ZONE5 13600 -#define BLK_SIZE_ZONE6 12240 -#define BLK_SIZE_ZONE7 10880 -#define BLK_SIZE_ZONE8 9520 - -#define MAX_BLK_SIZE BLK_SIZE_ZONE0 -#define MIN_BLK_SIZE BLK_SIZE_ZONE8 - -/* - * Error codes - */ -#define LEO_ERROR_GOOD 0 -#define LEO_ERROR_DRIVE_NOT_READY 1 -#define LEO_ERROR_DIAGNOSTIC_FAILURE 2 -#define LEO_ERROR_COMMAND_PHASE_ERROR 3 -#define LEO_ERROR_DATA_PHASE_ERROR 4 -#define LEO_ERROR_REAL_TIME_CLOCK_FAILURE 5 -#define LEO_ERROR_BUSY 8 -#define LEO_ERROR_INCOMPATIBLE_MEDIUM_INSTALLED 11 -#define LEO_ERROR_UNKNOWN_FORMAT 11 -#define LEO_ERROR_NO_SEEK_COMPLETE 21 -#define LEO_ERROR_WRITE_FAULT 22 -#define LEO_ERROR_UNRECOVERED_READ_ERROR 23 -#define LEO_ERROR_NO_REFERENCE_POSITION_FOUND 24 -#define LEO_ERROR_TRACK_FOLLOWING_ERROR 25 -#define LEO_ERROR_TRACKING_OR_SPDL_SERVO_FAILURE 25 -#define LEO_ERROR_INVALID_COMMAND_OPERATION_CODE 31 -#define LEO_ERROR_LBA_OUT_OF_RANGE 32 -#define LEO_ERROR_WRITE_PROTECT_ERROR 33 -#define LEO_ERROR_COMMAND_CLEARED_BY_HOST 34 -#define LEO_ERROR_COMMAND_TERMINATED 34 -#define LEO_ERROR_QUEUE_FULL 35 -#define LEO_ERROR_ILLEGAL_TIMER_VALUE 36 -#define LEO_ERROR_WAITING_NMI 37 -#define LEO_ERROR_DEVICE_COMMUNICATION_FAILURE 41 -#define LEO_ERROR_MEDIUM_NOT_PRESENT 42 -#define LEO_ERROR_POWERONRESET_DEVICERESET_OCCURED 43 -#define LEO_ERROR_RAMPACK_NOT_CONNECTED 44 -#define LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED 47 -#define LEO_ERROR_EJECTED_ILLEGALLY_RESUME 49 - -/* - * Reserved - */ -#define LEO_ERROR_NOT_BOOTED_DISK 45 -#define LEO_ERROR_DIDNOT_CHANGED_DISK_AS_EXPECTED 46 - -/* - * Error codes only used in IPL - */ -#define LEO_ERROR_RTC_NOT_SET_CORRECTLY 48 -#define LEO_ERROR_DIAGNOSTIC_FAILURE_RESET 50 -#define LEO_ERROR_EJECTED_ILLEGALLY_RESET 51 - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ -#define GET_ERROR(x) ((x).header.sense) - - -/************************************************************************** - * - * Extern variables - * - */ -extern LEODiskID leoBootID; -extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/ - - -/************************************************************************** - * - * Function prototypes - * - */ -/* Initialize routine */ -extern s32 LeoCreateLeoManager(OSPri comPri, OSPri intPri, - OSMesg *cmdBuf, s32 cmdMsgCnt); -extern s32 LeoCJCreateLeoManager(OSPri comPri, OSPri intPri, - OSMesg *cmdBuf, s32 cmdMsgCnt); -extern s32 LeoCACreateLeoManager(OSPri comPri, OSPri intPri, - OSMesg *cmdBuf, s32 cmdMsgCnt); -extern u32 LeoDriveExist(void); - -/* Synchronous functions */ -extern s32 LeoClearQueue(void); -extern s32 LeoByteToLBA(s32 startLBA, u32 nbytes, s32 *lbas); -extern s32 LeoLBAToByte(s32 startLBA, u32 nLBAs, s32 *bytes); -extern s32 LeoReadCapacity(LEOCapacity *cap, s32 dir); -extern s32 LeoInquiry(LEOVersion *ver); -extern s32 LeoTestUnitReady(LEOStatus *status); - -/* Asynchronous functions */ -extern s32 LeoSpdlMotor(LEOCmd *cmdBlock, LEOSpdlMode mode, OSMesgQueue *mq); -extern s32 LeoSeek(LEOCmd *cmdBlock, u32 lba, OSMesgQueue *mq); -extern s32 LeoRezero(LEOCmd *cmdBlock, OSMesgQueue *mq); -extern s32 LeoReadWrite(LEOCmd *cmdBlock, s32 direction, - u32 LBA, void *vAddr, u32 nLBAs, OSMesgQueue *mq); -extern s32 LeoReadDiskID(LEOCmd *cmdBlock, LEODiskID *vaddr, OSMesgQueue *mq); -extern s32 LeoSetRTC(LEOCmd *cmdBlock, LEODiskTime *RTCdata, OSMesgQueue *mq); -extern s32 LeoReadRTC(LEOCmd *cmdBlock, OSMesgQueue *mq); -extern s32 LeoModeSelectAsync(LEOCmd *cmdBlock, u32 standby, - u32 sleep, OSMesgQueue *mq); - -/* Font routines */ -extern int LeoGetKAdr(int sjis); -extern int LeoGetAAdr(int code,int *dx,int *dy, int *cy); -extern int LeoGetAAdr2(u32 ccode,int *dx,int *dy, int *cy); - -/* Boot function */ -extern void LeoBootGame(void *entry); - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_LEO_H */ diff --git a/include/2.0L/PR/leoappli.h b/include/2.0L/PR/leoappli.h deleted file mode 100644 index 619fbc08..00000000 --- a/include/2.0L/PR/leoappli.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * F i l e N a m e : l e o a p p l i . h - * - **************************************************************************** - * (C) Copyright ALPS Electric Co., Ltd. 1995-1997 - **************************************************************************** - * Version - * - * ver Date - * ---- -------- - * 1.01 '97-11-18 Add MOTOR BRAKE definition for control bit. - **************************************************************************** -*/ -/*-----------------------------------*/ -/* DRIVE PARAMETER */ -/*-----------------------------------*/ -#define LEO_DISK_TYPE_MIN 0 -#define LEO_DISK_TYPE_MAX 6 - -#define LEO_LBA_MIN 0 -#define LEO_LBA_MAX 4291 - -#define LEO_LBA_ROM_TOP LEO_LBA_MIN -#define LEO_LBA_ROM_END0 1417 -#define LEO_LBA_ROM_END1 1965 -#define LEO_LBA_ROM_END2 2513 -#define LEO_LBA_ROM_END3 3061 -#define LEO_LBA_ROM_END4 3609 -#define LEO_LBA_ROM_END5 4087 -#define LEO_LBA_ROM_END6 LEO_LBA_MAX -#define LEO_LBA_RAM_TOP0 (LEO_LBA_ROM_END0+1) -#define LEO_LBA_RAM_TOP1 (LEO_LBA_ROM_END1+1) -#define LEO_LBA_RAM_TOP2 (LEO_LBA_ROM_END2+1) -#define LEO_LBA_RAM_TOP3 (LEO_LBA_ROM_END3+1) -#define LEO_LBA_RAM_TOP4 (LEO_LBA_ROM_END4+1) -#define LEO_LBA_RAM_TOP5 (LEO_LBA_ROM_END5+1) -#define LEO_LBA_RAM_TOP6 (LEO_LBA_ROM_END6+1) -#define LEO_LBA_RAM_END6 LEO_LBA_MAX - -/*-----------------------------------*/ -/* LEO FUNCTION DEFINITIONS */ -/*-----------------------------------*/ -extern void leoInitialize(OSPri PRI_WRK, OSPri PRI_INT, OSMesg *command_que_buf, u32 cmd_buff_size); -extern void leoCommand(void *CDB); -extern void LeoReset(void); -extern s32 LeoResetClear(void); - -/*-----------------------------------*/ -/* THREAD PRIORITY */ -/*-----------------------------------*/ -#define LEO_PRIORITY_WRK (OS_PRIORITY_PIMGR-1) -#define LEO_PRIORITY_INT OS_PRIORITY_PIMGR - -/*-----------------------------------*/ -/* COMMAND CODE */ -/*-----------------------------------*/ -#define LEO_COMMAND_CLEAR_QUE 0x01 -#define LEO_COMMAND_INQUIRY 0x02 -#define LEO_COMMAND_TEST_UNIT_READY 0x03 -#define LEO_COMMAND_REZERO 0x04 -#define LEO_COMMAND_READ 0x05 -#define LEO_COMMAND_WRITE 0x06 -#define LEO_COMMAND_SEEK 0x07 -#define LEO_COMMAND_START_STOP 0x08 -#define LEO_COMMAND_READ_CAPACITY 0x09 -#define LEO_COMMAND_TRANSLATE 0x0a -#define LEO_COMMAND_MODE_SELECT 0x0b -#define LEO_COMMAND_READ_DISK_ID 0x0c -#define LEO_COMMAND_READ_TIMER 0x0d -#define LEO_COMMAND_SET_TIMER 0x0e - -/*-----------------------------------*/ -/* CONTROL BIT */ -/*-----------------------------------*/ -#define LEO_CONTROL_POST 0x80 /* ENABLE POST QUEUE */ -#define LEO_CONTROL_START 0x01 /* START COMMAND */ -#define LEO_CONTROL_STBY 0x02 /* STAND-BY MODE(NOT SLEEP MODE) */ -#define LEO_CONTROL_WRT 0x01 /* READ RE-WRITE-ABLE CAPACITY */ -#define LEO_CONTROL_TBL 0x01 /* TRANSLATE BYTE TO LBA */ -#define LEO_CONTROL_BRAKE 0x04 /* SLEEP MODE(BRAKE ON) */ - -/*-----------------------------------*/ -/* BIT FIELD PARAMETER */ -/*-----------------------------------*/ -#define LEO_TEST_UNIT_MR 0x01 /* MEDIUM REMOVED */ -#define LEO_TEST_UNIT_RE 0x02 /* HEAD RETRACTED */ -#define LEO_TEST_UNIT_SS 0x04 /* SPINDLE STOPPED */ - -/*-----------------------------------*/ -/* STATUS */ -/*-----------------------------------*/ -#define LEO_STATUS_GOOD 0x00 -#define LEO_STATUS_CHECK_CONDITION 0x02 -#define LEO_STATUS_BUSY 0x08 - -/*-----------------------------------*/ -/* SENSE CODE */ -/*-----------------------------------*/ -#define LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION 00 -#define LEO_SENSE_DRIVE_NOT_READY 01 -#define LEO_SENSE_DIAGNOSTIC_FAILURE 02 -#define LEO_SENSE_COMMAND_PHASE_ERROR 03 -#define LEO_SENSE_DATA_PHASE_ERROR 04 -#define LEO_SENSE_REAL_TIME_CLOCK_FAILURE 05 -#define LEO_SENSE_INCOMPATIBLE_MEDIUM_INSTALLED 11 -#define LEO_SENSE_UNKNOWN_FORMAT 11 -#define LEO_SENSE_NO_SEEK_COMPLETE 21 -#define LEO_SENSE_WRITE_FAULT 22 -#define LEO_SENSE_UNRECOVERED_READ_ERROR 23 -#define LEO_SENSE_NO_REFERENCE_POSITION_FOUND 24 -#define LEO_SENSE_TRACK_FOLLOWING_ERROR 25 -#define LEO_SENSE_TRACKING_OR_SPDL_SERVO_FAILURE 25 -#define LEO_SENSE_INVALID_COMMAND_OPERATION_CODE 31 -#define LEO_SENSE_LBA_OUT_OF_RANGE 32 -#define LEO_SENSE_WRITE_PROTECT_ERROR 33 -#define LEO_SENSE_COMMAND_TERMINATED 34 -#define LEO_SENSE_QUEUE_FULL 35 -#define LEO_SENSE_ILLEGAL_TIMER_VALUE 36 -#define LEO_SENSE_WAITING_NMI 37 -#define LEO_SENSE_DEVICE_COMMUNICATION_FAILURE 41 -#define LEO_SENSE_MEDIUM_NOT_PRESENT 42 -#define LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED 43 -#define LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED 47 -#define LEO_SENSE_EJECTED_ILLEGALLY_RESUME 49 - -/*-----------------------------------*/ -/* Command Block Header */ -/*-----------------------------------*/ -typedef struct{ - u8 command; - u8 reserve1; - u8 control; - u8 reserve3; - u8 status; - u8 sense; - u8 reserve6; - u8 reserve7; - OSMesgQueue *post; -} LEOCmdHeader; - -/*-----------------------------------*/ -/* CLEAR QUEUE(01H) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; -} LEOCmdClearQue; - -/*-----------------------------------*/ -/* INQUIRY(02H) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; - u8 dev_type; - u8 version; - u8 dev_num; - u8 leo_bios_ver; - u32 reserve5; -} LEOCmdInquiry; - -/*-----------------------------------*/ -/* TEST UNIT READY(03H) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; - u8 test; - u8 reserve2; - u8 reserve3; - u8 reserve4; -} LEOCmdTestUnitReady; - -/*-----------------------------------*/ -/* REZERO(04H) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; -} LEOCmdRezero; - -/*-----------------------------------*/ -/* READ(05H) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; - u32 lba; - u32 xfer_blks; - void *buff_ptr; - u32 rw_bytes; -} LEOCmdRead; - -/*-----------------------------------*/ -/* WRITE(06H) command */ -/*-----------------------------------*/ -typedef LEOCmdRead LEOCmdWrite; - -/*-----------------------------------*/ -/* SEEK(07H) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; - u32 lba; -} LEOCmdSeek; - -/*-----------------------------------*/ -/* START/STOP(08H) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; -} LEOCmdStartStop; - -/*-----------------------------------*/ -/* READ CAPACITY(09H) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; - u32 start_lba; - u32 end_lba; - u32 capa_bytes; -} LEOCmdReadCapacity; - -/*-----------------------------------*/ -/* TRANSLATE(0AH) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; - u32 start_lba; - u32 in_param; - u32 out_param; -} LEOCmdTranslate; - -/*-----------------------------------*/ -/* MODE SELECT(0BH) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; - u8 page_code; - u8 reserve1; - u8 standby_time; - u8 sleep_time; - u8 led_on_time; - u8 led_off_time; - u8 reserve18; - u8 reserve19; -} LEOCmdModeSelect; - -/*-----------------------------------*/ -/* READ DISK ID(0CH) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; - void *buffer_pointer; -} LEOCmdReadDiskId; - -/*-----------------------------------*/ -/* READ TIMER(0DH) command */ -/*-----------------------------------*/ -typedef struct { - LEOCmdHeader header; - u8 reserve12; - u8 reserve13; - u8 year; - u8 month; - u8 day; - u8 hour; - u8 minute; - u8 second; -} LEOCmdReadTimer; - -/*-----------------------------------*/ -/* SET TIMER(0EH) command */ -/*-----------------------------------*/ -typedef LEOCmdReadTimer LEOCmdSetTimer; - -/*-------end of leoappli.h--------------------------*/ - - diff --git a/include/2.0L/PR/libaudio.h b/include/2.0L/PR/libaudio.h deleted file mode 100644 index 3b77a86c..00000000 --- a/include/2.0L/PR/libaudio.h +++ /dev/null @@ -1,972 +0,0 @@ -/*==================================================================== - * libaudio.h - * - * Copyright 1993, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/************************************************************************** - * - * $Revision: 1.173 $ - * $Date: 1997/12/01 12:42:21 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/libaudio.h,v $ - * - **************************************************************************/ - -#ifndef __LIB_AUDIO__ -#define __LIB_AUDIO__ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include - -/*********************************************************************** - * misc defines - ***********************************************************************/ -#ifndef _EMULATOR -# ifdef AUD_PROFILE - -#define PROFILE_AUD(num, cnt, max, min) \ -{ \ - u32 currCnt = osGetCount(); \ - currCnt -= lastCnt[cnt_index]; \ - cnt_index--; \ - cnt += currCnt; \ - num++; \ - \ - if ( currCnt > max ) max = currCnt; \ - if ( currCnt < min ) min = currCnt; \ -} - -# endif /* AUD_PROFILE */ -#endif /* EMULATOR */ - -#ifndef NULL -#define NULL 0 -#endif - -#define AL_FX_BUFFER_SIZE 8192 -#define AL_FRAME_INIT -1 -#define AL_USEC_PER_FRAME 16000 -#define AL_MAX_PRIORITY 127 -#define AL_GAIN_CHANGE_TIME 1000 - -typedef s32 ALMicroTime; -typedef u8 ALPan; - -#define AL_PAN_CENTER 64 -#define AL_PAN_LEFT 0 -#define AL_PAN_RIGHT 127 -#define AL_VOL_FULL 127 -#define AL_KEY_MIN 0 -#define AL_KEY_MAX 127 -#define AL_DEFAULT_FXMIX 0 -#define AL_SUSTAIN 63 - -/*********************************************************************** - * Error handling - ***********************************************************************/ - -#ifdef _DEBUG -#define ALFailIf(condition, error) \ - if (condition) { \ - __osError(error, 0); \ - return; } - -#else -#define ALFailIf(condition, error) \ - if (condition) { \ - return; } -#endif - -#ifdef _DEBUG -#define ALFlagFailIf(condition, flag, error) \ - if (condition) { \ - if(flag) __osError(error, 0); \ - return; } - -#else -#define ALFlagFailIf(condition, flag, error) \ - if (condition) { \ - return; } -#endif - -/*********************************************************************** - * Audio Library global routines - ***********************************************************************/ -typedef struct ALLink_s { - struct ALLink_s *next; - struct ALLink_s *prev; -} ALLink; - -void alUnlink(ALLink *element); -void alLink(ALLink *element, ALLink *after); - -typedef s32 (*ALDMAproc)(s32 addr, s32 len, void *state); -typedef ALDMAproc (*ALDMANew)(void *state); - -void alCopy(void *src, void *dest, s32 len); - -typedef struct { - u8 *base; - u8 *cur; - s32 len; - s32 count; -} ALHeap; - -#define AL_HEAP_DEBUG 1 -#define AL_HEAP_MAGIC 0x20736a73 -#define AL_HEAP_INIT 0 - -void alHeapInit(ALHeap *hp, u8 *base, s32 len); -void *alHeapDBAlloc(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size); -s32 alHeapCheck(ALHeap *hp); - -#ifdef _DEBUG -#define alHeapAlloc(hp, elem ,size) alHeapDBAlloc((u8 *) __FILE__,__LINE__,(hp),(elem),(size)) -#else -#define alHeapAlloc(hp, elem ,size) alHeapDBAlloc(0, 0,(hp),(elem),(size)) -#endif - -/*********************************************************************** - * FX Stuff - ***********************************************************************/ -#define AL_FX_NONE 0 -#define AL_FX_SMALLROOM 1 -#define AL_FX_BIGROOM 2 -#define AL_FX_CHORUS 3 -#define AL_FX_FLANGE 4 -#define AL_FX_ECHO 5 -#define AL_FX_CUSTOM 6 - -typedef u8 ALFxId; -typedef void *ALFxRef; - -/*********************************************************************** - * data structures for sound banks - ***********************************************************************/ - -#define AL_BANK_VERSION 0x4231 /* 'B1' */ - -/* Possible wavetable types */ -enum {AL_ADPCM_WAVE = 0, - AL_RAW16_WAVE}; - -typedef struct { - s32 order; - s32 npredictors; - s16 book[1]; /* Actually variable size. Must be 8-byte aligned */ -} ALADPCMBook; - -typedef struct { - u32 start; - u32 end; - u32 count; - ADPCM_STATE state; -} ALADPCMloop; - -typedef struct { - u32 start; - u32 end; - u32 count; -} ALRawLoop; - -typedef struct { - ALMicroTime attackTime; - ALMicroTime decayTime; - ALMicroTime releaseTime; - u8 attackVolume; - u8 decayVolume; -} ALEnvelope; - -typedef struct { - u8 velocityMin; - u8 velocityMax; - u8 keyMin; - u8 keyMax; - u8 keyBase; - s8 detune; -} ALKeyMap; - -typedef struct { - ALADPCMloop *loop; - ALADPCMBook *book; -} ALADPCMWaveInfo; - -typedef struct { - ALRawLoop *loop; -} ALRAWWaveInfo; - -typedef struct ALWaveTable_s { - u8 *base; /* ptr to start of wave data */ - s32 len; /* length of data in bytes */ - u8 type; /* compression type */ - u8 flags; /* offset/address flags */ - union { - ALADPCMWaveInfo adpcmWave; - ALRAWWaveInfo rawWave; - } waveInfo; -} ALWaveTable; - -typedef struct ALSound_s { - ALEnvelope *envelope; - ALKeyMap *keyMap; - ALWaveTable *wavetable; /* offset to wavetable struct */ - ALPan samplePan; - u8 sampleVolume; - u8 flags; -} ALSound; - -typedef struct { - u8 volume; /* overall volume for this instrument */ - ALPan pan; /* 0 = hard left, 127 = hard right */ - u8 priority; /* voice priority for this instrument */ - u8 flags; - u8 tremType; /* the type of tremelo osc. to use */ - u8 tremRate; /* the rate of the tremelo osc. */ - u8 tremDepth; /* the depth of the tremelo osc */ - u8 tremDelay; /* the delay for the tremelo osc */ - u8 vibType; /* the type of tremelo osc. to use */ - u8 vibRate; /* the rate of the tremelo osc. */ - u8 vibDepth; /* the depth of the tremelo osc */ - u8 vibDelay; /* the delay for the tremelo osc */ - s16 bendRange; /* pitch bend range in cents */ - s16 soundCount; /* number of sounds in this array */ - ALSound *soundArray[1]; -} ALInstrument; - -typedef struct ALBank_s { - s16 instCount; /* number of programs in this bank */ - u8 flags; - u8 pad; - s32 sampleRate; /* e.g. 44100, 22050, etc... */ - ALInstrument *percussion; /* default percussion for GM */ - ALInstrument *instArray[1]; /* ARRAY of instruments */ -} ALBank; - -typedef struct { /* Note: sizeof won't be correct */ - s16 revision; /* format revision of this file */ - s16 bankCount; /* number of banks */ - ALBank *bankArray[1]; /* ARRAY of bank offsets */ -} ALBankFile; - -void alBnkfNew(ALBankFile *f, u8 *table); - -/*********************************************************************** - * Sequence Files - ***********************************************************************/ -#define AL_SEQBANK_VERSION 'S1' - -typedef struct { - u8 *offset; - s32 len; -} ALSeqData; - -typedef struct { /* Note: sizeof won't be correct */ - s16 revision; /* format revision of this file */ - s16 seqCount; /* number of sequences */ - ALSeqData seqArray[1]; /* ARRAY of sequence info */ -} ALSeqFile; - -void alSeqFileNew(ALSeqFile *f, u8 *base); - -/*********************************************************************** - * Synthesis driver stuff - ***********************************************************************/ -typedef ALMicroTime (*ALVoiceHandler)(void *); - -typedef struct { - s32 maxVVoices; /* obsolete */ - s32 maxPVoices; - s32 maxUpdates; - s32 maxFXbusses; - void *dmaproc; - ALHeap *heap; - s32 outputRate; /* output sample rate */ - ALFxId fxType; - s32 *params; -} ALSynConfig; - -typedef struct ALPlayer_s { - struct ALPlayer_s *next; - void *clientData; /* storage for client callback */ - ALVoiceHandler handler; /* voice handler for player */ - ALMicroTime callTime; /* usec requested callback */ - s32 samplesLeft; /* usec remaining to callback */ -} ALPlayer; - -typedef struct ALVoice_s { - ALLink node; - struct PVoice_s *pvoice; - ALWaveTable *table; - void *clientPrivate; - s16 state; - s16 priority; - s16 fxBus; - s16 unityPitch; -} ALVoice; - -typedef struct ALVoiceConfig_s { - s16 priority; /* voice priority */ - s16 fxBus; /* bus assignment */ - u8 unityPitch; /* unity pitch flag */ -} ALVoiceConfig; - -typedef struct { - ALPlayer *head; /* client list head */ - ALLink pFreeList; /* list of free physical voices */ - ALLink pAllocList; /* list of allocated physical voices */ - ALLink pLameList; /* list of voices ready to be freed */ - s32 paramSamples; - s32 curSamples; /* samples from start of game */ - ALDMANew dma; - ALHeap *heap; - - struct ALParam_s *paramList; - - struct ALMainBus_s *mainBus; - struct ALAuxBus_s *auxBus; /* ptr to array of aux bus structs */ - struct ALFilter_s *outputFilter; /* last filter in the filter chain */ - - s32 numPVoices; - s32 maxAuxBusses; - s32 outputRate; /* output sample rate */ - s32 maxOutSamples; /* Maximum samples rsp can generate - at one time at output rate */ -} ALSynth; - -void alSynNew(ALSynth *s, ALSynConfig *config); -void alSynDelete(ALSynth *s); - -void alSynAddPlayer(ALSynth *s, ALPlayer *client); -void alSynRemovePlayer(ALSynth *s, ALPlayer *client); - -s32 alSynAllocVoice(ALSynth *s, ALVoice *v, ALVoiceConfig *vc); -void alSynFreeVoice(ALSynth *s, ALVoice *voice); - -void alSynStartVoice(ALSynth *s, ALVoice *voice, ALWaveTable *w); -void alSynStartVoiceParams(ALSynth *s, ALVoice *voice, ALWaveTable *w, - f32 pitch, s16 vol, ALPan pan, u8 fxmix, - ALMicroTime t); -void alSynStopVoice(ALSynth *s, ALVoice *voice); - -void alSynSetVol(ALSynth *s, ALVoice *v, s16 vol, ALMicroTime delta); -void alSynSetPitch(ALSynth *s, ALVoice *voice, f32 ratio); -void alSynSetPan(ALSynth *s, ALVoice *voice, ALPan pan); -void alSynSetFXMix(ALSynth *s, ALVoice *voice, u8 fxmix); -void alSynSetPriority(ALSynth *s, ALVoice *voice, s16 priority); -s16 alSynGetPriority(ALSynth *s, ALVoice *voice); - -ALFxRef *alSynAllocFX(ALSynth *s, s16 bus, ALSynConfig *c, ALHeap *hp); -ALFxRef alSynGetFXRef(ALSynth *s, s16 bus, s16 index); -void alSynFreeFX(ALSynth *s, ALFxRef *fx); -void alSynSetFXParam(ALSynth *s, ALFxRef fx, s16 paramID, void *param); - -/*********************************************************************** - * Audio Library (AL) stuff - ***********************************************************************/ -typedef struct { - ALSynth drvr; -} ALGlobals; - -extern ALGlobals *alGlobals; - -void alInit(ALGlobals *glob, ALSynConfig *c); -void alClose(ALGlobals *glob); - -Acmd *alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen); - -/*********************************************************************** - * Sequence Player stuff - ***********************************************************************/ - -/* - * Play states - */ -#define AL_STOPPED 0 -#define AL_PLAYING 1 -#define AL_STOPPING 2 - -#define AL_DEFAULT_PRIORITY 5 -#define AL_DEFAULT_VOICE 0 -#define AL_MAX_CHANNELS 16 - -/* - * Audio Library event type definitions - */ -enum ALMsg { - AL_SEQ_REF_EVT, /* Reference to a pending event in the sequence. */ - AL_SEQ_MIDI_EVT, - AL_SEQP_MIDI_EVT, - AL_TEMPO_EVT, - AL_SEQ_END_EVT, - AL_NOTE_END_EVT, - AL_SEQP_ENV_EVT, - AL_SEQP_META_EVT, - AL_SEQP_PROG_EVT, - AL_SEQP_API_EVT, - AL_SEQP_VOL_EVT, - AL_SEQP_LOOP_EVT, - AL_SEQP_PRIORITY_EVT, - AL_SEQP_SEQ_EVT, - AL_SEQP_BANK_EVT, - AL_SEQP_PLAY_EVT, - AL_SEQP_STOP_EVT, - AL_SEQP_STOPPING_EVT, - AL_TRACK_END, - AL_CSP_LOOPSTART, - AL_CSP_LOOPEND, - AL_CSP_NOTEOFF_EVT, - AL_TREM_OSC_EVT, - AL_VIB_OSC_EVT, - AL_UNK18_EVT -}; - -/* - * Midi event definitions - */ -#define AL_EVTQ_END 0x7fffffff - -enum AL_MIDIstatus { - /* For distinguishing channel number from status */ - AL_MIDI_ChannelMask = 0x0F, - AL_MIDI_StatusMask = 0xF0, - - /* Channel voice messages */ - AL_MIDI_ChannelVoice = 0x80, - AL_MIDI_NoteOff = 0x80, - AL_MIDI_NoteOn = 0x90, - AL_MIDI_PolyKeyPressure = 0xA0, - AL_MIDI_ControlChange = 0xB0, - AL_MIDI_ChannelModeSelect = 0xB0, - AL_MIDI_ProgramChange = 0xC0, - AL_MIDI_ChannelPressure = 0xD0, - AL_MIDI_PitchBendChange = 0xE0, - - /* System messages */ - AL_MIDI_SysEx = 0xF0, /* System Exclusive */ - - /* System common */ - AL_MIDI_SystemCommon = 0xF1, - AL_MIDI_TimeCodeQuarterFrame = 0xF1, - AL_MIDI_SongPositionPointer = 0xF2, - AL_MIDI_SongSelect = 0xF3, - AL_MIDI_Undefined1 = 0xF4, - AL_MIDI_Undefined2 = 0xF5, - AL_MIDI_TuneRequest = 0xF6, - AL_MIDI_EOX = 0xF7, /* End of System Exclusive */ - - /* System real time */ - AL_MIDI_SystemRealTime = 0xF8, - AL_MIDI_TimingClock = 0xF8, - AL_MIDI_Undefined3 = 0xF9, - AL_MIDI_Start = 0xFA, - AL_MIDI_Continue = 0xFB, - AL_MIDI_Stop = 0xFC, - AL_MIDI_Undefined4 = 0xFD, - AL_MIDI_ActiveSensing = 0xFE, - AL_MIDI_SystemReset = 0xFF, - AL_MIDI_Meta = 0xFF /* MIDI Files only */ -}; - -enum AL_MIDIctrl { - AL_MIDI_VOLUME_CTRL = 0x07, - AL_MIDI_PAN_CTRL = 0x0A, - AL_MIDI_PRIORITY_CTRL = 0x10, /* use general purpose controller for priority */ - AL_MIDI_FX_CTRL_0 = 0x14, - AL_MIDI_FX_CTRL_1 = 0x15, - AL_MIDI_FX_CTRL_2 = 0x16, - AL_MIDI_FX_CTRL_3 = 0x17, - AL_MIDI_FX_CTRL_4 = 0x18, - AL_MIDI_FX_CTRL_5 = 0x19, - AL_MIDI_FX_CTRL_6 = 0x1A, - AL_MIDI_FX_CTRL_7 = 0x1B, - AL_MIDI_FX_CTRL_8 = 0x1C, - AL_MIDI_FX_CTRL_9 = 0x1D, - AL_MIDI_SUSTAIN_CTRL = 0x40, - AL_MIDI_FX1_CTRL = 0x5B, - AL_MIDI_FX3_CTRL = 0x5D -}; - -enum AL_MIDImeta { - AL_MIDI_META_TEMPO = 0x51, - AL_MIDI_META_EOT = 0x2f -}; - - -#define AL_CMIDI_BLOCK_CODE 0xFE -#define AL_CMIDI_LOOPSTART_CODE 0x2E -#define AL_CMIDI_LOOPEND_CODE 0x2D -#define AL_CMIDI_CNTRL_LOOPSTART 102 -#define AL_CMIDI_CNTRL_LOOPEND 103 -#define AL_CMIDI_CNTRL_LOOPCOUNT_SM 104 -#define AL_CMIDI_CNTRL_LOOPCOUNT_BIG 105 - -typedef struct { - u8 *curPtr; /* ptr to the next event */ - s32 lastTicks; /* sequence clock ticks (used by alSeqSetLoc) */ - s32 curTicks; /* sequence clock ticks of next event (used by loop end test) */ - s16 lastStatus; /* the last status msg */ -} ALSeqMarker; - -typedef struct { - s32 ticks; /* MIDI, Tempo and End events must start with ticks */ - u8 status; - u8 byte1; - u8 byte2; - u32 duration; -} ALMIDIEvent; - -typedef struct { - s32 ticks; - u8 status; - u8 type; - u8 len; - u8 byte1; - u8 byte2; - u8 byte3; -} ALTempoEvent; - -typedef struct { - s32 ticks; - u8 status; - u8 type; - u8 len; -} ALEndEvent; - -typedef struct { - struct ALVoice_s *voice; -} ALNoteEvent; - -typedef struct { - struct ALVoice_s *voice; - ALMicroTime delta; - u8 vol; -} ALVolumeEvent; - -typedef struct { - s16 vol; -} ALSeqpVolEvent; - -typedef struct { - ALSeqMarker *start; - ALSeqMarker *end; - s32 count; -} ALSeqpLoopEvent; - -typedef struct { - u8 chan; - u8 priority; -} ALSeqpPriorityEvent; - -typedef struct { - void *seq; /* pointer to a seq (could be an ALSeq or an ALCSeq). */ -} ALSeqpSeqEvent; - -typedef struct { - ALBank *bank; -} ALSeqpBankEvent; - -typedef struct { - struct ALVoiceState_s *vs; - void *oscState; - u8 chan; -} ALOscEvent; - -typedef struct { - float unk0; - float unk4; -} ALUnk18Event; - -typedef struct { - struct struct_81_s * unk0; - s32 unk4; -} ALUnk_Core1_3A70_Event; - -typedef struct { - ALVoice voice; - ALSound *sound; /* sound referenced here */ - s16 priority; - f32 pitch; /* current playback pitch */ - s32 state; /* play state for this sound */ - s16 vol; /* volume - combined with volume from bank */ - ALPan pan; /* pan - 0 = left, 127 = right */ - u8 fxMix; /* wet/dry mix - 0 = dry, 127 = wet */ -} ALSoundState; - -typedef struct { - s16 type; - union { - ALMIDIEvent midi; - ALTempoEvent tempo; - ALEndEvent end; - ALNoteEvent note; - ALVolumeEvent vol; - ALSeqpLoopEvent loop; - ALSeqpVolEvent spvol; - ALSeqpPriorityEvent sppriority; - ALSeqpSeqEvent spseq; - ALSeqpBankEvent spbank; - ALOscEvent osc; - ALUnk18Event unk18; - ALUnk_Core1_3A70_Event unk3A70; - } msg; -} ALEvent; - -typedef struct { - ALLink node; - ALMicroTime delta; - ALEvent evt; -} ALEventListItem; - -typedef struct { - ALLink freeList; - ALLink allocList; - s32 eventCount; -} ALEventQueue; - -void alEvtqNew(ALEventQueue *evtq, ALEventListItem *items, - s32 itemCount); -ALMicroTime alEvtqNextEvent(ALEventQueue *evtq, ALEvent *evt); -void alEvtqPostEvent(ALEventQueue *evtq, ALEvent *evt, - ALMicroTime delta); -void alEvtqFlush(ALEventQueue *evtq); -void alEvtqFlushType(ALEventQueue *evtq, s16 type); - - -#define AL_PHASE_ATTACK 0 -#define AL_PHASE_NOTEON 0 -#define AL_PHASE_DECAY 1 -#define AL_PHASE_SUSTAIN 2 -#define AL_PHASE_RELEASE 3 -#define AL_PHASE_SUSTREL 4 - -typedef struct ALVoiceState_s { - struct ALVoiceState_s *next;/* MUST be first */ - ALVoice voice; - ALSound *sound; - ALMicroTime envEndTime; /* time of envelope segment end */ - f32 pitch; /* currect pitch ratio */ - f32 vibrato; /* current value of the vibrato */ - u8 envGain; /* current envelope gain */ - u8 channel; /* channel assignment */ - u8 key; /* note on key number */ - u8 velocity; /* note on velocity */ - u8 envPhase; /* what envelope phase */ - u8 phase; - u8 tremelo; /* current value of the tremelo */ - u8 flags; /* bit 0 tremelo flag - bit 1 vibrato flag */ -} ALVoiceState; - -typedef struct { - ALInstrument *instrument; /* instrument assigned to this chan */ - s16 bendRange; /* pitch bend range in cents */ - ALFxId fxId; /* type of fx assigned to this chan */ - ALPan pan; /* overall pan for this chan */ - u8 priority; /* priority for this chan */ - u8 vol; /* current volume for this chan */ - u8 unkA; - u8 fxmix; /* current fx mix for this chan */ - u8 sustain; /* current sustain pedal state */ - f32 pitchBend; /* current pitch bend val in cents */ -} ALChanState; - -typedef struct ALSeq_s { - u8 *base; /* ptr to start of sequence file */ - u8 *trackStart; /* ptr to first MIDI event */ - u8 *curPtr; /* ptr to next event to read */ - s32 lastTicks; /* MIDI ticks for last event */ - s32 len; /* length of sequence in bytes */ - f32 qnpt; /* qrter notes / tick (1/division) */ - s16 division; /* ticks per quarter note */ - s16 lastStatus; /* for running status */ -} ALSeq; - -typedef struct { - u32 trackOffset[16]; - u32 division; -} ALCMidiHdr; - -typedef struct ALCSeq_s { - ALCMidiHdr *base; /* ptr to start of sequence file */ - u32 validTracks; /* set of flags, showing valid tracks */ - f32 qnpt; /* qrter notes / tick (1/division) */ - u32 lastTicks; /* keep track of ticks incase app wants */ - u32 lastDeltaTicks; /* number of delta ticks of last event */ - u32 deltaFlag; /* flag: set if delta's not subtracted */ - u8 *curLoc[16]; /* ptr to current track location, */ - /* may point to next event, or may point */ - /* to a backup code */ - u8 *curBUPtr[16]; /* ptr to next event if in backup mode */ - u8 curBULen[16]; /* if > 0, then in backup mode */ - u8 lastStatus[16]; /* for running status */ - u32 evtDeltaTicks[16]; /* delta time to next event */ -} ALCSeq; - -typedef struct { - u32 validTracks; - s32 lastTicks; - u32 lastDeltaTicks; - u8 *curLoc[16]; - u8 *curBUPtr[16]; - u8 curBULen[16]; - u8 lastStatus[16]; - u32 evtDeltaTicks[16]; -} ALCSeqMarker; - -#define NO_SOUND_ERR_MASK 0x01 -#define NOTE_OFF_ERR_MASK 0x02 -#define NO_VOICE_ERR_MASK 0x04 - -typedef struct { - s32 maxVoices; /* max number of voices to alloc */ - s32 maxEvents; /* max internal events to support */ - u8 maxChannels; /* max MIDI channels to support (16)*/ - u8 debugFlags; /* control which error get reported */ - ALHeap *heap; /* ptr to initialized heap */ - void *initOsc; - void *updateOsc; - void *stopOsc; -} ALSeqpConfig; - -typedef ALMicroTime (*ALOscInit)(void **oscState,f32 *initVal, u8 oscType, - u8 oscRate, u8 oscDepth, u8 oscDelay); -typedef ALMicroTime (*ALOscUpdate)(void *oscState, f32 *updateVal); -typedef void (*ALOscStop)(void *oscState); - -typedef struct { - ALPlayer node; /* note: must be first in structure */ - ALSynth *drvr; /* reference to the client driver */ - ALSeq *target; /* current sequence */ - ALMicroTime curTime; - ALBank *bank; /* current ALBank */ - s32 uspt; /* microseconds per tick */ - s32 nextDelta; /* microseconds to next callback */ - s32 state; - u16 chanMask; /* active channels */ - s16 vol; /* overall sequence volume */ - u8 maxChannels; /* number of MIDI channels */ - u8 debugFlags; /* control which error get reported */ - ALEvent nextEvent; - ALEventQueue evtq; - ALMicroTime frameTime; - ALChanState *chanState; /* 16 channels for MIDI */ - ALVoiceState *vAllocHead; /* list head for allocated voices */ - ALVoiceState *vAllocTail; /* list tail for allocated voices */ - ALVoiceState *vFreeList; /* list of free voice state structs */ - ALOscInit initOsc; - ALOscUpdate updateOsc; - ALOscStop stopOsc; - ALSeqMarker *loopStart; - ALSeqMarker *loopEnd; - s32 loopCount; /* -1 = loop forever, 0 = no loop */ -} ALSeqPlayer; - -typedef struct { - ALPlayer node; /* note: must be first in structure */ - ALSynth *drvr; /* reference to the client driver */ - ALCSeq *target; /* current sequence */ - ALMicroTime curTime; - ALBank *bank; /* current ALBank */ - s32 uspt; /* microseconds per tick */ - s32 nextDelta; /* microseconds to next callback */ - s32 state; - u16 chanMask; /* active channels */ - s16 vol; /* overall sequence volume */ - u8 maxChannels; /* number of MIDI channels */ - u8 debugFlags; /* control which error get reported */ - ALEvent nextEvent; - ALEventQueue evtq; - ALMicroTime frameTime; - ALChanState *chanState; /* 16 channels for MIDI */ - ALVoiceState *vAllocHead; /* list head for allocated voices */ - ALVoiceState *vAllocTail; /* list tail for allocated voices */ - ALVoiceState *vFreeList; /* list of free voice state structs */ - ALOscInit initOsc; - ALOscUpdate updateOsc; - ALOscStop stopOsc; -} ALCSPlayer; - -/* - * Sequence data representation routines - */ -void alSeqNew(ALSeq *seq, u8 *ptr, s32 len); -void alSeqNextEvent(ALSeq *seq, ALEvent *event); -s32 alSeqGetTicks(ALSeq *seq); -f32 alSeqTicksToSec(ALSeq *seq, s32 ticks, u32 tempo); -u32 alSeqSecToTicks(ALSeq *seq, f32 sec, u32 tempo); -void alSeqNewMarker(ALSeq *seq, ALSeqMarker *m, u32 ticks); -void alSeqSetLoc(ALSeq *seq, ALSeqMarker *marker); -void alSeqGetLoc(ALSeq *seq, ALSeqMarker *marker); -/* - * Compact Sequence data representation routines - */ -void alCSeqNew(ALCSeq *seq, u8 *ptr); -void alCSeqNextEvent(ALCSeq *seq,ALEvent *evt); -s32 alCSeqGetTicks(ALCSeq *seq); -f32 alCSeqTicksToSec(ALCSeq *seq, s32 ticks, u32 tempo); -u32 alCSeqSecToTicks(ALCSeq *seq, f32 sec, u32 tempo); -void alCSeqNewMarker(ALCSeq *seq, ALCSeqMarker *m, u32 ticks); -void alCSeqSetLoc(ALCSeq *seq, ALCSeqMarker *marker); -void alCSeqGetLoc(ALCSeq *seq, ALCSeqMarker *marker); - -/* - * Sequence Player routines - */ -f32 alCents2Ratio(s32 cents); - -void alSeqpNew(ALSeqPlayer *seqp, ALSeqpConfig *config); -void alSeqpDelete(ALSeqPlayer *seqp); -void alSeqpSetSeq(ALSeqPlayer *seqp, ALSeq *seq); -ALSeq *alSeqpGetSeq(ALSeqPlayer *seqp); -void alSeqpPlay(ALSeqPlayer *seqp); -void alSeqpStop(ALSeqPlayer *seqp); -s32 alSeqpGetState(ALSeqPlayer *seqp); -void alSeqpSetBank(ALSeqPlayer *seqp, ALBank *b); -void alSeqpSetTempo(ALSeqPlayer *seqp, s32 tempo); -s32 alSeqpGetTempo(ALSeqPlayer *seqp); -s16 alSeqpGetVol(ALSeqPlayer *seqp); /* Master volume control */ -void alSeqpSetVol(ALSeqPlayer *seqp, s16 vol); -void alSeqpLoop(ALSeqPlayer *seqp, ALSeqMarker *start, ALSeqMarker *end, s32 count); - -void alSeqpSetChlProgram(ALSeqPlayer *seqp, u8 chan, u8 prog); -s32 alSeqpGetChlProgram(ALSeqPlayer *seqp, u8 chan); -void alSeqpSetChlFXMix(ALSeqPlayer *seqp, u8 chan, u8 fxmix); -u8 alSeqpGetChlFXMix(ALSeqPlayer *seqp, u8 chan); -void alSeqpSetChlVol(ALSeqPlayer *seqp, u8 chan, u8 vol); -u8 alSeqpGetChlVol(ALSeqPlayer *seqp, u8 chan); -void alSeqpSetChlPan(ALSeqPlayer *seqp, u8 chan, ALPan pan); -ALPan alSeqpGetChlPan(ALSeqPlayer *seqp, u8 chan); -void alSeqpSetChlPriority(ALSeqPlayer *seqp, u8 chan, u8 priority); -u8 alSeqpGetChlPriority(ALSeqPlayer *seqp, u8 chan); -void alSeqpSendMidi(ALSeqPlayer *seqp, s32 ticks, u8 status, u8 byte1, u8 byte2); - - -/* Maintain backwards compatibility with old routine names. */ -#define alSeqpSetProgram alSeqpSetChlProgram -#define alSeqpGetProgram alSeqpGetChlProgram -#define alSeqpSetFXMix alSeqpSetChlFXMix -#define alSeqpGetFXMix alSeqpGetChlFXMix -#define alSeqpSetPan alSeqpSetChlPan -#define alSeqpGetPan alSeqpGetChlPan -#define alSeqpSetChannelPriority alSeqpSetChlPriority -#define alSeqpGetChannelPriority alSeqpGetChlPriority - - - -/* - * Compressed Sequence Player routines - */ -void alCSPNew(ALCSPlayer *seqp, ALSeqpConfig *config); -void alCSPDelete(ALCSPlayer *seqp); -void alCSPSetSeq(ALCSPlayer *seqp, ALCSeq *seq); -ALCSeq *alCSPGetSeq(ALCSPlayer *seqp); -void alCSPPlay(ALCSPlayer *seqp); -void alCSPStop(ALCSPlayer *seqp); -s32 alCSPGetState(ALCSPlayer *seqp); -void alCSPSetBank(ALCSPlayer *seqp, ALBank *b); -void alCSPSetTempo(ALCSPlayer *seqp, s32 tempo); -s32 alCSPGetTempo(ALCSPlayer *seqp); -s16 alCSPGetVol(ALCSPlayer *seqp); -void alCSPSetVol(ALCSPlayer *seqp, s16 vol); - -void alCSPSetChlProgram(ALCSPlayer *seqp, u8 chan, u8 prog); -s32 alCSPGetChlProgram(ALCSPlayer *seqp, u8 chan); -void alCSPSetChlFXMix(ALCSPlayer *seqp, u8 chan, u8 fxmix); -u8 alCSPGetChlFXMix(ALCSPlayer *seqp, u8 chan); -void alCSPSetChlPan(ALCSPlayer *seqp, u8 chan, ALPan pan); -ALPan alCSPGetChlPan(ALCSPlayer *seqp, u8 chan); -void alCSPSetChlVol(ALCSPlayer *seqp, u8 chan, u8 vol); -u8 alCSPGetChlVol(ALCSPlayer *seqp, u8 chan); -void alCSPSetChlPriority(ALCSPlayer *seqp, u8 chan, u8 priority); -u8 alCSPGetChlPriority(ALCSPlayer *seqp, u8 chan); -void alCSPSendMidi(ALCSPlayer *seqp, s32 ticks, u8 status, - u8 byte1, u8 byte2); - - -/* Maintain backwards compatibility with old routine names. */ -#define alCSPSetProgram alCSPSetChlProgram -#define alCSPGetProgram alCSPGetChlProgram -#define alCSPSetFXMix alCSPSetChlFXMix -#define alCSPGetFXMix alCSPGetChlFXMix -#define alCSPSetPan alCSPSetChlPan -#define alCSPGetPan alCSPGetChlPan -#define alCSPSetChannelPriority alCSPSetChlPriority -#define alCSPGetChannelPriority alCSPGetChlPriority - - - -/*********************************************************************** - * Sound Player stuff - ***********************************************************************/ - -typedef struct { - s32 maxSounds; - s32 maxEvents; - ALHeap *heap; -} ALSndpConfig; - -typedef struct { - ALPlayer node; /* note: must be first in structure */ - ALEventQueue evtq; - ALEvent nextEvent; - ALSynth *drvr; /* reference to the client driver */ - s32 target; - void *sndState; - s32 maxSounds; - ALMicroTime frameTime; - ALMicroTime nextDelta; /* microseconds to next callback */ - ALMicroTime curTime; -} ALSndPlayer; - -typedef s16 ALSndId; - -void alSndpNew(ALSndPlayer *sndp, ALSndpConfig *c); -void alSndpDelete(ALSndPlayer *sndp); - -ALSndId alSndpAllocate(ALSndPlayer *sndp, ALSound *sound); -void alSndpDeallocate(ALSndPlayer *sndp, ALSndId id); - -void alSndpSetSound(ALSndPlayer *sndp, ALSndId id); -ALSndId alSndpGetSound(ALSndPlayer *sndp); - -void alSndpPlay(ALSndPlayer *sndp); -void alSndpPlayAt(ALSndPlayer *sndp, ALMicroTime delta); -void alSndpStop(ALSndPlayer *sndp); - -void alSndpSetVol(ALSndPlayer *sndp, s16 vol); -void alSndpSetPitch(ALSndPlayer *sndp, f32 pitch); -void alSndpSetPan(ALSndPlayer *sndp, ALPan pan); -void alSndpSetPriority(ALSndPlayer *sndp, ALSndId id, u8 priority); - -void alSndpSetFXMix(ALSndPlayer *sndp, u8 mix); -s32 alSndpGetState(ALSndPlayer *sndp); - -#ifndef _FINALROM -void alParseAbiCL(Acmd *cmdList, u32 nbytes); -#endif -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !__LIB_AUDIO__ */ - - - diff --git a/include/2.0L/PR/mbi.h b/include/2.0L/PR/mbi.h deleted file mode 100644 index ac900a54..00000000 --- a/include/2.0L/PR/mbi.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef _MBI_H_ -#define _MBI_H_ - -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * $Revision: 1.136 $ - * $Date: 1999/01/05 13:04:00 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/mbi.h,v $ - * - **************************************************************************/ - -/* - * Header file for the Media Binary Interface - * - * NOTE: This file is included by the RSP microcode, so any C-specific - * constructs must be bracketed by #ifdef _LANGUAGE_C - * - */ - - -/* - * the SHIFT macros are used to build display list commands, inserting - * bit-fields into a 32-bit word. They take a value, a shift amount, - * and a width. - * - * For the left shift, the lower bits of the value are masked, - * then shifted left. - * - * For the right shift, the value is shifted right, then the lower bits - * are masked. - * - * (NOTE: _SHIFTL(v, 0, 32) won't work, just use an assignment) - * - */ -#define _SHIFTL(v, s, w) \ - ((unsigned int) (((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s))) -#define _SHIFTR(v, s, w) \ - ((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1))) - -#define _SHIFT _SHIFTL /* old, for compatibility only */ - -#define G_ON (1) -#define G_OFF (0) - -/************************************************************************** - * - * Graphics Binary Interface - * - **************************************************************************/ - -#include - -/************************************************************************** - * - * Audio Binary Interface - * - **************************************************************************/ - -#include - -/************************************************************************** - * - * Task list - * - **************************************************************************/ - -#define M_GFXTASK 1 -#define M_AUDTASK 2 -#define M_VIDTASK 3 -#define M_HVQTASK 6 -#define M_HVQMTASK 7 - -/************************************************************************** - * - * Segment macros and definitions - * - **************************************************************************/ - -#define NUM_SEGMENTS (16) -#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff) -#define SEGMENT_NUMBER(a) (((unsigned int)(a) << 4) >> 28) -#define SEGMENT_ADDR(num, off) (((num) << 24) + (off)) - -#ifndef NULL -#define NULL 0 -#endif - -#endif /* !_MBI_H_ */ diff --git a/include/2.0L/PR/os.h b/include/2.0L/PR/os.h deleted file mode 100644 index 4b52dfb2..00000000 --- a/include/2.0L/PR/os.h +++ /dev/null @@ -1,108 +0,0 @@ - -/*==================================================================== - * os.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os.h,v $ - $Revision: 1.168 $ - $Date: 2000/06/15 06:24:52 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_H_ -#define _OS_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -/************************************************************************** - * - * Global definitions - * - */ - -/* - * Stack size for I/O device managers: PIM (PI Manager), VIM (VI Manager), - * SIM (SI Manager) - * - */ -#define OS_PIM_STACKSIZE 4096 -#define OS_VIM_STACKSIZE 4096 -#define OS_SIM_STACKSIZE 4096 - -#define OS_MIN_STACKSIZE 72 - -/* - * Leo Disk - */ - -/* transfer mode */ - -#define LEO_BLOCK_MODE 1 -#define LEO_TRACK_MODE 2 -#define LEO_SECTOR_MODE 3 - -/* - * Boot addresses - */ -#define BOOT_ADDRESS_ULTRA 0x80000400 -#define BOOT_ADDRESS_COSIM 0x80002000 -#define BOOT_ADDRESS_EMU 0x20010000 -#define BOOT_ADDRESS_INDY 0x88100000 - - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_H */ diff --git a/include/2.0L/PR/os_ai.h b/include/2.0L/PR/os_ai.h deleted file mode 100644 index f89d87cf..00000000 --- a/include/2.0L/PR/os_ai.h +++ /dev/null @@ -1,92 +0,0 @@ - -/*==================================================================== - * os_ai.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_ai.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:04 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_AI_H_ -#define _OS_AI_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Audio interface (Ai) */ -extern u32 osAiGetStatus(void); -extern u32 osAiGetLength(void); -extern s32 osAiSetFrequency(u32); -extern s32 osAiSetNextBuffer(void *, u32); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_AI_H_ */ diff --git a/include/2.0L/PR/os_cache.h b/include/2.0L/PR/os_cache.h deleted file mode 100644 index 54ed9230..00000000 --- a/include/2.0L/PR/os_cache.h +++ /dev/null @@ -1,96 +0,0 @@ - -/*==================================================================== - * os_cache.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_cache.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:04 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_CACHE_H_ -#define _OS_CACHE_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - -#define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10)) -#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10)) - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Cache operations and macros */ - -extern void osInvalDCache(void *, s32); -extern void osInvalICache(void *, s32); -extern void osWritebackDCache(void *, s32); -extern void osWritebackDCacheAll(void); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_CACHE_H_ */ diff --git a/include/2.0L/PR/os_cont.h b/include/2.0L/PR/os_cont.h deleted file mode 100644 index 2754f250..00000000 --- a/include/2.0L/PR/os_cont.h +++ /dev/null @@ -1,207 +0,0 @@ - -/*==================================================================== - * os_cont.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_cont.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:05 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_CONT_H_ -#define _OS_CONT_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include "os_message.h" - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -/* - * Structure for controllers - */ - -typedef struct { - u16 type; /* Controller Type */ - u8 status; /* Controller status */ - u8 errno; -}OSContStatus; - -typedef struct { - u16 button; - s8 stick_x; /* -80 <= stick_x <= 80 */ - s8 stick_y; /* -80 <= stick_y <= 80 */ - u8 errno; -} OSContPad; - -typedef struct { - void *address; /* Ram pad Address: 11 bits */ - u8 databuffer[32]; /* address of the data buffer */ - u8 addressCrc; /* CRC code for address */ - u8 dataCrc; /* CRC code for data */ - u8 errno; -} OSContRamIo; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* - * Controllers number - */ - -#ifndef _HW_VERSION_1 -#define MAXCONTROLLERS 4 -#else -#define MAXCONTROLLERS 6 -#endif - -/* controller errors */ -#define CONT_NO_RESPONSE_ERROR 0x8 -#define CONT_OVERRUN_ERROR 0x4 -#ifdef _HW_VERSION_1 -#define CONT_FRAME_ERROR 0x2 -#define CONT_COLLISION_ERROR 0x1 -#endif - -/* Controller type */ - -#define CONT_ABSOLUTE 0x0001 -#define CONT_RELATIVE 0x0002 -#define CONT_JOYPORT 0x0004 -#define CONT_EEPROM 0x8000 -#define CONT_EEP16K 0x4000 -#define CONT_TYPE_MASK 0x1f07 -#define CONT_TYPE_NORMAL 0x0005 -#define CONT_TYPE_MOUSE 0x0002 -#define CONT_TYPE_VOICE 0x0100 - -/* Controller status */ - -#define CONT_CARD_ON 0x01 -#define CONT_CARD_PULL 0x02 -#define CONT_ADDR_CRC_ER 0x04 -#define CONT_EEPROM_BUSY 0x80 - -/* Buttons */ - -#define CONT_A 0x8000 -#define CONT_B 0x4000 -#define CONT_G 0x2000 -#define CONT_START 0x1000 -#define CONT_UP 0x0800 -#define CONT_DOWN 0x0400 -#define CONT_LEFT 0x0200 -#define CONT_RIGHT 0x0100 -#define CONT_L 0x0020 -#define CONT_R 0x0010 -#define CONT_E 0x0008 -#define CONT_D 0x0004 -#define CONT_C 0x0002 -#define CONT_F 0x0001 - -/* Nintendo's official button names */ - -#define A_BUTTON CONT_A -#define B_BUTTON CONT_B -#define L_TRIG CONT_L -#define R_TRIG CONT_R -#define Z_TRIG CONT_G -#define START_BUTTON CONT_START -#define U_JPAD CONT_UP -#define L_JPAD CONT_LEFT -#define R_JPAD CONT_RIGHT -#define D_JPAD CONT_DOWN -#define U_CBUTTONS CONT_E -#define L_CBUTTONS CONT_C -#define R_CBUTTONS CONT_F -#define D_CBUTTONS CONT_D - -/* Controller error number */ - -#define CONT_ERR_NO_CONTROLLER PFS_ERR_NOPACK /* 1 */ -#define CONT_ERR_CONTRFAIL CONT_OVERRUN_ERROR /* 4 */ -#define CONT_ERR_INVALID PFS_ERR_INVALID /* 5 */ -#define CONT_ERR_DEVICE PFS_ERR_DEVICE /* 11 */ -#define CONT_ERR_NOT_READY 12 -#define CONT_ERR_VOICE_MEMORY 13 -#define CONT_ERR_VOICE_WORD 14 -#define CONT_ERR_VOICE_NO_RESPONSE 15 - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Controller interface */ - -extern s32 osContInit(OSMesgQueue *, u8 *, OSContStatus *); -extern s32 osContReset(OSMesgQueue *, OSContStatus *); -extern s32 osContStartQuery(OSMesgQueue *); -extern s32 osContStartReadData(OSMesgQueue *); -#ifndef _HW_VERSION_1 -extern s32 osContSetCh(u8); -#endif -extern void osContGetQuery(OSContStatus *); -extern void osContGetReadData(OSContPad *); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_CONT_H_ */ diff --git a/include/2.0L/PR/os_convert.h b/include/2.0L/PR/os_convert.h deleted file mode 100644 index 0a5da10a..00000000 --- a/include/2.0L/PR/os_convert.h +++ /dev/null @@ -1,111 +0,0 @@ - -/*==================================================================== - * os_convert.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_convert.h,v $ - $Revision: 1.2 $ - $Date: 1999/04/21 02:53:11 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_CONVERT_H_ -#define _OS_CONVERT_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -#define OS_CLOCK_RATE 62500000LL -#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4) - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - -#define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625000LL))/(1000000000LL/15625000LL)) -#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL)) -#define OS_CYCLES_TO_NSEC(c) (((u64)(c)*(1000000000LL/15625000LL))/(OS_CPU_COUNTER/15625000LL)) -#define OS_CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(OS_CPU_COUNTER/15625LL)) - -/* OS_K?_TO_PHYSICAL macro bug fix for CodeWarrior */ -#ifndef __MWERKS__ -#define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000)) -#define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000)) -#else -#define OS_K0_TO_PHYSICAL(x) ((char *)(x)-0x80000000) -#define OS_K1_TO_PHYSICAL(x) ((char *)(x)-0xa0000000) -#endif - -#define OS_PHYSICAL_TO_K0(x) (void *)(((u32)(x)+0x80000000)) -#define OS_PHYSICAL_TO_K1(x) (void *)(((u32)(x)+0xa0000000)) - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Address translation routines and macros */ - -extern u32 osVirtualToPhysical(void *); -extern void * osPhysicalToVirtual(u32); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_CONVERT_H_ */ diff --git a/include/2.0L/PR/os_debug.h b/include/2.0L/PR/os_debug.h deleted file mode 100644 index f8f5a89a..00000000 --- a/include/2.0L/PR/os_debug.h +++ /dev/null @@ -1,117 +0,0 @@ - -/*==================================================================== - * os_debug.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_debug.h,v $ - $Revision: 1.4 $ - $Date: 1999/06/30 03:04:08 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_DEBUG_H_ -#define _OS_DEBUG_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -/* - * Structure for Profiler - */ -typedef struct { - u16 *histo_base; /* histogram base */ - u32 histo_size; /* histogram size */ - u32 *text_start; /* start of text segment */ - u32 *text_end; /* end of text segment */ -} OSProf; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* - * Profiler constants - */ -#define PROF_MIN_INTERVAL 50 /* microseconds */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Profiler Interface */ - -extern void osProfileInit(OSProf *, u32 profcnt); -extern void osProfileStart(u32); -extern void osProfileFlush(void); -extern void osProfileStop(void); - -/* Thread Profiler Interface */ -extern void osThreadProfileClear(OSId); -extern void osThreadProfileInit(void); -extern void osThreadProfileStart(void); -extern void osThreadProfileStop(void); -extern u32 osThreadProfileReadCount(OSId); -extern u32 osThreadProfileReadCountTh(OSThread*); -extern OSTime osThreadProfileReadTime(OSId); -extern OSTime osThreadProfileReadTimeTh(OSThread*); - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_DEBUG_H_ */ diff --git a/include/2.0L/PR/os_eeprom.h b/include/2.0L/PR/os_eeprom.h deleted file mode 100644 index b3bca814..00000000 --- a/include/2.0L/PR/os_eeprom.h +++ /dev/null @@ -1,107 +0,0 @@ - -/*==================================================================== - * os_eeprom.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_eeprom.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:06 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_EEPROM_H_ -#define _OS_EEPROM_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include "os_message.h" - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* EEPROM TYPE */ - -#define EEPROM_TYPE_4K 0x01 -#define EEPROM_TYPE_16K 0x02 - -/* definition for EEPROM */ - -#define EEPROM_MAXBLOCKS 64 -#define EEP16K_MAXBLOCKS 256 -#define EEPROM_BLOCK_SIZE 8 - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* EEPROM interface */ - -extern s32 osEepromProbe(OSMesgQueue *); -extern s32 osEepromRead(OSMesgQueue *, u8, u8 *); -extern s32 osEepromWrite(OSMesgQueue *, u8, u8 *); -extern s32 osEepromLongRead(OSMesgQueue *, u8, u8 *, int); -extern s32 osEepromLongWrite(OSMesgQueue *, u8, u8 *, int); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_EEPROM_H_ */ diff --git a/include/2.0L/PR/os_error.h b/include/2.0L/PR/os_error.h deleted file mode 100644 index f4c3b83c..00000000 --- a/include/2.0L/PR/os_error.h +++ /dev/null @@ -1,86 +0,0 @@ - -/*==================================================================== - * os_error.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_error.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:06 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_ERROR_H_ -#define _OS_ERROR_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_ERROR_H_ */ diff --git a/include/2.0L/PR/os_exception.h b/include/2.0L/PR/os_exception.h deleted file mode 100644 index 245e5e69..00000000 --- a/include/2.0L/PR/os_exception.h +++ /dev/null @@ -1,119 +0,0 @@ - -/*==================================================================== - * os_exception.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_exception.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:07 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_EXCEPTION_H_ -#define _OS_EXCEPTION_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -typedef u32 OSIntMask; -typedef u32 OSHWIntr; - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* Flags for debugging purpose */ - -#define OS_FLAG_CPU_BREAK 1 /* Break exception has occurred */ -#define OS_FLAG_FAULT 2 /* CPU fault has occurred */ - -/* Interrupt masks */ - -#define OS_IM_NONE 0x00000001 -#define OS_IM_SW1 0x00000501 -#define OS_IM_SW2 0x00000601 -#define OS_IM_CART 0x00000c01 -#define OS_IM_PRENMI 0x00001401 -#define OS_IM_RDBWRITE 0x00002401 -#define OS_IM_RDBREAD 0x00004401 -#define OS_IM_COUNTER 0x00008401 -#define OS_IM_CPU 0x0000ff01 -#define OS_IM_SP 0x00010401 -#define OS_IM_SI 0x00020401 -#define OS_IM_AI 0x00040401 -#define OS_IM_VI 0x00080401 -#define OS_IM_PI 0x00100401 -#define OS_IM_DP 0x00200401 -#define OS_IM_ALL 0x003fff01 -#define RCP_IMASK 0x003f0000 -#define RCP_IMASKSHIFT 16 - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Interrupt operations */ - -extern OSIntMask osGetIntMask(void); -extern OSIntMask osSetIntMask(OSIntMask); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_EXCEPTION_H_ */ diff --git a/include/2.0L/PR/os_flash.h b/include/2.0L/PR/os_flash.h deleted file mode 100644 index 4e0a129b..00000000 --- a/include/2.0L/PR/os_flash.h +++ /dev/null @@ -1,71 +0,0 @@ -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. - - $RCSfile: os_flash.h,v $ - $Revision: 1.1 $ - $Date: 2000/06/15 06:24:55 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_FLASH_H_ -#define _OS_FLASH_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* - * defines for FLASH - */ -#define FLASH_START_ADDR 0x08000000 - -#define FLASH_SIZE 0x20000 -#define FLASH_LATENCY 0x5 -#define FLASH_PULSE 0x0c -#define FLASH_PAGE_SIZE 0xf -#define FLASH_REL_DURATION 0x2 -#define DEVICE_TYPE_FLASH 8 - -#define FLASH_VERSION_MX_PROTO_A 0x00c20000 -#define FLASH_VERSION_MX_A 0x00c20001 -#define FLASH_VERSION_MX_C 0x00c2001e -#define FLASH_VERSION_MX_B_AND_D 0x00c2001d -#define FLASH_VERSION_MEI 0x003200f1 - -#define OLD_FLASH 0 -#define NEW_FLASH 1 -/* OLD_FLASH is MX_PROTO_A, MX_A and MX_C */ -/* NEW_FLASH is MX_B_AND_D and MATSUSHITA flash */ - -#define FLASH_STATUS_ERASE_BUSY 2 -#define FLASH_STATUS_ERASE_ERROR -1 -#define FLASH_STATUS_ERASE_OK 0 - -extern OSPiHandle *osFlashReInit(u8 latency, u8 pulse, - u8 page_size, u8 rel_duration, u32 start); -extern OSPiHandle *osFlashInit(void); -extern void osFlashReadStatus(u8 *flash_status); -extern void osFlashReadId(u32 *flash_type, u32 *flash_maker); -extern void osFlashClearStatus(void); -extern s32 osFlashAllErase(void); -extern s32 osFlashSectorErase(u32 page_num); -extern s32 osFlashWriteBuffer(OSIoMesg *mb, s32 priority, - void *dramAddr, OSMesgQueue *mq); -extern s32 osFlashWriteArray(u32 page_num); -extern s32 osFlashReadArray(OSIoMesg *mb, s32 priority, u32 page_num, - void *dramAddr, u32 n_pages, OSMesgQueue *mq); -extern void osFlashChange(u32 flash_num); -extern void osFlashAllEraseThrough(void); -extern void osFlashSectorEraseThrough(u32 page_num); -extern s32 osFlashCheckEraseEnd(void); - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_FLASH_H_ */ diff --git a/include/2.0L/PR/os_gbpak.h b/include/2.0L/PR/os_gbpak.h deleted file mode 100644 index 0a999945..00000000 --- a/include/2.0L/PR/os_gbpak.h +++ /dev/null @@ -1,107 +0,0 @@ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. - - $RCSfile: os_gbpak.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:07 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_GBPAK_H_ -#define _OS_GBPAK_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include "os_message.h" -#include "os_pfs.h" - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -typedef struct { - u16 fixed1; - u16 start_address; - u8 nintendo_chr[0x30]; - u8 game_title[16]; - u16 company_code; - u8 body_code; - u8 cart_type; - u8 rom_size; - u8 ram_size; - u8 country_code; - u8 fixed2; - u8 version; - u8 isum; - u16 sum; -} OSGbpakId; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* definition for 64GB-PAK */ - -#define OS_GBPAK_POWER 0x01 -#define OS_GBPAK_RSTB_DETECTION 0x04 -#define OS_GBPAK_RSTB_STATUS 0x08 -#define OS_GBPAK_GBCART_PULL 0x40 -#define OS_GBPAK_GBCART_ON 0x80 - -#define OS_GBPAK_POWER_OFF 0x00 /* power of 64GB-PAK */ -#define OS_GBPAK_POWER_ON 0x01 - -#define OS_GBPAK_ROM_ID_SIZE 0x50 /* ID size of GB cartridge */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* 64GB-PAK */ -extern s32 osGbpakInit(OSMesgQueue *, OSPfs *, int); -extern s32 osGbpakPower(OSPfs *, s32); -extern s32 osGbpakGetStatus(OSPfs *, u8 *); -extern s32 osGbpakReadWrite(OSPfs *, u16, u16, u8 *, u16); -extern s32 osGbpakReadId(OSPfs *, OSGbpakId *, u8 *); -extern s32 osGbpakCheckConnector(OSPfs *, u8 *); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_GBPAK_H_ */ diff --git a/include/2.0L/PR/os_gio.h b/include/2.0L/PR/os_gio.h deleted file mode 100644 index ad3c020f..00000000 --- a/include/2.0L/PR/os_gio.h +++ /dev/null @@ -1,86 +0,0 @@ - -/*==================================================================== - * os_gio.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_gio.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:08 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_GIO_H_ -#define _OS_GIO_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_GIO_H_ */ diff --git a/include/2.0L/PR/os_host.h b/include/2.0L/PR/os_host.h deleted file mode 100644 index 0cc1ae5b..00000000 --- a/include/2.0L/PR/os_host.h +++ /dev/null @@ -1,161 +0,0 @@ - -/*==================================================================== - * os_host.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_host.h,v $ - $Revision: 1.3 $ - $Date: 1999/06/24 09:23:06 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_HOST_H_ -#define _OS_HOST_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - -extern void __osInitialize_common(void); - -#if defined(_FINALROM) - -#define osInitialize() __osInitialize_common() - -#else - -/* PARTNER-N64 */ -#if defined(PTN64) -extern void __osInitialize_kmc(void); -#define osReadHost osReadHost_pt -#define osWriteHost osWriteHost_pt -#define osInitialize() \ -{ \ - __osInitialize_common(); \ - __osInitialize_kmc(); \ -} - -/* MONEGI SMART PACK A */ -#elif defined(MWN64) -extern void __osInitialize_msp(void); -#define osReadHost osReadHost_pt -#define osWriteHost osWriteHost_pt -#define osInitialize() \ -{ \ - __osInitialize_common(); \ - __osInitialize_msp(); \ -} - -/* IS-Viewer(for Debugger) */ -#elif defined(ISV64) -extern void __osInitialize_isv(void); -#define osInitialize() \ -{ \ - __osInitialize_common(); \ - __osInitialize_isv(); \ -} - -/* Emulation board for INDY */ -#elif defined(EMU64) -extern void __osInitialize_emu(void); -#define osInitialize() \ -{ \ - __osInitialize_common(); \ - __osInitialize_emu(); \ -} - -#else -/* Default (auto detect) */ -extern void __osInitialize_autodetect(void); -extern void __osInitialize_msp(void); -extern void __osInitialize_kmc(void); -extern void __osInitialize_isv(void); -extern void __osInitialize_emu(void); -#define osInitialize() \ -{ \ - __osInitialize_common(); \ - __osInitialize_autodetect(); \ -} -#endif - -#endif /* _FINAL_ROM */ - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Game <> Host data transfer functions */ - -extern s32 osTestHost(void); -extern void osReadHost(void *, u32); -extern void osWriteHost(void *, u32); -extern void osAckRamromRead(void); -extern void osAckRamromWrite(void); - -/* RDB port operations */ - -extern void osInitRdb(u8 *sendBuf, u32 sendSize); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_HOST_H_ */ diff --git a/include/2.0L/PR/os_internal.h b/include/2.0L/PR/os_internal.h deleted file mode 100644 index 754d1ee2..00000000 --- a/include/2.0L/PR/os_internal.h +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal.h,v $ - $Revision: 1.20 $ - $Date: 1998/10/09 08:01:09 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_H_ -#define _OS_INTERNAL_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -#include "os_internal_reg.h" -#include "os_internal_exception.h" -#include "os_internal_tlb.h" -#include "os_internal_si.h" -#include "os_internal_rsp.h" -#include "os_internal_error.h" -#include "os_internal_gio.h" -#include "os_internal_thread.h" -#include "os_internal_debug.h" -#include "os_internal_host.h" - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_H */ diff --git a/include/2.0L/PR/os_internal_debug.h b/include/2.0L/PR/os_internal_debug.h deleted file mode 100644 index 7b307d6e..00000000 --- a/include/2.0L/PR/os_internal_debug.h +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_debug.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:09 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_DEBUG_H_ -#define _OS_INTERNAL_DEBUG_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* Debug port */ -extern void __osSyncPutChars(int, int, const char *); -extern int __osAtomicDec(unsigned int *p); - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_DEBUG_H */ diff --git a/include/2.0L/PR/os_internal_error.h b/include/2.0L/PR/os_internal_error.h deleted file mode 100644 index de188d23..00000000 --- a/include/2.0L/PR/os_internal_error.h +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_error.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:10 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_ERROR_H_ -#define _OS_INTERNAL_ERROR_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* Error handling */ - -extern void __osError(s16, s16, ...); -extern OSThread * __osGetCurrFaultedThread(void); -extern OSThread * __osGetNextFaultedThread(OSThread *); - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_ERROR_H */ diff --git a/include/2.0L/PR/os_internal_exception.h b/include/2.0L/PR/os_internal_exception.h deleted file mode 100644 index 530b3d2b..00000000 --- a/include/2.0L/PR/os_internal_exception.h +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_exception.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:10 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_EXCEPTION_H_ -#define _OS_INTERNAL_EXCEPTION_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* Routine for HW interrupt "handler" */ -extern void __osSetHWIntrRoutine(OSHWIntr interrupt, - s32 (*handler)(void)); // no stackEnd -extern void __osGetHWIntrRoutine(OSHWIntr interrupt, - s32 (**handler)(void), void **stackEnd); - -/* Routine for global interrupt mask */ -extern void __osSetGlobalIntMask(OSHWIntr); -extern void __osResetGlobalIntMask(OSHWIntr); - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_EXCEPTION_H */ diff --git a/include/2.0L/PR/os_internal_gio.h b/include/2.0L/PR/os_internal_gio.h deleted file mode 100644 index ff133850..00000000 --- a/include/2.0L/PR/os_internal_gio.h +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_gio.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:11 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_GIO_H_ -#define _OS_INTERNAL_GIO_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* Development board functions */ - -extern void __osGIOInit(s32); -extern void __osGIOInterrupt(s32); -extern void __osGIORawInterrupt(s32); - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_GIO_H */ diff --git a/include/2.0L/PR/os_internal_host.h b/include/2.0L/PR/os_internal_host.h deleted file mode 100644 index b6d19513..00000000 --- a/include/2.0L/PR/os_internal_host.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_host.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:11 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_HOST_H_ -#define _OS_INTERNAL_HOST_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* routine for rdb port */ -extern u32 __osRdbSend(u8 *buf, u32 size, u32 type); - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_HOST_H */ diff --git a/include/2.0L/PR/os_internal_reg.h b/include/2.0L/PR/os_internal_reg.h deleted file mode 100644 index a1619981..00000000 --- a/include/2.0L/PR/os_internal_reg.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_reg.h,v $ - $Revision: 1.2 $ - $Date: 1999/03/10 12:19:14 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_REG_H_ -#define _OS_INTERNAL_REG_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* Routines to get/fetch coprocessor 0 registers */ - -extern u32 __osGetCause(void); -extern void __osSetCause(u32); -extern u32 __osGetCompare(void); -extern void __osSetCompare(u32); -extern u32 __osGetConfig(void); -extern void __osSetConfig(u32); -extern void __osSetCount(u32); -extern u32 __osGetSR(void); -extern void __osSetSR(u32); -extern u32 __osDisableInt(void); -extern void __osRestoreInt(u32); -extern u32 __osGetWatchLo(void); -extern void __osSetWatchLo(u32); - -/* Routines to get/set floating-point control and status register */ -extern u32 __osSetFpcCsr(u32); -extern u32 __osGetFpcCsr(void); - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_REG_H */ diff --git a/include/2.0L/PR/os_internal_rsp.h b/include/2.0L/PR/os_internal_rsp.h deleted file mode 100644 index 646e6679..00000000 --- a/include/2.0L/PR/os_internal_rsp.h +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_rsp.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:12 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_RSP_H_ -#define _OS_INTERNAL_RSP_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* Signal processor interface (Sp) */ - -extern u32 __osSpGetStatus(void); -extern void __osSpSetStatus(u32); -extern s32 __osSpSetPc(u32); -extern s32 __osSpRawWriteIo(u32, u32); -extern s32 __osSpRawReadIo(u32, u32 *); -extern s32 __osSpRawStartDma(s32, u32, void *, u32); - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_RSP_H */ diff --git a/include/2.0L/PR/os_internal_si.h b/include/2.0L/PR/os_internal_si.h deleted file mode 100644 index d0eeedcc..00000000 --- a/include/2.0L/PR/os_internal_si.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_si.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:13 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_SI_H_ -#define _OS_INTERNAL_SI_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* Serial interface (Si) */ - -extern u32 __osSiGetStatus(void); -extern s32 __osSiRawWriteIo(u32, u32); -extern s32 __osSiRawReadIo(u32, u32 *); -extern s32 __osSiRawStartDma(s32, void *); - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_SI_H */ diff --git a/include/2.0L/PR/os_internal_thread.h b/include/2.0L/PR/os_internal_thread.h deleted file mode 100644 index 1305eb58..00000000 --- a/include/2.0L/PR/os_internal_thread.h +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_thread.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:13 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_THREAD_H_ -#define _OS_INTERNAL_THREAD_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* For debugger use */ - -extern OSThread * __osGetActiveQueue(void); - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_THREAD_H */ diff --git a/include/2.0L/PR/os_internal_tlb.h b/include/2.0L/PR/os_internal_tlb.h deleted file mode 100644 index b92918ff..00000000 --- a/include/2.0L/PR/os_internal_tlb.h +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_tlb.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:14 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_TLB_H_ -#define _OS_INTERNAL_TLB_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* Routines for fetch TLB info */ - -extern u32 __osGetTLBASID(void); -extern u32 __osGetTLBPageMask(s32); -extern u32 __osGetTLBHi(s32); -extern u32 __osGetTLBLo0(s32); -extern u32 __osGetTLBLo1(s32); - - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_TLB_H */ diff --git a/include/2.0L/PR/os_libc.h b/include/2.0L/PR/os_libc.h deleted file mode 100644 index 35d0e8e6..00000000 --- a/include/2.0L/PR/os_libc.h +++ /dev/null @@ -1,100 +0,0 @@ - -/*==================================================================== - * os_libc.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_libc.h,v $ - $Revision: 1.3 $ - $Date: 1999/07/13 01:43:47 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_LIBC_H_ -#define _OS_LIBC_H_ - -#include "os_pfs.h" - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* byte string operations */ - - -extern void bcopy(const void *, void *, int); -extern int bcmp(const void *, const void *, int); -extern void bzero(void *, int); - -/* Printf */ - -extern int sprintf(char *s, const char *fmt, ...); -extern void osSyncPrintf(const char *fmt, ...); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_LIBC_H_ */ diff --git a/include/2.0L/PR/os_message.h b/include/2.0L/PR/os_message.h deleted file mode 100644 index 5bc565e3..00000000 --- a/include/2.0L/PR/os_message.h +++ /dev/null @@ -1,163 +0,0 @@ - -/*==================================================================== - * os_message.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_message.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:15 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_MESSAGE_H_ -#define _OS_MESSAGE_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -typedef u32 OSEvent; - -/* - * Structure for message - */ -typedef void * OSMesg; - -/* - * Structure for message queue - */ -typedef struct OSMesgQueue_s { - OSThread *mtqueue; /* Queue to store threads blocked - on empty mailboxes (receive) */ - OSThread *fullqueue; /* Queue to store threads blocked - on full mailboxes (send) */ - s32 validCount; /* Contains number of valid message */ - s32 first; /* Points to first valid message */ - s32 msgCount; /* Contains total # of messages */ - OSMesg *msg; /* Points to message buffer array */ -} OSMesgQueue; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* Events */ -#ifdef _FINALROM -#define OS_NUM_EVENTS 15 -#else -#define OS_NUM_EVENTS 23 -#endif - -#define OS_EVENT_SW1 0 /* CPU SW1 interrupt */ -#define OS_EVENT_SW2 1 /* CPU SW2 interrupt */ -#define OS_EVENT_CART 2 /* Cartridge interrupt: used by rmon */ -#define OS_EVENT_COUNTER 3 /* Counter int: used by VI/Timer Mgr */ -#define OS_EVENT_SP 4 /* SP task done interrupt */ -#define OS_EVENT_SI 5 /* SI (controller) interrupt */ -#define OS_EVENT_AI 6 /* AI interrupt */ -#define OS_EVENT_VI 7 /* VI interrupt: used by VI/Timer Mgr */ -#define OS_EVENT_PI 8 /* PI interrupt: used by PI Manager */ -#define OS_EVENT_DP 9 /* DP full sync interrupt */ -#define OS_EVENT_CPU_BREAK 10 /* CPU breakpoint: used by rmon */ -#define OS_EVENT_SP_BREAK 11 /* SP breakpoint: used by rmon */ -#define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */ -#define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */ -#define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */ -#ifndef _FINALROM -#define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */ -#define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */ -#define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */ -#define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */ -#define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */ -#define OS_EVENT_RDB_DBG_DONE 20 -#define OS_EVENT_RDB_FLUSH_PROF 21 -#define OS_EVENT_RDB_ACK_PROF 22 -#endif - -/* Flags to turn blocking on/off when sending/receiving message */ - -#define OS_MESG_NOBLOCK 0 -#define OS_MESG_BLOCK 1 - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - -/* Get count of valid messages in queue */ -#define MQ_GET_COUNT(mq) ((mq)->validCount) - -/* Figure out if message queue is empty or full */ -#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0) -#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount) - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Message operations */ - -extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32); -extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32); -extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32); -extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32); - -/* Event operations */ - -extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_MESSAGE_H_ */ diff --git a/include/2.0L/PR/os_motor.h b/include/2.0L/PR/os_motor.h deleted file mode 100644 index eb8c7d6c..00000000 --- a/include/2.0L/PR/os_motor.h +++ /dev/null @@ -1,75 +0,0 @@ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. - - $RCSfile: os_motor.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:15 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_MOTOR_H_ -#define _OS_MOTOR_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include "os_message.h" -#include "os_pfs.h" - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Rumble PAK interface */ - -extern s32 osMotorInit(OSMesgQueue *, OSPfs *, int); -extern s32 osMotorStop(OSPfs *); -extern s32 osMotorStart(OSPfs *); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_MOTOR_H_ */ diff --git a/include/2.0L/PR/os_pfs.h b/include/2.0L/PR/os_pfs.h deleted file mode 100644 index 188f9d28..00000000 --- a/include/2.0L/PR/os_pfs.h +++ /dev/null @@ -1,174 +0,0 @@ - -/*==================================================================== - * os_pfs.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_pfs.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:16 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_PFS_H_ -#define _OS_PFS_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include "os_message.h" - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -/* - * Structure for file system - */ -typedef struct { - int status; - OSMesgQueue *queue; - int channel; - u8 id[32]; - u8 label[32]; - int version; - int dir_size; - int inode_table; /* block location */ - int minode_table; /* mirrioring inode_table */ - int dir_table; /* block location */ - int inode_start_page; /* page # */ - u8 banks; - u8 activebank; -} OSPfs; - -typedef struct { - u32 file_size; /* bytes */ - u32 game_code; - u16 company_code; - char ext_name[4]; - char game_name[16]; -} OSPfsState; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* File System size */ -#define OS_PFS_VERSION 0x0200 -#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8) -#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255) - -#define PFS_FILE_NAME_LEN 16 -#define PFS_FILE_EXT_LEN 4 -#define BLOCKSIZE 32 /* bytes */ -#define PFS_ONE_PAGE 8 /* blocks */ -#define PFS_MAX_BANKS 62 - -/* File System flag */ - -#define PFS_READ 0 -#define PFS_WRITE 1 -#define PFS_CREATE 2 - -/* File System status */ -#define PFS_INITIALIZED 0x1 -#define PFS_CORRUPTED 0x2 /* File system was corrupted */ -#define PFS_ID_BROKEN 0x4 -#define PFS_MOTOR_INITIALIZED 0x8 -#define PFS_GBPAK_INITIALIZED 0x10 - -/* File System error number */ - -#define PFS_ERR_NOPACK 1 /* no memory card is plugged or */ -#define PFS_ERR_NEW_PACK 2 /* ram pack has been changed to a */ - /* different one */ -#define PFS_ERR_INCONSISTENT 3 /* need to run Pfschecker */ -#define PFS_ERR_CONTRFAIL CONT_OVERRUN_ERROR -#define PFS_ERR_INVALID 5 /* invalid parameter or file not exist*/ -#define PFS_ERR_BAD_DATA 6 /* the data read from pack are bad*/ -#define PFS_DATA_FULL 7 /* no free pages on ram pack */ -#define PFS_DIR_FULL 8 /* no free directories on ram pack*/ -#define PFS_ERR_EXIST 9 /* file exists */ -#define PFS_ERR_ID_FATAL 10 /* dead ram pack */ -#define PFS_ERR_DEVICE 11 /* wrong device type*/ -#define PFS_ERR_NO_GBCART 12 /* no gb cartridge (64GB-PAK) */ -#define PFS_ERR_NEW_GBCART 13 /* gb cartridge may be changed */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* file system interface */ - -extern s32 osPfsInitPak(OSMesgQueue *, OSPfs *, int); -extern s32 osPfsRepairId(OSPfs *); -extern s32 osPfsInit(OSMesgQueue *, OSPfs *, int); -extern s32 osPfsReFormat(OSPfs *, OSMesgQueue *, int); -extern s32 osPfsChecker(OSPfs *); -extern s32 osPfsAllocateFile(OSPfs *, u16, u32, u8 *, u8 *, int, s32 *); -extern s32 osPfsFindFile(OSPfs *, u16, u32, u8 *, u8 *, s32 *); -extern s32 osPfsDeleteFile(OSPfs *, u16, u32, u8 *, u8 *); -extern s32 osPfsReadWriteFile(OSPfs *, s32, u8, int, int, u8 *); -extern s32 osPfsFileState(OSPfs *, s32, OSPfsState *); -extern s32 osPfsGetLabel(OSPfs *, u8 *, int *); -extern s32 osPfsSetLabel(OSPfs *, u8 *); -extern s32 osPfsIsPlug(OSMesgQueue *, u8 *); -extern s32 osPfsFreeBlocks(OSPfs *, s32 *); -extern s32 osPfsNumFiles(OSPfs *, s32 *, s32 *); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_PFS_H_ */ diff --git a/include/2.0L/PR/os_pi.h b/include/2.0L/PR/os_pi.h deleted file mode 100644 index 11e3454a..00000000 --- a/include/2.0L/PR/os_pi.h +++ /dev/null @@ -1,228 +0,0 @@ - -/*==================================================================== - * os_pi.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_pi.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:16 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_PI_H_ -#define _OS_PI_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include "os_thread.h" -#include "os_message.h" - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -/* - * Structure for Enhanced PI interface - */ - -/* - * OSTranxInfo is set up for Leo Disk DMA. This info will be maintained - * by exception handler. This is how the PIMGR and the ISR communicate. - */ - -typedef struct { - u32 errStatus; /* error status */ - void *dramAddr; /* RDRAM buffer address (DMA) */ - void *C2Addr; /* C2 buffer address */ - u32 sectorSize; /* size of transfering sector */ - u32 C1ErrNum; /* total # of C1 errors */ - u32 C1ErrSector[4]; /* error sectors */ -} __OSBlockInfo; - -typedef struct { - u32 cmdType; /* for disk only */ - u16 transferMode; /* Block, Track, or sector? */ - u16 blockNum; /* which block is transfering */ - s32 sectorNum; /* which sector is transfering */ - u32 devAddr; /* Device buffer address */ - u32 bmCtlShadow; /* asic bm_ctl(510) register shadow ram */ - u32 seqCtlShadow; /* asic seq_ctl(518) register shadow ram */ - __OSBlockInfo block[2]; /* bolck transfer info */ -} __OSTranxInfo; - - -typedef struct OSPiHandle_s { - struct OSPiHandle_s *next; /* point to next handle on the table */ - u8 type; /* DEVICE_TYPE_BULK for disk */ - u8 latency; /* domain latency */ - u8 pageSize; /* domain page size */ - u8 relDuration; /* domain release duration */ - u8 pulse; /* domain pulse width */ - u8 domain; /* which domain */ - u32 baseAddress; /* Domain address */ - u32 speed; /* for roms only */ - /* The following are "private" elements" */ - __OSTranxInfo transferInfo; /* for disk only */ -} OSPiHandle; - -typedef struct { - u8 type; - u32 address; -} OSPiInfo; - -/* - * Structure for I/O message block - */ -typedef struct { - u16 type; /* Message type */ - u8 pri; /* Message priority (High or Normal) */ - u8 status; /* Return status */ - OSMesgQueue *retQueue; /* Return message queue to notify I/O - * completion */ -} OSIoMesgHdr; - -typedef struct { - OSIoMesgHdr hdr; /* Message header */ - void * dramAddr; /* RDRAM buffer address (DMA) */ - u32 devAddr; /* Device buffer address (DMA) */ - u32 size; /* DMA transfer size in bytes */ - OSPiHandle *piHandle; /* PI device handle */ -} OSIoMesg; - -/* - * Structure for device manager block - */ -typedef struct { - s32 active; /* Status flag */ - OSThread *thread; /* Calling thread */ - OSMesgQueue *cmdQueue; /* Command queue */ - OSMesgQueue *evtQueue; /* Event queue */ - OSMesgQueue *acsQueue; /* Access queue */ - /* Raw DMA routine */ - s32 (*dma)(s32, u32, void *, u32); - s32 (*edma)(OSPiHandle *, s32, u32, void *, u32); -} OSDevMgr; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* Flags to indicate direction of data transfer */ - -#define OS_READ 0 /* device -> RDRAM */ -#define OS_WRITE 1 /* device <- RDRAM */ -#define OS_OTHERS 2 /* for Leo disk only */ - -/* - * I/O message types - */ -#define OS_MESG_TYPE_BASE (10) -#define OS_MESG_TYPE_LOOPBACK (OS_MESG_TYPE_BASE+0) -#define OS_MESG_TYPE_DMAREAD (OS_MESG_TYPE_BASE+1) -#define OS_MESG_TYPE_DMAWRITE (OS_MESG_TYPE_BASE+2) -#define OS_MESG_TYPE_VRETRACE (OS_MESG_TYPE_BASE+3) -#define OS_MESG_TYPE_COUNTER (OS_MESG_TYPE_BASE+4) -#define OS_MESG_TYPE_EDMAREAD (OS_MESG_TYPE_BASE+5) -#define OS_MESG_TYPE_EDMAWRITE (OS_MESG_TYPE_BASE+6) - -/* - * I/O message priority - */ -#define OS_MESG_PRI_NORMAL 0 -#define OS_MESG_PRI_HIGH 1 - -/* - * PI/EPI - */ -#define PI_DOMAIN1 0 -#define PI_DOMAIN2 1 - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - -extern OSPiHandle *__osPiTable; /* The head of OSPiHandle link list */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Peripheral interface (Pi) */ -extern u32 osPiGetStatus(void); -extern s32 osPiGetDeviceType(void); -extern s32 osPiWriteIo(u32, u32); -extern s32 osPiReadIo(u32, u32 *); -extern s32 osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32, - OSMesgQueue *); -extern void osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32); - -extern s32 osEPiRawStartDma(OSPiHandle *, s32 , u32 , void *, u32 ); - -/* Enhanced PI interface */ - -extern OSPiHandle *osCartRomInit(void); -extern OSPiHandle *osLeoDiskInit(void); -extern OSPiHandle *osDriveRomInit(void); - -extern s32 osEPiDeviceType(OSPiHandle *, OSPiInfo *); -extern s32 osEPiWriteIo(OSPiHandle *, u32 , u32 ); -extern s32 osEPiReadIo(OSPiHandle *, u32 , u32 *); -extern s32 osEPiStartDma(OSPiHandle *, OSIoMesg *, s32); -extern s32 osEPiLinkHandle(OSPiHandle *); - -extern s32 osPiRawStartDma(s32, u32, void *, u32); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_PI_H_ */ diff --git a/include/2.0L/PR/os_rdp.h b/include/2.0L/PR/os_rdp.h deleted file mode 100644 index 6b3d288c..00000000 --- a/include/2.0L/PR/os_rdp.h +++ /dev/null @@ -1,92 +0,0 @@ - -/*==================================================================== - * os_rdp.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_rdp.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:16 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_RDP_H_ -#define _OS_RDP_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Display processor interface (Dp) */ -extern u32 osDpGetStatus(void); -extern void osDpSetStatus(u32); -extern void osDpGetCounters(u32 *); -extern s32 osDpSetNextBuffer(void *, u64); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_RDP_H_ */ diff --git a/include/2.0L/PR/os_reg.h b/include/2.0L/PR/os_reg.h deleted file mode 100644 index 50aa2188..00000000 --- a/include/2.0L/PR/os_reg.h +++ /dev/null @@ -1,90 +0,0 @@ - -/*==================================================================== - * os_reg.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_reg.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:17 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_REG_H_ -#define _OS_REG_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Miscellaneous operations */ - -extern u32 osGetCount(void); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_REG_H_ */ diff --git a/include/2.0L/PR/os_rsp.h b/include/2.0L/PR/os_rsp.h deleted file mode 100644 index 12116053..00000000 --- a/include/2.0L/PR/os_rsp.h +++ /dev/null @@ -1,86 +0,0 @@ - -/*==================================================================== - * os_rsp.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_rsp.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:17 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_RSP_H_ -#define _OS_RSP_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_RSP_H_ */ diff --git a/include/2.0L/PR/os_si.h b/include/2.0L/PR/os_si.h deleted file mode 100644 index 23b07c07..00000000 --- a/include/2.0L/PR/os_si.h +++ /dev/null @@ -1,86 +0,0 @@ - -/*==================================================================== - * os_si.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_si.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:18 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_SI_H_ -#define _OS_SI_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_SI_H_ */ diff --git a/include/2.0L/PR/os_system.h b/include/2.0L/PR/os_system.h deleted file mode 100644 index 1179189a..00000000 --- a/include/2.0L/PR/os_system.h +++ /dev/null @@ -1,118 +0,0 @@ - -/*==================================================================== - * os_system.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_system.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:18 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_SYSTEM_H_ -#define _OS_SYSTEM_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* - * Values for osTvType - */ -#define OS_TV_PAL 0 -#define OS_TV_NTSC 1 -#define OS_TV_MPAL 2 - -/* - * Size of buffer the retains contents after NMI - */ -#define OS_APP_NMI_BUFSIZE 64 - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - -extern s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */ -extern void *osRomBase; /* Rom base address of the game image */ -extern s32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */ -extern s32 osResetType; /* 0 = cold reset, 1 = NMI */ -extern s32 osCicId; -extern s32 osVersion; -extern u32 osMemSize; /* Memory Size */ -extern s32 osAppNMIBuffer[]; - -extern u64 osClockRate; - -extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -extern void osInitialize(void); -extern void osExit(void); -extern u32 osGetMemSize(void); - -/* pre-NMI */ -extern s32 osAfterPreNMI(void); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_SYSTEM_H_ */ diff --git a/include/2.0L/PR/os_thread.h b/include/2.0L/PR/os_thread.h deleted file mode 100644 index 7b82dc79..00000000 --- a/include/2.0L/PR/os_thread.h +++ /dev/null @@ -1,154 +0,0 @@ - -/*==================================================================== - * os_thread.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_thread.h,v $ - $Revision: 1.3 $ - $Date: 1999/06/15 12:39:40 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_THREAD_H_ -#define _OS_THREAD_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -typedef s32 OSPri; -typedef s32 OSId; -typedef union { struct { f32 f_odd; f32 f_even; } f; f64 d; } __OSfp; - -typedef struct { - u64 at, v0, v1, a0, a1, a2, a3; - u64 t0, t1, t2, t3, t4, t5, t6, t7; - u64 s0, s1, s2, s3, s4, s5, s6, s7; - u64 t8, t9, gp, sp, s8, ra; - u64 lo, hi; - u32 sr, pc, cause, badvaddr, rcp; - u32 fpcsr; - __OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14; - __OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30; -} __OSThreadContext; - -typedef struct { - u32 flag; - u32 count; - u64 time; -} __OSThreadprofile_s; - -typedef struct OSThread_s { - struct OSThread_s *next; /* run/mesg queue link */ - OSPri priority; /* run/mesg queue priority */ - struct OSThread_s **queue; /* queue thread is on */ - struct OSThread_s *tlnext; /* all threads queue link */ - u16 state; /* OS_STATE_* */ - u16 flags; /* flags for rmon */ - OSId id; /* id for debugging */ - int fp; /* thread has used fp unit */ - __OSThreadprofile_s *thprof; /* workarea for thread profiler */ - __OSThreadContext context; /* register/interrupt mask */ -} OSThread; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* Thread states */ - -#define OS_STATE_STOPPED 1 -#define OS_STATE_RUNNABLE 2 -#define OS_STATE_RUNNING 4 -#define OS_STATE_WAITING 8 - -/* Recommended thread priorities for the system threads */ - -#define OS_PRIORITY_MAX 255 -#define OS_PRIORITY_VIMGR 254 -#define OS_PRIORITY_RMON 250 -#define OS_PRIORITY_RMONSPIN 200 -#define OS_PRIORITY_PIMGR 150 -#define OS_PRIORITY_SIMGR 140 -#define OS_PRIORITY_APPMAX 127 -#define OS_PRIORITY_IDLE 0 /* Must be 0 */ - -/* for thread profiler */ -#define THPROF_IDMAX 64 -#define THPROF_STACKSIZE 256 - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Thread operations */ - -extern void osCreateThread(OSThread *, OSId, void (*)(void *), - void *, void *, OSPri); -extern void osDestroyThread(OSThread *); -extern void osYieldThread(void); -extern void osStartThread(OSThread *); -extern void osStopThread(OSThread *); -extern OSId osGetThreadId(OSThread *); -extern void osSetThreadPri(OSThread *, OSPri); -extern OSPri osGetThreadPri(OSThread *); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_THREAD_H_ */ diff --git a/include/2.0L/PR/os_time.h b/include/2.0L/PR/os_time.h deleted file mode 100644 index deaec659..00000000 --- a/include/2.0L/PR/os_time.h +++ /dev/null @@ -1,114 +0,0 @@ - -/*==================================================================== - * os_time.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_time.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:19 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_TIME_H_ -#define _OS_TIME_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include "os_message.h" - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -/* - * Structure for time value - */ -typedef u64 OSTime; - -/* - * Structure for interval timer - */ -typedef struct OSTimer_s { - struct OSTimer_s *next; /* point to next timer in list */ - struct OSTimer_s *prev; /* point to previous timer in list */ - OSTime interval; /* duration set by user */ - OSTime value; /* time remaining before */ - /* timer fires */ - OSMesgQueue *mq; /* Message Queue */ - OSMesg msg; /* Message to send */ -} OSTimer; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Timer interface */ - -extern OSTime osGetTime(void); -extern void osSetTime(OSTime); -extern int osSetTimer(OSTimer *, OSTime, OSTime, - OSMesgQueue *, OSMesg); -extern int osStopTimer(OSTimer *); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_TIME_H_ */ diff --git a/include/2.0L/PR/os_tlb.h b/include/2.0L/PR/os_tlb.h deleted file mode 100644 index 2cdd5c9c..00000000 --- a/include/2.0L/PR/os_tlb.h +++ /dev/null @@ -1,107 +0,0 @@ - -/*==================================================================== - * os_tlb.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_tlb.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:20 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_TLB_H_ -#define _OS_TLB_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -typedef u32 OSPageMask; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* - * Page size argument for TLB routines - */ -#define OS_PM_4K 0x0000000 -#define OS_PM_16K 0x0006000 -#define OS_PM_64K 0x001e000 -#define OS_PM_256K 0x007e000 -#define OS_PM_1M 0x01fe000 -#define OS_PM_4M 0x07fe000 -#define OS_PM_16M 0x1ffe000 - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* TLB management routines */ - -extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32); -extern void osMapTLBRdb(void); -extern void osUnmapTLB(s32); -extern void osUnmapTLBAll(void); -extern void osSetTLBASID(s32); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_TLB_H_ */ diff --git a/include/2.0L/PR/os_version.h b/include/2.0L/PR/os_version.h deleted file mode 100644 index c485a438..00000000 --- a/include/2.0L/PR/os_version.h +++ /dev/null @@ -1,16 +0,0 @@ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. - - $RCSfile: os_version.h,v $ - $Revision: 1.2 $ - $Date: 1999/06/17 01:33:01 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_VERSION_H_ -#define _OS_VERSION_H_ - -#define OS_MAJOR_VERSION "2.0K" /* major version */ -#define OS_MINOR_VERSION 0 /* patch level */ - -#endif /* !_OS_VERSION_H_ */ diff --git a/include/2.0L/PR/os_vi.h b/include/2.0L/PR/os_vi.h deleted file mode 100644 index 5a17f258..00000000 --- a/include/2.0L/PR/os_vi.h +++ /dev/null @@ -1,298 +0,0 @@ - -/*==================================================================== - * os_vi.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_vi.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:20 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_VI_H_ -#define _OS_VI_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include "os_thread.h" -#include "os_message.h" - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -/* - * Structure to store VI register values that remain the same between 2 fields - */ -typedef struct { - u32 ctrl; - u32 width; - u32 burst; - u32 vSync; - u32 hSync; - u32 leap; - u32 hStart; - u32 xScale; - u32 vCurrent; -} OSViCommonRegs; - - -/* - * Structure to store VI register values that change between fields - */ -typedef struct { - u32 origin; - u32 yScale; - u32 vStart; - u32 vBurst; - u32 vIntr; -} OSViFieldRegs; - - -/* - * Structure for VI mode - */ -typedef struct { - u8 type; /* Mode type */ - OSViCommonRegs comRegs; /* Common registers for both fields */ - OSViFieldRegs fldRegs[2]; /* Registers for Field 1 & 2 */ -} OSViMode; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* - * Video Interface (VI) mode type - */ -#define OS_VI_NTSC_LPN1 0 /* NTSC */ -#define OS_VI_NTSC_LPF1 1 -#define OS_VI_NTSC_LAN1 2 -#define OS_VI_NTSC_LAF1 3 -#define OS_VI_NTSC_LPN2 4 -#define OS_VI_NTSC_LPF2 5 -#define OS_VI_NTSC_LAN2 6 -#define OS_VI_NTSC_LAF2 7 -#define OS_VI_NTSC_HPN1 8 -#define OS_VI_NTSC_HPF1 9 -#define OS_VI_NTSC_HAN1 10 -#define OS_VI_NTSC_HAF1 11 -#define OS_VI_NTSC_HPN2 12 -#define OS_VI_NTSC_HPF2 13 - -#define OS_VI_PAL_LPN1 14 /* PAL */ -#define OS_VI_PAL_LPF1 15 -#define OS_VI_PAL_LAN1 16 -#define OS_VI_PAL_LAF1 17 -#define OS_VI_PAL_LPN2 18 -#define OS_VI_PAL_LPF2 19 -#define OS_VI_PAL_LAN2 20 -#define OS_VI_PAL_LAF2 21 -#define OS_VI_PAL_HPN1 22 -#define OS_VI_PAL_HPF1 23 -#define OS_VI_PAL_HAN1 24 -#define OS_VI_PAL_HAF1 25 -#define OS_VI_PAL_HPN2 26 -#define OS_VI_PAL_HPF2 27 - -#define OS_VI_MPAL_LPN1 28 /* MPAL - mainly Brazil */ -#define OS_VI_MPAL_LPF1 29 -#define OS_VI_MPAL_LAN1 30 -#define OS_VI_MPAL_LAF1 31 -#define OS_VI_MPAL_LPN2 32 -#define OS_VI_MPAL_LPF2 33 -#define OS_VI_MPAL_LAN2 34 -#define OS_VI_MPAL_LAF2 35 -#define OS_VI_MPAL_HPN1 36 -#define OS_VI_MPAL_HPF1 37 -#define OS_VI_MPAL_HAN1 38 -#define OS_VI_MPAL_HAF1 39 -#define OS_VI_MPAL_HPN2 40 -#define OS_VI_MPAL_HPF2 41 - -#define OS_VI_FPAL_LPN1 42 /* FPAL - Full screen PAL */ -#define OS_VI_FPAL_LPF1 43 -#define OS_VI_FPAL_LAN1 44 -#define OS_VI_FPAL_LAF1 45 -#define OS_VI_FPAL_LPN2 46 -#define OS_VI_FPAL_LPF2 47 -#define OS_VI_FPAL_LAN2 48 -#define OS_VI_FPAL_LAF2 49 -#define OS_VI_FPAL_HPN1 50 -#define OS_VI_FPAL_HPF1 51 -#define OS_VI_FPAL_HAN1 52 -#define OS_VI_FPAL_HAF1 53 -#define OS_VI_FPAL_HPN2 54 -#define OS_VI_FPAL_HPF2 55 - -/* - * Video Interface (VI) special features - */ -#define OS_VI_GAMMA_ON 0x0001 -#define OS_VI_GAMMA_OFF 0x0002 -#define OS_VI_GAMMA_DITHER_ON 0x0004 -#define OS_VI_GAMMA_DITHER_OFF 0x0008 -#define OS_VI_DIVOT_ON 0x0010 -#define OS_VI_DIVOT_OFF 0x0020 -#define OS_VI_DITHER_FILTER_ON 0x0040 -#define OS_VI_DITHER_FILTER_OFF 0x0080 - -/* - * Video Interface (VI) mode attribute bit - */ -#define OS_VI_BIT_NONINTERLACE 0x0001 /* lo-res */ -#define OS_VI_BIT_INTERLACE 0x0002 /* lo-res */ -#define OS_VI_BIT_NORMALINTERLACE 0x0004 /* hi-res */ -#define OS_VI_BIT_DEFLICKINTERLACE 0x0008 /* hi-res */ -#define OS_VI_BIT_ANTIALIAS 0x0010 -#define OS_VI_BIT_POINTSAMPLE 0x0020 -#define OS_VI_BIT_16PIXEL 0x0040 -#define OS_VI_BIT_32PIXEL 0x0080 -#define OS_VI_BIT_LORES 0x0100 -#define OS_VI_BIT_HIRES 0x0200 -#define OS_VI_BIT_NTSC 0x0400 -#define OS_VI_BIT_PAL 0x0800 - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - -extern OSViMode osViModeTable[]; /* Global VI mode table */ - -extern OSViMode osViModeNtscLpn1; /* Individual VI NTSC modes */ -extern OSViMode osViModeNtscLpf1; -extern OSViMode osViModeNtscLan1; -extern OSViMode osViModeNtscLaf1; -extern OSViMode osViModeNtscLpn2; -extern OSViMode osViModeNtscLpf2; -extern OSViMode osViModeNtscLan2; -extern OSViMode osViModeNtscLaf2; -extern OSViMode osViModeNtscHpn1; -extern OSViMode osViModeNtscHpf1; -extern OSViMode osViModeNtscHan1; -extern OSViMode osViModeNtscHaf1; -extern OSViMode osViModeNtscHpn2; -extern OSViMode osViModeNtscHpf2; - -extern OSViMode osViModePalLpn1; /* Individual VI PAL modes */ -extern OSViMode osViModePalLpf1; -extern OSViMode osViModePalLan1; -extern OSViMode osViModePalLaf1; -extern OSViMode osViModePalLpn2; -extern OSViMode osViModePalLpf2; -extern OSViMode osViModePalLan2; -extern OSViMode osViModePalLaf2; -extern OSViMode osViModePalHpn1; -extern OSViMode osViModePalHpf1; -extern OSViMode osViModePalHan1; -extern OSViMode osViModePalHaf1; -extern OSViMode osViModePalHpn2; -extern OSViMode osViModePalHpf2; - -extern OSViMode osViModeMpalLpn1; /* Individual VI MPAL modes */ -extern OSViMode osViModeMpalLpf1; -extern OSViMode osViModeMpalLan1; -extern OSViMode osViModeMpalLaf1; -extern OSViMode osViModeMpalLpn2; -extern OSViMode osViModeMpalLpf2; -extern OSViMode osViModeMpalLan2; -extern OSViMode osViModeMpalLaf2; -extern OSViMode osViModeMpalHpn1; -extern OSViMode osViModeMpalHpf1; -extern OSViMode osViModeMpalHan1; -extern OSViMode osViModeMpalHaf1; -extern OSViMode osViModeMpalHpn2; -extern OSViMode osViModeMpalHpf2; - -extern OSViMode osViModeFpalLpn1; /* Individual VI FPAL modes */ -extern OSViMode osViModeFpalLpf1; -extern OSViMode osViModeFpalLan1; -extern OSViMode osViModeFpalLaf1; -extern OSViMode osViModeFpalLpn2; -extern OSViMode osViModeFpalLpf2; -extern OSViMode osViModeFpalLan2; -extern OSViMode osViModeFpalLaf2; -extern OSViMode osViModeFpalHpn1; -extern OSViMode osViModeFpalHpf1; -extern OSViMode osViModeFpalHan1; -extern OSViMode osViModeFpalHaf1; -extern OSViMode osViModeFpalHpn2; -extern OSViMode osViModeFpalHpf2; - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Video interface (Vi) */ -extern u32 osViGetStatus(void); -extern u32 osViGetCurrentMode(void); -extern u32 osViGetCurrentLine(void); -extern u32 osViGetCurrentField(void); -extern void *osViGetCurrentFramebuffer(void); -extern void *osViGetNextFramebuffer(void); -extern void osViSetXScale(f32); -extern void osViSetYScale(f32); -extern void osViExtendVStart(u32); -extern void osViSetSpecialFeatures(u32); -extern void osViSetMode(OSViMode *); -extern void osViSetEvent(OSMesgQueue *, OSMesg, u32); -extern void osViSwapBuffer(void *); -extern void osViBlack(u8); -extern void osViFade(u8, u16); -extern void osViRepeatLine(u8); -extern void osCreateViManager(OSPri); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_VI_H_ */ diff --git a/include/2.0L/PR/os_voice.h b/include/2.0L/PR/os_voice.h deleted file mode 100644 index 4e3cf6ec..00000000 --- a/include/2.0L/PR/os_voice.h +++ /dev/null @@ -1,108 +0,0 @@ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. - - $RCSfile: os_voice.h,v $ - $Revision: 1.2 $ - $Date: 1999/07/13 08:36:42 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_VOICE_H_ -#define _OS_VOICE_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -typedef struct { /* Voice Recognition System */ - OSMesgQueue *__mq; /* SI Message Queue */ - int __channel; /* Controller Port # */ - s32 __mode; - u8 cmd_status; /* Command Status */ -} OSVoiceHandle; - -typedef struct { /* Voice Recognition System */ - u16 warning; - u16 answer_num; /* 0...5 */ - u16 voice_level; - u16 voice_sn; - u16 voice_time; - u16 answer[5]; - u16 distance[5]; -} OSVoiceData; - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -/* definition for Voice Recognition System */ - -#define VOICE_WARN_TOO_SMALL 0x0400 -#define VOICE_WARN_TOO_LARGE 0x0800 -#define VOICE_WARN_NOT_FIT 0x4000 -#define VOICE_WARN_TOO_NOISY 0x8000 - -#define VOICE_STATUS_READY 0 -#define VOICE_STATUS_START 1 -#define VOICE_STATUS_CANCEL 3 -#define VOICE_STATUS_BUSY 5 -#define VOICE_STATUS_END 7 - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* Voice Recognition System */ -extern s32 osVoiceInit(OSMesgQueue *, OSVoiceHandle *, int); -extern s32 osVoiceCheckWord(u8 *data); -extern s32 osVoiceClearDictionary(OSVoiceHandle *, u8); -extern s32 osVoiceControlGain(OSVoiceHandle *, s32, s32); -extern s32 osVoiceSetWord(OSVoiceHandle *, u8 *); -extern s32 osVoiceStartReadData(OSVoiceHandle *); -extern s32 osVoiceStopReadData(OSVoiceHandle *); -extern s32 osVoiceGetReadData(OSVoiceHandle *, OSVoiceData *); -extern s32 osVoiceMaskDictionary(OSVoiceHandle *, u8 *, int); -extern void osVoiceCountSyllables(u8 *, u32 *); - - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_VOICE_H_ */ diff --git a/include/2.0L/PR/ramrom.h b/include/2.0L/PR/ramrom.h deleted file mode 100644 index 42e5c2d5..00000000 --- a/include/2.0L/PR/ramrom.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef _RAMROM_H -#define _RAMROM_H - -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * $Revision: 1.20 $ - * $Date: 1997/02/11 08:26:47 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ramrom.h,v $ - * - **************************************************************************/ - -/* - * Defines for the GIO card in the Nintendo Development Station - * - * The RAM on the GIO card acts as ROM for the game - * Interrupts available between the game and the Indy host - * - * The last part of the ramrom is used for communication between - * game and host. There are 6 4K buffers defined: - * log, printf, rmon to indy, rmon from indy, app to indy, app from indy - * The last 8 bytes of the buffer are used in the emulator environment - */ - -#define RAMROM_SIZE (0x1000000) - -#define RAMROM_BUF_SIZE (4096) -#define RAMROM_MSG_SIZE (RAMROM_BUF_SIZE*6) -#define RAMROM_MSG_ADDR (RAMROM_SIZE - RAMROM_MSG_SIZE) -#define RAMROM_MSG_HDR_SIZE (3*sizeof(long)) -#define RAMROM_USER_DATA_SIZE (RAMROM_MSG_SIZE-RAMROM_MSG_HDR_SIZE) - -#define RAMROM_APP_READ_ADDR (RAMROM_MSG_ADDR + (0*RAMROM_BUF_SIZE)) -#define RAMROM_APP_WRITE_ADDR (RAMROM_MSG_ADDR + (1*RAMROM_BUF_SIZE)) -#define RAMROM_RMON_READ_ADDR (RAMROM_MSG_ADDR + (2*RAMROM_BUF_SIZE)) -#define RAMROM_RMON_WRITE_ADDR (RAMROM_MSG_ADDR + (3*RAMROM_BUF_SIZE)) -#define RAMROM_PRINTF_ADDR (RAMROM_MSG_ADDR + (4*RAMROM_BUF_SIZE)) -#define RAMROM_LOG_ADDR (RAMROM_MSG_ADDR + (5*RAMROM_BUF_SIZE)) - -/*#define RAMROM_GIO_INTERRUPT (RAMROM_MSG_ADDR + RAMROM_MSG_SIZE - 4)*/ - -/* - * For the initial round of PIF bringup, we will load in a bootstrap loader - * 0x400 bytes into the ramrom, and the rom will be loaded at 0x2000 - */ -#ifndef _HW_VERSION_1 -#define RAMROM_BOOTSTRAP_OFFSET 0x40 -#define RAMROM_GAME_OFFSET 0x1000 -#define RAMROM_FONTDATA_OFFSET 0xb70 -#define RAMROM_FONTDATA_SIZE 1152 -#else -#define RAMROM_BOOTSTRAP_OFFSET 0x400 -#define RAMROM_GAME_OFFSET 0x2000 -#endif -#define RAMROM_CLOCKRATE_OFFSET 0x4 -#define RAMROM_CLOCKRATE_MASK 0xfffffff0 -#define RAMROM_BOOTADDR_OFFSET 0x8 -#define RAMROM_RELEASE_OFFSET 0xc -/* - * Second version of the PIF jumps to location 0x1000, and we'll put a jump to - * location 0x400 into the ramrom (for backwards compatibility). - */ -#define RAMROM_PIF2BOOTSTRAP_OFFSET 0x1000 - -typedef struct { - long type; - long length; /* in bytes of userdata */ - long magic; - char userdata[RAMROM_USER_DATA_SIZE]; -} RamRomBuffer; - -/* - * Interrupt values (must fit in 6 bits!) - * values are used for both request & response - * Transactions initiated by the host start with HOST - * and those initiated by the target start with GAME. - */ - -#define HOST_PIACCESS_REQ 1 -#define HOST_DBG_CMD_READY 2 -#define GAME_DBG_DATA_SEND 3 -#define HOST_DBG_DATA_ACK 4 -#define GAME_PRINTF_SEND 5 -#define HOST_PRINTF_ACK 6 -#define GAME_LOG_SEND 7 -#define HOST_LOG_ACK 8 -#define HOST_APP_CMD_READY 9 -#define GAME_APP_DATA_READY 10 -#define HOST_PROF_REQ 11 -#define GAME_PROF_SEND 12 -#define HOST_PROF_ACK 13 -#define GAME_FAULT_SEND 14 -#define HOST_FAULT_ACK 15 -#define GAME_EXIT 16 -#define HOST_DATA_ACK 17 - -#ifdef _EMULATOR -void __RamRomInit(int key, void *romaddr); -void __RamRomDestroy(int key); -#endif /* _EMULATOR */ - -#endif /* !_RAMROM_H */ diff --git a/include/2.0L/PR/rcp.h b/include/2.0L/PR/rcp.h deleted file mode 100644 index 980f21f0..00000000 --- a/include/2.0L/PR/rcp.h +++ /dev/null @@ -1,885 +0,0 @@ -#ifndef _RCP_H_ -#define _RCP_H_ - -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * File: rcp.h - * - * This file contains register and bit definitions for RCP memory map. - * $Revision: 1.22 $ - * $Date: 1999/05/20 03:01:49 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rcp.h,v $ - * - **************************************************************************/ - -#include -#include - -/********************************************************************** - * - * Here is a quick overview of the RCP memory map: - * - -0x0000_0000 .. 0x03ef_ffff RDRAM memory -0x03f0_0000 .. 0x03ff_ffff RDRAM registers - - RCP registers (see below) -0x0400_0000 .. 0x040f_ffff SP registers -0x0410_0000 .. 0x041f_ffff DP command registers -0x0420_0000 .. 0x042f_ffff DP span registers -0x0430_0000 .. 0x043f_ffff MI registers -0x0440_0000 .. 0x044f_ffff VI registers -0x0450_0000 .. 0x045f_ffff AI registers -0x0460_0000 .. 0x046f_ffff PI registers -0x0470_0000 .. 0x047f_ffff RI registers -0x0480_0000 .. 0x048f_ffff SI registers -0x0490_0000 .. 0x04ff_ffff unused - -0x0500_0000 .. 0x05ff_ffff cartridge domain 2 -0x0600_0000 .. 0x07ff_ffff cartridge domain 1 -0x0800_0000 .. 0x0fff_ffff cartridge domain 2 -0x1000_0000 .. 0x1fbf_ffff cartridge domain 1 - -0x1fc0_0000 .. 0x1fc0_07bf PIF Boot Rom (1984 bytes) -0x1fc0_07c0 .. 0x1fc0_07ff PIF (JoyChannel) RAM (64 bytes) -0x1fc0_0800 .. 0x1fcf_ffff Reserved -0x1fd0_0000 .. 0x7fff_ffff cartridge domain 1 -0x8000_0000 .. 0xffff_ffff external SysAD device - -The Indy development board use cartridge domain 1: -0x1000_0000 .. 0x10ff_ffff RAMROM -0x1800_0000 .. 0x1800_0003 GIO interrupt (6 bits valid in 4 bytes) -0x1800_0400 .. 0x1800_0403 GIO sync (6 bits valid in 4 bytes) -0x1800_0800 .. 0x1800_0803 CART interrupt (6 bits valid in 4 bytes) - - - -**************************************************************************/ - - -/************************************************************************* - * RDRAM Memory (Assumes that maximum size is 4 MB) - */ -#define RDRAM_0_START 0x00000000 -#define RDRAM_0_END 0x001FFFFF -#define RDRAM_1_START 0x00200000 -#define RDRAM_1_END 0x003FFFFF - -#define RDRAM_START RDRAM_0_START -#define RDRAM_END RDRAM_1_END - - -/************************************************************************* - * Address predicates - */ -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) -#define IS_RDRAM(x) ((unsigned)(x) >= RDRAM_START && \ - (unsigned)(x) < RDRAM_END) -#endif - - -/************************************************************************* - * RDRAM Registers (0x03f0_0000 .. 0x03ff_ffff) - */ -#define RDRAM_BASE_REG 0x03F00000 - -#define RDRAM_CONFIG_REG (RDRAM_BASE_REG+0x00) -#define RDRAM_DEVICE_TYPE_REG (RDRAM_BASE_REG+0x00) -#define RDRAM_DEVICE_ID_REG (RDRAM_BASE_REG+0x04) -#define RDRAM_DELAY_REG (RDRAM_BASE_REG+0x08) -#define RDRAM_MODE_REG (RDRAM_BASE_REG+0x0c) -#define RDRAM_REF_INTERVAL_REG (RDRAM_BASE_REG+0x10) -#define RDRAM_REF_ROW_REG (RDRAM_BASE_REG+0x14) -#define RDRAM_RAS_INTERVAL_REG (RDRAM_BASE_REG+0x18) -#define RDRAM_MIN_INTERVAL_REG (RDRAM_BASE_REG+0x1c) -#define RDRAM_ADDR_SELECT_REG (RDRAM_BASE_REG+0x20) -#define RDRAM_DEVICE_MANUF_REG (RDRAM_BASE_REG+0x24) - -#define RDRAM_0_DEVICE_ID 0 -#define RDRAM_1_DEVICE_ID 1 - -#define RDRAM_RESET_MODE 0 -#define RDRAM_ACTIVE_MODE 1 -#define RDRAM_STANDBY_MODE 2 - -#define RDRAM_LENGTH (2*512*2048) -#define RDRAM_0_BASE_ADDRESS (RDRAM_0_DEVICE_ID*RDRAM_LENGTH) -#define RDRAM_1_BASE_ADDRESS (RDRAM_1_DEVICE_ID*RDRAM_LENGTH) - -#define RDRAM_0_CONFIG 0x00000 -#define RDRAM_1_CONFIG 0x00400 -#define RDRAM_GLOBAL_CONFIG 0x80000 - - -/************************************************************************* - * PIF Physical memory map (total size = 2 KB) - * - * Size Description Mode - * 1FC007FF +-------+-----------------+-----+ - * | 64 B | JoyChannel RAM | R/W | - * 1FC007C0 +-------+-----------------+-----+ - * |1984 B | Boot ROM | * | * = Reserved - * 1FC00000 +-------+-----------------+-----+ - * - */ -#define PIF_ROM_START 0x1FC00000 -#define PIF_ROM_END 0x1FC007BF -#define PIF_RAM_START 0x1FC007C0 -#define PIF_RAM_END 0x1FC007FF - - -/************************************************************************* - * Controller channel - * Each game controller channel has 4 error bits that are defined in bit 6-7 of - * the Rx and Tx data size area bytes. Programmers need to clear these bits - * when setting the Tx/Rx size area values for a channel - */ -#define CHNL_ERR_NORESP 0x80 /* Bit 7 (Rx): No response error */ -#define CHNL_ERR_OVERRUN 0x40 /* Bit 6 (Rx): Overrun error */ -#define CHNL_ERR_FRAME 0x80 /* Bit 7 (Tx): Frame error */ -#define CHNL_ERR_COLLISION 0x40 /* Bit 6 (Tx): Collision error */ - -#define CHNL_ERR_MASK 0xC0 /* Bit 6-7: channel errors */ - - -/************************************************************************* - * External device info - */ -#define DEVICE_TYPE_CART 0 /* ROM cartridge */ -#define DEVICE_TYPE_BULK 1 /* ROM bulk */ -#define DEVICE_TYPE_64DD 2 /* 64 Disk Drive */ -#define DEVICE_TYPE_SRAM 3 /* SRAM */ -/* 4-6 are reserved */ -#define DEVICE_TYPE_INIT 7 /* initial value */ -/* 8-14 are reserved */ - -/************************************************************************* - * SP Memory - */ -#define SP_DMEM_START 0x04000000 /* read/write */ -#define SP_DMEM_END 0x04000FFF -#define SP_IMEM_START 0x04001000 /* read/write */ -#define SP_IMEM_END 0x04001FFF - -/************************************************************************* - * SP CP0 Registers - */ - -#define SP_BASE_REG 0x04040000 - -/* SP memory address (R/W): [11:0] DMEM/IMEM address; [12] 0=DMEM,1=IMEM */ -#define SP_MEM_ADDR_REG (SP_BASE_REG+0x00) /* Master */ - -/* SP DRAM DMA address (R/W): [23:0] RDRAM address */ -#define SP_DRAM_ADDR_REG (SP_BASE_REG+0x04) /* Slave */ - -/* SP read DMA length (R/W): [11:0] length, [19:12] count, [31:20] skip */ -/* direction: I/DMEM <- RDRAM */ -#define SP_RD_LEN_REG (SP_BASE_REG+0x08) /* R/W: read len */ - -/* SP write DMA length (R/W): [11:0] length, [19:12] count, [31:20] skip */ -/* direction: I/DMEM -> RDRAM */ -#define SP_WR_LEN_REG (SP_BASE_REG+0x0C) /* R/W: write len */ - -/* SP status (R/W): [14:0] valid bits; see below for write/read mode */ -#define SP_STATUS_REG (SP_BASE_REG+0x10) - -/* SP DMA full (R): [0] valid bit; dma full */ -#define SP_DMA_FULL_REG (SP_BASE_REG+0x14) - -/* SP DMA busy (R): [0] valid bit; dma busy */ -#define SP_DMA_BUSY_REG (SP_BASE_REG+0x18) - -/* SP semaphore (R/W): Read: [0] semaphore flag (set on read) */ -/* Write: [] clear semaphore flag */ -#define SP_SEMAPHORE_REG (SP_BASE_REG+0x1C) - -/* SP PC (R/W): [11:0] program counter */ -#define SP_PC_REG 0x04080000 - -/* SP MEM address: bit 12 specifies if address is IMEM or DMEM */ -#define SP_DMA_DMEM 0x0000 /* Bit 12: 0=DMEM, 1=IMEM */ -#define SP_DMA_IMEM 0x1000 /* Bit 12: 0=DMEM, 1=IMEM */ - -/* - * Values to clear/set bit in status reg (SP_STATUS_REG - write) - */ -#define SP_CLR_HALT 0x00001 /* Bit 0: clear halt */ -#define SP_SET_HALT 0x00002 /* Bit 1: set halt */ -#define SP_CLR_BROKE 0x00004 /* Bit 2: clear broke */ -#define SP_CLR_INTR 0x00008 /* Bit 3: clear intr */ -#define SP_SET_INTR 0x00010 /* Bit 4: set intr */ -#define SP_CLR_SSTEP 0x00020 /* Bit 5: clear sstep */ -#define SP_SET_SSTEP 0x00040 /* Bit 6: set sstep */ -#define SP_CLR_INTR_BREAK 0x00080 /* Bit 7: clear intr on break */ -#define SP_SET_INTR_BREAK 0x00100 /* Bit 8: set intr on break */ -#define SP_CLR_SIG0 0x00200 /* Bit 9: clear signal 0 */ -#define SP_SET_SIG0 0x00400 /* Bit 10: set signal 0 */ -#define SP_CLR_SIG1 0x00800 /* Bit 11: clear signal 1 */ -#define SP_SET_SIG1 0x01000 /* Bit 12: set signal 1 */ -#define SP_CLR_SIG2 0x02000 /* Bit 13: clear signal 2 */ -#define SP_SET_SIG2 0x04000 /* Bit 14: set signal 2 */ -#define SP_CLR_SIG3 0x08000 /* Bit 15: clear signal 3 */ -#define SP_SET_SIG3 0x10000 /* Bit 16: set signal 3 */ -#define SP_CLR_SIG4 0x20000 /* Bit 17: clear signal 4 */ -#define SP_SET_SIG4 0x40000 /* Bit 18: set signal 4 */ -#define SP_CLR_SIG5 0x80000 /* Bit 19: clear signal 5 */ -#define SP_SET_SIG5 0x100000 /* Bit 20: set signal 5 */ -#define SP_CLR_SIG6 0x200000 /* Bit 21: clear signal 6 */ -#define SP_SET_SIG6 0x400000 /* Bit 22: set signal 6 */ -#define SP_CLR_SIG7 0x800000 /* Bit 23: clear signal 7 */ -#define SP_SET_SIG7 0x1000000 /* Bit 24: set signal 7 */ - -/* - * Patterns to interpret status reg (SP_STATUS_REG - read) - */ -#define SP_STATUS_HALT 0x001 /* Bit 0: halt */ -#define SP_STATUS_BROKE 0x002 /* Bit 1: broke */ -#define SP_STATUS_DMA_BUSY 0x004 /* Bit 2: dma busy */ -#define SP_STATUS_DMA_FULL 0x008 /* Bit 3: dma full */ -#define SP_STATUS_IO_FULL 0x010 /* Bit 4: io full */ -#define SP_STATUS_SSTEP 0x020 /* Bit 5: single step */ -#define SP_STATUS_INTR_BREAK 0x040 /* Bit 6: interrupt on break */ -#define SP_STATUS_SIG0 0x080 /* Bit 7: signal 0 set */ -#define SP_STATUS_SIG1 0x100 /* Bit 8: signal 1 set */ -#define SP_STATUS_SIG2 0x200 /* Bit 9: signal 2 set */ -#define SP_STATUS_SIG3 0x400 /* Bit 10: signal 3 set */ -#define SP_STATUS_SIG4 0x800 /* Bit 11: signal 4 set */ -#define SP_STATUS_SIG5 0x1000 /* Bit 12: signal 5 set */ -#define SP_STATUS_SIG6 0x2000 /* Bit 13: signal 6 set */ -#define SP_STATUS_SIG7 0x4000 /* Bit 14: signal 7 set */ - -/* - * Use of SIG bits - */ -#define SP_CLR_YIELD SP_CLR_SIG0 -#define SP_SET_YIELD SP_SET_SIG0 -#define SP_STATUS_YIELD SP_STATUS_SIG0 -#define SP_CLR_YIELDED SP_CLR_SIG1 -#define SP_SET_YIELDED SP_SET_SIG1 -#define SP_STATUS_YIELDED SP_STATUS_SIG1 -#define SP_CLR_TASKDONE SP_CLR_SIG2 -#define SP_SET_TASKDONE SP_SET_SIG2 -#define SP_STATUS_TASKDONE SP_STATUS_SIG2 -#define SP_CLR_RSPSIGNAL SP_CLR_SIG3 -#define SP_SET_RSPSIGNAL SP_SET_SIG3 -#define SP_STATUS_RSPSIGNAL SP_STATUS_SIG3 -#define SP_CLR_CPUSIGNAL SP_CLR_SIG4 -#define SP_SET_CPUSIGNAL SP_SET_SIG4 -#define SP_STATUS_CPUSIGNAL SP_STATUS_SIG4 - -/* SP IMEM BIST REG (R/W): [6:0] BIST status bits; see below for detail */ -#define SP_IBIST_REG 0x04080004 - -/* - * Patterns to interpret status reg (SP_BIST_REG - write) - */ -#define SP_IBIST_CHECK 0x01 /* Bit 0: BIST check */ -#define SP_IBIST_GO 0x02 /* Bit 1: BIST go */ -#define SP_IBIST_CLEAR 0x04 /* Bit 2: BIST clear */ - -/* - * Patterns to interpret status reg (SP_BIST_REG - read) - */ -/* First 2 bits are same as in write mode: - * Bit 0: BIST check; Bit 1: BIST go - */ -#define SP_IBIST_DONE 0x04 /* Bit 2: BIST done */ -#define SP_IBIST_FAILED 0x78 /* Bit [6:3]: BIST fail */ - - -/************************************************************************* - * DP Command Registers - */ -#define DPC_BASE_REG 0x04100000 - -/* DP CMD DMA start (R/W): [23:0] DMEM/RDRAM start address */ -#define DPC_START_REG (DPC_BASE_REG+0x00) - -/* DP CMD DMA end (R/W): [23:0] DMEM/RDRAM end address */ -#define DPC_END_REG (DPC_BASE_REG+0x04) - -/* DP CMD DMA end (R): [23:0] DMEM/RDRAM current address */ -#define DPC_CURRENT_REG (DPC_BASE_REG+0x08) - -/* DP CMD status (R/W): [9:0] valid bits - see below for definitions */ -#define DPC_STATUS_REG (DPC_BASE_REG+0x0C) - -/* DP clock counter (R): [23:0] clock counter */ -#define DPC_CLOCK_REG (DPC_BASE_REG+0x10) - -/* DP buffer busy counter (R): [23:0] clock counter */ -#define DPC_BUFBUSY_REG (DPC_BASE_REG+0x14) - -/* DP pipe busy counter (R): [23:0] clock counter */ -#define DPC_PIPEBUSY_REG (DPC_BASE_REG+0x18) - -/* DP TMEM load counter (R): [23:0] clock counter */ -#define DPC_TMEM_REG (DPC_BASE_REG+0x1C) - -/* - * Values to clear/set bit in status reg (DPC_STATUS_REG - write) - */ -#define DPC_CLR_XBUS_DMEM_DMA 0x0001 /* Bit 0: clear xbus_dmem_dma */ -#define DPC_SET_XBUS_DMEM_DMA 0x0002 /* Bit 1: set xbus_dmem_dma */ -#define DPC_CLR_FREEZE 0x0004 /* Bit 2: clear freeze */ -#define DPC_SET_FREEZE 0x0008 /* Bit 3: set freeze */ -#define DPC_CLR_FLUSH 0x0010 /* Bit 4: clear flush */ -#define DPC_SET_FLUSH 0x0020 /* Bit 5: set flush */ -#define DPC_CLR_TMEM_CTR 0x0040 /* Bit 6: clear tmem ctr */ -#define DPC_CLR_PIPE_CTR 0x0080 /* Bit 7: clear pipe ctr */ -#define DPC_CLR_CMD_CTR 0x0100 /* Bit 8: clear cmd ctr */ -#define DPC_CLR_CLOCK_CTR 0x0200 /* Bit 9: clear clock ctr */ - -/* - * Patterns to interpret status reg (DPC_STATUS_REG - read) - */ -#define DPC_STATUS_XBUS_DMEM_DMA 0x001 /* Bit 0: xbus_dmem_dma */ -#define DPC_STATUS_FREEZE 0x002 /* Bit 1: freeze */ -#define DPC_STATUS_FLUSH 0x004 /* Bit 2: flush */ -/*#define DPC_STATUS_FROZEN 0x008*/ /* Bit 3: frozen */ -#define DPC_STATUS_START_GCLK 0x008 /* Bit 3: start gclk */ -#define DPC_STATUS_TMEM_BUSY 0x010 /* Bit 4: tmem busy */ -#define DPC_STATUS_PIPE_BUSY 0x020 /* Bit 5: pipe busy */ -#define DPC_STATUS_CMD_BUSY 0x040 /* Bit 6: cmd busy */ -#define DPC_STATUS_CBUF_READY 0x080 /* Bit 7: cbuf ready */ -#define DPC_STATUS_DMA_BUSY 0x100 /* Bit 8: dma busy */ -#define DPC_STATUS_END_VALID 0x200 /* Bit 9: end valid */ -#define DPC_STATUS_START_VALID 0x400 /* Bit 10: start valid */ - - -/************************************************************************* - * DP Span Registers - */ -#define DPS_BASE_REG 0x04200000 - -/* DP tmem bist (R/W): [10:0] BIST status bits; see below for detail */ -#define DPS_TBIST_REG (DPS_BASE_REG+0x00) - -/* DP span test mode (R/W): [0] Span buffer test access enable */ -#define DPS_TEST_MODE_REG (DPS_BASE_REG+0x04) - -/* DP span buffer test address (R/W): [6:0] bits; see below for detail */ -#define DPS_BUFTEST_ADDR_REG (DPS_BASE_REG+0x08) - -/* DP span buffer test data (R/W): [31:0] span buffer data */ -#define DPS_BUFTEST_DATA_REG (DPS_BASE_REG+0x0C) - -/* - * Patterns to interpret status reg (DPS_TMEM_BIST_REG - write) - */ -#define DPS_TBIST_CHECK 0x01 /* Bit 0: BIST check */ -#define DPS_TBIST_GO 0x02 /* Bit 1: BIST go */ -#define DPS_TBIST_CLEAR 0x04 /* Bit 2: BIST clear */ - -/* - * Patterns to interpret status reg (DPS_TMEM_BIST_REG - read) - */ -/* First 2 bits are same as in write mode: - * Bit 0: BIST check; Bit 1: BIST go - */ -#define DPS_TBIST_DONE 0x004 /* Bit 2: BIST done */ -#define DPS_TBIST_FAILED 0x7F8 /* Bit [10:3]: BIST fail */ - - -/************************************************************************* - * MIPS Interface (MI) Registers - */ -#define MI_BASE_REG 0x04300000 - -/* - * MI init mode (W): [6:0] init length, [7] clear init mode, [8] set init mode - * [9/10] clear/set ebus test mode, [11] clear DP interrupt - * (R): [6:0] init length, [7] init mode, [8] ebus test mode - */ -#define MI_INIT_MODE_REG (MI_BASE_REG+0x00) -#define MI_MODE_REG MI_INIT_MODE_REG - -/* - * Values to clear/set bit in mode reg (MI_MODE_REG - write) - */ -#define MI_CLR_INIT 0x0080 /* Bit 7: clear init mode */ -#define MI_SET_INIT 0x0100 /* Bit 8: set init mode */ -#define MI_CLR_EBUS 0x0200 /* Bit 9: clear ebus test */ -#define MI_SET_EBUS 0x0400 /* Bit 10: set ebus test mode */ -#define MI_CLR_DP_INTR 0x0800 /* Bit 11: clear dp interrupt */ -#define MI_CLR_RDRAM 0x1000 /* Bit 12: clear RDRAM reg */ -#define MI_SET_RDRAM 0x2000 /* Bit 13: set RDRAM reg mode */ - -/* - * Patterns to interpret mode reg (MI_MODE_REG - read) - */ -#define MI_MODE_INIT 0x0080 /* Bit 7: init mode */ -#define MI_MODE_EBUS 0x0100 /* Bit 8: ebus test mode */ -#define MI_MODE_RDRAM 0x0200 /* Bit 9: RDRAM reg mode */ - -/* MI version (R): [7:0] io, [15:8] rac, [23:16] rdp, [31:24] rsp */ -#define MI_VERSION_REG (MI_BASE_REG+0x04) -#define MI_NOOP_REG MI_VERSION_REG - -/* MI interrupt (R): [5:0] valid bits - see below for bit patterns */ -#define MI_INTR_REG (MI_BASE_REG+0x08) - -/* - * MI interrupt mask (W): [11:0] valid bits - see below for bit patterns - * (R): [5:0] valid bits - see below for bit patterns - */ -#define MI_INTR_MASK_REG (MI_BASE_REG+0x0C) - -/* - * The following are values to check for interrupt setting (MI_INTR_REG) - */ -#define MI_INTR_SP 0x01 /* Bit 0: SP intr */ -#define MI_INTR_SI 0x02 /* Bit 1: SI intr */ -#define MI_INTR_AI 0x04 /* Bit 2: AI intr */ -#define MI_INTR_VI 0x08 /* Bit 3: VI intr */ -#define MI_INTR_PI 0x10 /* Bit 4: PI intr */ -#define MI_INTR_DP 0x20 /* Bit 5: DP intr */ - -/* - * The following are values to clear/set various interrupt bit mask - * They can be ORed together to manipulate multiple bits - * (MI_INTR_MASK_REG - write) - */ -#define MI_INTR_MASK_CLR_SP 0x0001 /* Bit 0: clear SP mask */ -#define MI_INTR_MASK_SET_SP 0x0002 /* Bit 1: set SP mask */ -#define MI_INTR_MASK_CLR_SI 0x0004 /* Bit 2: clear SI mask */ -#define MI_INTR_MASK_SET_SI 0x0008 /* Bit 3: set SI mask */ -#define MI_INTR_MASK_CLR_AI 0x0010 /* Bit 4: clear AI mask */ -#define MI_INTR_MASK_SET_AI 0x0020 /* Bit 5: set AI mask */ -#define MI_INTR_MASK_CLR_VI 0x0040 /* Bit 6: clear VI mask */ -#define MI_INTR_MASK_SET_VI 0x0080 /* Bit 7: set VI mask */ -#define MI_INTR_MASK_CLR_PI 0x0100 /* Bit 8: clear PI mask */ -#define MI_INTR_MASK_SET_PI 0x0200 /* Bit 9: set PI mask */ -#define MI_INTR_MASK_CLR_DP 0x0400 /* Bit 10: clear DP mask */ -#define MI_INTR_MASK_SET_DP 0x0800 /* Bit 11: set DP mask */ - -/* - * The following are values to check for interrupt mask setting - * (MI_INTR_MASK_REG - read) - */ -#define MI_INTR_MASK_SP 0x01 /* Bit 0: SP intr mask */ -#define MI_INTR_MASK_SI 0x02 /* Bit 1: SI intr mask */ -#define MI_INTR_MASK_AI 0x04 /* Bit 2: AI intr mask */ -#define MI_INTR_MASK_VI 0x08 /* Bit 3: VI intr mask */ -#define MI_INTR_MASK_PI 0x10 /* Bit 4: PI intr mask */ -#define MI_INTR_MASK_DP 0x20 /* Bit 5: DP intr mask */ - - -/************************************************************************* - * Video Interface (VI) Registers - */ -#define VI_BASE_REG 0x04400000 - -/* VI status/control (R/W): [15-0] valid bits: - * [1:0] = type[1:0] (pixel size) - * 0: blank (no data, no sync) - * 1: reserved - * 2: 5/5/5/3 ("16" bit) - * 3: 8/8/8/8 (32 bit) - * [2] = gamma_dither_enable (normally on, unless "special effect") - * [3] = gamma_enable (normally on, unless MPEG/JPEG) - * [4] = divot_enable (normally on if antialiased, unless decal lines) - * [5] = reserved - always off - * [6] = serrate (always on if interlaced, off if not) - * [7] = reserved - diagnostics only - * [9:8] = anti-alias (aa) mode[1:0] - * 0: aa & resamp (always fetch extra lines) - * 1: aa & resamp (fetch extra lines if needed) - * 2: resamp only (treat as all fully covered) - * 3: neither (replicate pixels, no interpolate) - * [11] = reserved - diagnostics only - * [15:12] = reserved - * - */ -#define VI_STATUS_REG (VI_BASE_REG+0x00) -#define VI_CONTROL_REG VI_STATUS_REG - -/* VI origin (R/W): [23:0] frame buffer origin in bytes */ -#define VI_ORIGIN_REG (VI_BASE_REG+0x04) -#define VI_DRAM_ADDR_REG VI_ORIGIN_REG - -/* VI width (R/W): [11:0] frame buffer line width in pixels */ -#define VI_WIDTH_REG (VI_BASE_REG+0x08) -#define VI_H_WIDTH_REG VI_WIDTH_REG - -/* VI vertical intr (R/W): [9:0] interrupt when current half-line = V_INTR */ -#define VI_INTR_REG (VI_BASE_REG+0x0C) -#define VI_V_INTR_REG VI_INTR_REG - -/* - * VI current vertical line (R/W): [9:0] current half line, sampled once per - * line (the lsb of V_CURRENT is constant within a field, and in - * interlaced modes gives the field number - which is constant for non- - * interlaced modes) - * - Any write to this register will clear interrupt line - */ -#define VI_CURRENT_REG (VI_BASE_REG+0x10) -#define VI_V_CURRENT_LINE_REG VI_CURRENT_REG - -/* - * VI video timing (R/W): [ 7: 0] horizontal sync width in pixels, - * [15: 8] color burst width in pixels, - * [19:16] vertical sync width in half lines, - * [29:20] start of color burst in pixels from h-sync - */ -#define VI_BURST_REG (VI_BASE_REG+0x14) -#define VI_TIMING_REG VI_BURST_REG - -/* VI vertical sync (R/W): [9:0] number of half-lines per field */ -#define VI_V_SYNC_REG (VI_BASE_REG+0x18) - -/* VI horizontal sync (R/W): [11: 0] total duration of a line in 1/4 pixel - * [20:16] a 5-bit leap pattern used for PAL only - * (h_sync_period) - */ -#define VI_H_SYNC_REG (VI_BASE_REG+0x1C) - -/* - * VI horizontal sync leap (R/W): [11: 0] identical to h_sync_period - * [27:16] identical to h_sync_period - */ -#define VI_LEAP_REG (VI_BASE_REG+0x20) -#define VI_H_SYNC_LEAP_REG VI_LEAP_REG - -/* - * VI horizontal video (R/W): [ 9: 0] end of active video in screen pixels - * : [25:16] start of active video in screen pixels - */ -#define VI_H_START_REG (VI_BASE_REG+0x24) -#define VI_H_VIDEO_REG VI_H_START_REG - -/* - * VI vertical video (R/W): [ 9: 0] end of active video in screen half-lines - * : [25:16] start of active video in screen half-lines - */ -#define VI_V_START_REG (VI_BASE_REG+0x28) -#define VI_V_VIDEO_REG VI_V_START_REG - -/* - * VI vertical burst (R/W): [ 9: 0] end of color burst enable in half-lines - * : [25:16] start of color burst enable in half-lines - */ -#define VI_V_BURST_REG (VI_BASE_REG+0x2C) - -/* VI x-scale (R/W): [11: 0] 1/horizontal scale up factor (2.10 format) - * [27:16] horizontal subpixel offset (2.10 format) - */ -#define VI_X_SCALE_REG (VI_BASE_REG+0x30) - -/* VI y-scale (R/W): [11: 0] 1/vertical scale up factor (2.10 format) - * [27:16] vertical subpixel offset (2.10 format) - */ -#define VI_Y_SCALE_REG (VI_BASE_REG+0x34) - -/* - * Patterns to interpret VI_CONTROL_REG - */ -#define VI_CTRL_TYPE_16 0x00002 /* Bit [1:0] pixel size: 16 bit */ -#define VI_CTRL_TYPE_32 0x00003 /* Bit [1:0] pixel size: 32 bit */ -#define VI_CTRL_GAMMA_DITHER_ON 0x00004 /* Bit 2: default = on */ -#define VI_CTRL_GAMMA_ON 0x00008 /* Bit 3: default = on */ -#define VI_CTRL_DIVOT_ON 0x00010 /* Bit 4: default = on */ -#define VI_CTRL_SERRATE_ON 0x00040 /* Bit 6: on if interlaced */ -#define VI_CTRL_ANTIALIAS_MASK 0x00300 /* Bit [9:8] anti-alias mode */ -#define VI_CTRL_DITHER_FILTER_ON 0x10000 /* Bit 16: dither-filter mode */ - -/* - * Possible video clocks (NTSC or PAL) - */ -#define VI_NTSC_CLOCK 48681812 /* Hz = 48.681812 MHz */ -#define VI_PAL_CLOCK 49656530 /* Hz = 49.656530 MHz */ -#define VI_MPAL_CLOCK 48628316 /* Hz = 48.628316 MHz */ - - -/************************************************************************* - * Audio Interface (AI) Registers - * - * The address and length registers are double buffered; that is, they - * can be written twice before becoming full. - * The address must be written before the length. - */ -#define AI_BASE_REG 0x04500000 - -/* AI DRAM address (W): [23:0] starting RDRAM address (8B-aligned) */ -#define AI_DRAM_ADDR_REG (AI_BASE_REG+0x00) /* R0: DRAM address */ - -/* AI length (R/W): [14:0] transfer length (v1.0) - Bottom 3 bits are ignored */ -/* [17:0] transfer length (v2.0) - Bottom 3 bits are ignored */ -#define AI_LEN_REG (AI_BASE_REG+0x04) /* R1: Length */ - -/* AI control (W): [0] DMA enable - if LSB == 1, DMA is enabled */ -#define AI_CONTROL_REG (AI_BASE_REG+0x08) /* R2: DMA Control */ - -/* - * AI status (R): [31]/[0] ai_full (addr & len buffer full), [30] ai_busy - * Note that a 1->0 transition in ai_full will set interrupt - * (W): clear audio interrupt - */ -#define AI_STATUS_REG (AI_BASE_REG+0x0C) /* R3: Status */ - -/* - * AI DAC sample period register (W): [13:0] dac rate - * - vid_clock/(dperiod + 1) is the DAC sample rate - * - (dperiod + 1) >= 66 * (aclockhp + 1) must be true - */ -#define AI_DACRATE_REG (AI_BASE_REG+0x10) /* R4: DAC rate 14-lsb*/ - -/* - * AI bit rate (W): [3:0] bit rate (abus clock half period register - aclockhp) - * - vid_clock/(2 * (aclockhp + 1)) is the DAC clock rate - * - The abus clock stops if aclockhp is zero - */ -#define AI_BITRATE_REG (AI_BASE_REG+0x14) /* R5: Bit rate 4-lsb */ - -/* Value for control register */ -#define AI_CONTROL_DMA_ON 0x01 /* LSB = 1: DMA enable*/ -#define AI_CONTROL_DMA_OFF 0x00 /* LSB = 1: DMA enable*/ - -/* Value for status register */ -#define AI_STATUS_FIFO_FULL 0x80000000 /* Bit 31: full */ -#define AI_STATUS_DMA_BUSY 0x40000000 /* Bit 30: busy */ - -/* DAC rate = video clock / audio frequency - * - DAC rate >= (66 * Bit rate) must be true - */ -#define AI_MAX_DAC_RATE 16384 /* 14-bit+1 */ -#define AI_MIN_DAC_RATE 132 - -/* Bit rate <= (DAC rate / 66) */ -#define AI_MAX_BIT_RATE 16 /* 4-bit+1 */ -#define AI_MIN_BIT_RATE 2 - -/* - * Maximum and minimum values for audio frequency based on video clocks - * max frequency = (video clock / min dac rate) - * min frequency = (video clock / max dac rate) - */ -#define AI_NTSC_MAX_FREQ 368000 /* 368 KHz */ -#define AI_NTSC_MIN_FREQ 3000 /* 3 KHz ~ 2971 Hz */ - -#define AI_PAL_MAX_FREQ 376000 /* 376 KHz */ -#define AI_PAL_MIN_FREQ 3050 /* 3 KHz ~ 3031 Hz */ - -#define AI_MPAL_MAX_FREQ 368000 /* 368 KHz */ -#define AI_MPAL_MIN_FREQ 3000 /* 3 KHz ~ 2968 Hz */ - - -/************************************************************************* - * Peripheral Interface (PI) Registers - */ -#define PI_BASE_REG 0x04600000 - -/* PI DRAM address (R/W): [23:0] starting RDRAM address */ -#define PI_DRAM_ADDR_REG (PI_BASE_REG+0x00) /* DRAM address */ - -/* PI pbus (cartridge) address (R/W): [31:0] starting AD16 address */ -#define PI_CART_ADDR_REG (PI_BASE_REG+0x04) - -/* PI read length (R/W): [23:0] read data length */ -#define PI_RD_LEN_REG (PI_BASE_REG+0x08) - -/* PI write length (R/W): [23:0] write data length */ -#define PI_WR_LEN_REG (PI_BASE_REG+0x0C) - -/* - * PI status (R): [0] DMA busy, [1] IO busy, [2], error - * (W): [0] reset controller (and abort current op), [1] clear intr - */ -#define PI_STATUS_REG (PI_BASE_REG+0x10) - -/* PI dom1 latency (R/W): [7:0] domain 1 device latency */ -#define PI_BSD_DOM1_LAT_REG (PI_BASE_REG+0x14) - -/* PI dom1 pulse width (R/W): [7:0] domain 1 device R/W strobe pulse width */ -#define PI_BSD_DOM1_PWD_REG (PI_BASE_REG+0x18) - -/* PI dom1 page size (R/W): [3:0] domain 1 device page size */ -#define PI_BSD_DOM1_PGS_REG (PI_BASE_REG+0x1C) /* page size */ - -/* PI dom1 release (R/W): [1:0] domain 1 device R/W release duration */ -#define PI_BSD_DOM1_RLS_REG (PI_BASE_REG+0x20) - -/* PI dom2 latency (R/W): [7:0] domain 2 device latency */ -#define PI_BSD_DOM2_LAT_REG (PI_BASE_REG+0x24) /* Domain 2 latency */ - -/* PI dom2 pulse width (R/W): [7:0] domain 2 device R/W strobe pulse width */ -#define PI_BSD_DOM2_PWD_REG (PI_BASE_REG+0x28) /* pulse width */ - -/* PI dom2 page size (R/W): [3:0] domain 2 device page size */ -#define PI_BSD_DOM2_PGS_REG (PI_BASE_REG+0x2C) /* page size */ - -/* PI dom2 release (R/W): [1:0] domain 2 device R/W release duration */ -#define PI_BSD_DOM2_RLS_REG (PI_BASE_REG+0x30) /* release duration */ - -#define PI_DOMAIN1_REG PI_BSD_DOM1_LAT_REG -#define PI_DOMAIN2_REG PI_BSD_DOM2_LAT_REG - -#define PI_DOM_LAT_OFS 0x00 -#define PI_DOM_PWD_OFS 0x04 -#define PI_DOM_PGS_OFS 0x08 -#define PI_DOM_RLS_OFS 0x0C - -/* - * PI status register has 3 bits active when read from (PI_STATUS_REG - read) - * Bit 0: DMA busy - set when DMA is in progress - * Bit 1: IO busy - set when IO is in progress - * Bit 2: Error - set when CPU issues IO request while DMA is busy - */ -#define PI_STATUS_ERROR 0x04 -#define PI_STATUS_IO_BUSY 0x02 -#define PI_STATUS_DMA_BUSY 0x01 - -/* PI status register has 2 bits active when written to: - * Bit 0: When set, reset PIC - * Bit 1: When set, clear interrupt flag - * The values of the two bits can be ORed together to both reset PIC and - * clear interrupt at the same time. - * - * Note: - * - The PIC does generate an interrupt at the end of each DMA. CPU - * needs to clear the interrupt flag explicitly (from an interrupt - * handler) by writing into the STATUS register with bit 1 set. - * - * - When a DMA completes, the interrupt flag is set. CPU can issue - * another request even while the interrupt flag is set (as long as - * PIC is idle). However, it is the CPU's responsibility for - * maintaining accurate correspondence between DMA completions and - * interrupts. - * - * - When PIC is reset, if PIC happens to be busy, an interrupt will - * be generated as PIC returns to idle. Otherwise, no interrupt will - * be generated and PIC remains idle. - */ -/* - * Values to clear interrupt/reset PIC (PI_STATUS_REG - write) - */ -#define PI_STATUS_RESET 0x01 -#define PI_SET_RESET PI_STATUS_RESET - -#define PI_STATUS_CLR_INTR 0x02 -#define PI_CLR_INTR PI_STATUS_CLR_INTR - -#define PI_DMA_BUFFER_SIZE 128 - -#define PI_DOM1_ADDR1 0x06000000 /* to 0x07FFFFFF */ -#define PI_DOM1_ADDR2 0x10000000 /* to 0x1FBFFFFF */ -#define PI_DOM1_ADDR3 0x1FD00000 /* to 0x7FFFFFFF */ -#define PI_DOM2_ADDR1 0x05000000 /* to 0x05FFFFFF */ -#define PI_DOM2_ADDR2 0x08000000 /* to 0x0FFFFFFF */ - - -/************************************************************************* - * RDRAM Interface (RI) Registers - */ -#define RI_BASE_REG 0x04700000 - -/* RI mode (R/W): [1:0] operating mode, [2] stop T active, [3] stop R active */ -#define RI_MODE_REG (RI_BASE_REG+0x00) - -/* RI config (R/W): [5:0] current control input, [6] current control enable */ -#define RI_CONFIG_REG (RI_BASE_REG+0x04) - -/* RI current load (W): [] any write updates current control register */ -#define RI_CURRENT_LOAD_REG (RI_BASE_REG+0x08) - -/* RI select (R/W): [2:0] receive select, [2:0] transmit select */ -#define RI_SELECT_REG (RI_BASE_REG+0x0C) - -/* RI refresh (R/W): [7:0] clean refresh delay, [15:8] dirty refresh delay, - * [16] refresh bank, [17] refresh enable - * [18] refresh optimize - */ -#define RI_REFRESH_REG (RI_BASE_REG+0x10) -#define RI_COUNT_REG RI_REFRESH_REG - -/* RI latency (R/W): [3:0] DMA latency/overlap */ -#define RI_LATENCY_REG (RI_BASE_REG+0x14) - -/* RI error (R): [0] nack error, [1] ack error */ -#define RI_RERROR_REG (RI_BASE_REG+0x18) - -/* RI error (W): [] any write clears all error bits */ -#define RI_WERROR_REG (RI_BASE_REG+0x1C) - - -/************************************************************************* - * Serial Interface (SI) Registers - */ -#define SI_BASE_REG 0x04800000 - -/* SI DRAM address (R/W): [23:0] starting RDRAM address */ -#define SI_DRAM_ADDR_REG (SI_BASE_REG+0x00) /* R0: DRAM address */ - -/* SI address read 64B (W): [] any write causes a 64B DMA write */ -#define SI_PIF_ADDR_RD64B_REG (SI_BASE_REG+0x04) /* R1: 64B PIF->DRAM */ - -/* Address SI_BASE_REG + (0x08, 0x0c, 0x14) are reserved */ - -/* SI address write 64B (W): [] any write causes a 64B DMA read */ -#define SI_PIF_ADDR_WR64B_REG (SI_BASE_REG+0x10) /* R4: 64B DRAM->PIF */ - -/* - * SI status (W): [] any write clears interrupt - * (R): [0] DMA busy, [1] IO read busy, [2] reserved - * [3] DMA error, [12] interrupt - */ -#define SI_STATUS_REG (SI_BASE_REG+0x18) /* R6: Status */ - -/* SI status register has the following bits active: - * 0: DMA busy - set when DMA is in progress - * 1: IO busy - set when IO access is in progress - * 3: DMA error - set when there are overlapping DMA requests - * 12: Interrupt - Interrupt set - */ -#define SI_STATUS_DMA_BUSY 0x0001 -#define SI_STATUS_RD_BUSY 0x0002 -#define SI_STATUS_DMA_ERROR 0x0008 -#define SI_STATUS_INTERRUPT 0x1000 - -/************************************************************************* - * Development Board GIO Control Registers - */ - -#define GIO_BASE_REG 0x18000000 - -/* Game to Host Interrupt */ -#define GIO_GIO_INTR_REG (GIO_BASE_REG+0x000) - -/* Game to Host SYNC */ -#define GIO_GIO_SYNC_REG (GIO_BASE_REG+0x400) - -/* Host to Game Interrupt */ -#define GIO_CART_INTR_REG (GIO_BASE_REG+0x800) - - -/************************************************************************* - * Common macros - */ -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) -#define IO_READ(addr) (*(vu32 *)PHYS_TO_K1(addr)) -#define IO_WRITE(addr,data) (*(vu32 *)PHYS_TO_K1(addr)=(u32)(data)) -#define RCP_STAT_PRINT \ - rmonPrintf("current=%x start=%x end=%x dpstat=%x spstat=%x\n", \ - IO_READ(DPC_CURRENT_REG), \ - IO_READ(DPC_START_REG), \ - IO_READ(DPC_END_REG), \ - IO_READ(DPC_STATUS_REG), \ - IO_READ(SP_STATUS_REG)) - -#endif - -#endif /* _RCP_H_ */ - diff --git a/include/2.0L/PR/rdb.h b/include/2.0L/PR/rdb.h deleted file mode 100644 index e0897493..00000000 --- a/include/2.0L/PR/rdb.h +++ /dev/null @@ -1,93 +0,0 @@ - -/************************************************************************** - * - * $Revision: 1.6 $ - * $Date: 1997/02/11 08:29:31 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rdb.h,v $ - * - **************************************************************************/ - -#ifndef _RDB_H -#define _RDB_H - -/* U64 side address */ -#define RDB_BASE_REG 0xc0000000 -#define RDB_WRITE_INTR_REG (RDB_BASE_REG + 0x8) -#define RDB_READ_INTR_REG (RDB_BASE_REG + 0xc) -#define RDB_BASE_VIRTUAL_ADDR 0x80000000 - -/* packet type Have six bits, so can have up to 63 types */ -#define RDB_TYPE_INVALID 0 -#define RDB_TYPE_GtoH_PRINT 1 -#define RDB_TYPE_GtoH_FAULT 2 -#define RDB_TYPE_GtoH_LOG_CT 3 -#define RDB_TYPE_GtoH_LOG 4 -#define RDB_TYPE_GtoH_READY_FOR_DATA 5 -#define RDB_TYPE_GtoH_DATA_CT 6 -#define RDB_TYPE_GtoH_DATA 7 -#define RDB_TYPE_GtoH_DEBUG 8 -#define RDB_TYPE_GtoH_RAMROM 9 -#define RDB_TYPE_GtoH_DEBUG_DONE 10 -#define RDB_TYPE_GtoH_DEBUG_READY 11 -#define RDB_TYPE_GtoH_KDEBUG 12 -#define RDB_TYPE_GtoH_PROF_DATA 22 - - -#define RDB_TYPE_HtoG_LOG_DONE 13 -#define RDB_TYPE_HtoG_DEBUG 14 -#define RDB_TYPE_HtoG_DEBUG_CT 15 -#define RDB_TYPE_HtoG_DATA 16 -#define RDB_TYPE_HtoG_DATA_DONE 17 -#define RDB_TYPE_HtoG_REQ_RAMROM 18 -#define RDB_TYPE_HtoG_FREE_RAMROM 19 -#define RDB_TYPE_HtoG_KDEBUG 20 -#define RDB_TYPE_HtoG_PROF_SIGNAL 21 - - -#define RDB_PROF_ACK_SIG 1 -#define RDB_PROF_FLUSH_SIG 2 -#define PROF_BLOCK_SIZE 2048 - -#define RDB_LOG_MAX_BLOCK_SIZE 0x8000 -#define RDB_DATA_MAX_BLOCK_SIZE 0x8000 - - -/* GIO side address */ -#define GIO_RDB_BASE_REG 0xbf480000 -#define GIO_RDB_WRITE_INTR_REG (GIO_RDB_BASE_REG + 0x8) -#define GIO_RDB_READ_INTR_REG (GIO_RDB_BASE_REG + 0xc) - -/* minor device number */ -#define GIO_RDB_PRINT_MINOR 1 -#define GIO_RDB_DEBUG_MINOR 2 - -/* interrupt bit */ -#define GIO_RDB_WRITE_INTR_BIT 0x80000000 -#define GIO_RDB_READ_INTR_BIT 0x40000000 - -/* debug command */ -#define DEBUG_COMMAND_NULL 0 -#define DEBUG_COMMAND_MEMORY 1 -#define DEBUG_COMMAND_REGISTER 2 -#define DEBUG_COMMAND_INVALID 255 - -/* debug state */ -#define DEBUG_STATE_NULL 0 -#define DEBUG_STATE_RECEIVE 1 -#define DEBUG_STATE_INVALID 255 - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* Structure for debug port */ -typedef struct { - unsigned type : 6; /* 0: invalid, 1: print, 2: debug */ - unsigned length : 2; /* 1, 2, or 3 */ - char buf[3]; /* character buffer */ -} rdbPacket; - -extern unsigned int __osRdbWriteOK; -extern unsigned int __osRdbSendMessage; - -#endif /* _LANGUAGE_C */ - -#endif /* !_RDB_H */ diff --git a/include/2.0L/PR/region.h b/include/2.0L/PR/region.h deleted file mode 100644 index 0ac8a253..00000000 --- a/include/2.0L/PR/region.h +++ /dev/null @@ -1,123 +0,0 @@ - -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * Module: region.h - * - * $Revision: 1.8 $ - * $Date: 1997/11/26 00:30:56 $ - * $Author: mitu $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/region.h,v $ - * - * Description: - * This file contains macros and structure definitions for the region - * library. - * - **************************************************************************/ - - -#ifndef _REGION_H_ -#define _REGION_H_ - - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - - -/*************************************** - * - * Global defines - * - */ - /* Alignment sizes */ -#define ALIGNSZ (sizeof(long long)) /* 8 bytes */ -#define ALIGNOFFST (ALIGNSZ-1) - - /* size for storing index to free buffer */ -#define BUF_CTRL_SIZE ALIGNSZ - - /* Max bufcount = 32K */ -#define MAX_BUFCOUNT 0x8000 - /* code for last free buffer */ -#define BUF_FREE_WO_NEXT 0x8000 - -/* - * Global defines for alignment size (default is 8-byte alignment) - */ -#define OS_RG_ALIGN_2B 2 /* 2 bytes = 16-bit alignment */ -#define OS_RG_ALIGN_4B 4 /* 4 bytes = 32-bit alignment */ -#define OS_RG_ALIGN_8B 8 /* 8 bytes = 64-bit alignment */ -#define OS_RG_ALIGN_16B 16 /* 16 bytes = 128-bit alignment */ - -#define OS_RG_ALIGN_DEFAULT OS_RG_ALIGN_8B - - -/*************************************** - * - * Macro definitions - * - */ - -/* Perform alignment on input 's' */ -#define ALIGN(s, align) (((u32)(s) + ((align)-1)) & ~((align)-1)) - - -/*************************************** - * - * Typedefs & structure definitions - * - */ -/* - * Structure for region header/control area - */ -typedef struct _Region_s { - u8 *r_startBufferAddress; /* start address to data buffer */ - u8 *r_endAddress; /* end address of region */ - s32 r_bufferSize; /* size of buffers for this region */ - s32 r_bufferCount; /* up to 32K entries; MSB is used for - setting end-of-list/used */ - u16 r_freeList; /* point to array index of first - available memory buffer */ - u16 r_alignSize; /* alignment size (# of bytes) */ -} OSRegion; - -/* - * Macro to simplify accessing region header structure - */ -#define RP(x) rp->r_##x - - -/*************************************** - * - * Function prototypes - * - */ -extern void *osCreateRegion(void *, u32, u32, u32); -extern void *osMalloc(void *); -extern void osFree(void *, void *); -extern s32 osGetRegionBufCount(void *); -extern s32 osGetRegionBufSize(void *); - - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - - -#endif /* _REGION_H_ */ - - diff --git a/include/2.0L/PR/rmon.h b/include/2.0L/PR/rmon.h deleted file mode 100644 index 199e5699..00000000 --- a/include/2.0L/PR/rmon.h +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * $Revision: 1.6 $ - * $Date: 1997/02/11 08:30:08 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rmon.h,v $ - * - **************************************************************************/ - -#ifndef _RMON_H_ -#define _RMON_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#define RMON_DBG_BUF_SIZE 2048 -#define RMON_STACKSIZE 0x1000 - -extern void rmonMain( void * ); -extern void rmonPrintf( const char *, ... ); - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_H */ diff --git a/include/2.0L/PR/sched.h b/include/2.0L/PR/sched.h deleted file mode 100644 index 2d305a2e..00000000 --- a/include/2.0L/PR/sched.h +++ /dev/null @@ -1,115 +0,0 @@ -/*==================================================================== - * sched.h - * - * Synopsis: - * - * Copyright 1993, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/************************************************************************** - * - * $Revision: 1.7 $ - * $Date: 1997/02/11 08:32:02 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sched.h,v $ - * - **************************************************************************/ - -#ifndef __sched__ -#define __sched__ - -#include - -#define OS_SC_STACKSIZE 0x2000 - -#define OS_SC_RETRACE_MSG 1 -#define OS_SC_DONE_MSG 2 -#define OS_SC_RDP_DONE_MSG 3 -#define OS_SC_PRE_NMI_MSG 4 -#define OS_SC_LAST_MSG 4 /* this should have highest number */ -#define OS_SC_MAX_MESGS 8 - -typedef struct { - short type; - char misc[30]; -} OSScMsg; - -typedef struct OSScTask_s { - struct OSScTask_s *next; /* note: this must be first */ - u32 state; - u32 flags; - void *framebuffer; /* used by graphics tasks */ - - OSTask list; - OSMesgQueue *msgQ; - OSMesg msg; -#ifndef _FINALROM /* all #ifdef items should */ - OSTime startTime; /* remain at the end!!, or */ - OSTime totalTime; /* possible conflict if */ -#endif /* FINALROM library used with */ -} OSScTask; /* non FINALROM code */ - -/* - * OSScTask flags: - */ -#define OS_SC_NEEDS_RDP 0x0001 /* uses the RDP */ -#define OS_SC_NEEDS_RSP 0x0002 /* uses the RSP */ -#define OS_SC_DRAM_DLIST 0x0004 /* SP & DP communicate through DRAM */ -#define OS_SC_PARALLEL_TASK 0x0010 /* must be first gfx task on list */ -#define OS_SC_LAST_TASK 0x0020 /* last task in queue for frame */ -#define OS_SC_SWAPBUFFER 0x0040 /* swapbuffers when gfx task done */ - -#define OS_SC_RCP_MASK 0x0003 /* mask for needs bits */ -#define OS_SC_TYPE_MASK 0x0007 /* complete type mask */ -/* - * OSScClient: - * - * Data structure used by threads that wish to communicate to the - * scheduling thread - * - */ -typedef struct SCClient_s { - struct SCClient_s *next; /* next client in the list */ - OSMesgQueue *msgQ; /* where to send the frame msg */ -} OSScClient; - -typedef struct { - OSScMsg retraceMsg; - OSScMsg prenmiMsg; - OSMesgQueue interruptQ; - OSMesg intBuf[OS_SC_MAX_MESGS]; - OSMesgQueue cmdQ; - OSMesg cmdMsgBuf[OS_SC_MAX_MESGS]; - OSThread thread; - OSScClient *clientList; - OSScTask *audioListHead; - OSScTask *gfxListHead; - OSScTask *audioListTail; - OSScTask *gfxListTail; - OSScTask *curRSPTask; - OSScTask *curRDPTask; - u32 frameCount; - s32 doAudio; -} OSSched; - -void osCreateScheduler(OSSched *s, void *stack, OSPri priority, - u8 mode, u8 numFields); -void osScAddClient(OSSched *s, OSScClient *c, OSMesgQueue *msgQ); -void osScRemoveClient(OSSched *s, OSScClient *c); -OSMesgQueue *osScGetCmdQ(OSSched *s); - -#endif - diff --git a/include/2.0L/PR/sp.h b/include/2.0L/PR/sp.h deleted file mode 100644 index 8167ca23..00000000 --- a/include/2.0L/PR/sp.h +++ /dev/null @@ -1,196 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * Sprite library include file - * - * $Revision: 1.16 $ - * $Date: 1998/04/17 05:03:46 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sp.h,v $ - * - **************************************************************************/ - -#ifndef _SP_H_ -#define _SP_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include -#include - -struct bitmap { - s16 width; /* Size across to draw in texels */ - /* Done if width = 0 */ - - s16 width_img; /* Size across of bitmap in texels */ - /* Done if width = 0 */ - - s16 s; /* Horizontal offset into bitmap */ - /* if (s > width), then load only! */ - - s16 t; /* Vertical offset into base */ - - void *buf; /* Pointer to bitmap data */ - /* Don't re-load if new buf */ - /* is the same as the old one */ - /* Skip if NULL */ - - s16 actualHeight; /* True Height of this bitmap piece */ - - s16 LUToffset; /* LUT base index */ -}; - -typedef struct bitmap Bitmap; - -struct sprite { - s16 x,y; /* Target position */ - - s16 width, height; /* Target size */ - - f32 scalex, scaley; /* Texel to Pixel scale factor */ - - s16 expx, expy; /* Explosion spacing */ - - u16 attr; /* Attribute Flags */ - s16 zdepth; /* Z Depth */ - - u8 red; /* Red component */ - u8 green; /* Green component */ - u8 blue; /* Blue component */ - u8 alpha; /* Alpha component */ - - s16 startTLUT; /* Lookup Table Entry Starting index */ - s16 nTLUT; /* Total number of Lookup Table Entries */ - - int *LUT; /* Pointer to Lookup Table */ - - s16 istart; /* Starting bitmap index */ - s16 istep; /* Bitmaps index step (see SP_INCY) */ - /* if 0, then variable width bitmaps */ - - s16 nbitmaps; /* Total number of bitmaps */ - s16 ndisplist; /* Total number of display-list words */ - - s16 bmheight; /* Bitmap Texel height (Used) */ - s16 bmHreal; /* Bitmap Texel height (Real) */ - u8 bmfmt; /* Bitmap Format */ - u8 bmsiz; /* Bitmap Texel Size */ - - Bitmap *bitmap; /* Pointer to first bitmap */ - - Gfx *rsp_dl; /* Pointer to RSP display list */ - - Gfx *rsp_dl_next; /* Pointer to next RSP display entry */ - - s16 frac_s, /* Fractional Texture offsets */ - frac_t; /* These have 5 fraction bits */ -}; - -typedef struct sprite Sprite; - -/* - * DANGER! - * This is bad programming. Where the *heck* do these numbers come - * from? - * - * They are obviously 'maximums' from the sprite library, but since - * the sprite library is built on top of gbi.h, which includes macros - * that decode into multiple macros, etc., it is nearly impossible to - * know what these maximums should be. - * - * Worse, there are some gbi macros (texture alignment mostly) that - * decode into *many* macros, so if we choose that as a maximum, we - * are wasting TONS of space... - * - * These numbers work for "reasonable" sprite library usage, and - * there is an assert() in the library to detect when they aren't - * enough. (use the debug version) - */ -#define DL_BM_OVERHEAD (12) -#define DL_SPRITE_OVERHEAD (24) - -#define NUM_DL(nb) ((nb)*DL_BM_OVERHEAD +DL_SPRITE_OVERHEAD) - -/* - * Misc constants - */ - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -/* - * For sprite->attr - */ - -#define SP_TRANSPARENT 0x00000001 -#define SP_CUTOUT 0x00000002 -#define SP_HIDDEN 0x00000004 -#define SP_Z 0x00000008 -#define SP_SCALE 0x00000010 -#define SP_FASTCOPY 0x00000020 -#define SP_OVERLAP 0x00000040 -#define SP_TEXSHIFT 0x00000080 -#define SP_FRACPOS 0x00000100 -#define SP_TEXSHUF 0x00000200 -#define SP_EXTERN 0x00000400 - -/* - * Function wrapper - */ -#if defined(F3DEX_GBI_2) -#define spMove spX2Move -#define spSetZ spX2SetZ -#define spScissor spX2Scissor -#define spDraw spX2Draw -#define spInit spX2Init -#define spFinish spX2Finish -#elif defined(F3DEX_GBI) -#define spMove spXMove -#define spSetZ spXSetZ -#define spScissor spXScissor -#define spDraw spXDraw -#define spInit spXInit -#define spFinish spXFinish -#endif - -/* - * Function prototypes - */ - -void spSetAttribute (Sprite *sp, s32 attr); -void spClearAttribute (Sprite *sp, s32 attr); -void spMove (Sprite *sp, s32 x, s32 y); -void spScale (Sprite *sp, f32 sx, f32 sy); -void spSetZ (Sprite *sp, s32 z ); -void spColor (Sprite *sp, u8 red, u8 green, u8 blue, u8 alpha); -Gfx *spDraw (Sprite *sp); -void spInit( Gfx **glistp ); -void spScissor( s32 xmin, s32 xmax, s32 ymin, s32 ymax ); -void spFinish( Gfx **glistp ); - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* _SP_H_ */ diff --git a/include/2.0L/PR/sptask.h b/include/2.0L/PR/sptask.h deleted file mode 100644 index 960cab9b..00000000 --- a/include/2.0L/PR/sptask.h +++ /dev/null @@ -1,201 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * $Revision: 1.9 $ - * $Date: 1998/03/05 06:40:29 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sptask.h,v $ - * - **************************************************************************/ - -#ifndef _SPTASK_H_ -#define _SPTASK_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -/* - * Task List Structure. - * - * Things an app might pass to the SP via the task list. - * Not every task ucode would need/use every field, but - * - * - type (audio, gfx, video, ...) - * - flags - * - wait for DP to drain before running new task - * - SEE BIT DEFINITIONS UNDER "Task Flags field" - * - pointer to boot ucode - * - size of boot ucode - * - pointer to ucode - * - size of ucode - * - pointer to initial DMEM data - * - size of initial DMEM data - * - pointer to DRAM stack - * - size of DRAM stack (max) - * - pointer to output buffer - * - pointer to store output buffer length - * - generic data pointer (for display list, etc.) - * - generic data length (for display list, etc.) - * - pointer to buffer where to store saved DMEM (in yield case) - * - size of buffer to store saved DMEM. - * - * IMPORTANT!!! Watch alignment issues. - * - * IMPORTANT!!! Watch data cache issues. The RCP may write data into the - * dram_stack, output_buff, output_buff_size, and the yield_data_ptr areas. - * These buffers should be cache aligned and use the entire line (16 bytes) to - * avoid corruption by writebacks by the CPU (cache tearing). - * - * IMPORTANT!!! all addresses are virtual addresses. Library does - * any necessary translation. - * - */ -typedef struct { - u32 type; - u32 flags; - - u64 *ucode_boot; - u32 ucode_boot_size; - - u64 *ucode; - u32 ucode_size; - - u64 *ucode_data; - u32 ucode_data_size; - - u64 *dram_stack; - u32 dram_stack_size; - - u64 *output_buff; - u64 *output_buff_size; - - u64 *data_ptr; - u32 data_size; - - u64 *yield_data_ptr; - u32 yield_data_size; - -} OSTask_t; - -typedef union { - OSTask_t t; - long long int force_structure_alignment; -} OSTask; - -typedef u32 OSYieldResult; - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_ASSEMBLY - -/* - * For the RSP ucode: - * offsets into the task structure - */ - -#include - -#endif - -/* - * Task Flags field - */ -#define OS_TASK_YIELDED 0x0001 -#define OS_TASK_DP_WAIT 0x0002 -#define OS_TASK_LOADABLE 0x0004 -#define OS_TASK_SP_ONLY 0x0008 -#define OS_TASK_USR0 0x0010 -#define OS_TASK_USR1 0x0020 -#define OS_TASK_USR2 0x0040 -#define OS_TASK_USR3 0x0080 - -/* - * Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a - * buffer of this size. (The size is in bytes). ONLY If the task will NEVER - * yield it may be a null pointer. The buffer must be aligned to a 64 bit - * boundary. The taskHdrPtr->t.yield_data_ptr must be set to point to the - * buffer BEFORE the task is started. - */ -#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)||defined(F3DEX_GBI_2)) -#define OS_YIELD_DATA_SIZE 0xc00 -#else -#define OS_YIELD_DATA_SIZE 0x900 -#endif -#define OS_YIELD_AUDIO_SIZE 0x400 - -/************************************************************************** - * - * Global definitions - * - */ - - - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - -/* - * this macro simulates atomic action. - */ -#define osSpTaskStart(tp) \ - { \ - osSpTaskLoad((tp)); \ - osSpTaskStartGo((tp)); \ - } - - -/************************************************************************** - * - * Extern variables - * - */ - - -/************************************************************************** - * - * Function prototypes - * - */ - -/* - * break this up into two steps for debugging. - */ -extern void osSpTaskLoad(OSTask *tp); -extern void osSpTaskStartGo(OSTask *tp); - -extern void osSpTaskYield(void); -extern OSYieldResult osSpTaskYielded(OSTask *tp); - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_SPTASK_H */ diff --git a/include/2.0L/PR/ucode.h b/include/2.0L/PR/ucode.h deleted file mode 100644 index e43f52ae..00000000 --- a/include/2.0L/PR/ucode.h +++ /dev/null @@ -1,192 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/************************************************************************** - * - * $Revision: 1.15 $ - * $Date: 1998/03/31 07:58:57 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ucode.h,v $ - * - **************************************************************************/ - -#ifndef _UCODE_H_ -#define _UCODE_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - -/* - * This is the recommended size of the SP DRAM stack area, used - * by the graphics ucode. This stack is used primarily for the - * matrix stack, so it needs to be AT LEAST (10 * 64bytes) in size. - */ -#define SP_DRAM_STACK_SIZE8 (1024) -#define SP_DRAM_STACK_SIZE64 (SP_DRAM_STACK_SIZE8 >> 3) - -/* - * This is the size of the IMEM, which is also the size of the - * graphics microcode. (other ucode might be less) - * This value is used in apps to tell the OS how much ucode to - * load. - */ -#define SP_UCODE_SIZE 4096 - -/* - * This is 1/2 the size of DMEM, which is the maximum amount of - * initialized DMEM data any of the ucode tasks need to start up. - * This value is dependent on all of the task ucodes, and is therefore - * fixed per release. - */ -#define SP_UCODE_DATA_SIZE 2048 - - -/************************************************************************** - * - * Extern variables - * - */ - -/* - * Symbols generated by "rsp2elf", included by "makerom" that indicate - * the location and size of the SP microcode objects. The ucode objects - * are loaded as part of the codesegment (arbitrary, could do other - * ways) - * - */ - -/* standard boot ucode: */ -extern long long int rspbootTextStart[], rspbootTextEnd[]; - -/* standard 3D ucode: */ -extern long long int gspFast3DTextStart[], gspFast3DTextEnd[]; -extern long long int gspFast3DDataStart[], gspFast3DDataEnd[]; - -/* 3D ucode with output to DRAM: */ -extern long long int gspFast3D_dramTextStart[], gspFast3D_dramTextEnd[]; -extern long long int gspFast3D_dramDataStart[], gspFast3D_dramDataEnd[]; - -/* 3D ucode with output through DRAM FIFO to RDP: */ -extern long long int gspFast3D_fifoTextStart[], gspFast3D_fifoTextEnd[]; -extern long long int gspFast3D_fifoDataStart[], gspFast3D_fifoDataEnd[]; - -/* 3D ucode without nearclip: */ -extern long long int gspF3DNoNTextStart[], gspF3DNoNTextEnd[]; -extern long long int gspF3DNoNDataStart[], gspF3DNoNDataEnd[]; - -/* 3D ucode without nearclip with output to DRAM: */ -extern long long int gspF3DNoN_dramTextStart[]; -extern long long int gspF3DNoN_dramTextEnd[]; -extern long long int gspF3DNoN_dramDataStart[]; -extern long long int gspF3DNoN_dramDataEnd[]; - -/* 3D ucode without nearclip with output through DRAM FIFO to RDP: */ -extern long long int gspF3DNoN_fifoTextStart[]; -extern long long int gspF3DNoN_fifoTextEnd[]; -extern long long int gspF3DNoN_fifoDataStart[]; -extern long long int gspF3DNoN_fifoDataEnd[]; - -/* 3D line ucode: */ -extern long long int gspLine3DTextStart[], gspLine3DTextEnd[]; -extern long long int gspLine3DDataStart[], gspLine3DDataEnd[]; - -/* 3D line ucode with output to DRAM: */ -extern long long int gspLine3D_dramTextStart[], gspLine3D_dramTextEnd[]; -extern long long int gspLine3D_dramDataStart[], gspLine3D_dramDataEnd[]; - -/* 3D line ucode with output through DRAM FIFO to RDP: */ -extern long long int gspLine3D_fifoTextStart[], gspLine3D_fifoTextEnd[]; -extern long long int gspLine3D_fifoDataStart[], gspLine3D_fifoDataEnd[]; - -/* 2D sprite ucode: */ -extern long long int gspSprite2DTextStart[], gspSprite2DTextEnd[]; -extern long long int gspSprite2DDataStart[], gspSprite2DDataEnd[]; - -/* 2D sprite ucode with output to DRAM: */ -extern long long int gspSprite2D_dramTextStart[], gspSprite2D_dramTextEnd[]; -extern long long int gspSprite2D_dramDataStart[], gspSprite2D_dramDataEnd[]; - -/* 2D sprite ucode with output through DRAM FIFO to RDP: */ -extern long long int gspSprite2D_fifoTextStart[], gspSprite2D_fifoTextEnd[]; -extern long long int gspSprite2D_fifoDataStart[], gspSprite2D_fifoDataEnd[]; - -/* basic audio ucode: */ -extern long long int aspMainTextStart[], aspMainTextEnd[]; -extern long long int aspMainDataStart[], aspMainDataEnd[]; - -/*========== F3DEX/F3DLX/F3DLP/L3DEX ==========*/ -/* FIFO version only */ -extern long long int gspF3DEX_fifoTextStart[], gspF3DEX_fifoTextEnd[]; -extern long long int gspF3DEX_fifoDataStart[], gspF3DEX_fifoDataEnd[]; -extern long long int gspF3DEX_NoN_fifoTextStart[], gspF3DEX_NoN_fifoTextEnd[]; -extern long long int gspF3DEX_NoN_fifoDataStart[], gspF3DEX_NoN_fifoDataEnd[]; - -extern long long int gspF3DLX_fifoTextStart[], gspF3DLX_fifoTextEnd[]; -extern long long int gspF3DLX_fifoDataStart[], gspF3DLX_fifoDataEnd[]; -extern long long int gspF3DLX_NoN_fifoTextStart[], gspF3DLX_NoN_fifoTextEnd[]; -extern long long int gspF3DLX_NoN_fifoDataStart[], gspF3DLX_NoN_fifoDataEnd[]; -extern long long int gspF3DLX_Rej_fifoTextStart[], gspF3DLX_Rej_fifoTextEnd[]; -extern long long int gspF3DLX_Rej_fifoDataStart[], gspF3DLX_Rej_fifoDataEnd[]; - -extern long long int gspF3DLP_Rej_fifoTextStart[], gspF3DLP_Rej_fifoTextEnd[]; -extern long long int gspF3DLP_Rej_fifoDataStart[], gspF3DLP_Rej_fifoDataEnd[]; -extern long long int gspL3DEX_fifoTextStart[], gspL3DEX_fifoTextEnd[]; -extern long long int gspL3DEX_fifoDataStart[], gspL3DEX_fifoDataEnd[]; - -/*========== F3DEX2/F3DLX2/F3DLP2/L3DEX2 ==========*/ -/* FIFO version */ -extern long long int gspF3DEX2_fifoTextStart[], gspF3DEX2_fifoTextEnd[]; -extern long long int gspF3DEX2_fifoDataStart[], gspF3DEX2_fifoDataEnd[]; -extern long long int gspF3DEX2_NoN_fifoTextStart[],gspF3DEX2_NoN_fifoTextEnd[]; -extern long long int gspF3DEX2_NoN_fifoDataStart[],gspF3DEX2_NoN_fifoDataEnd[]; -extern long long int gspF3DEX2_Rej_fifoTextStart[],gspF3DEX2_Rej_fifoTextEnd[]; -extern long long int gspF3DEX2_Rej_fifoDataStart[],gspF3DEX2_Rej_fifoDataEnd[]; -extern long long int gspF3DLX2_Rej_fifoTextStart[],gspF3DLX2_Rej_fifoTextEnd[]; -extern long long int gspF3DLX2_Rej_fifoDataStart[],gspF3DLX2_Rej_fifoDataEnd[]; -extern long long int gspL3DEX2_fifoTextStart[], gspL3DEX2_fifoTextEnd[]; -extern long long int gspL3DEX2_fifoDataStart[], gspL3DEX2_fifoDataEnd[]; - -/* XBUS version */ -extern long long int gspF3DEX2_xbusTextStart[], gspF3DEX2_xbusTextEnd[]; -extern long long int gspF3DEX2_xbusDataStart[], gspF3DEX2_xbusDataEnd[]; -extern long long int gspF3DEX2_NoN_xbusTextStart[],gspF3DEX2_NoN_xbusTextEnd[]; -extern long long int gspF3DEX2_NoN_xbusDataStart[],gspF3DEX2_NoN_xbusDataEnd[]; -extern long long int gspF3DEX2_Rej_xbusTextStart[],gspF3DEX2_Rej_xbusTextEnd[]; -extern long long int gspF3DEX2_Rej_xbusDataStart[],gspF3DEX2_Rej_xbusDataEnd[]; -extern long long int gspF3DLX2_Rej_xbusTextStart[],gspF3DLX2_Rej_xbusTextEnd[]; -extern long long int gspF3DLX2_Rej_xbusDataStart[],gspF3DLX2_Rej_xbusDataEnd[]; -extern long long int gspL3DEX2_xbusTextStart[], gspL3DEX2_xbusTextEnd[]; -extern long long int gspL3DEX2_xbusDataStart[], gspL3DEX2_xbusDataEnd[]; - -/************************************************************************** - * - * Function prototypes - * - */ - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_UCODE_H */ diff --git a/include/2.0L/PR/ucode_debug.h b/include/2.0L/PR/ucode_debug.h deleted file mode 100644 index 189a7f21..00000000 --- a/include/2.0L/PR/ucode_debug.h +++ /dev/null @@ -1,54 +0,0 @@ -/*---------------------------------------------------------------------* - Copyright (C) 1998, Nintendo. - - File ucode_debug.h - Coded by Yoshitaka Yasumoto. Nov 15, 1998. - - $Id: ucode_debug.h,v 1.1 1998/12/25 01:06:21 has Exp $ - *---------------------------------------------------------------------*/ -#ifndef _UCODE_DEBUG_H_ -#define _UCODE_DEBUG_H_ - -#define DEBUG_DL_PTR() IO_READ(SP_DMEM_START+0xfc0) - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) -/*========== F3DEX2/F3DLX2/L3DEX2/S2DEX2 ==========*/ -/* FIFO version */ -extern long long int gspF3DEX2d_fifoTextStart[], gspF3DEX2d_fifoTextEnd[]; -extern long long int gspF3DEX2d_fifoDataStart[], gspF3DEX2d_fifoDataEnd[]; -extern long long int gspF3DEX2d_NoN_fifoTextStart[],gspF3DEX2d_NoN_fifoTextEnd[]; -extern long long int gspF3DEX2d_NoN_fifoDataStart[],gspF3DEX2d_NoN_fifoDataEnd[]; -extern long long int gspF3DEX2d_Rej_fifoTextStart[],gspF3DEX2d_Rej_fifoTextEnd[]; -extern long long int gspF3DEX2d_Rej_fifoDataStart[],gspF3DEX2d_Rej_fifoDataEnd[]; -extern long long int gspF3DLX2d_Rej_fifoTextStart[],gspF3DLX2d_Rej_fifoTextEnd[]; -extern long long int gspF3DLX2d_Rej_fifoDataStart[],gspF3DLX2d_Rej_fifoDataEnd[]; -extern long long int gspL3DEX2d_fifoTextStart[], gspL3DEX2d_fifoTextEnd[]; -extern long long int gspL3DEX2d_fifoDataStart[], gspL3DEX2d_fifoDataEnd[]; -extern long long int gspS2DEX2d_fifoTextStart[], gspS2DEX2d_fifoTextEnd[]; -extern long long int gspS2DEX2d_fifoDataStart[], gspS2DEX2d_fifoDataEnd[]; - -/* XBUS version */ -extern long long int gspF3DEX2d_xbusTextStart[], gspF3DEX2d_xbusTextEnd[]; -extern long long int gspF3DEX2d_xbusDataStart[], gspF3DEX2d_xbusDataEnd[]; -extern long long int gspF3DEX2d_NoN_xbusTextStart[],gspF3DEX2d_NoN_xbusTextEnd[]; -extern long long int gspF3DEX2d_NoN_xbusDataStart[],gspF3DEX2d_NoN_xbusDataEnd[]; -extern long long int gspF3DEX2d_Rej_xbusTextStart[],gspF3DEX2d_Rej_xbusTextEnd[]; -extern long long int gspF3DEX2d_Rej_xbusDataStart[],gspF3DEX2d_Rej_xbusDataEnd[]; -extern long long int gspF3DLX2d_Rej_xbusTextStart[],gspF3DLX2d_Rej_xbusTextEnd[]; -extern long long int gspF3DLX2d_Rej_xbusDataStart[],gspF3DLX2d_Rej_xbusDataEnd[]; -extern long long int gspL3DEX2d_xbusTextStart[], gspL3DEX2d_xbusTextEnd[]; -extern long long int gspL3DEX2d_xbusDataStart[], gspL3DEX2d_xbusDataEnd[]; -extern long long int gspS2DEX2d_xbusTextStart[], gspS2DEX2d_xbusTextEnd[]; -extern long long int gspS2DEX2d_xbusDataStart[], gspS2DEX2d_xbusDataEnd[]; - -#endif /* _LANGUAGE_C */ -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif -#endif /* !_UCODE_DEBUG_H */ - -/*======== End of ucode_debug.h ========*/ diff --git a/include/2.0L/PR/ultraerror.h b/include/2.0L/PR/ultraerror.h deleted file mode 100644 index 6b0893df..00000000 --- a/include/2.0L/PR/ultraerror.h +++ /dev/null @@ -1,179 +0,0 @@ -/*==================================================================== - * ultraerror.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/************************************************************************** - * - * $Revision: 1.27 $ - * $Date: 1999/07/14 02:44:00 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultraerror.h,v $ - * - **************************************************************************/ - -#ifndef __ULTRAERROR_H__ -#define __ULTRAERROR_H__ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#define OS_ERROR_FMT "/usr/lib/PR/error.fmt" -#define OS_ERROR_MAGIC 0x6b617479 - -/* OS error codes */ - -#define ERR_OSCREATETHREAD_SP 1 -#define ERR_OSCREATETHREAD_PRI 2 -#define ERR_OSSTARTTHREAD 3 -#define ERR_OSSETTHREADPRI 4 -#define ERR_OSCREATEMESGQUEUE 5 -#define ERR_OSSENDMESG 6 -#define ERR_OSJAMMESG 7 -#define ERR_OSRECVMESG 8 -#define ERR_OSSETEVENTMESG 9 -#define ERR_OSMAPTLB_INDEX 10 -#define ERR_OSMAPTLB_ASID 11 -#define ERR_OSUNMAPTLB 12 -#define ERR_OSSETTLBASID 13 -#define ERR_OSAISETFREQUENCY 14 -#define ERR_OSAISETNEXTBUFFER_ADDR 15 -#define ERR_OSAISETNEXTBUFFER_SIZE 16 -#define ERR_OSDPSETNEXTBUFFER_ADDR 17 -#define ERR_OSDPSETNEXTBUFFER_SIZE 18 -#define ERR_OSPIRAWREADIO 19 -#define ERR_OSPIRAWWRITEIO 20 -#define ERR_OSPIRAWSTARTDMA_DIR 21 -#define ERR_OSPIRAWSTARTDMA_DEVADDR 22 -#define ERR_OSPIRAWSTARTDMA_ADDR 23 -#define ERR_OSPIRAWSTARTDMA_SIZE 24 -#define ERR_OSPIRAWSTARTDMA_RANGE 25 -#define ERR_OSPIREADIO 26 -#define ERR_OSPIWRITEIO 27 -#define ERR_OSPISTARTDMA_PIMGR 28 -#define ERR_OSPISTARTDMA_PRI 29 -#define ERR_OSPISTARTDMA_DIR 30 -#define ERR_OSPISTARTDMA_DEVADDR 31 -#define ERR_OSPISTARTDMA_ADDR 32 -#define ERR_OSPISTARTDMA_SIZE 33 -#define ERR_OSPISTARTDMA_RANGE 34 -#define ERR_OSCREATEPIMANAGER 35 -#define ERR_OSVIGETCURRENTMODE 36 -#define ERR_OSVIGETCURRENTFRAMEBUFFER 37 -#define ERR_osViGetNextFramebuffer 38 -#define ERR_OSVISETXSCALE_VALUE 39 -#define ERR_OSVISETXSCALE_VIMGR 40 -#define ERR_OSVISETYSCALE_VALUE 41 -#define ERR_OSVISETYSCALE_VIMGR 42 -#define ERR_OSVISETSPECIAL_VALUE 43 -#define ERR_OSVISETSPECIAL_VIMGR 44 -#define ERR_OSVISETMODE 45 -#define ERR_OSVISETEVENT 46 -#define ERR_OSVISWAPBUFFER_ADDR 47 -#define ERR_OSVISWAPBUFFER_VIMGR 48 -#define ERR_OSCREATEVIMANAGER 49 -#define ERR_OSCREATEREGION_ALIGN 50 -#define ERR_OSCREATEREGION_SIZE 51 -#define ERR_OSMALLOC 52 -#define ERR_OSFREE_REGION 53 -#define ERR_OSFREE_ADDR 54 -#define ERR_OSGETREGIONBUFCOUNT 55 -#define ERR_OSGETREGIONBUFSIZE 56 -#define ERR_OSSPTASKLOAD_DRAM 57 -#define ERR_OSSPTASKLOAD_OUT 58 -#define ERR_OSSPTASKLOAD_OUTSIZE 59 -#define ERR_OSSPTASKLOAD_YIELD 60 -#define ERR_OSPROFILEINIT_STR 61 -#define ERR_OSPROFILEINIT_CNT 62 -#define ERR_OSPROFILEINIT_ALN 63 -#define ERR_OSPROFILEINIT_ORD 64 -#define ERR_OSPROFILEINIT_SIZ 65 -#define ERR_OSPROFILESTART_TIME 66 -#define ERR_OSPROFILESTART_FLAG 67 -#define ERR_OSPROFILESTOP_FLAG 68 -#define ERR_OSPROFILESTOP_TIMER 69 -#define ERR_OSREADHOST_ADDR 70 -#define ERR_OSREADHOST_SIZE 71 -#define ERR_OSWRITEHOST_ADDR 72 -#define ERR_OSWRITEHOST_SIZE 73 -#define ERR_OSGETTIME 74 -#define ERR_OSSETTIME 75 -#define ERR_OSSETTIMER 76 -#define ERR_OSSTOPTIMER 77 -#define ERR_ALSEQP_NO_SOUND 100 -#define ERR_ALSEQP_NO_VOICE 101 -#define ERR_ALSEQP_MAP_VOICE 102 -#define ERR_ALSEQP_OFF_VOICE 103 -#define ERR_ALSEQP_POLY_VOICE 104 -#define ERR_ALSNDP_NO_VOICE 105 -#define ERR_ALSYN_NO_UPDATE 106 -#define ERR_ALSNDPDEALLOCATE 107 -#define ERR_ALSNDPDELETE 108 -#define ERR_ALSNDPPLAY 109 -#define ERR_ALSNDPSETSOUND 110 -#define ERR_ALSNDPSETPRIORITY 111 -#define ERR_ALSNDPSETPAR 112 -#define ERR_ALBNKFNEW 113 -#define ERR_ALSEQNOTMIDI 114 -#define ERR_ALSEQNOTMIDI0 115 -#define ERR_ALSEQNUMTRACKS 116 -#define ERR_ALSEQTIME 117 -#define ERR_ALSEQTRACKHDR 118 -#define ERR_ALSEQSYSEX 119 -#define ERR_ALSEQMETA 120 -#define ERR_ALSEQPINVALIDPROG 121 -#define ERR_ALSEQPUNKNOWNMIDI 122 -#define ERR_ALSEQPUNMAP 123 -#define ERR_ALEVENTNOFREE 124 -#define ERR_ALHEAPNOFREE 125 -#define ERR_ALHEAPCORRUPT 126 -#define ERR_ALHEAPFIRSTBLOCK 127 -#define ERR_ALCSEQZEROSTATUS 128 -#define ERR_ALCSEQZEROVEL 129 -#define ERR_ALCSPVNOTFREE 130 -#define ERR_ALSEQOVERRUN 131 -#define ERR_OSAISETNEXTBUFFER_ENDADDR 132 -#define ERR_ALMODDELAYOVERFLOW 133 -#define ERR_OSVIEXTENDVSTART_VIMGR 134 -#define ERR_OSVIEXTENDVSTART_VALUE 135 -#define ERR_OSTHPROFILESTART_FLAG 136 -#define ERR_OSTHPROFILESTART_START 137 -#define ERR_OSTHPROFILESTOP_FLAG 138 -#define ERR_OSTHPROFILEREADCOUNT_FLAG 139 -#define ERR_OSTHPROFILEREADTIME_FLAG 140 -#define ERR_OSTHPROFILEREADCOUNTTH_FLAG 141 -#define ERR_OSTHPROFILEREADTIMETH_FLAG 142 -#define ERR_OSTHPROFILEREADCOUNT_LAR 143 -#define ERR_OSTHPROFILEREADTIME_LAR 144 -#define ERR_OSTHPROFILEREADCOUNTTH_LAR 145 -#define ERR_OSTHPROFILEREADTIMETH_LAR 146 -#define ERR_OSTHPROFILESTOP_LAR 147 - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) -typedef void (*OSErrorHandler)(s16, s16, ...); - -OSErrorHandler osSetErrorHandler(OSErrorHandler); -#endif - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* __ULTRAERROR_H__ */ diff --git a/include/2.0L/PR/ultralog.h b/include/2.0L/PR/ultralog.h deleted file mode 100644 index 48b84b97..00000000 --- a/include/2.0L/PR/ultralog.h +++ /dev/null @@ -1,74 +0,0 @@ -/*==================================================================== - * ultralog.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/************************************************************************** - * - * $Revision: 1.6 $ - * $Date: 1997/02/11 08:39:05 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultralog.h,v $ - * - **************************************************************************/ - -#ifndef __log__ -#define __log__ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#define OS_LOG_MAX_ARGS 16 -#define OS_LOG_MAGIC 0x20736a73 -#define OS_LOG_FLOAT(x) (*(int *) &(x)) -#define OS_LOG_VERSION 1 - -typedef struct { - u32 magic; /* log identifier */ - u32 len; /* length of log data + log structure */ - u32 *base; /* starting addr array */ - s32 startCount; /* read offset from dataBase */ - s32 writeOffset; /* write offset from dataBase */ -} OSLog; - -typedef struct { - u32 magic; - u32 timeStamp; - u16 argCount; - u16 eventID; -} OSLogItem; - -typedef struct { - u32 magic; /* log identifier */ - u32 version; /* 1 */ -} OSLogFileHdr; - -void osCreateLog(OSLog *log, u32 *base, s32 len); -void osLogEvent(OSLog *log, s16 code, s16 numArgs, ...); -void osFlushLog(OSLog *log); -u32 osLogFloat(f32); - -extern void osDelay(int count); - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif diff --git a/include/2.0L/PR/ultratypes.h b/include/2.0L/PR/ultratypes.h deleted file mode 100644 index ff7305ec..00000000 --- a/include/2.0L/PR/ultratypes.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef _ULTRATYPES_H_ -#define _ULTRATYPES_H_ - - -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - - -/************************************************************************* - * - * File: ultratypes.h - * - * This file contains various types used in Ultra64 interfaces. - * - * $Revision: 1.6 $ - * $Date: 1997/12/17 04:02:06 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultratypes.h,v $ - * - **************************************************************************/ - - - -/********************************************************************** - * General data types for R4300 - */ -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -typedef unsigned char u8; /* unsigned 8-bit */ -typedef unsigned short u16; /* unsigned 16-bit */ -typedef unsigned long u32; /* unsigned 32-bit */ -typedef unsigned long long u64; /* unsigned 64-bit */ - -typedef signed char s8; /* signed 8-bit */ -typedef short s16; /* signed 16-bit */ -typedef long s32; /* signed 32-bit */ -typedef long long s64; /* signed 64-bit */ - -typedef volatile unsigned char vu8; /* unsigned 8-bit */ -typedef volatile unsigned short vu16; /* unsigned 16-bit */ -typedef volatile unsigned long vu32; /* unsigned 32-bit */ -typedef volatile unsigned long long vu64; /* unsigned 64-bit */ - -typedef volatile signed char vs8; /* signed 8-bit */ -typedef volatile short vs16; /* signed 16-bit */ -typedef volatile long vs32; /* signed 32-bit */ -typedef volatile long long vs64; /* signed 64-bit */ - -typedef float f32; /* single prec floating point */ -typedef double f64; /* double prec floating point */ - -#if !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(_SIZE_T_DEF) -#define _SIZE_T -#define _SIZE_T_DEF /* exeGCC size_t define label */ -#if (_MIPS_SZLONG == 32) -typedef unsigned int size_t; -#endif -#if (_MIPS_SZLONG == 64) -typedef unsigned long size_t; -#endif -#endif - -#endif /* _LANGUAGE_C */ - - -/************************************************************************* - * Common definitions - */ -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#endif /* _ULTRATYPES_H_ */ - diff --git a/include/2.0L/PR/uportals.h b/include/2.0L/PR/uportals.h deleted file mode 100644 index 129c47ce..00000000 --- a/include/2.0L/PR/uportals.h +++ /dev/null @@ -1,134 +0,0 @@ -/*==================================================================== - * uportals.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/************************************************************************** - * - * uportals.h - header file for the ultraportals library - * - * $Revision: 1.12 $ - * $Date: 1997/02/11 08:40:49 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/uportals.h,v $ - * - **************************************************************************/ - - - -#ifndef __ULTRAPORTALS_H__ -#define __ULTRAPORTALS_H__ - -#include -#include "matrix.h" -#include "vector.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef ENABLEPORTALS -#define ENABLEPORTALS -#endif - -#define UP_MAXPVERTS 16 /* max number of portal verts */ -#define UP_MAXCELLS 50 /* max number of cells */ -#define UP_CELLNL 32 /* max length of cell names */ -#define UP_OBNL 32 /* max length of obejct names */ - -typedef struct -{ - vec3 min, max; /* min and max pts of the box */ -} upBox; - -typedef struct _upPortalData * _portalptr; -typedef struct _upCellData * _cellptr; -typedef struct _upObjectData * _objectptr; - -typedef struct _upPortalData -{ - int numverts; /* number of verts in the portal*/ - _cellptr attached_cell; /* cell on the 'other side' */ - vec3 verts[UP_MAXPVERTS]; /* the actual vertices */ -#ifdef MVTVIEW - int mvt_id; /* if has mvt, this is the id */ -#endif -} upPortalData; - -typedef struct _upCellData -{ - int numportals; /* number of portals */ - int numobjects; /* number of objects */ - int rendered; /* last frame number rendered */ - _portalptr *portals; /* array for the actual portals */ - _objectptr *objects; /* array for 'detail' objects */ - upBox bbox; /* bounding box of the cell */ - Gfx *dlist; /* associated display list */ - char name[UP_CELLNL]; /* name of the cell */ - float eyeheight; /* height to constrain eyept to */ - int zone; /* current zone number */ -} upCellData; - -typedef struct _upObjectData -{ - int rendered; /* last frame number rendered */ - upBox bbox; /* bounding box for the object */ - Gfx *dlist; /* associated display list */ - char name[UP_OBNL]; /* name of the object */ -} upObjectData; - -typedef struct -{ - int numcells; /* how many cells are there? */ - upCellData cells[UP_MAXCELLS]; /* the actual cells */ - Gfx *rootdlist; /* display list for all cells */ - vec2 portalmin, portalmax; /* XY bbox used by upCheckCells */ - float near, far; /* near, far clipping planes */ - FMatrix viewmat; /* viewing matrix (world->eye) */ - FMatrix projmat; /* proj matrix (eye->screen) */ - FMatrix compmat; /* view * proj (world->screen) */ - int portaldepth; /* depth of the portal stack */ - int framecount; /* current frame number */ -} upLocateData; - -/* - * Functions: - */ -extern void upInit(); /* generated automatically by flt2walk */ -extern Gfx *upAddVisibleCells(Gfx * glistp, vec3 eyept); -extern void upTogglePortalBounds(); -extern void upToggleScissorBox(); - -/* - * Globals: - */ -extern upLocateData upLocator; /* also extern by test_portals.h */ - -/* - * Macros: - */ -#define UP_HUGEVAL 3.40282347e+37 -#define PT_IN_BOX(p,box) ((p)[0] > (box).min[0] && (p)[0] < (box).max[0] &&\ - (p)[1] > (box).min[1] && (p)[1] < (box).max[1] &&\ - (p)[2] > (box).min[2] && (p)[2] < (box).max[2]) - - -#ifdef __Cplusplus -} -#endif - -#endif diff --git a/include/2.0L/assert.h b/include/2.0L/assert.h deleted file mode 100644 index 5f92bf37..00000000 --- a/include/2.0L/assert.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __ASSERT_H__ -#define __ASSERT_H__ -#ifdef __cplusplus -extern "C" { -#endif -/************************************************************************** - * * - * Copyright (C) 1984, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - -#ident "$Revision: 1.17 $" - -/* ANSI C Notes: - * - * - THE IDENTIFIERS APPEARING OUTSIDE OF #ifdef __EXTENSIONS__ IN THIS - * standard header ARE SPECIFIED BY ANSI! CONFORMANCE WILL BE ALTERED - * IF ANY NEW IDENTIFIERS ARE ADDED TO THIS AREA UNLESS THEY ARE IN ANSI's - * RESERVED NAMESPACE. (i.e., unless they are prefixed by __[a-z] or - * _[A-Z]. For external objects, identifiers with the prefix _[a-z] - * are also reserved.) - */ - -#ifdef NDEBUG -#undef assert -#define assert(EX) ((void)0) - -#else - -extern void func_8033F000(const char *, const char *, int); -#ifdef __ANSI_CPP__ -#define assert(EX) ((EX)?((void)0):func_8033F000( # EX , __FILE__, __LINE__)) -#else -#define assert(EX) ((EX)?((void)0):func_8033F000("EX", __FILE__, __LINE__)) -#endif -#endif /* NDEBUG */ - -#ifdef __cplusplus -} -#endif - -#endif /* !__ASSERT_H__ */ diff --git a/include/2.0L/ultra64.h b/include/2.0L/ultra64.h deleted file mode 100644 index 053db38e..00000000 --- a/include/2.0L/ultra64.h +++ /dev/null @@ -1,40 +0,0 @@ - -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - *************************************************************************/ - -/************************************************************************** - * - * $Revision: 1.10 $ - * $Date: 1997/02/11 08:37:33 $ - * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultra64.h,v $ - * - **************************************************************************/ - -#ifndef _ULTRA64_H_ -#define _ULTRA64_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/include/boot/overlays.h b/include/boot/overlays.h new file mode 100644 index 00000000..9248d1ad --- /dev/null +++ b/include/boot/overlays.h @@ -0,0 +1,38 @@ +#ifndef BANJO_KAZOOIE_BOOT_OVERLAYS_H +#define BANJO_KAZOOIE_BOOT_OVERLAYS_H + +#include + +struct Overlay { + void *start; + void *end; +}; + +#define MAKE_ROM_OVERLAY_VAR(name, _) \ + extern u8 name##_rzip_ROM_START[]; \ + extern u8 name##_rzip_ROM_END[]; + +#define MAKE_OVERLAY_TABLE_ENTRY(name, index) \ + { gOverlayTable[index].start = name##_rzip_ROM_START; } \ + { gOverlayTable[index].end = name##_rzip_ROM_END; } + +MAKE_ROM_OVERLAY_VAR(core1, -1) +MAKE_ROM_OVERLAY_VAR(core2, 0) +MAKE_ROM_OVERLAY_VAR(emptyLvl, 1) +MAKE_ROM_OVERLAY_VAR(CC, 2) +MAKE_ROM_OVERLAY_VAR(MMM, 3) +MAKE_ROM_OVERLAY_VAR(GV, 4) +MAKE_ROM_OVERLAY_VAR(TTC, 5) +MAKE_ROM_OVERLAY_VAR(MM, 6) +MAKE_ROM_OVERLAY_VAR(BGS, 7) +MAKE_ROM_OVERLAY_VAR(RBB, 8) +MAKE_ROM_OVERLAY_VAR(FP, 9) +MAKE_ROM_OVERLAY_VAR(CCW, 10) +MAKE_ROM_OVERLAY_VAR(SM, 11) +MAKE_ROM_OVERLAY_VAR(cutscenes, 12) +MAKE_ROM_OVERLAY_VAR(lair, 13) +MAKE_ROM_OVERLAY_VAR(fight, 14) + +extern struct Overlay gOverlayTable[]; + +#endif diff --git a/include/boot/rarezip.h b/include/boot/rarezip.h new file mode 100644 index 00000000..bd7c1210 --- /dev/null +++ b/include/boot/rarezip.h @@ -0,0 +1,29 @@ +#ifndef BANJO_KAZOOIE_BOOT_RAREZIP_H +#define BANJO_KAZOOIE_BOOT_RAREZIP_H + +#include + +struct huft_s { + u8 e; /* number of extra bits or operation */ + u8 b; /* number of bits in this code or subcode */ + union { + u16 n; /* literal, length base, or distance base */ + struct huft_s *t; /* pointer to next level of table */ + } v; +}; + +extern u8 *inflate_inbuf; +extern u8 *inflate_slide; +extern u32 inflate_inptr; +extern u32 inflate_wp; +extern struct huft_s *inflate_huft; +extern u32 inflate_crc1; +extern u32 inflate_crc2; + +u32 rarezip_get_uncompressed_size(u8 *file); +void rarezip_init(void); +u32 rarezip_uncompress_file(u8 *in, u8 *out); +void rarezip_uncompress_file_and_update_pointers(u8 **in, u8 **out); +s32 inflate(void); + +#endif diff --git a/include/core1/main.h b/include/core1/main.h index 65fd50ad..31845145 100644 --- a/include/core1/main.h +++ b/include/core1/main.h @@ -1,7 +1,9 @@ #ifndef BANJO_KAZOOIE_CORE1_MAIN_H #define BANJO_KAZOOIE_CORE1_MAIN_H -void func_8023DA20(s32 arg0); +#include + +void core1_main(s32 arg0); void func_8023DA74(void); void func_8023DA9C(s32 arg0); u32 globalTimer_getTimeMasked(u32 mask); diff --git a/include/string.h b/include/core2/string.h similarity index 63% rename from include/string.h rename to include/core2/string.h index 5bb8ee7f..c68119f9 100644 --- a/include/string.h +++ b/include/core2/string.h @@ -1,18 +1,17 @@ -#ifndef STRING_H -#define STRING_H +#ifndef BKSTRING_H +#define BKSTRING_H #include "structs.h" -void strcat(char *dst, char *src); +void strcat(char *dst, const char *src); void strcatc(char *dst, char src); void strFToA(char *dst, f32 val); void _strFToA(char *dst, f32 val, s32 decPlaces); void strIToA(char *str, s32 num); void _strIToA(char *str, s32 num, char base); -void strcpy(char *dst, char *src); -s32 strlen(char *str); +void *strcpy(char *dst, const char *src); +int strlen(const char *str); void strToUpper(char *str); - - #endif + diff --git a/include/file_and_line.h b/include/file_and_line.h index 06231717..a931d6b5 100644 --- a/include/file_and_line.h +++ b/include/file_and_line.h @@ -1,7 +1,7 @@ #ifndef _FILE_AND_LINE_H_ #define _FILE_AND_LINE_H_ #include -extern void func_8033F000(const char *, const char *, int); +extern void __assert(const char *, const char *, int); #ifdef NONMATCHING @@ -17,9 +17,9 @@ extern void func_8033F000(const char *, const char *, int); #endif #ifdef __ANSI_CPP__ - #define matching_assert(EX, F, L) ((EX)?((void)0):func_8033F000( # EX , # F, L)) + #define matching_assert(EX, F, L) ((EX)?((void)0):__assert( # EX , # F, L)) #else - #define matching_assert(EX, F , L) ((EX)?((void)0):func_8033F000("EX", "F", L)) + #define matching_assert(EX, F , L) ((EX)?((void)0):__assert("EX", "F", L)) #endif #endif diff --git a/include/functions.h b/include/functions.h index 20d6bd4e..4fcbe5ac 100644 --- a/include/functions.h +++ b/include/functions.h @@ -5,7 +5,7 @@ #include "enums.h" #include "structs.h" -#include "string.h" +#include "core2/string.h" #include "rand.h" #include "prop.h" @@ -45,7 +45,7 @@ void * malloc(s32 size); void free(void*); void *realloc(void* ptr, s32 size); -float gu_sqrtf(float val); + bool baanim_isAt(f32); void baanim_playForDuration_once(enum asset_e anim_id, f32 duration); diff --git a/include/guint.h b/include/guint.h deleted file mode 100644 index 259bf201..00000000 --- a/include/guint.h +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ -#include "mbi.h" -#include "gu.h" - -typedef union -{ - struct - { - unsigned int hi; - unsigned int lo; - } word; - - double d; -} du; - -typedef union -{ - unsigned int i; - float f; -} fu; - -#ifndef __GL_GL_H__ - -typedef float Matrix[4][4]; - -#endif - -#define ROUND(d) (int)(((d) >= 0.0) ? ((d) + 0.5) : ((d) - 0.5)) -#define ABS(d) ((d) > 0) ? (d) : -(d) - -extern float __libm_qnan_f; \ No newline at end of file diff --git a/include/math.h b/include/math.h index 8b8ba7f4..c0a10900 100644 --- a/include/math.h +++ b/include/math.h @@ -64,7 +64,7 @@ } #define LENGTH_SQ_VEC3F(v) (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]) -#define LENGTH_VEC3F(v) gu_sqrtf(LENGTH_SQ_VEC3F(v)) +#define LENGTH_VEC3F(v) sqrtf(LENGTH_SQ_VEC3F(v)) #define TUPLE_DOT_PRODUCT(vec1, vec2) (vec1[0] * vec2[0] + vec1[1] * vec2[1] + vec1[2] * vec2[2]) diff --git a/include/2.0L/PR/n_abi.h b/include/n_audio/PR/n_abi.h similarity index 100% rename from include/2.0L/PR/n_abi.h rename to include/n_audio/PR/n_abi.h diff --git a/include/2.0L/PR/n_libaudio.h b/include/n_audio/PR/n_libaudio.h similarity index 100% rename from include/2.0L/PR/n_libaudio.h rename to include/n_audio/PR/n_libaudio.h diff --git a/include/2.0L/PR/n_libaudio_s_to_n.h b/include/n_audio/PR/n_libaudio_s_to_n.h similarity index 100% rename from include/2.0L/PR/n_libaudio_s_to_n.h rename to include/n_audio/PR/n_libaudio_s_to_n.h diff --git a/include/osint.h b/include/osint.h deleted file mode 100644 index 82d78080..00000000 --- a/include/osint.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _OSINT_H -#define _OSINT_H -#include -typedef struct __OSEventState -{ - OSMesgQueue *messageQueue; - OSMesg message; -} __OSEventState; -extern struct __osThreadTail -{ - OSThread *next; - OSPri priority; -} __osThreadTail; - -//maybe should be in exceptasm.h? -extern void __osEnqueueAndYield(OSThread **); -extern void __osDequeueThread(OSThread **, OSThread *); -extern void __osEnqueueThread(OSThread **, OSThread *); -extern OSThread *__osPopThread(OSThread **); -extern void __osDispatchThread(void); - -extern void __osSetTimerIntr(OSTime); -extern OSTime __osInsertTimer(OSTimer *); -extern void __osTimerInterrupt(void); -extern u32 __osProbeTLB(void *); -extern int __osSpDeviceBusy(void); - -extern OSThread *__osRunningThread; -extern OSThread *__osActiveQueue; -extern OSThread *__osFaultedThread; -extern OSThread *__osRunQueue; - -extern OSTimer *__osTimerList; -extern OSTimer __osBaseTimer; -extern OSTime __osCurrentTime; -extern u32 __osBaseCounter; -extern u32 __osViIntrCount; -extern u32 __osTimerCounter; - -extern __OSEventState __osEventStateTab[OS_NUM_EVENTS]; - - -//not sure if this should be here -extern s32 osViClock; -extern void __osTimerServicesInit(void); -extern s32 __osAiDeviceBusy(void); -extern int __osDpDeviceBusy(void); -#endif diff --git a/include/overlays.h b/include/overlays.h deleted file mode 100644 index c0c7066e..00000000 --- a/include/overlays.h +++ /dev/null @@ -1,15 +0,0 @@ -OVERLAY(core2,0) -OVERLAY(emptyLvl,1) -OVERLAY(CC,2) -OVERLAY(MMM,3) -OVERLAY(GV,4) -OVERLAY(TTC,5) -OVERLAY(MM,6) -OVERLAY(BGS,7) -OVERLAY(RBB,8) -OVERLAY(FP,9) -OVERLAY(CCW,10) -OVERLAY(SM,11) -OVERLAY(cutscenes,12) -OVERLAY(lair,13) -OVERLAY(fight,14) diff --git a/include/piint.h b/include/piint.h deleted file mode 100644 index b618cd3a..00000000 --- a/include/piint.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef _PIINT_H -#define _PIINT_H -#include -#include - -//https://github.com/LuigiBlood/64dd/wiki/Memory-Map - -#define LEO_BASE_REG 0x05000000 - -#define LEO_CMD (LEO_BASE_REG + 0x508) -#define LEO_STATUS (LEO_BASE_REG + 0x508) - -#define LEO_BM_CTL (LEO_BASE_REG + 0x510) -#define LEO_BM_STATUS (LEO_BASE_REG + 0x510) - -#define LEO_SEQ_CTL (LEO_BASE_REG + 0x518) -#define LEO_SEQ_STATUS (LEO_BASE_REG + 0x518) - -#define LEO_C2_BUFF (LEO_BASE_REG + 0x000) //C2 Sector Buffer -#define LEO_SECTOR_BUFF (LEO_BASE_REG + 0x400) //Data Sector Buffer -#define LEO_DATA (LEO_BASE_REG + 0x500) //Data -#define LEO_MISC_REG (LEO_BASE_REG + 0x504) //Misc Register -#define LEO_CUR_TK (LEO_BASE_REG + 0x50C) //Current Track -#define LEO_ERR_SECTOR (LEO_BASE_REG + 0x514) //Sector Error Status -#define LEO_CUR_SECTOR (LEO_BASE_REG + 0x51C) //Current Sector -#define LEO_HARD_RESET (LEO_BASE_REG + 0x520) //Hard Reset -#define LEO_C1_S0 (LEO_BASE_REG + 0x524) //C1 -#define LEO_HOST_SECBYTE (LEO_BASE_REG + 0x528) //Sector Size (in bytes) -#define LEO_C1_S2 (LEO_BASE_REG + 0x52C) //C1 -#define LEO_SEC_BYTE (LEO_BASE_REG + 0x530) //Sectors per Block, Full Size -#define LEO_C1_S4 (LEO_BASE_REG + 0x534) //C1 -#define LEO_C1_S6 (LEO_BASE_REG + 0x538) //C1 -#define LEO_CUR_ADDR (LEO_BASE_REG + 0x53C) //Current Address? -#define LEO_ID_REG (LEO_BASE_REG + 0x540) //ID -#define LEO_TEST_REG (LEO_BASE_REG + 0x544) //Test Read -#define LEO_TEST_PIN_SEL (LEO_BASE_REG + 0x548) //Test Write -#define LEO_RAM_ADDR (LEO_BASE_REG + 0x580) //Microsequencer RAM - -#define LEO_STATUS_PRESENCE_MASK 0xFFFF - -#define LEO_STATUS_DATA_REQUEST 0x40000000 -#define LEO_STATUS_C2_TRANSFER 0x10000000 -#define LEO_STATUS_BUFFER_MANAGER_ERROR 0x08000000 -#define LEO_STATUS_BUFFER_MANAGER_INTERRUPT 0x04000000 -#define LEO_STATUS_MECHANIC_INTERRUPT 0x02000000 -#define LEO_STATUS_DISK_PRESENT 0x01000000 -#define LEO_STATUS_BUSY_STATE 0x00800000 -#define LEO_STATUS_RESET_STATE 0x00400000 -#define LEO_STATUS_MOTOR_NOT_SPINNING 0x00100000 -#define LEO_STATUS_HEAD_RETRACTED 0x00080000 -#define LEO_STATUS_WRITE_PROTECT_ERROR 0x00040000 -#define LEO_STATUS_MECHANIC_ERROR 0x00020000 -#define LEO_STATUS_DISK_CHANGE 0x00010000 - -#define LEO_STATUS_MODE_MASK (LEO_STATUS_MOTOR_NOT_SPINNING | LEO_STATUS_HEAD_RETRACTED) -#define LEO_STATUS_MODE_SLEEP (LEO_STATUS_MOTOR_NOT_SPINNING | LEO_STATUS_HEAD_RETRACTED) -#define LEO_STATUS_MODE_STANDBY (LEO_STATUS_HEAD_RETRACTED) -#define LEO_STATUS_MODE_ACTIVE 0 - -#define LEO_CUR_TK_INDEX_LOCK 0x60000000 - -#define LEO_BM_STATUS_RUNNING 0x80000000 //Running -#define LEO_BM_STATUS_ERROR 0x04000000 //Error -#define LEO_BM_STATUS_MICRO 0x02000000 //Micro Status? -#define LEO_BM_STATUS_BLOCK 0x01000000 //Block Transfer -#define LEO_BM_STATUS_C1CORRECTION 0x00800000 //C1 Correction -#define LEO_BM_STATUS_C1DOUBLE 0x00400000 //C1 Double -#define LEO_BM_STATUS_C1SINGLE 0x00200000 //C1 Single -#define LEO_BM_STATUS_C1ERROR 0x00010000 //C1 Error - -#define LEO_BM_CTL_START 0x80000000 //Start Buffer Manager -#define LEO_BM_CTL_MODE 0x40000000 //Buffer Manager Mode -#define LEO_BM_CTL_IMASK 0x20000000 //BM Interrupt Mask -#define LEO_BM_CTL_RESET 0x10000000 //Buffer Manager Reset -#define LEO_BM_CTL_DISABLE_OR 0x08000000 //Disable OR Check? -#define LEO_BM_CTL_DISABLE_C1 0x04000000 //Disable C1 Correction -#define LEO_BM_CTL_BLOCK 0x02000000 //Block Transfer -#define LEO_BM_CTL_CLR_MECHANIC_INTR 0x01000000 //Mechanic Interrupt Reset - -#define LEO_BM_CTL_CONTROL_MASK 0xFF000000 -#define LEO_BM_CTL_SECTOR_MASK 0x00FF0000 -#define LEO_BM_CTL_SECTOR_SHIFT 16 - -#define LEO_CMD_TYPE_0 0 //TODO: name -#define LEO_CMD_TYPE_1 1 //TODO: name -#define LEO_CMD_TYPE_2 2 //TODO: name - -#define LEO_ERROR_GOOD 0 -#define LEO_ERROR_4 4 //maybe busy? -#define LEO_ERROR_22 22 // -#define LEO_ERROR_23 23 //unrecovered read error? -#define LEO_ERROR_24 24 //no reference position found? -#define LEO_ERROR_29 29 // - -extern OSDevMgr __osPiDevMgr; -extern OSPiHandle *__osCurrentHandle[2]; -extern OSPiHandle CartRomHandle; -extern OSPiHandle LeoDiskHandle; -extern OSMesgQueue __osPiAccessQueue; -extern u32 __osPiAccessQueueEnabled; - -int __osPiDeviceBusy(void); -void __osDevMgrMain(void *); -void __osPiCreateAccessQueue(void); -void __osPiRelAccess(void); -void __osPiGetAccess(void); -OSMesgQueue *osPiGetCmdQueue(void); - -#define OS_RAMROM_STACKSIZE 1024 - -#define WAIT_ON_IOBUSY(stat) \ - stat = IO_READ(PI_STATUS_REG); \ - while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \ - stat = IO_READ(PI_STATUS_REG); - -#define UPDATE_REG(reg, var) \ - if (cHandle->var != pihandle->var) \ - IO_WRITE(reg, pihandle->var); - -#define EPI_SYNC(pihandle, stat, domain) \ - \ - WAIT_ON_IOBUSY(stat) \ - \ - domain = pihandle->domain; \ - if (__osCurrentHandle[domain] != pihandle) \ - { \ - OSPiHandle *cHandle = __osCurrentHandle[domain]; \ - if (domain == PI_DOMAIN1) \ - { \ - UPDATE_REG(PI_BSD_DOM1_LAT_REG, latency); \ - UPDATE_REG(PI_BSD_DOM1_PGS_REG, pageSize); \ - UPDATE_REG(PI_BSD_DOM1_RLS_REG, relDuration); \ - UPDATE_REG(PI_BSD_DOM1_PWD_REG, pulse); \ - } \ - else \ - { \ - UPDATE_REG(PI_BSD_DOM2_LAT_REG, latency); \ - UPDATE_REG(PI_BSD_DOM2_PGS_REG, pageSize); \ - UPDATE_REG(PI_BSD_DOM2_RLS_REG, relDuration); \ - UPDATE_REG(PI_BSD_DOM2_PWD_REG, pulse); \ - } \ - __osCurrentHandle[domain] = pihandle; \ - } - -#endif diff --git a/include/rarezip.h b/include/rarezip.h deleted file mode 100644 index d66d058c..00000000 --- a/include/rarezip.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef RAREZIP_H -#define RAREZIP_H -#include - -extern struct huft *D_80007270; - -extern u8 *inbuf; //inbuf -extern u8 *D_80007284; //slide -extern u32 inptr; //inptr -extern u32 wp; //wp -extern struct huft *D_80007290; //unk -extern u32 bb; //bb -extern u32 bk; //bk -extern u32 crc1; //crc1 -extern u32 crc2; //crc2 -extern u32 hufts; //hufts - - -#ifndef WSIZE -# define WSIZE 0x8000 /* window size--must be a power of two, and */ -#endif /* at least 32K for zip's deflate method */ - -//#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf(0)) -#define get_byte() (inbuf[inptr++]) - -#ifdef CRYPT - uch cc; -# define NEXTBYTE() \ - (decrypt ? (cc = get_byte(), zdecode(cc), cc) : get_byte()) -#else -# define NEXTBYTE() (u8)get_byte() -#endif -#define NEEDBITS(n) {while(k<(n)){b|=((u32)NEXTBYTE())<>=(n);k-=(n);} - -struct huft { - u8 e; /* number of extra bits or operation */ - u8 b; /* number of bits in this code or subcode */ - union { - u16 n; /* literal, length base, or distance base */ - struct huft *t; /* pointer to next level of table */ - } v; -}; - -/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ -#define BMAX 16 /* maximum bit length of any code (16 for explode) */ -#define N_MAX 288 /* maximum number of codes in any set */ - -int bkboot_inflate(void); - -#endif diff --git a/include/seqp.h b/include/seqp.h deleted file mode 100755 index c481f9c8..00000000 --- a/include/seqp.h +++ /dev/null @@ -1,37 +0,0 @@ - - -#define KILL_TIME 50000 /* 50 ms */ - -#ifndef MIN -#define MIN(a,b) (((a)<(b))?(a):(b)) -#endif - -#ifndef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) -#endif - -ALVoiceState *__n_mapVoice(ALSeqPlayer *, u8, u8, u8); -void __n_unmapVoice(ALSeqPlayer *seqp, ALVoice *voice); -char __n_voiceNeedsNoteKill(ALSeqPlayer *seqp, ALVoice *voice, ALMicroTime killTime); /* sct 1/5/96 */ - -ALVoiceState *__n_lookupVoice(ALSeqPlayer *, u8, u8); -ALSound *__lookupSound(ALSeqPlayer *, u8, u8, u8); -ALSound *__n_lookupSoundQuick(ALSeqPlayer *, u8, u8, u8); - -s16 __n_vsVol(ALVoiceState *voice, ALSeqPlayer *seqp); -ALMicroTime __n_vsDelta(ALVoiceState *voice, ALMicroTime t); -ALPan __n_vsPan(ALVoiceState *voice, ALSeqPlayer *seqp); - -void __n_initFromBank(ALSeqPlayer *seqp, ALBank *b); -void __n_initChanState(ALSeqPlayer *seqp); -void __resetPerfChanState(ALSeqPlayer *seqp, s32 chan); -void __n_setInstChanState(ALSeqPlayer *seqp, ALInstrument *inst, s32 chan); - -void __seqpPrintVoices(ALSeqPlayer *); -void __n_seqpReleaseVoice(ALSeqPlayer *seqp, ALVoice *voice, - ALMicroTime deltaTime); - -void __n_seqpStopOsc(ALSeqPlayer *seqp, ALVoiceState *vs); - -void __postNextSeqEvent(ALSeqPlayer *seqp); /* sct 11/7/95 */ - diff --git a/include/stdarg.h b/include/stdarg.h deleted file mode 100644 index a5d0b13f..00000000 --- a/include/stdarg.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef STDARG_H -#define STDARG_H - -// When not building with IDO, use the builtin vaarg macros for portability. -#ifndef __sgi -#define va_list __builtin_va_list -#define va_start __builtin_va_start -#define va_arg __builtin_va_arg -#define va_end __builtin_va_end -#else - -typedef char *va_list; -#define _FP 1 -#define _INT 0 -#define _STRUCT 2 - -#define _VA_FP_SAVE_AREA 0x10 -#define _VA_ALIGN(p, a) (((unsigned int)(((char *)p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4)) -#define va_start(vp, parmN) (vp = ((va_list)&parmN + sizeof(parmN))) - -#define __va_stack_arg(list, mode) \ - ( \ - ((list) = (char *)_VA_ALIGN(list, __builtin_alignof(mode)) + \ - _VA_ALIGN(sizeof(mode), 4)), \ - (((char *)list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode)))) - -#define __va_double_arg(list, mode) \ - ( \ - (((long)list & 0x1) /* 1 byte aligned? */ \ - ? (list = (char *)((long)list + 7), (char *)((long)list - 6 - _VA_FP_SAVE_AREA)) \ - : (((long)list & 0x2) /* 2 byte aligned? */ \ - ? (list = (char *)((long)list + 10), (char *)((long)list - 24 - _VA_FP_SAVE_AREA)) \ - : __va_stack_arg(list, mode)))) - -#define va_arg(list, mode) ((mode *)(((__builtin_classof(mode) == _FP && \ - __builtin_alignof(mode) == sizeof(double)) \ - ? __va_double_arg(list, mode) \ - : __va_stack_arg(list, mode))))[-1] -#define va_end(__list) - -#endif -#endif diff --git a/include/variables.h b/include/variables.h index 3a59f3cc..b3574e8e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -6,14 +6,6 @@ #define M_TAU (2*M_PI) #define BAD_TAU 6.2831853 - -struct Overlay { - void *start; - void *end; -}; - -extern struct Overlay gOverlayTable[]; - extern f32 climbPoleBottom[3]; extern f32 climbPoleTop[3]; #endif diff --git a/include/viint.h b/include/viint.h deleted file mode 100644 index 68b53610..00000000 --- a/include/viint.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _VIINT_H -#define _VIINT_H -#include - -#define OS_TV_TYPE_PAL 0 -#define OS_TV_TYPE_NTSC 1 -#define OS_TV_TYPE_MPAL 2 - -//TODO: figure out what this is -#define VI_STATE_01 0x01 -#define VI_STATE_XSCALE_UPDATED 0x02 -#define VI_STATE_YSCALE_UPDATED 0x04 -#define VI_STATE_08 0x08 //related to control regs changing -#define VI_STATE_10 0x10 //swap buffer -#define VI_STATE_BLACK 0x20 //probably related to a black screen -#define VI_STATE_REPEATLINE 0x40 //repeat line? -#define VI_STATE_FADE 0x80 //fade - -#define VI_CTRL_ANTIALIAS_MODE_3 0x00300 /* Bit [9:8] anti-alias mode */ -#define VI_CTRL_ANTIALIAS_MODE_2 0x00200 /* Bit [9:8] anti-alias mode */ -#define VI_CTRL_ANTIALIAS_MODE_1 0x00100 /* Bit [9:8] anti-alias mode */ - -#define VI_SCALE_MASK 0xfff //see rcp scale_x/scale_y -#define VI_2_10_FPART_MASK 0x3ff -#define VI_SUBPIXEL_SH 0x10 - -#define BURST(hsync_width, color_width, vsync_width, color_start) \ - (hsync_width | (color_width << 8) | (vsync_width << 16) | (color_start << 20)) -#define WIDTH(v) v -#define VSYNC(v) v -#define HSYNC(duration, leap) (duration | (leap << 16)) -#define LEAP(upper, lower) ((upper << 16) | lower) -#define START(start, end) ((start << 16) | end) - -#define FTOFIX(val, i, f) ((u32)(val * (f32)(1 << f)) & ((1 << (i + f)) - 1)) - -#define F210(val) FTOFIX(val, 2, 10) -#define SCALE(scaleup, off) (F210((1.0f / (f32)scaleup)) | (F210((f32)off) << 16)) - -#define VCURRENT(v) v //seemingly unused -#define ORIGIN(v) v -#define VINTR(v) v -#define HSTART START - -typedef struct -{ - /* 0x0 */ f32 factor; - /* 0x4 */ u16 offset; - /* 0x8 */ u32 scale; -} __OSViScale; - -typedef struct -{ - /* 0x0 */ u16 state; - /* 0x2 */ u16 retraceCount; - /* 0x4 */ void *framep; - /* 0x8 */ OSViMode *modep; - /* 0xC */ u32 control; - /* 0x10 */ OSMesgQueue *msgq; - /* 0x14 */ OSMesg msg; - /* 0x18 */ __OSViScale x; - /* 0x24 */ __OSViScale y; -} __OSViContext; - -void __osViSwapContext(void); -extern __OSViContext *__osViCurr; -extern __OSViContext *__osViNext; -__OSViContext *__osViGetCurrentContext(void); -void __osViInit(void); -#endif diff --git a/lib/ultralib b/lib/ultralib new file mode 160000 index 00000000..0caf1dff --- /dev/null +++ b/lib/ultralib @@ -0,0 +1 @@ +Subproject commit 0caf1dfffd710d1c23a145b485191abf6554228c diff --git a/manual_syms.pal.txt b/manual_syms.pal.txt index bda303c9..9e62a9a1 100644 --- a/manual_syms.pal.txt +++ b/manual_syms.pal.txt @@ -16,9 +16,9 @@ gSPL3DEX_fifoDataEnd = boot_gSPL3DEX_fifoDataEnd; D_8000E800 = 0x8000E800; D_8002D500 = 0x8002D500; D_8023DA00 = 0x8023E600; /* confirm */ -func_8023DA20 = 0x8023E620; -D_803FBE00 = 0x803FBE00; -D_803FFE00 = 0x803FFE00; +core1_main = 0x8023E620; +gGlobalHuffTable = 0x803FBE00; +gCore1CRCs = 0x803FFE00; D_803FFE10 = 0x803FFE10; gOverlayTable = 0x803FFE10; gFramebuffers = 0x803A5D00; /* framebuffers */ @@ -26,10 +26,10 @@ gFramebuffers = 0x803A5D00; /* framebuffers */ /* Renames for the boot segment */ boot_D_8002D500 = D_8002D500; boot_core1_VRAM = core1_VRAM; -boot_D_803FBE00 = D_803FBE00; -boot_D_803FFE00 = D_803FFE00; +boot_gGlobalHuffTable = gGlobalHuffTable; +boot_gCore1CRCs = gCore1CRCs; boot_gOverlayTable = gOverlayTable; -boot_func_8023DA20 = func_8023DA20; +boot_core1_main = core1_main; /* Temporary*/ @@ -404,7 +404,7 @@ time_getDeltaReal_frames = 0x8033e1e0; time_getDelta = 0x8033e1ec; allocUnusedBlock = 0x8033f3a8; func_8033EFB0 = 0x8033f400; -func_8033F000 = 0x8033f450; +__assert = 0x8033f450; item_inc = 0x80346374; item_dec = 0x80346394; item_empty = 0x803463c4; diff --git a/manual_syms.us.v10.txt b/manual_syms.us.v10.txt index dceb33b6..5ab8bcb4 100644 --- a/manual_syms.us.v10.txt +++ b/manual_syms.us.v10.txt @@ -16,8 +16,8 @@ gSPL3DEX_fifoDataEnd = boot_gSPL3DEX_fifoDataEnd; D_8000E800 = 0x8000E800; D_8002D500 = 0x8002D500; D_8023DA00 = 0x8023DA00; /* confirm */ -D_803FBE00 = 0x803FBE00; -D_803FFE00 = 0x803FFE00; +gGlobalHuffTable = 0x803FBE00; +gCore1CRCs = 0x803FFE00; D_803FFE10 = 0x803FFE10; gOverlayTable = 0x803FFE10; gFramebuffers = 0x803A5D00; /* framebuffers */ @@ -25,8 +25,8 @@ gFramebuffers = 0x803A5D00; /* framebuffers */ /* Renames for the boot segment */ boot_D_8002D500 = D_8002D500; boot_core1_VRAM = core1_VRAM; -boot_D_803FBE00 = D_803FBE00; -boot_D_803FFE00 = D_803FFE00; +boot_gGlobalHuffTable = gGlobalHuffTable; +boot_gCore1CRCs = gCore1CRCs; boot_gOverlayTable = gOverlayTable; -boot_func_8023DA20 = func_8023DA20; +boot_core1_main = core1_main; diff --git a/src/FP/ch/twinkly.c b/src/FP/ch/twinkly.c index a90fb0bd..caca25d0 100644 --- a/src/FP/ch/twinkly.c +++ b/src/FP/ch/twinkly.c @@ -154,7 +154,7 @@ void chTwinkly_hopToTree(Actor *arg0, f32 arg1[3], f32 arg2) sp7F = (arg2 == 0.0f) ? (0) : (1); var_f22 = arg1[0] - arg0->position[0]; var_f24 = arg1[2] - arg0->position[2]; - sp54 = gu_sqrtf((var_f22 * var_f22) + (var_f24 * var_f24)); + sp54 = sqrtf((var_f22 * var_f22) + (var_f24 * var_f24)); sp48[0] = var_f22 / sp54; sp48[2] = var_f24 / sp54; if (sp7F) diff --git a/src/SM/ch/vegetables.c b/src/SM/ch/vegetables.c index b31ecf70..069f5fe2 100644 --- a/src/SM/ch/vegetables.c +++ b/src/SM/ch/vegetables.c @@ -442,7 +442,7 @@ static void __chVegetables_update(Actor* this) { this->velocity_x += sp6C[0]*sp78; this->velocity_y += sp6C[1]*sp78; this->velocity_z += sp6C[2]*sp78; - if (gu_sqrtf(this->velocity_z*this->velocity_z + (this->velocity_x*this->velocity_x + this->velocity_y*this->velocity_y)) > 50.0f) { + if (sqrtf(this->velocity_z*this->velocity_z + (this->velocity_x*this->velocity_x + this->velocity_y*this->velocity_y)) > 50.0f) { ml_vec3f_set_length(this->velocity, 50.0f); } if (ml_vec3f_distance(this->position, this->unk1C) < 20.0f) { diff --git a/src/SM/code_F0.c b/src/SM/code_F0.c index 4deacb7c..a18a8f91 100644 --- a/src/SM/code_F0.c +++ b/src/SM/code_F0.c @@ -26,7 +26,7 @@ extern ActorInfo gBanjosChair; extern ActorInfo gBanjosStove; extern ActorInfo gRockTrappingGrunty; -extern u32 D_803FFE00[4]; +extern u32 gCore1CRCs[4]; /* .data */ s32 D_8038AAE0 = 0x000FE2C1; //compiled SM_code_crc_1 @@ -116,10 +116,10 @@ extern u8 crc_ROM_START[]; static bool __codeF0_areRomCrcsCorrect(){ u32 sp24; - if( (osPiReadIo((u32)crc_ROM_START + 8, &sp24), sp24 == D_803FFE00[0]) - && (osPiReadIo((u32)crc_ROM_START + 12, &sp24), sp24 == D_803FFE00[1]) - && (osPiReadIo((u32)crc_ROM_START + 16, &sp24), sp24 == D_803FFE00[2]) - && (osPiReadIo((u32)crc_ROM_START + 20, &sp24), sp24 == D_803FFE00[3]) + if( (osPiReadIo((u32)crc_ROM_START + 8, &sp24), sp24 == gCore1CRCs[0]) + && (osPiReadIo((u32)crc_ROM_START + 12, &sp24), sp24 == gCore1CRCs[1]) + && (osPiReadIo((u32)crc_ROM_START + 16, &sp24), sp24 == gCore1CRCs[2]) + && (osPiReadIo((u32)crc_ROM_START + 20, &sp24), sp24 == gCore1CRCs[3]) ){ return TRUE; } diff --git a/src/TTC/ch/clam.c b/src/TTC/ch/clam.c index d422ae0f..fa406bb4 100644 --- a/src/TTC/ch/clam.c +++ b/src/TTC/ch/clam.c @@ -70,7 +70,7 @@ static bool __chClam_updateFuncTarget(Actor *this, f32 arg1) { phi_f2 = egg_dist; } else if ((subaddie_playerIsWithinSphereAndActive(this, 1200) != 0) && (func_803292E0(this) != 0)) { - phi_f2 = gu_sqrtf((f32) func_8032970C(this)); + phi_f2 = sqrtf((f32) func_8032970C(this)); player_getPosition(target_position); sp38 = 1; } diff --git a/src/boot/bk_boot_1050.c b/src/boot/bk_boot_1050.c new file mode 100644 index 00000000..9ad3a30a --- /dev/null +++ b/src/boot/bk_boot_1050.c @@ -0,0 +1,38 @@ +#include +#include "boot/overlays.h" +#include "boot/rarezip.h" +#include "core1/main.h" + +#define ENTRY_STACK_LEN 0x2000 + +u8 gEntryStack[ENTRY_STACK_LEN]; + +extern u8 D_8002D500[]; +extern u8 core1_VRAM[]; +extern u32 gCore1CRCs[4]; + +/// @brief Entry point of the game +/// @param arg0 unused/unknown parameter +void func_80000450(s32 arg0) { + u8 *in = D_8002D500; + u8 *out = core1_VRAM; + + osInitialize(); + + osPiRawStartDma(OS_READ, (u32) core1_rzip_ROM_START, in, core1_rzip_ROM_END - core1_rzip_ROM_START); + while (osPiGetStatus() & PI_STATUS_DMA_BUSY); + + rarezip_init(); + + rarezip_uncompress_file_and_update_pointers(&in, &out); + gCore1CRCs[0] = inflate_crc1; + gCore1CRCs[1] = inflate_crc2; + + rarezip_uncompress_file_and_update_pointers(&in, &out); + gCore1CRCs[2] = inflate_crc1; + gCore1CRCs[3] = inflate_crc2; + + overlay_table_init(); + + (&core1_main)(arg0); +} diff --git a/src/boot/inflate.c b/src/boot/inflate.c new file mode 100644 index 00000000..4c2e421f --- /dev/null +++ b/src/boot/inflate.c @@ -0,0 +1,566 @@ +#include +#include "boot/rarezip.h" +#include "bool.h" + +#define WSIZE 0x8000 /* window size--must be a power of two, and */ + /* at least 32K for zip's deflate method */ + +#define NEEDBITS(n) { while (k < (n)) { b |= ((u32) inflate_inbuf[inflate_inptr++]) << k; k += 8; } } +#define DUMPBITS(n) { b >>= (n); k -= (n); } + +/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ +#define BMAX 16 /* maximum bit length of any code (16 for explode) */ +#define N_MAX 288 /* maximum number of codes in any set */ + +/* Order of the bit length code lengths */ +static u8 border[] = { + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 +}; + +/* Copy lengths for literal codes 257..285 */ +static u16 cplens[] = { + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 +}; /* note: see note #13 above about the 258 in this list. */ + +/* Extra bits for literal codes 257..285 */ +static u8 cplext[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99 +}; /* 99==invalid */ + +/* Copy offsets for distance codes 0..29 */ +static u16 cpdist[] = { + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577 +}; + +/* Extra bits for distance codes */ +static u8 cpdext[] = { + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, + 12, 12, 13, 13 +}; + +static u16 mask_bits[] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; + +const s32 lbits = 9; +const s32 dbits = 6; + +u8 *inflate_inbuf; +u8 *inflate_slide; +u32 inflate_inptr; +u32 inflate_wp; +struct huft_s *inflate_huft; +static u32 bb; +static u32 bk; +u32 inflate_crc1; +u32 inflate_crc2; +static u32 hufts; + +/* Given a list of code lengths and a maximum table size, make a set of + tables to decode that set of codes. Return zero on success, one if + the given code set is incomplete (the tables are still built in this + case), two if the input is invalid (all zero length codes or an + oversubscribed set of lengths), and three if not enough memory. */ +static bool huft_build( + u32 *b, /* code lengths in bits (all assumed <= BMAX) */ + u32 n, /* number of codes (assumed <= N_MAX) */ + u32 s, /* number of simple-valued codes (0..s-1) */ + u16 *d, /* list of base values for non-simple codes */ + u8 *e, /* list of extra bits for non-simple codes */ + struct huft_s **t, /* result: starting table */ + s32 *m /* maximum lookup bits, returns actual */ +) { + u32 a; /* counter for codes of length k */ + u32 c[BMAX+1]; /* bit length count table */ + u32 f; /* i repeats in table every f entries */ + s32 g; /* maximum code length */ + s32 h; /* table level */ + u32 i; /* counter, current code */ + u32 j; /* counter */ + s32 k; /* number of bits in current code */ + s32 l; /* bits per table (returned in m) */ + u32 *p; /* pointer into c[], b[], or v[] */ + struct huft_s *q; /* points to current table */ + struct huft_s r; /* table entry for structure assignment */ + struct huft_s *u[BMAX]; /* table stack */ + u32 v[N_MAX]; /* values in order of bit length */ + s32 w; /* bits before this table == (l * h) */ + u32 x[BMAX+1]; /* bit offsets, then code stack */ + u32 *xp; /* pointer into x */ + s32 y; /* number of dummy codes added */ + u32 z; /* number of entries in current table */ + + /* Generate counts for each bit length */ + bzero(c, sizeof(c)); + p = b; i = n; + + do { + c[*p]++; /* assume all entries <= BMAX */ + p++; /* Can't combine with above line (Solaris bug) */ + } while (--i); + + if (c[0] == n) { /* null input--all zero length codes */ + *t = (struct huft_s *)NULL; + *m = 0; + return 0; + } + + /* Find minimum and maximum length, bound *m by those */ + l = *m; + for (j = 1; j <= BMAX; j++) + if (c[j]) break; + k = j; /* minimum code length */ + if ((u32)l < j) + l = j; + for (i = BMAX; i; i--) + if (c[i]) break; + g = i; /* maximum code length */ + if ((u32)l > i) + l = i; + *m = l; + + /* Adjust last length count to fill out codes, if needed */ + for (y = 1 << j; j < i; j++, y <<= 1) { + (y -= c[j]); + } + y -= c[i]; + c[i] += y; + + /* Generate starting offsets into the value table for each length */ + x[1] = j = 0; + p = c + 1; xp = x + 2; + while (--i) { /* note that i == g from above */ + *xp++ = (j += *p++); + } + + /* Make a table of values in order of bit lengths */ + p = b; i = 0; + do { + if ((j = *p++) != 0) + v[x[j]++] = i; + } while (++i < n); + + /* Generate the Huffman codes and for each, make the table entries */ + x[0] = i = 0; /* first Huffman code is zero */ + p = v; /* grab values in bit order */ + h = -1; /* no tables yet--level -1 */ + w = -l; /* bits decoded == (l * h) */ + u[0] = (struct huft_s *)NULL; /* just to keep compilers happy */ + q = (struct huft_s *)NULL; /* ditto */ + z = 0; /* ditto */ + + /* go through the bit lengths (k already is bits in shortest code) */ + for (; k <= g; k++) { + a = c[k]; + while (a--) { + /* here i is the Huffman code of length k bits for value *p */ + /* make tables up to required level */ + while (k > w + l) { + h++; + w += l; /* previous table always l bits */ + + /* compute minimum size table less than or equal to l bits */ + z = (z = g - w) > (u32)l ? l : z; /* upper limit on table size */ + if ((f = 1 << (j = k - w)) > a + 1) { /* try a k-w bit table */ + /* too few codes for k-w bit table */ + f -= a + 1; /* deduct codes from patterns left */ + xp = c + k; + while (++j < z) { /* try smaller tables up to z bits */ + if ((f <<= 1) <= *++xp) + break; /* enough codes to use up j bits */ + f -= *xp; /* else deduct codes from patterns */ + } + } + z = 1 << j; /* table entries for j-bit table */ + + /* allocate and link in new table */ + q = inflate_huft + hufts; + + hufts += z + 1; /* track memory usage */ + *t = q + 1; /* link to list for huft_free() */ + *(t = &(q->v.t)) = (struct huft_s *)NULL; + u[h] = ++q; /* table starts after link */ + + /* connect to last table, if there is one */ + if (h) { + x[h] = i; /* save pattern for backing up */ + r.b = (u8)l; /* bits to dump before this table */ + r.e = (u8)(16 + j); /* bits in this table */ + r.v.t = q; /* pointer to this table */ + j = i >> (w - l); /* (get around Turbo C bug) */ + u[h-1][j] = r; /* connect to last table */ + } + } + + /* set up table entry in r */ + r.b = (u8)(k - w); + if (p >= v + n) { + r.e = 99; /* out of values--invalid code */ + } + else if (*p < s) { + r.e = (u8)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ + r.v.n = *p; /* simple code is just the value */ + p++; /* one compiler does not like *p++ */ + } + else { + r.e = *((u8 *)e + (*p - s)); /* non-simple--look up in lists */ + r.v.n = d[*p++ - s]; + } + + /* fill code-like entries with r */ + f = 1 << (k - w); + for (j = i >> w; j < z; j += f) + q[j] = r; + + /* backwards increment the k-bit code i */ + for (j = 1 << (k - 1); i & j; j >>= 1) + i ^= j; + i ^= j; + + /* backup over finished tables */ + while ((i & ((1 << w) - 1)) != x[h]) { + h--; /* don't need to update q */ + w -= l; + } + } + } + + /* Return true (1) if we were given an incomplete table */ + return y != 0 && g != 1; +} + +static s32 inflate_codes(struct huft_s *tl, struct huft_s *td, s32 bl, s32 bd) +{ + u32 e; /* table entry flag/number of extra bits */ + u32 n, d; /* length and index for copy */ + u32 w; /* current window position */ + struct huft_s *t; /* pointer to table entry */ + u32 ml, md; /* masks for bl and bd bits */ + u32 b; /* bit buffer */ + u32 k; /* number of bits in bit buffer */ + u8 tmp; + + /* make local copies of globals */ + b = bb; /* initialize bit buffer */ + k = bk; + w = inflate_wp; /* initialize window position */ + + /* inflate the coded data */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + + for (;;) { /* do until end of block */ + NEEDBITS((u32)bl) + if ((e = (t = tl + ((u32)b & ml))->e) > 16) { + do { + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((u32)b & mask_bits[e]))->e) > 16); + } + + DUMPBITS(t->b) + if (e == 16) { /* then it's a literal */ + tmp = (u8)t->v.n; + inflate_slide[w++] = tmp; + inflate_crc1 += tmp; + inflate_crc2 ^= tmp << (inflate_crc1 & 0x17); + } + else { /* it's an EOB or a length */ + /* exit if end of block */ + if (e == 15) + break; + + /* get length of block to copy */ + NEEDBITS(e) + n = t->v.n + ((u32)b & mask_bits[e]); + DUMPBITS(e); + + /* decode distance of block to copy */ + NEEDBITS((u32)bd) + if ((e = (t = td + ((u32)b & md))->e) > 16) { + do { + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((u32)b & mask_bits[e]))->e) > 16); + } + + DUMPBITS(t->b) + NEEDBITS(e) + d = w - t->v.n - ((u32)b & mask_bits[e]); + DUMPBITS(e) + + /* do the copy */ + do { + tmp = inflate_slide[d++]; + inflate_slide[w++] = tmp; + inflate_crc1 += tmp; + inflate_crc2 ^= tmp << (inflate_crc1 & 0x17); + } while(--n); + } + } + + /* restore the globals from the locals */ + inflate_wp = w; /* restore global window pointer */ + bb = b; /* restore global bit buffer */ + bk = k; + + /* done */ + return 0; +} + +/* "decompress" an inflated type 0 (stored) block. */ +static s32 inflate_stored(void) { + u32 n; /* number of bytes in block */ + u32 w; /* current window position */ + u32 b; /* bit buffer */ + u32 k; /* number of bits in bit buffer */ + + /* make local copies of globals */ + b = bb; /* initialize bit buffer */ + k = bk; + w = inflate_wp; /* initialize window position */ + + /* go to byte boundary */ + n = k & 7; + DUMPBITS(n); + + /* get the length and its complement */ + NEEDBITS(16) + n = ((u32)b & 0xffff); + DUMPBITS(16) + NEEDBITS(16) + DUMPBITS(16) + + /* read and output the compressed data */ + while (n--) { + NEEDBITS(8) + inflate_slide[w++] = (u8) b; + inflate_crc1 += b & 0xFF; + inflate_crc2 ^= (b &0xFF) << (inflate_crc1 & 0x17); + DUMPBITS(8) + } + + /* restore the globals from the locals */ + inflate_wp = w; /* restore global window pointer */ + bb = b; /* restore global bit buffer */ + bk = k; + + return 0; +} + +/* decompress an inflated type 1 (fixed Huffman codes) block. We should + either replace this with a custom decoder, or at least precompute the + Huffman tables. */ +static s32 inflate_fixed(void) { + s32 i; /* temporary variable */ + struct huft_s *tl; /* literal/length code table */ + struct huft_s *td; /* distance code table */ + s32 bl; /* lookup bits for tl */ + s32 bd; /* lookup bits for td */ + u32 l[288]; /* length list for huft_build */ + + /* set up literal table */ + for (i = 0; i < 144; i++) + l[i] = 8; + for (; i < 256; i++) + l[i] = 9; + for (; i < 280; i++) + l[i] = 7; + for (; i < 288; i++) /* make a complete, but wrong code set */ + l[i] = 8; + bl = 7; + huft_build(l, 288, 257, cplens, cplext, &tl, &bl); + + /* set up distance table */ + for (i = 0; i < 30; i++) /* make an incomplete code set */ + l[i] = 5; + bd = 5; + huft_build(l, 30, 0, cpdist, cpdext, &td, &bd); + + /* decompress until an end-of-block code */ + inflate_codes(tl, td, bl, bd); + + return 0; +} + +/* decompress an inflated type 2 (dynamic Huffman codes) block. */ +static s32 inflate_dynamic(void) { + s32 i; /* temporary variables */ + u32 j; + u32 l; /* last length */ + u32 m; /* mask for bit lengths table */ + u32 n; /* number of lengths to get */ + struct huft_s *tl; /* literal/length code table */ + struct huft_s *td; /* distance code table */ + s32 bl; /* lookup bits for tl */ + s32 bd; /* lookup bits for td */ + u32 nb; /* number of bit length codes */ + u32 nl; /* number of literal/length codes */ + u32 nd; /* number of distance codes */ + u32 k; /* number of bits in bit buffer */ + u32 b; /* bit buffer */ + u32 ll[286+30]; /* literal/length and distance code lengths */ + + /* make local bit buffer */ + b = bb; + k = bk; + + /* read in table lengths */ + NEEDBITS(5) + nl = 257 + ((u32)b & 0x1f); /* number of literal/length codes */ + DUMPBITS(5) + NEEDBITS(5) + nd = 1 + ((u32)b & 0x1f); /* number of distance codes */ + DUMPBITS(5) + NEEDBITS(4) + nb = 4 + ((u32)b & 0xf); /* number of bit length codes */ + DUMPBITS(4) + + /* read in bit-length-code lengths */ + for (j = 0; j < nb; j++) { + NEEDBITS(3) + ll[border[j]] = (u32)b & 7; + DUMPBITS(3) + } + for (; j < 19; j++) + ll[border[j]] = 0; + + /* build decoding table for trees--single level, 7 bit lookup */ + bl = 7; + huft_build(ll, 19, 19, NULL, NULL, &tl, &bl); + + /* read in literal and distance code lengths */ + n = nl + nd; + m = mask_bits[bl]; + i = l = 0; + while ((u32)i < n) + { + NEEDBITS((u32)bl) + j = (td = tl + ((u32)b & m))->b; + DUMPBITS(j) + j = td->v.n; + + if (j < 16) { /* length of code in bits (0..15) */ + ll[i++] = l = j; /* save last length in l */ + } + else if (j == 16) { /* repeat last length 3 to 6 times */ + NEEDBITS(2) + j = 3 + ((u32)b & 3); + DUMPBITS(2) + while (j--) + ll[i++] = l; + } + else if (j == 17) { /* 3 to 10 zero length codes */ + NEEDBITS(3) + j = 3 + ((u32)b & 7); + DUMPBITS(3) + while (j--) + ll[i++] = 0; + l = 0; + } + else { /* j == 18: 11 to 138 zero length codes */ + NEEDBITS(7) + j = 11 + ((u32)b & 0x7f); + DUMPBITS(7) + while (j--) + ll[i++] = 0; + l = 0; + } + } + + /* restore the global bit buffer */ + bb = b; + bk = k; + + /* build the decoding tables for literal/length and distance codes */ + bl = lbits; + huft_build(ll, nl, 257, cplens, cplext, &tl, &bl); + bd = dbits; + huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd); + + /* decompress until an end-of-block code */ + inflate_codes(tl, td, bl, bd); + + return 0; +} + +/* decompress an inflated block */ +static s32 inflate_block(s32 *e) { + u32 t; /* block type */ + u32 b; /* bit buffer */ + u32 k; /* number of bits in bit buffer */ + + /* make local bit buffer */ + b = bb; + k = bk; + + /* read in last block bit */ + NEEDBITS(1) + *e = (s32)b & 1; + DUMPBITS(1) + + /* read in block type */ + NEEDBITS(2) + t = (u32)b & 3; + DUMPBITS(2) + + /* restore the global bit buffer */ + bb = b; + bk = k; + + /* inflate that block type */ + if (t == 2) + return inflate_dynamic(); + if (t == 0) + return inflate_stored(); + if (t == 1) + return inflate_fixed(); + + /* bad block type */ + return 2; +} + +/* decompress an inflated entry */ +s32 inflate(void) { + s32 e; /* last block flag */ + s32 r; /* result code */ + u32 h; /* maximum struct huft_s's malloc'ed */ + + /* initialize window, bit buffer */ + inflate_wp = 0; + bk = 0; + bb = 0; + + inflate_crc1 = 0; + inflate_crc2 = -1; + + /* decompress until the last block */ + h = 0; + do { + hufts = 0; + if ((r = inflate_block(&e)) != 0) + return r; + if (hufts > h) + h = hufts; + } while (!e); + + /* Undo too much lookahead. The next read will be byte aligned so we + * can discard unused bits in the last meaningful byte. + */ + while (bk >= 8) { + bk -= 8; + inflate_inptr--; + } + + /* return success */ + return 0; +} diff --git a/src/done/overlays.c b/src/boot/overlays.c similarity index 72% rename from src/done/overlays.c rename to src/boot/overlays.c index bb8c6b85..85439879 100644 --- a/src/done/overlays.c +++ b/src/boot/overlays.c @@ -1,12 +1,5 @@ #include -#include "functions.h" -#include "variables.h" - -#define OVERLAY(ovl, _) \ - extern u8 ovl##_rzip_ROM_START[]; \ - extern u8 ovl##_rzip_ROM_END[]; -#include -#undef OVERLAY +#include "boot/overlays.h" // This doesn't match as macros, even if two macros are used per overlay. // Look into autogenerating this table in the long run for a cleaner solution. @@ -41,4 +34,20 @@ void overlay_table_init(void) { gOverlayTable[13].end = lair_rzip_ROM_END; gOverlayTable[14].start = fight_rzip_ROM_START; gOverlayTable[14].end = fight_rzip_ROM_END; + + // MAKE_OVERLAY_TABLE_ENTRY(core2, 0) + // MAKE_OVERLAY_TABLE_ENTRY(emptyLvl, 1) + // MAKE_OVERLAY_TABLE_ENTRY(CC, 2) + // MAKE_OVERLAY_TABLE_ENTRY(MMM, 3) + // MAKE_OVERLAY_TABLE_ENTRY(GV, 4) + // MAKE_OVERLAY_TABLE_ENTRY(TTC, 5) + // MAKE_OVERLAY_TABLE_ENTRY(MM, 6) + // MAKE_OVERLAY_TABLE_ENTRY(BGS, 7) + // MAKE_OVERLAY_TABLE_ENTRY(RBB, 8) + // MAKE_OVERLAY_TABLE_ENTRY(FP, 9) + // MAKE_OVERLAY_TABLE_ENTRY(CCW, 10) + // MAKE_OVERLAY_TABLE_ENTRY(SM, 11) + // MAKE_OVERLAY_TABLE_ENTRY(cutscenes, 12) + // MAKE_OVERLAY_TABLE_ENTRY(lair, 13) + // MAKE_OVERLAY_TABLE_ENTRY(fight, 14) } diff --git a/src/boot/rarezip.c b/src/boot/rarezip.c new file mode 100644 index 00000000..eeb4d62e --- /dev/null +++ b/src/boot/rarezip.c @@ -0,0 +1,69 @@ +#include +#include "boot/rarezip.h" + +struct huft_s *D_80007270; // rarezip_huft +extern struct huft_s gGlobalHuffTable; + +static u32 rarezip_uncompress_file_internal(u8 *in, u8 *out, struct huft_s *huft); +static u32 rarezip_uncompress_file_and_update_pointers_internal(u8 **in, u8 **out, struct huft_s *huft); + +/// @brief Returns the uncompressed file size from the file header +/// @param file Pointer to the compressed file +/// @return Uncompressed file size in bytes +u32 rarezip_get_uncompressed_size(u8 *file) { + return *((u32 *) (file + 2)); +} + +/// @brief Initializes the Rarezip Huff table +void rarezip_init(void) { + D_80007270 = &gGlobalHuffTable; +} + +/// @brief Uncompresses a Rarezip file in memory (public function) +/// @param in Pointer to the compressed file +/// @param out Pointer to the output buffer for the decompressed file +/// @return Uncompressed file size in bytes +u32 rarezip_uncompress_file(u8 *in, u8 *out) { + return rarezip_uncompress_file_internal(in, out, D_80007270); +} + +/// @brief Uncompresses a Rarezip file in memory and updates file and buffer pointers (public function) +/// @param in Pointer to the compressed file +/// @param out Pointer to the output buffer for the decompressed file +void rarezip_uncompress_file_and_update_pointers(u8 **in, u8 **out) { + rarezip_uncompress_file_and_update_pointers_internal(in, out, D_80007270); +} + +/// @brief Possible debug function +void rarezip_debug(void) {} + +/// @brief Uncompresses a Rarezip file in memory (internal function) +/// @param in Pointer to the compressed file +/// @param out Pointer to the output buffer for the decompressed file +/// @param huft Pointer to the Huff table +/// @return Uncompressed file size in bytes +static u32 rarezip_uncompress_file_internal(u8 *in, u8 *out, struct huft_s *huft) { + inflate_inbuf = in; + inflate_slide = out; + inflate_huft = huft; + inflate_inbuf += 6; //skip 6 byte bk header + inflate_wp = 0; + inflate_inptr = 0; + + inflate(); + + return inflate_wp; +} + +/// @brief Uncompresses a Rarezip file in memory and updates file and buffer pointers (public function) +/// @param in Pointer to the compressed file +/// @param out Pointer to the output buffer for the decompressed file +/// @param huft Pointer to the Huff table +/// @return Uncompressed file size in bytes +static u32 rarezip_uncompress_file_and_update_pointers_internal(u8 **in, u8 **out, struct huft_s *huft) { + u32 size = rarezip_uncompress_file_internal(*in, *out, huft); + *out += inflate_wp; + *out = ((u32)(*out) & 0xF) ? (u8 *) ((u32)(*out) & ~0xF) + 0x10 : *out; + *in += inflate_inptr + 6; + return size; +} diff --git a/src/core1/audio/auxbus.c b/src/core1/audio/auxbus.c deleted file mode 100644 index 2eb4efc4..00000000 --- a/src/core1/audio/auxbus.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include "synthInternals.h" - -Acmd *alAuxBusPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p) -{ - Acmd *ptr = p; - ALAuxBus *m = (ALAuxBus *)filter; - ALFilter **sources = m->sources; - s32 i; - - /* - * clear the output buffers here - */ - aClearBuffer(ptr++, AL_AUX_L_OUT, outCount<<1); - aClearBuffer(ptr++, AL_AUX_R_OUT, outCount<<1); - - for (i = 0; i < m->sourceCount; i++) { - ptr = (sources[i]->handler)(sources[i], outp, outCount, sampleOffset, - ptr); - } - - return ptr; -} - -s32 alAuxBusParam(void *filter, s32 paramID, void *param) -{ - ALAuxBus *m = (ALAuxBus *) filter; - ALFilter **sources = m->sources; - - switch (paramID) { - - case (AL_FILTER_ADD_SOURCE): - sources[m->sourceCount++] = (ALFilter *) param; - break; - - default: - /* ??? */ - break; - } - - return 0; -} diff --git a/src/core1/audio/bnkf.c b/src/core1/audio/bnkf.c deleted file mode 100644 index 9985a4c9..00000000 --- a/src/core1/audio/bnkf.c +++ /dev/null @@ -1,118 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -/* copt used??? */ - -void alSeqFileNew(ALSeqFile *file, u8 *base) -{ - s32 offset = (s32) base; - s32 i; - - /* - * patch the file so that offsets are pointers - */ - for (i = 0; i < file->seqCount; i++) { - file->seqArray[i].offset = (u8 *)((u8 *)file->seqArray[i].offset + offset); - } -} - -static void _bnkfPatchWaveTable(ALWaveTable *w, s32 offset, s32 table) -{ - if (w->flags) - return; - - w->flags = 1; - - w->base += table; - - /* sct 2/14/96 - patch wavetable loop info based on type. */ - if (w->type == AL_ADPCM_WAVE) - { - w->waveInfo.adpcmWave.book = (ALADPCMBook *)((u8 *)w->waveInfo.adpcmWave.book + offset); - if (w->waveInfo.adpcmWave.loop) - w->waveInfo.adpcmWave.loop = (ALADPCMloop *)((u8 *)w->waveInfo.adpcmWave.loop + offset); - } - else if (w->type == AL_RAW16_WAVE) - { - if (w->waveInfo.rawWave.loop) - w->waveInfo.rawWave.loop = (ALRawLoop *)((u8 *)w->waveInfo.rawWave.loop + offset); - } -} - -static void _bnkfPatchSound(ALSound *s, s32 offset, s32 table) -{ - if (s->flags) - return; - - s->flags = 1; - - s->envelope = (ALEnvelope *)((u8 *)s->envelope + offset); - s->keyMap = (ALKeyMap *)((u8 *)s->keyMap + offset); - - s->wavetable = (ALWaveTable *)((u8 *)s->wavetable + offset); - _bnkfPatchWaveTable(s->wavetable, offset, table); -} - -static void _bnkfPatchInst(ALInstrument *inst, s32 offset, s32 table) -{ - s32 i; - - if (inst->flags) - return; - - inst->flags = 1; - - for (i = 0; i < inst->soundCount; i++) { - inst->soundArray[i] = (ALSound *)((u8 *)inst->soundArray[i] + - offset); - _bnkfPatchSound(inst->soundArray[i], offset, table); - - } -} - -static void _bnkfPatchBank(ALBank *bank, s32 offset, s32 table) -{ - s32 i; - - if (bank->flags) - return; - - bank->flags = 1; - - if (bank->percussion) { - bank->percussion = (ALInstrument *)((u8 *)bank->percussion + offset); - _bnkfPatchInst(bank->percussion, offset, table); - } - - for (i = 0; i < bank->instCount; i++) { - bank->instArray[i] = (ALInstrument *)((u8 *)bank->instArray[i] + - offset); - if(bank->instArray[i]) - _bnkfPatchInst(bank->instArray[i], offset, table); - } -} - -void alBnkfNew(ALBankFile *file, u8 *table) -{ - s32 offset = (s32) file; - s32 woffset = (s32) table; - - s32 i; - - /* - * check the file format revision in debug libraries - */ - ALFailIf(file->revision != AL_BANK_VERSION, ERR_ALBNKFNEW); - - /* - * patch the file so that offsets are pointers - */ - for (i = 0; i < file->bankCount; i++) { - file->bankArray[i] = (ALBank *)((u8 *)file->bankArray[i] + offset); - if(file->bankArray[i]) - _bnkfPatchBank(file->bankArray[i], offset, woffset); - } -} - diff --git a/src/core1/audio/cents2ratio.c b/src/core1/audio/cents2ratio.c deleted file mode 100644 index 497b5dbc..00000000 --- a/src/core1/audio/cents2ratio.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -f32 alCents2Ratio(s32 cents) -{ - f32 x; - f32 ratio = 1.0f; - - if (cents >= 0) { - x = 1.00057779f; /* 2^(1/1200) */ - } else { - x = 0.9994225441f; /* 2^(-1/1200) */ - cents = -cents; - } - - while (cents) { - if (cents & 1) - ratio *= x; - x *= x; - cents >>= 1; - } - - return ratio; -} diff --git a/src/core1/audio/copy.c b/src/core1/audio/copy.c deleted file mode 100644 index ef27d6e9..00000000 --- a/src/core1/audio/copy.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -void alCopy(void *src, void *dest, s32 len) -{ - s32 i; - u8 *s = (u8 *)src; - u8 *d = (u8 *)dest; - - for (i = 0; i < len; i++){ - *d++ = *s++; - } -} diff --git a/src/core1/audio/cseq.c b/src/core1/audio/cseq.c deleted file mode 100644 index 142b1a3b..00000000 --- a/src/core1/audio/cseq.c +++ /dev/null @@ -1,375 +0,0 @@ -#include - -static u32 __readVarLen(ALCSeq *s,u32 track); -static u8 __getTrackByte(ALCSeq *s,u32 track); -static u32 __alCSeqGetTrackEvent(ALCSeq *seq, u32 track, ALEvent *event); - -void alCSeqNew(ALCSeq *seq, u8 *ptr) -{ - u32 i,tmpOff,flagTmp; - - /* load the seqence pointed to by ptr */ - seq->base = (ALCMidiHdr*)ptr; - seq->validTracks = 0; - seq->lastDeltaTicks = 0; - seq->lastTicks = 0; - seq->deltaFlag = 1; - - for(i = 0; i < 16; i++) - { - seq->lastStatus[i] = 0; - seq->curBUPtr[i] = 0; - seq->curBULen[i] = 0; - tmpOff = seq->base->trackOffset[i]; - if(tmpOff) /* if the track is valid */ - { - flagTmp = 1 << i; - seq->validTracks |= flagTmp; - seq->curLoc[i] = (u8*)((u32)ptr + tmpOff); - seq->evtDeltaTicks[i] = __readVarLen(seq,i); - /*__alCSeqGetTrackEvent(seq,i); prime the event buffers */ - } - else - seq->curLoc[i] = 0; - } - - seq->qnpt = 1.0/(f32)seq->base->division; -} - -void alCSeqNextEvent(ALCSeq *seq,ALEvent *evt) -{ - u32 i; - u32 firstTime = 0xFFFFFFFF; - u32 firstTrack; - u32 lastTicks = seq->lastDeltaTicks; - -#ifdef _DEBUG - /* sct 1/17/96 - Warn if we are beyond the end of sequence. */ - if (!seq->validTracks) - __osError(ERR_ALSEQOVERRUN, 0); -#endif - - - for(i = 0; i < 16 ; i++) - { - if((seq->validTracks >> i) & 1) - { - if(seq->deltaFlag) - seq->evtDeltaTicks[i] -= lastTicks; - if(seq->evtDeltaTicks[i] < firstTime) - { - firstTime = seq->evtDeltaTicks[i]; - firstTrack = i; - } - } - } - - __alCSeqGetTrackEvent(seq,firstTrack,evt); - - evt->msg.midi.ticks = firstTime; - seq->lastTicks += firstTime; - seq->lastDeltaTicks = firstTime; - if(evt->type != AL_TRACK_END) - seq->evtDeltaTicks[firstTrack] += __readVarLen(seq,firstTrack); - seq->deltaFlag = 1; - -} - - -/* - Note: If there are no valid tracks (ie. all tracks have - reached the end of their data stream), then return FALSE - to indicate that there is no next event. -*/ -char __alCSeqNextDelta(ALCSeq *seq, s32 *pDeltaTicks) -{ - u32 i; - u32 firstTime = 0xFFFFFFFF; - u32 lastTicks = seq->lastDeltaTicks; - - if (!seq->validTracks) - return FALSE; - - for(i = 0; i < 16 ; i++) - { - if((seq->validTracks >> i) & 1) - { - if(seq->deltaFlag) - seq->evtDeltaTicks[i] -= lastTicks; - - if(seq->evtDeltaTicks[i] < firstTime) - firstTime = seq->evtDeltaTicks[i]; - } - } - - seq->deltaFlag = 0; - *pDeltaTicks = firstTime; - - return TRUE; -} - -/* only call alCSeqGetTrackEvent with a valid track !! */ -static u32 __alCSeqGetTrackEvent(ALCSeq *seq, u32 track, ALEvent *event) -{ - u32 offset; - u8 status, loopCt, curLpCt, *tmpPtr; - - - status = __getTrackByte(seq,track); /* read the status byte */ - - if (status == AL_MIDI_Meta) /* running status not allowed on meta events!! */ - { - u8 type = __getTrackByte(seq,track); - - if (type == AL_MIDI_META_TEMPO) - { - event->type = AL_TEMPO_EVT; - event->msg.tempo.status = status; - event->msg.tempo.type = type; - event->msg.tempo.byte1 = __getTrackByte(seq,track); - event->msg.tempo.byte2 = __getTrackByte(seq,track); - event->msg.tempo.byte3 = __getTrackByte(seq,track); - seq->lastStatus[track] = 0; /* lastStatus not supported after meta */ - } - else if (type == AL_MIDI_META_EOT) - { - u32 flagMask; - - flagMask = 0x01 << track; - seq->validTracks = seq->validTracks ^ flagMask; - - if(seq->validTracks) /* there is music left don't end */ - event->type = AL_TRACK_END; - else /* no more music send AL_SEQ_END_EVT msg */ - event->type = AL_SEQ_END_EVT; - } - else if (type == AL_CMIDI_LOOPSTART_CODE) - { - status = __getTrackByte(seq,track); /* get next two bytes, ignore them */ - status = __getTrackByte(seq,track); - seq->lastStatus[track] = 0; - event->type = AL_CSP_LOOPSTART; - } - else if (type == AL_CMIDI_LOOPEND_CODE) - { - tmpPtr = seq->curLoc[track]; - loopCt = *tmpPtr++; - curLpCt = *tmpPtr; - if(curLpCt == 0) /* done looping */ - { - *tmpPtr = loopCt; /* reset current loop count */ - seq->curLoc[track] = tmpPtr + 5; /* move pointer to end of event */ - } - else - { - if(curLpCt != 0xFF) /* not a loop forever */ - *tmpPtr = curLpCt - 1; /* decrement current loop count */ - tmpPtr++; /* get offset from end of event */ - offset = (*tmpPtr++) << 24; - offset += (*tmpPtr++) << 16; - offset += (*tmpPtr++) << 8; - offset += *tmpPtr++; - seq->curLoc[track] = tmpPtr - offset; - } - seq->lastStatus[track] = 0; - event->type = AL_CSP_LOOPEND; - } - -#ifdef _DEBUG - else - __osError(ERR_ALSEQMETA, 1, type); -#endif - - } - else - { - event->type = AL_SEQ_MIDI_EVT; - if (status & 0x80) /* if high bit is set, then new status */ - { - event->msg.midi.status = status; - event->msg.midi.byte1 = __getTrackByte(seq,track); - seq->lastStatus[track] = status; - } - else /* running status */ - { -#ifdef _DEBUG - if(seq->lastStatus[track] == 0) - __osError(ERR_ALCSEQZEROSTATUS, 1, track); -#endif - event->msg.midi.status = seq->lastStatus[track]; - event->msg.midi.byte1 = status; - } - - if (((event->msg.midi.status & 0xf0) != AL_MIDI_ProgramChange) && - ((event->msg.midi.status & 0xf0) != AL_MIDI_ChannelPressure)) - { - event->msg.midi.byte2 = __getTrackByte(seq,track); - if((event->msg.midi.status & 0xf0) == AL_MIDI_NoteOn) - { - event->msg.midi.duration = __readVarLen(seq,track); -#ifdef _DEBUG - if(event->msg.midi.byte2 == 0) - __osError( ERR_ALCSEQZEROVEL, 1, track); -#endif - } - } - else - event->msg.midi.byte2 = 0; - } - return TRUE; -} - -f32 alCSeqTicksToSec(ALCSeq *seq, s32 ticks, u32 tempo) -{ - return ((f32) (((f32)(ticks) * (f32)(tempo)) / - ((f32)(seq->base->division) * 1000000.0))); -} - -u32 alCSeqSecToTicks(ALCSeq *seq, f32 sec, u32 tempo) -{ - return (u32)(((sec * 1000000.0) * seq->base->division) / tempo); -} - - -s32 alCSeqGetTicks(ALCSeq *seq) -{ - return seq->lastTicks; -} - - -void alCSeqNewMarker(ALCSeq *seq, ALCSeqMarker *m, u32 ticks) -{ - ALEvent evt; - ALCSeq tempSeq; - s32 i; - - - alCSeqNew(&tempSeq, (u8*)seq->base); - - do { - m->validTracks = tempSeq.validTracks; - m->lastTicks = tempSeq.lastTicks; - m->lastDeltaTicks = tempSeq.lastDeltaTicks; - - for(i=0;i<16;i++) - { - m->curLoc[i] = tempSeq.curLoc[i]; - m->curBUPtr[i] = tempSeq.curBUPtr[i]; - m->curBULen[i] = tempSeq.curBULen[i]; - m->lastStatus[i] = tempSeq.lastStatus[i]; - m->evtDeltaTicks[i] = tempSeq.evtDeltaTicks[i]; - } - - alCSeqNextEvent(&tempSeq, &evt); - - if (evt.type == AL_SEQ_END_EVT) - break; - - } while (tempSeq.lastTicks < ticks); - -} - -void alCSeqSetLoc(ALCSeq *seq, ALCSeqMarker *m) -{ - s32 i; - - seq->validTracks = m->validTracks; - seq->lastTicks = m->lastTicks; - seq->lastDeltaTicks = m->lastDeltaTicks; - - for(i=0;i<16;i++) - { - seq->curLoc[i] = m->curLoc[i]; - seq->curBUPtr[i] = m->curBUPtr[i]; - seq->curBULen[i] = m->curBULen[i]; - seq->lastStatus[i] = m->lastStatus[i]; - seq->evtDeltaTicks[i] = m->evtDeltaTicks[i]; - } -} - -void alCSeqGetLoc(ALCSeq *seq, ALCSeqMarker *m) -{ - s32 i; - - m->validTracks = seq->validTracks; - m->lastTicks = seq->lastTicks; - m->lastDeltaTicks = seq->lastDeltaTicks; - - for(i=0;i<16;i++) - { - m->curLoc[i] = seq->curLoc[i]; - m->curBUPtr[i] = seq->curBUPtr[i]; - m->curBULen[i] = seq->curBULen[i]; - m->lastStatus[i] = seq->lastStatus[i]; - m->evtDeltaTicks[i] = seq->evtDeltaTicks[i]; - } -} - -/* non-aligned byte reading routines */ -static u8 __getTrackByte(ALCSeq *seq,u32 track) -{ - u8 theByte; - - - if(seq->curBULen[track]) - { - theByte = *seq->curBUPtr[track]; - seq->curBUPtr[track]++; - seq->curBULen[track]--; - } - else /* need to handle backup mode */ - { - theByte = *seq->curLoc[track]; - seq->curLoc[track]++; - if(theByte == AL_CMIDI_BLOCK_CODE) - { - u8 loBackUp,hiBackUp,theLen,nextByte; - u32 backup; - - nextByte = *seq->curLoc[track]; - seq->curLoc[track]++; - if(nextByte != AL_CMIDI_BLOCK_CODE) - { - /* if here, then got a backup section. get the amount of - backup, and the len of the section. Subtract the amount of - backup from the curLoc ptr, and subtract four more, since - curLoc has been advanced by four while reading the codes. */ - hiBackUp = nextByte; - loBackUp = *seq->curLoc[track]; - seq->curLoc[track]++; - theLen = *seq->curLoc[track]; - seq->curLoc[track]++; - backup = (u32)hiBackUp; - backup = backup << 8; - backup += loBackUp; - seq->curBUPtr[track] = seq->curLoc[track] - (backup + 4); - seq->curBULen[track] = (u32)theLen; - - /* now get the byte */ - theByte = *seq->curBUPtr[track]; - seq->curBUPtr[track]++; - seq->curBULen[track]--; - } - } - } - - return theByte; -} - -static u32 __readVarLen(ALCSeq *seq,u32 track) -{ - u32 value; - u32 c; - - value = (u32)__getTrackByte(seq,track); - if ( value & 0x00000080 ) - { - value &= 0x7f; - do - { - c = (u32)__getTrackByte(seq,track); - value = (value << 7) + (c & 0x7f); - } while (c & 0x80); - } - return (value); -} diff --git a/src/core1/audio/cspgettempo.c b/src/core1/audio/cspgettempo.c deleted file mode 100644 index 0f22e99b..00000000 --- a/src/core1/audio/cspgettempo.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -s32 alCSPGetTempo(ALCSPlayer *seqp){ - if(seqp->target == NULL) - return 0; - return seqp->uspt / seqp->target->qnpt; -} - diff --git a/src/core1/audio/cspplay.c b/src/core1/audio/cspplay.c deleted file mode 100644 index 0de783d5..00000000 --- a/src/core1/audio/cspplay.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -void alCSPPlay(ALCSPlayer *seqp) -{ - ALEvent evt; - - evt.type = AL_SEQP_PLAY_EVT; - alEvtqPostEvent(&seqp->evtq, &evt, 0); -} diff --git a/src/core1/audio/cspsetbank.c b/src/core1/audio/cspsetbank.c deleted file mode 100644 index 2170fdcb..00000000 --- a/src/core1/audio/cspsetbank.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -void alCSPSetBank(ALCSPlayer *seqp, ALBank *b) -{ - ALEvent evt; - - evt.type = AL_SEQP_BANK_EVT; - evt.msg.spbank.bank = b; - - alEvtqPostEvent(&seqp->evtq, &evt, 0); -} diff --git a/src/core1/audio/cspsetseq.c b/src/core1/audio/cspsetseq.c deleted file mode 100644 index 09dc5c9e..00000000 --- a/src/core1/audio/cspsetseq.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -void alCSPSetSeq(ALCSPlayer *seqp, ALCSeq *seq) -{ - ALEvent evt; - - evt.type = AL_SEQP_SEQ_EVT; - evt.msg.spseq.seq = seq; - - alEvtqPostEvent(&seqp->evtq, &evt, 0); -} diff --git a/src/core1/audio/cspsettempo.c b/src/core1/audio/cspsettempo.c deleted file mode 100644 index cbee2a44..00000000 --- a/src/core1/audio/cspsettempo.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -void alCSPSetTempo(ALCSPlayer *seqp, s32 tempo) -{ - ALEvent evt; - - evt.type = AL_SEQP_META_EVT; - evt.msg.tempo.status = AL_MIDI_Meta; - evt.msg.tempo.type = AL_MIDI_META_TEMPO; - evt.msg.tempo.byte1 = (tempo & 0xff0000)>>16; - evt.msg.tempo.byte2 = (tempo & 0xff00)>>8; - evt.msg.tempo.byte3 = tempo & 0xff; - - alEvtqPostEvent(&seqp->evtq, &evt, 0); -} diff --git a/src/core1/audio/cspsetvol.c b/src/core1/audio/cspsetvol.c deleted file mode 100644 index f937be63..00000000 --- a/src/core1/audio/cspsetvol.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -void alCSPSetVol(ALCSPlayer *seqp, s16 vol) -{ - ALEvent evt; - - evt.type = AL_SEQP_VOL_EVT; - evt.msg.spvol.vol = vol; - - alEvtqPostEvent(&seqp->evtq, &evt, 0); -} - diff --git a/src/core1/audio/cspstop.c b/src/core1/audio/cspstop.c deleted file mode 100644 index 9f92c21e..00000000 --- a/src/core1/audio/cspstop.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - - -void alCSPStop(ALCSPlayer *seqp) -{ - ALEvent evt; - - evt.type = AL_SEQP_STOPPING_EVT; - alEvtqPostEvent(&seqp->evtq, &evt, 0); -} diff --git a/src/core1/audio/drvrNew.c b/src/core1/audio/drvrNew.c deleted file mode 100644 index 895ae9e9..00000000 --- a/src/core1/audio/drvrNew.c +++ /dev/null @@ -1,280 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -#include "synthInternals.h" - -/* - * WARNING: THE FOLLOWING CONSTANT MUST BE KEPT IN SYNC - * WITH SCALING IN MICROCODE!!! - */ -#define SCALE 16384 - -/* - * the following arrays contain default parameters for - * a few hopefully useful effects. - */ -#define ms *(((s32)((f32)44.1))&~0x7) - - -static s32 SMALLROOM_PARAMS[26] = { - /* sections length */ - 3, 100 ms, - /* chorus chorus filter - input output fbcoef ffcoef gain rate depth coef */ - 0, 54 ms, 9830, -9830, 0, 0, 0, 0, - 19 ms, 38 ms, 3276, -3276, 0x3fff, 0, 0, 0, - 0, 60 ms, 5000, 0, 0, 0, 0, 0x5000 -}; - -static s32 BIGROOM_PARAMS[34] = { - /* sections length */ - 4, 100 ms, - /* chorus chorus filter - input output fbcoef ffcoef gain rate depth coef */ - 0, 66 ms, 9830, -9830, 0, 0, 0, 0, - 22 ms, 54 ms, 3276, -3276, 0x3fff, 0, 0, 0, - 66 ms, 91 ms, 3276, -3276, 0x3fff, 0, 0, 0, - 0, 94 ms, 8000, 0, 0, 0, 0, 0x5000 -}; - -static s32 ECHO_PARAMS[10] = { - /* sections length */ - 1, 200 ms, - /* chorus chorus filter - input output fbcoef ffcoef gain rate depth coef */ - 0, 179 ms, 12000, 0, 0x7fff, 0, 0, 0 -}; - -static s32 CHORUS_PARAMS[10] = { - /* sections length */ - 1, 20 ms, - /* chorus chorus filter - input output fbcoef ffcoef gain rate depth coef */ - 0, 5 ms, 0x4000, 0, 0x7fff, 7600, 700, 0 -}; - -static s32 FLANGE_PARAMS[10] = { - /* sections length */ - 1, 20 ms, - /* chorus chorus filter - input output fbcoef ffcoef gain rate depth coef */ - 0, 5 ms, 0, 0x5fff, 0x7fff, 380, 500, 0 -}; - -static s32 NULL_PARAMS[10] = { - 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -void _init_lpfilter(ALLowPass *lp) -{ - s32 i, temp; - s16 fc; - f64 ffc, fcoef; - - temp = lp->fc * SCALE; - fc = temp >> 15; - lp->fgain = SCALE - fc; - - lp->first = 1; - for (i=0; i<8; i++) - lp->fcvec.fccoef[i] = 0; - - lp->fcvec.fccoef[i++] = fc; - fcoef = ffc = (f64)fc/SCALE; - - for (; i<16; i++){ - fcoef *= ffc; - lp->fcvec.fccoef[i] = (s16)(fcoef * SCALE); - } -} - -void alFxNew(ALFx *r, ALSynConfig *c, ALHeap *hp) -{ - u16 i, j, k; - s32 *param = 0; - ALFilter *f = (ALFilter *) r; - ALDelay *d; - - alFilterNew(f, 0, alFxParam, AL_FX); - f->handler = alFxPull; - r->paramHdl = (ALSetFXParam)alFxParamHdl; - - switch (c->fxType) { - case AL_FX_SMALLROOM: param = SMALLROOM_PARAMS; break; - case AL_FX_BIGROOM: param = BIGROOM_PARAMS; break; - case AL_FX_ECHO: param = ECHO_PARAMS; break; - case AL_FX_CHORUS: param = CHORUS_PARAMS; break; - case AL_FX_FLANGE: param = FLANGE_PARAMS; break; - case AL_FX_CUSTOM: param = c->params; break; - default: param = NULL_PARAMS; break; - } - - - j = 0; - - r->section_count = param[j++]; - r->length = param[j++]; - - r->delay = alHeapAlloc(hp, r->section_count, sizeof(ALDelay)); - r->base = alHeapAlloc(hp, r->length, sizeof(s16)); - r->input = r->base; - - for ( k=0; k < r->length; k++) - r->base[k] = 0; - - for ( i=0; isection_count; i++ ){ - d = &r->delay[i]; - d->input = param[j++]; - d->output = param[j++]; - d->fbcoef = param[j++]; - d->ffcoef = param[j++]; - d->gain = param[j++]; - - if (param[j]) { -#define RANGE 2.0 -/* d->rsinc = ((f32) param[j++])/0xffffff; */ - d->rsinc = ((((f32)param[j++])/1000) * RANGE)/c->outputRate; - - /* - * the following constant is derived from: - * - * ratio = 2^(cents/1200) - * - * and therefore for hundredths of a cent - * x - * ln(ratio) = --------------- - * (120,000)/ln(2) - * where - * 120,000/ln(2) = 173123.40... - */ -#define CONVERT 173123.404906676 -#define LENGTH (d->output - d->input) - d->rsgain = (((f32) param[j++])/CONVERT) * LENGTH; - d->rsval = 1.0; - d->rsdelta = 0.0; - d->rs = alHeapAlloc(hp, 1, sizeof(ALResampler)); - d->rs->state = alHeapAlloc(hp, 1, sizeof(RESAMPLE_STATE)); - d->rs->delta = 0.0; - d->rs->first = 1; - } else { - d->rs = 0; - j++; - j++; - } - - if (param[j]) { - d->lp = alHeapAlloc(hp, 1, sizeof(ALLowPass)); - d->lp->fstate = alHeapAlloc(hp, 1, sizeof(POLEF_STATE)); - d->lp->fc = param[j++]; - _init_lpfilter(d->lp); - } else { - d->lp = 0; - j++; - } - } -} - -void alEnvmixerNew(ALEnvMixer *e, ALHeap *hp) -{ - alFilterNew((ALFilter *) e, alEnvmixerPull, alEnvmixerParam, AL_ENVMIX); - - e->state = alHeapAlloc(hp, 1, sizeof(ENVMIX_STATE)); - - e->first = 1; - e->motion = AL_STOPPED; - e->volume = 1; - e->ltgt = 1; - e->rtgt = 1; - e->cvolL = 1; - e->cvolR = 1; - e->dryamt = 0; - e->wetamt = 0; - e->lratm = 1; - e->lratl = 0; - e->lratm = 1; - e->lratl = 0; - e->delta = 0; - e->segEnd = 0; - e->pan = 0; - e->ctrlList = 0; - e->ctrlTail = 0; - e->sources = 0; -} - -void alLoadNew(ALLoadFilter *f, ALDMANew dmaNew, ALHeap *hp) -{ - s32 - i; - - /* - * init filter superclass - */ - - alFilterNew((ALFilter *) f, alAdpcmPull, alLoadParam, AL_ADPCM); - - f->state = alHeapAlloc(hp, 1, sizeof(ADPCM_STATE)); - f->lstate = alHeapAlloc(hp, 1, sizeof(ADPCM_STATE)); - - f->dma = dmaNew(&f->dmaState); - - /* - * init the adpcm state - */ - f->lastsam = 0; - f->first = 1; - f->memin = 0; -} - -void alResampleNew(ALResampler *r, ALHeap *hp) -{ - alFilterNew((ALFilter *) r, alResamplePull, alResampleParam, AL_RESAMPLE); - - /* - * Init resampler state - */ - r->state = alHeapAlloc(hp, 1, sizeof(RESAMPLE_STATE)); - r->delta = 0.0; - r->first = 1; - r->motion = AL_STOPPED; - r->ratio = 1.0; - r->upitch = 0; - r->ctrlList = 0; - r->ctrlTail = 0; - - /* state in the ucode is initialized by the A_INIT flag */ -} - -void alAuxBusNew(ALAuxBus *m, void *sources, s32 maxSources) -{ - alFilterNew((ALFilter *) m, alAuxBusPull, alAuxBusParam, AL_AUXBUS); - m->sourceCount = 0; - m->maxSources = maxSources; - m->sources = (ALFilter **)sources; -} - -void alMainBusNew(ALMainBus *m, void *sources, s32 maxSources) -{ - alFilterNew((ALFilter *) m, alMainBusPull, alMainBusParam, AL_MAINBUS); - m->sourceCount = 0; - m->maxSources = maxSources; - m->sources = (ALFilter **)sources; -} - -void alSaveNew(ALSave *f) -{ - /* - * init filter superclass - */ - - alFilterNew((ALFilter *) f, alSavePull, alSaveParam, AL_SAVE); - - /* - * init the save state, which is a virtual dram address - */ - - f->dramout = 0; - f->first = 1; - -} diff --git a/src/core1/audio/env.c b/src/core1/audio/env.c deleted file mode 100644 index 07239b24..00000000 --- a/src/core1/audio/env.c +++ /dev/null @@ -1,495 +0,0 @@ -#include -#include "synthInternals.h" - -#ifndef assert -#define assert(s) -#endif - -#ifdef AUD_PROFILE -extern u32 cnt_index, env_num, env_cnt, env_max, env_min, lastCnt[]; -extern u32 rate_num, rate_cnt, rate_max, rate_min; -extern u32 vol_num, vol_cnt, vol_max, vol_min; -#endif - -#define EQPOWER_LENGTH 128 -static s16 eqpower[ EQPOWER_LENGTH ] = { - 32767, 32764, 32757, 32744, 32727, 32704, - 32677, 32644, 32607, 32564, 32517, 32464, - 32407, 32344, 32277, 32205, 32127, 32045, - 31958, 31866, 31770, 31668, 31561, 31450, - 31334, 31213, 31087, 30957, 30822, 30682, - 30537, 30388, 30234, 30075, 29912, 29744, - 29572, 29395, 29214, 29028, 28838, 28643, - 28444, 28241, 28033, 27821, 27605, 27385, - 27160, 26931, 26698, 26461, 26220, 25975, - 25726, 25473, 25216, 24956, 24691, 24423, - 24151, 23875, 23596, 23313, 23026, 22736, - 22442, 22145, 21845, 21541, 21234, 20924, - 20610, 20294, 19974, 19651, 19325, 18997, - 18665, 18331, 17993, 17653, 17310, 16965, - 16617, 16266, 15913, 15558, 15200, 14840, - 14477, 14113, 13746, 13377, 13006, 12633, - 12258, 11881, 11503, 11122, 10740, 10357, - 9971, 9584, 9196, 8806, 8415, 8023, - 7630, 7235, 6839, 6442, 6044, 5646, - 5246, 4845, 4444, 4042, 3640, 3237, - 2833, 2429, 2025, 1620, 1216, 810, - 405, 0 -}; - -extern f64 __pow(f64, f64); - -/* - * prototypes for private enveloper functions - */ -static Acmd *_pullSubFrame(void *filter, s16 *inp, s16 *outp, s32 outCount, - s32 sampleOffset, Acmd *p) ; -static s16 _getRate(f64 vol, f64 tgt, s32 count, u16* ratel); - -static f32 _getVol(f32 ivol, s32 samples, s16 ratem, u16 ratel); - -/*********************************************************************** - * Enveloper filter public interfaces - ***********************************************************************/ -Acmd *alEnvmixerPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, - Acmd *p) -{ - Acmd *ptr = p; - ALEnvMixer *e = (ALEnvMixer *)filter; - s16 inp; - s32 lastOffset; - s32 thisOffset = sampleOffset; - s32 samples; - s16 loutp = 0; - s32 fVol; - ALParam *thisParam; - -#ifdef AUD_PROFILE - lastCnt[++cnt_index] = osGetCount(); -#endif - - /* - * Force the input to be the resampler output - */ - inp = AL_RESAMPLER_OUT; - - while (e->ctrlList != 0) { - - lastOffset = thisOffset; - thisOffset = e->ctrlList->delta; - samples = thisOffset - lastOffset; - if (samples > outCount) - break; - - assert(samples >= 0); - assert(samples <= AL_MAX_RSP_SAMPLES); - - switch (e->ctrlList->type) { - case (AL_FILTER_START_VOICE_ALT): - { - ALStartParamAlt *param = (ALStartParamAlt *)e->ctrlList; - ALFilter *f = (ALFilter *) e; - s32 tmp; - - if (param->unity) { - (*e->filter.setParam)(&e->filter, - AL_FILTER_SET_UNITY_PITCH, 0); - } - - (*e->filter.setParam)(&e->filter, AL_FILTER_SET_WAVETABLE, - param->wave); - (*e->filter.setParam)(&e->filter, AL_FILTER_START, 0); - - e->first = 1; - - e->delta = 0; - e->segEnd = param->samples; - tmp = ((s32)param->volume + (s32)param->volume) /2; - //tmp = ((s32)param->volume * (s32)param->volume) >> 15; - e->volume = (s16) tmp; - e->pan = param->pan; - e->dryamt = eqpower[param->fxMix]; - e->wetamt = eqpower[EQPOWER_LENGTH - param->fxMix - 1]; - - if (param->samples) { - e->cvolL = 1; - e->cvolR = 1; - } else { - /* - * Attack time is zero. Simply set the - * volume. We don't want an attack segment. - */ - e->cvolL = (e->volume * eqpower[e->pan]) >> 15; - e->cvolR = (e->volume * - eqpower[EQPOWER_LENGTH - e->pan - 1]) >> 15; - } - - if (f->source) { - union { - f32 f; - s32 i; - } data; - data.f = param->pitch; - (*f->source->setParam)(f->source, AL_FILTER_SET_PITCH, - (void *)data.i); - } - - } - - break; - - case (AL_FILTER_SET_FXAMT): - case (AL_FILTER_SET_PAN): - case (AL_FILTER_SET_VOLUME): - ptr = _pullSubFrame(e, &inp, &loutp, samples, sampleOffset, ptr); - e->delta += samples; - if (e->delta >= e->segEnd){ - /* - * We should have reached our target, calculate - * target in case e->segEnd was 0 - */ - e->ltgt = (e->volume * eqpower[e->pan]) >> 15; - e->rtgt = (e->volume * - eqpower[EQPOWER_LENGTH - e->pan - 1]) >> 15; - e->delta = e->segEnd; /* To prevent overflow */ - e->cvolL = e->ltgt; - e->cvolR = e->rtgt; - } else { - /* - * Estimate the current volume - */ - e->cvolL = _getVol(e->cvolL, e->delta, e->lratm, e->lratl); - e->cvolR = _getVol(e->cvolR, e->delta, e->rratm, e->rratl); - } - - /* - * We can't have volume of zero, because the envelope - * would never go anywhere from there - */ - if( e->cvolL == 0 ) e->cvolL = 1; - if( e->cvolR == 0 ) e->cvolR = 1; - - if (e->ctrlList->type == AL_FILTER_SET_PAN) - - /* - * This should result in a change to the current - * segment rate and target - */ - e->pan = (s16) e->ctrlList->data.i; - - if (e->ctrlList->type == AL_FILTER_SET_VOLUME){ - - /* - * Switching to a new segment - */ - e->delta = 0; - - /* - * Map volume non-linearly to give something close to - * loudness - */ - fVol = (e->ctrlList->data.i); - //fVol = (fVol*fVol)>>15; - fVol = (fVol+fVol)/2; - e->volume = (s16) fVol; - - e->segEnd = e->ctrlList->moredata.i; - - } - - if (e->ctrlList->type == AL_FILTER_SET_FXAMT){ - e->dryamt = eqpower[e->ctrlList->data.i]; - e->wetamt = eqpower[EQPOWER_LENGTH - e->ctrlList->data.i - 1]; - } - - /* - * Force a volume update - */ - e->first = 1; - break; - - case (AL_FILTER_START_VOICE): - { - ALStartParam *p = (ALStartParam *)e->ctrlList; - - /* - * Changing to PLAYING (since the previous state was - * persumable STOPPED, we'll just bump the output - * pointer rather than pull a subframe of zeros). - */ - if (p->unity) { - (*e->filter.setParam)(&e->filter, - AL_FILTER_SET_UNITY_PITCH, 0); - } - - (*e->filter.setParam)(&e->filter, AL_FILTER_SET_WAVETABLE, - p->wave); - (*e->filter.setParam)(&e->filter, AL_FILTER_START, 0); - } - break; - - case (AL_FILTER_STOP_VOICE): - { - /* - * Changing to STOPPED and reset the filter - */ - ptr = _pullSubFrame(e, &inp, &loutp, samples, sampleOffset, ptr); - (*e->filter.setParam)(&e->filter, AL_FILTER_RESET, 0); - } - break; - - case (AL_FILTER_FREE_VOICE): - { - ALSynth *drvr = &alGlobals->drvr; - ALFreeParam *param = (ALFreeParam *)e->ctrlList; - param->pvoice->offset = 0; - _freePVoice(drvr, (PVoice *)param->pvoice); - } - break; - - default: - /* - * Pull the reuired number of samples and then pass the message - * on down the chain - */ - ptr = _pullSubFrame(e, &inp, &loutp, samples, sampleOffset, ptr); - e->delta += samples; - (*e->filter.setParam)(&e->filter, e->ctrlList->type, - (void *) e->ctrlList->data.i); - break; - } - loutp += (samples<<1); - outCount -= samples; - - /* - * put the param record back on the free list - */ - thisParam = e->ctrlList; - e->ctrlList = e->ctrlList->next; - if (e->ctrlList == 0) - e->ctrlTail = 0; - - __freeParam(thisParam); - - } - - if(e->motion == 1){ - ptr = _pullSubFrame(e, &inp, &loutp, outCount, sampleOffset, ptr); - e->delta += outCount; - } - /* - * Prevent overflow in e->delta - */ - if (e->delta > e->segEnd) - e->delta = e->segEnd; - -#ifdef AUD_PROFILE - PROFILE_AUD(env_num, env_cnt, env_max, env_min); -#endif - return ptr; -} - -s32 -alEnvmixerParam(void *filter, s32 paramID, void *param) -{ - ALFilter *f = (ALFilter *) filter; - ALEnvMixer *e = (ALEnvMixer *) filter; - - switch (paramID) { - - case (AL_FILTER_ADD_UPDATE): - if (e->ctrlTail) { - e->ctrlTail->next = (ALParam *)param; - } else { - e->ctrlList = (ALParam *)param; - } - e->ctrlTail = (ALParam *)param; - - break; - - case (AL_FILTER_RESET): - e->first = 1; - e->motion = AL_STOPPED; - e->volume = 1; - if (f->source) - (*f->source->setParam)(f->source, AL_FILTER_RESET, param); - break; - - case (AL_FILTER_START): - e->motion = AL_PLAYING; - if (f->source) - (*f->source->setParam)(f->source, AL_FILTER_START, param); - break; - - case (AL_FILTER_SET_SOURCE): - f->source = (ALFilter *) param; - break; - - default: - if (f->source) - (*f->source->setParam)(f->source, paramID, param); - } - return 0; -} - -static -Acmd* _pullSubFrame(void *filter, s16 *inp, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p) -{ - Acmd *ptr = p; - ALEnvMixer *e = (ALEnvMixer *)filter; - ALFilter *source= e->filter.source; - - /* filter must be playing and request non-zero output samples to pull. */ - //if (e->motion != AL_PLAYING || !outCount) - // return ptr; - - if(!outCount) - return ptr; - /* - * ask all filters upstream from us to build their command - * lists. - */ - assert(source); - - ptr = (*source->handler)(source, inp, outCount, sampleOffset, p); - - /* - * construct our portion of the command list - */ - aSetBuffer(ptr++, A_MAIN, *inp, AL_MAIN_L_OUT + *outp, outCount<<1); - aSetBuffer(ptr++, A_AUX, AL_MAIN_R_OUT + *outp, AL_AUX_L_OUT + *outp, - AL_AUX_R_OUT + *outp); - - if (e->first){ - e->first = 0; - - /* - * Calculate derived parameters - */ - e->ltgt = (e->volume * eqpower[e->pan]) >> 15; - e->lratm = _getRate((f64)e->cvolL, (f64)e->ltgt, - e->segEnd, &(e->lratl)); - e->rtgt = (e->volume * - eqpower[EQPOWER_LENGTH - e->pan - 1]) >> 15; - e->rratm = _getRate((f64)e->cvolR, (f64)e->rtgt, e->segEnd, - &(e->rratl)); - - aSetVolume(ptr++, A_LEFT | A_VOL, e->cvolL, 0, 0); - aSetVolume(ptr++, A_RIGHT | A_VOL, e->cvolR, 0, 0); - aSetVolume(ptr++, A_LEFT | A_RATE, e->ltgt, e->lratm, e->lratl); - aSetVolume(ptr++, A_RIGHT | A_RATE, e->rtgt, e->rratm, e->rratl); - aSetVolume(ptr++, A_AUX, e->dryamt, 0, e->wetamt); - aEnvMixer (ptr++, A_INIT | A_AUX, osVirtualToPhysical(e->state)); - } - else - aEnvMixer(ptr++, A_CONTINUE | A_AUX, osVirtualToPhysical(e->state)); - - /* - * bump the input buffer pointer - */ - - *inp += (outCount<<1); - //e->delta += outCount; - - return ptr; -} - -#define EXP_MASK 0x7f800000 -#define MANT_MASK 0x807fffff - -f64 -_frexpf(f64 value, s32 *eptr) -{ - f64 absvalue; - - *eptr = 0; - if (value == 0.0) /* nothing to do for zero */ - return (value); - absvalue = (value > 0.0) ? value : -value; - for ( ; absvalue >= 1.0; absvalue *= 0.5) - ++*eptr; - for ( ; absvalue < 0.5; absvalue += absvalue) - --*eptr; - return (value > 0.0 ? absvalue : -absvalue); -} - -f64 -_ldexpf(f64 in, s32 ex) -{ - s32 exp; - - if ( ex ) { - exp = 1 << ex; - in *= (f64)exp; - } - - return ( in ); -} - -/* - _getRate() -- This function determines how to go from the - current volume level (vol) to the target - volume level (tgt) in some number of steps - (count). Two values are returned that are - used as multipliers to incrementally scale - the volume. Some tricky math is used and - is explained below. - RWW 28jun95 -*/ - -static -s16 _getRate(f64 vol, f64 tgt, s32 count, u16* ratel) -{ - s16 s; - f64 a; - - - #ifdef AUD_PROFILE - lastCnt[++cnt_index] = osGetCount(); - #endif - - if (count == 0){ - if (tgt >= vol){ - *ratel = 0xffff; - return 0x7fff; - } - else{ - *ratel = 0; - return -0x8000; - } - } - - a = ((tgt - vol)/(f32)count) * 8.0; - if(a < 0.0) - a = a - 1.0; - s = (s16) a; - *ratel = (s16)(0xffff * (a - (f32) s)); - -#ifdef AUD_PROFILE - PROFILE_AUD(rate_num, rate_cnt, rate_max, rate_min); -#endif - return (s16)a; - -} - -static -f32 _getVol(f32 ivol, s32 samples, s16 ratem, u16 ratel) -{ - f32 r; - -#ifdef AUD_PROFILE - lastCnt[++cnt_index] = osGetCount(); -#endif - - - r = ((f32) (ratem<<16) + (f32) ratel)/65536.0; - - ivol += r* samples * 0.125; -#ifdef AUD_PROFILE - PROFILE_AUD(vol_num, vol_cnt, vol_max, vol_min); -#endif - - - return ivol; -} - diff --git a/src/core1/audio/event.c b/src/core1/audio/event.c deleted file mode 100644 index cd14ecf6..00000000 --- a/src/core1/audio/event.c +++ /dev/null @@ -1,137 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -void alEvtqNew(ALEventQueue *evtq, ALEventListItem *items, s32 itemCount) -{ - s32 i; - - evtq->eventCount = 0; - evtq->allocList.next = 0; - evtq->allocList.prev = 0; - evtq->freeList.next = 0; - evtq->freeList.prev = 0; - if(itemCount > 0){ - i = 0; - do{ - alLink(&items[i].node, &evtq->freeList); - i++; - } while (i != itemCount); - } -} - -ALMicroTime alEvtqNextEvent(ALEventQueue *evtq, ALEvent *evt) -{ - ALEventListItem *item; - ALMicroTime delta; - OSIntMask mask; - - mask = osSetIntMask(OS_IM_NONE); - - item = (ALEventListItem *)evtq->allocList.next; - - if (item) - { - alUnlink((ALLink *)item); - alCopy(&item->evt, evt, sizeof(*evt)); - alLink((ALLink *)item, &evtq->freeList); - delta = item->delta; - } - else - { - /* sct 11/28/95 - If we get here, most like we overflowed the event queue */ - /* with non-self-perpetuating events. Eg. if we filled the evtq with volume */ - /* events, then when the seqp is told to play it will handle all the events */ - /* at once completely emptying out the queue. At this point this problem */ - /* must be treated as an out of resource error and the evtq should be increased. */ - evt->type = -1; - delta = 0; - } - - osSetIntMask(mask); - - return delta; -} - -void alEvtqPostEvent(ALEventQueue *evtq, ALEvent *evt, ALMicroTime delta) -{ - ALEventListItem *item; - ALEventListItem *nextItem; - ALLink *node; - s32 postAtEnd=0; - OSIntMask mask; - - mask = osSetIntMask(OS_IM_NONE); - - - item = (ALEventListItem *)evtq->freeList.next; - if (!item) { - osSetIntMask(mask); - return; - } - - alUnlink(&item->node); - alCopy(evt, &item->evt, sizeof(item->evt)); - - if (delta == AL_EVTQ_END) - postAtEnd = -1; - - for (node = &evtq->allocList; node != 0; node = node->next) { - if (!node->next) { /* end of the list */ - if (postAtEnd) - item->delta = 0; - else - item->delta = delta; - alLink(&item->node, node); - break; - } else { - nextItem = (ALEventListItem *)node->next; - - if (delta < nextItem->delta) { - item->delta = delta; - nextItem->delta -= delta; - - alLink(&item->node, node); - break; - } - - delta -= nextItem->delta; - - } - } - - osSetIntMask(mask); - -} - - - -void alEvtqFlushType(ALEventQueue *evtq, s16 type) -{ - ALLink *thisNode; - ALLink *nextNode; - ALEventListItem *thisItem, *nextItem; - OSIntMask mask; - - mask = osSetIntMask(OS_IM_NONE); - - thisNode = evtq->allocList.next; - while( thisNode != 0 ) - { - nextNode = thisNode->next; - thisItem = (ALEventListItem *)thisNode; - nextItem = (ALEventListItem *)nextNode; - if (thisItem->evt.type == type) - { - if (nextItem) - nextItem->delta += thisItem->delta; - alUnlink(thisNode); - alLink(thisNode, &evtq->freeList); - } - thisNode = nextNode; - } - - osSetIntMask(mask); -} - - diff --git a/src/core1/audio/filter.c b/src/core1/audio/filter.c deleted file mode 100644 index e6f2ce89..00000000 --- a/src/core1/audio/filter.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "synthInternals.h" - -void alFilterNew(ALFilter *f, ALCmdHandler h, ALSetParam s, s32 type) -{ - f->source = 0; - f->handler = h; - f->setParam = s; - f->inp = 0; - f->outp = 0; - f->type = type; -} diff --git a/src/core1/audio/heapalloc.c b/src/core1/audio/heapalloc.c deleted file mode 100644 index 084c1544..00000000 --- a/src/core1/audio/heapalloc.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include "synthInternals.h" - -void *alHeapDBAlloc(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size) -{ - s32 bytes; - u8 *ptr = 0; - - bytes = (num*size + AL_CACHE_ALIGN) & ~AL_CACHE_ALIGN; - -#ifdef _DEBUG - hp->count++; - bytes += sizeof(HeapInfo); -#endif - - if ((hp->cur + bytes) <= (hp->base + hp->len)) { - - ptr = hp->cur; - hp->cur += bytes; - -#ifdef _DEBUG - ((HeapInfo *)ptr)->magic = AL_HEAP_MAGIC; - ((HeapInfo *)ptr)->size = bytes; - ((HeapInfo *)ptr)->count = hp->count; - if (file) { - ((HeapInfo *)ptr)->file = file; - ((HeapInfo *)ptr)->line = line; - } else { - ((HeapInfo *)ptr)->file = (u8 *) "unknown"; - ((HeapInfo *)ptr)->line = 0; - } - - ptr += sizeof(HeapInfo); -#endif - - } else { -#ifdef _DEBUG - __osError(ERR_ALHEAPNOFREE, 1, size); -#endif - } - - return ptr; -} diff --git a/src/core1/audio/heapinit.c b/src/core1/audio/heapinit.c deleted file mode 100644 index 2116d62e..00000000 --- a/src/core1/audio/heapinit.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "synthInternals.h" -#include - -void alHeapInit(ALHeap *hp, u8 *base, s32 len) -{ - s32 extraAlign = (AL_CACHE_ALIGN+1) - ((s32) base & AL_CACHE_ALIGN); - - if (extraAlign != AL_CACHE_ALIGN+1) - hp->base = base + extraAlign; - else - hp->base = base; - - hp->len = len; - hp->cur = hp->base; - hp->count = 0; -} diff --git a/src/core1/audio/load.c b/src/core1/audio/load.c deleted file mode 100644 index 0c9c578d..00000000 --- a/src/core1/audio/load.c +++ /dev/null @@ -1,446 +0,0 @@ -#include -#include "synthInternals.h" - -#ifndef MIN -# define MIN(a,b) (((a)<(b))?(a):(b)) -#endif - -#ifdef AUD_PROFILE -extern u32 cnt_index, adpcm_num, adpcm_cnt, adpcm_max, adpcm_min, lastCnt[]; -#endif - -#define ADPCMFBYTES 9 -#define LFSAMPLES 4 - -static -Acmd *_decodeChunk(Acmd *ptr, ALLoadFilter *f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags); - -Acmd *alAdpcmPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p) -{ - Acmd *ptr = p; - s16 inp; - s32 tsam; - s32 nframes; - s32 nbytes; - s32 overFlow; - s32 startZero; - s32 nOver; - s32 nSam; - s32 op; - s32 nLeft; - s32 bEnd; - s32 decoded = 0; - s32 looped = 0; - - ALLoadFilter *f = (ALLoadFilter *)filter; - -#ifdef AUD_PROFILE - lastCnt[++cnt_index] = osGetCount(); -#endif - - if (outCount == 0) - return ptr; - - inp = AL_DECODER_IN; - aLoadADPCM(ptr++, f->bookSize, - K0_TO_PHYS(f->table->waveInfo.adpcmWave.book->book)); - - looped = (outCount + f->sample > f->loop.end) && (f->loop.count != 0); - if (looped) - nSam = f->loop.end - f->sample; - else - nSam = outCount; - - if (f->lastsam) - nLeft = ADPCMFSIZE - f->lastsam; - else - nLeft = 0; - tsam = nSam - nLeft; - if (tsam<0) tsam = 0; - - nframes = (tsam+ADPCMFSIZE-1)>>LFSAMPLES; - nbytes = nframes*ADPCMFBYTES; - - if (looped){ - - ptr = _decodeChunk(ptr, f, tsam, nbytes, *outp, inp, f->first); - - /* - * Fix up output pointer, which will be used as the input pointer - * by the following module. - */ - if (f->lastsam) - *outp += (f->lastsam<<1); - else - *outp += (ADPCMFSIZE<<1); - - /* - * Now fix up state info to reflect the loop start point - */ - f->lastsam = f->loop.start &0xf; - f->memin = (s32) f->table->base + ADPCMFBYTES * - ((s32) (f->loop.start>>LFSAMPLES) + 1); - f->sample = f->loop.start; - - bEnd = *outp; - while (outCount > nSam){ - - outCount -= nSam; - - /* - * Put next one after the end of the last lot - on the - * frame boundary (32 byte) after the end. - */ - op = (bEnd + ((nframes+1)<<(LFSAMPLES+1))) & ~0x1f; - - /* - * The actual end of data - */ - bEnd += (nSam<<1); - - /* - * -1 is loop forever - the loop count is not exact now - * for small loops! - */ - if ((f->loop.count != -1) && (f->loop.count != 0)) - f->loop.count--; - - /* - * What's left to compute. - */ - nSam = MIN(outCount, f->loop.end - f->loop.start); - tsam = nSam - ADPCMFSIZE + f->lastsam; - if (tsam<0) tsam = 0; - nframes = (tsam+ADPCMFSIZE-1)>>LFSAMPLES; - nbytes = nframes*ADPCMFBYTES; - ptr = _decodeChunk(ptr, f, tsam, nbytes, op, inp, f->first | A_LOOP); - /* - * Merge the two sections in DMEM. - */ - aDMEMMove(ptr++, op+(f->lastsam<<1), bEnd, nSam<<1); - - } - - f->lastsam = (outCount + f->lastsam) & 0xf; - f->sample += outCount; - f->memin += ADPCMFBYTES*nframes; -#ifdef AUD_PROFILE - PROFILE_AUD(adpcm_num, adpcm_cnt, adpcm_max, adpcm_min); -#endif - return ptr; - } - - /* - * The unlooped case, which is executed most of the time - */ - - nSam = nframes<memin + nbytes - ((s32) f->table->base + f->table->len); - if (overFlow < 0) - overFlow = 0; - nOver = (overFlow/ADPCMFBYTES)< nSam + nLeft) - nOver = nSam + nLeft; - - nbytes -= overFlow; - - if ((nOver - (nOver & 0xf))< outCount){ - decoded = 1; - ptr = _decodeChunk(ptr, f, nSam - nOver, nbytes, *outp, inp, f->first); - - if (f->lastsam) - *outp += (f->lastsam<<1); - else - *outp += (ADPCMFSIZE<<1); - - f->lastsam = (outCount + f->lastsam) & 0xf; - f->sample += outCount; - f->memin += ADPCMFBYTES*nframes; - } else { - f->lastsam = 0; - f->memin += ADPCMFBYTES*nframes; - } - - /* - * Put zeros in if necessary - */ - if (nOver){ - f->lastsam = 0; - if (decoded) - startZero = (nLeft + nSam - nOver)<<1; - else - startZero = 0; - aClearBuffer(ptr++, startZero + *outp, nOver<<1); - } -#ifdef AUD_PROFILE - PROFILE_AUD(adpcm_num, adpcm_cnt, adpcm_max, adpcm_min); -#endif - - return ptr; -} - -Acmd *alRaw16Pull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p) -{ - Acmd *ptr = p; - s32 nbytes; - s32 dramLoc; - s32 dramAlign; - s32 dmemAlign; - s32 overFlow; - s32 startZero; - s32 nSam; - s32 op; - - ALLoadFilter *f = (ALLoadFilter *)filter; - ALFilter *a = (ALFilter *) filter; - - if (outCount == 0) - return ptr; - - if ((outCount + f->sample > f->loop.end) && (f->loop.count != 0)){ - - nSam = f->loop.end - f->sample; - nbytes = nSam<<1; - if (nSam > 0){ - dramLoc = (f->dma)(f->memin, nbytes, f->dmaState); - - /* - * Make sure enough is loaded into DMEM to take care - * of 8 byte alignment - */ - dramAlign = dramLoc & 0x7; - nbytes += dramAlign; - aSetBuffer(ptr++, 0, *outp, 0, nbytes + 8 - (nbytes & 0x7)); - aLoadBuffer(ptr++, dramLoc - dramAlign); - } else - dramAlign = 0; - - /* - * Fix up output pointer to allow for dram alignment - */ - *outp += dramAlign; - - f->memin = (s32) f->table->base + (f->loop.start<<1); - f->sample = f->loop.start; - op = *outp; - - while (outCount > nSam){ - - op += (nSam<<1); - outCount -= nSam; - /* - * -1 is loop forever - */ - if ((f->loop.count != -1) && (f->loop.count != 0)) - f->loop.count--; - - /* - * What to compute. - */ - nSam = MIN(outCount, f->loop.end - f->loop.start); - nbytes = nSam<<1; - - /* - * Do the next section, same as last. - */ - dramLoc = (f->dma)(f->memin, nbytes, f->dmaState); - - /* - * Make sure enough is loaded into DMEM to take care - * of 8 byte alignment - */ - dramAlign = dramLoc & 0x7; - nbytes += dramAlign; - if (op & 0x7) - dmemAlign = 8 - (op & 0x7); - else - dmemAlign = 0; - - aSetBuffer(ptr++, 0, op + dmemAlign, 0, nbytes + 8 - (nbytes & 0x7)); - aLoadBuffer(ptr++, dramLoc - dramAlign); - - /* - * Merge the two sections in DMEM. - */ - if (dramAlign || dmemAlign) - aDMEMMove(ptr++, op+dramAlign+dmemAlign, op, nSam<<1); - - } - - f->sample += outCount; - f->memin += (outCount<<1); - - return ptr; - } - - /* - * The unlooped case, which is executed most of the time - * - * overFlow is the number of bytes past the end - * of the bitstream I try to generate - */ - - nbytes = outCount<<1; - overFlow = f->memin + nbytes - ((s32) f->table->base + f->table->len); - if (overFlow < 0) - overFlow = 0; - if (overFlow > nbytes) - overFlow = nbytes; - - if (overFlow < nbytes){ - if (outCount > 0){ - nbytes -= overFlow; - dramLoc = (f->dma)(f->memin, nbytes, f->dmaState); - - /* - * Make sure enough is loaded into DMEM to take care - * of 8 byte alignment - */ - dramAlign = dramLoc & 0x7; - nbytes += dramAlign; - aSetBuffer(ptr++, 0, *outp, 0, nbytes + 8 - (nbytes & 0x7)); - aLoadBuffer(ptr++, dramLoc - dramAlign); - } else - dramAlign = 0; - *outp += dramAlign; - - f->sample += outCount; - f->memin += outCount<<1; - } else { - f->memin += outCount<<1; - } - - /* - * Put zeros in if necessary - */ - if (overFlow){ - startZero = (outCount<<1) - overFlow; - if (startZero < 0) - startZero = 0; - aClearBuffer(ptr++, startZero + *outp, overFlow); - } - return ptr; -} - - -s32 -alLoadParam(void *filter, s32 paramID, void *param) -{ - ALLoadFilter *a = (ALLoadFilter *) filter; - ALFilter *f = (ALFilter *) filter; - - switch (paramID) { - case (AL_FILTER_SET_WAVETABLE): - a->table = (ALWaveTable *) param; - a->memin = (s32) a->table->base; - a->sample = 0; - switch (a->table->type){ - case (AL_ADPCM_WAVE): - - /* - * Set up the correct handler - */ - f->handler = alAdpcmPull; - - /* - * Make sure the table length is an integer number of - * frames - */ - a->table->len = ADPCMFBYTES * - ((s32) (a->table->len/ADPCMFBYTES)); - - a->bookSize = 2*a->table->waveInfo.adpcmWave.book->order* - a->table->waveInfo.adpcmWave.book->npredictors*ADPCMVSIZE; - if (a->table->waveInfo.adpcmWave.loop) { - a->loop.start = a->table->waveInfo.adpcmWave.loop->start; - a->loop.end = a->table->waveInfo.adpcmWave.loop->end; - a->loop.count = a->table->waveInfo.adpcmWave.loop->count; - alCopy(a->table->waveInfo.adpcmWave.loop->state, - a->lstate, sizeof(ADPCM_STATE)); - } else { - a->loop.start = a->loop.end = a->loop.count = 0; - } - break; - - case (AL_RAW16_WAVE): - f->handler = alRaw16Pull; - if (a->table->waveInfo.rawWave.loop) { - a->loop.start = a->table->waveInfo.rawWave.loop->start; - a->loop.end = a->table->waveInfo.rawWave.loop->end; - a->loop.count = a->table->waveInfo.rawWave.loop->count; - } else { - a->loop.start = a->loop.end = a->loop.count = 0; - } - break; - - default: - break; - - } - break; - - case (AL_FILTER_RESET): - a->lastsam = 0; - a->first = 1; - a->sample = 0; - - /* sct 2/14/96 - Check table since it is initialized to null and */ - /* Get loop info according to table type. */ - if (a->table) - { - a->memin = (s32) a->table->base; - if (a->table->type == AL_ADPCM_WAVE) - { - if (a->table->waveInfo.adpcmWave.loop) - a->loop.count = a->table->waveInfo.adpcmWave.loop->count; - } - else if (a->table->type == AL_RAW16_WAVE) - { - if (a->table->waveInfo.rawWave.loop) - a->loop.count = a->table->waveInfo.rawWave.loop->count; - } - } - - break; - - default: - break; - } -} - -Acmd *_decodeChunk(Acmd *ptr, ALLoadFilter *f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags) - -{ - - s32 - dramAlign, - dramLoc; - - if (nbytes > 0){ - dramLoc = (f->dma)(f->memin, nbytes, f->dmaState); - /* - * Make sure enough is loaded into DMEM to take care - * of 8 byte alignment - */ - dramAlign = dramLoc & 0x7; - nbytes += dramAlign; - aSetBuffer(ptr++, 0, inp, 0, nbytes + 8 - (nbytes & 0x7)); - aLoadBuffer(ptr++, dramLoc - dramAlign); - } else - dramAlign = 0; - - if (flags & A_LOOP){ - aSetLoop(ptr++, K0_TO_PHYS(f->lstate)); - } - - aSetBuffer(ptr++, 0, inp + dramAlign, outp, tsam<<1); - aADPCMdec(ptr++, flags, K0_TO_PHYS(f->state)); - f->first = 0; - - return ptr; -} diff --git a/src/core1/audio/mainbus.c b/src/core1/audio/mainbus.c deleted file mode 100644 index ad18c2e4..00000000 --- a/src/core1/audio/mainbus.c +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include "synthInternals.h" - -Acmd *alMainBusPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p) -{ - Acmd *ptr = p; - ALMainBus *m = (ALMainBus *)filter; - ALFilter **sources = m->sources; - s32 i; - - /* - * clear the output buffers here - */ - aClearBuffer(ptr++, AL_MAIN_L_OUT, outCount<<1); - aClearBuffer(ptr++, AL_MAIN_R_OUT, outCount<<1); - - for (i = 0; i < m->sourceCount; i++) { - ptr = (sources[i]->handler)(sources[i], outp, outCount, sampleOffset, - ptr); - aSetBuffer(ptr++, 0, 0, 0, outCount<<1); - aMix(ptr++, 0, 0x7fff, AL_AUX_L_OUT, AL_MAIN_L_OUT); - aMix(ptr++, 0, 0x7fff, AL_AUX_R_OUT, AL_MAIN_R_OUT); - } - - return ptr; -} - -s32 alMainBusParam(void *filter, s32 paramID, void *param) -{ - ALMainBus *m = (ALMainBus *) filter; - ALFilter **sources = m->sources; - - switch (paramID) { - - case (AL_FILTER_ADD_SOURCE): - sources[m->sourceCount++] = (ALFilter *) param; - break; - - default: - /* ??? */ - break; - } - - return 0; - -} diff --git a/src/core1/audio/resample.c b/src/core1/audio/resample.c deleted file mode 100644 index d8278ca7..00000000 --- a/src/core1/audio/resample.c +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include "synthInternals.h" - -#ifdef AUD_PROFILE -extern u32 cnt_index, resampler_num, resampler_cnt, resampler_max, resampler_min, lastCnt[]; -#endif - -/*********************************************************************** - * Resampler filter public interfaces - ***********************************************************************/ -Acmd *alResamplePull(void *filter, s16 *outp, s32 outCnt, s32 sampleOffset, Acmd *p) -{ - ALResampler *f = (ALResampler *)filter; - Acmd *ptr = p; - s16 inp; - s32 inCount; - ALFilter *source = f->filter.source; - s32 incr; - f32 finCount; - -#ifdef AUD_PROFILE - lastCnt[++cnt_index] = osGetCount(); -#endif - - inp = AL_DECODER_OUT; - - if (!outCnt) - return ptr; - - /* - * check if resampler is required - */ - if (f->upitch) { - - ptr = (*source->handler)(source, &inp, outCnt, sampleOffset, p); - aDMEMMove(ptr++, inp, *outp, outCnt<<1); - - } else { - - /* - * clip to maximum allowable pitch - * FIXME: should we check for some minimum as well? - */ - if (f->ratio > MAX_RATIO) f->ratio = MAX_RATIO; - - /* - * quantize the pitch - */ - f->ratio = (s32)(f->ratio * UNITY_PITCH); - f->ratio = f->ratio / UNITY_PITCH; - - /* - * determine how many samples to generate - */ - finCount = f->delta + (f->ratio * (f32) outCnt); - inCount = (s32) finCount; - f->delta = finCount - (f32)inCount; - - /* - * ask all filters upstream from us to build their command - * lists. - */ - ptr = (*source->handler)(source, &inp, inCount, sampleOffset, p); - - /* - * construct our portion of the command list - */ - incr = (s32)(f->ratio * UNITY_PITCH); - aSetBuffer(ptr++, 0, inp, *outp, outCnt<<1); - aResample(ptr++, f->first, incr, osVirtualToPhysical(f->state)); - f->first = 0; - } - -#ifdef AUD_PROFILE - PROFILE_AUD(resampler_num, resampler_cnt, resampler_max, resampler_min); -#endif - return ptr; -} - -s32 alResampleParam(void *filter, s32 paramID, void *param) -{ - ALFilter *f = (ALFilter *) filter; - ALResampler *r = (ALResampler *) filter; - union { - f32 f; - s32 i; - } data; - - switch (paramID) { - - case (AL_FILTER_SET_SOURCE): - f->source = (ALFilter *) param; - break; - - case (AL_FILTER_RESET): - r->delta = 0.0; - r->first = 1; - r->motion = AL_STOPPED; - r->upitch = 0; - if (f->source) - (*f->source->setParam)(f->source, AL_FILTER_RESET, 0); - break; - - case (AL_FILTER_START): - r->motion = AL_PLAYING; - if (f->source) - (*f->source->setParam)(f->source, AL_FILTER_START, 0); - break; - - case (AL_FILTER_SET_PITCH): - data.i = (s32) param; - r->ratio = data.f; - break; - - case (AL_FILTER_SET_UNITY_PITCH): - r->upitch = 1; - break; - - default: - if (f->source) - (*f->source->setParam)(f->source, paramID, param); - break; - } - return 0; -} diff --git a/src/core1/audio/reverb.c b/src/core1/audio/reverb.c deleted file mode 100644 index 529e9529..00000000 --- a/src/core1/audio/reverb.c +++ /dev/null @@ -1,431 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -#include "synthInternals.h" -#include "initfx.h" - -#ifndef assert -#define assert(s) -#endif - - - -#define RANGE 2.0 -extern ALGlobals *alGlobals; - -#ifdef AUD_PROFILE -extern u32 cnt_index, reverb_num, reverb_cnt, reverb_max, reverb_min, lastCnt[]; -extern u32 load_num, load_cnt, load_max, load_min, save_num, save_cnt, save_max, save_min; -#endif - -/* - * macros - */ -#define SWAP(in, out) \ -{ \ - s16 t = out; \ - out = in; \ - in = t; \ -} - - - -Acmd *_loadOutputBuffer(ALFx *r, ALDelay *d, s32 buff, s32 incount, Acmd *p); -Acmd *_loadBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p); -Acmd *_saveBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p); -Acmd *_filterBuffer(ALLowPass *lp, s32 buff, s32 count, Acmd *p); -f32 _doModFunc(ALDelay *d, s32 count); - -static s32 L_INC[] = { L0_INC, L1_INC, L2_INC }; - -/*********************************************************************** - * Reverb filter public interfaces - ***********************************************************************/ -Acmd *alFxPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, - Acmd *p) -{ - Acmd *ptr = p; - ALFx *r = (ALFx *)filter; - ALFilter *source = r->filter.source; - s16 i, buff1, buff2, input, output; - s16 *in_ptr, *out_ptr, gain, *prev_out_ptr = 0; - ALDelay *d, *pd; - -#ifdef AUD_PROFILE - lastCnt[++cnt_index] = osGetCount(); -#endif - - assert(source); - /* - * pull channels going into this effect first - */ - ptr = (*source->handler)(source, outp, outCount, sampleOffset, p); - - input = AL_AUX_L_OUT; - output = AL_AUX_R_OUT; - buff1 = AL_TEMP_0; - buff2 = AL_TEMP_1; - - aSetBuffer(ptr++, 0, 0, 0, outCount<<1); /* set the buffer size */ - aMix(ptr++, 0, 0xda83, AL_AUX_L_OUT, input); /* .707L = L - .293L */ - aMix(ptr++, 0, 0x5a82, AL_AUX_R_OUT, input); /* mix the AuxL and AuxR into the AuxL */ - /* and write the mixed value to the delay line at r->input */ - ptr = _saveBuffer(r, r->input, input, outCount, ptr); - - aClearBuffer(ptr++, output, outCount<<1); /* clear the AL_AUX_R_OUT */ - - for (i = 0; i < r->section_count; i++) { - d = &r->delay[i]; /* get the ALDelay structure */ - in_ptr = &r->input[-d->input]; - out_ptr = &r->input[-d->output]; - - if (in_ptr == prev_out_ptr) { - SWAP(buff1, buff2); - } else { /* load data at in_ptr into buff1 */ - ptr = _loadBuffer(r, in_ptr, buff1, outCount, ptr); - } - ptr = _loadOutputBuffer(r, d, buff2, outCount, ptr); - - if (d->ffcoef) { - aMix(ptr++, 0, (u16)d->ffcoef, buff1, buff2); - if (!d->rs && !d->lp) { - ptr = _saveBuffer(r, out_ptr, buff2, outCount, ptr); - } - } - - if (d->fbcoef) { - aMix(ptr++, 0, (u16)d->fbcoef, buff2, buff1); - ptr = _saveBuffer(r, in_ptr, buff1, outCount, ptr); - } - - if (d->lp) - ptr = _filterBuffer(d->lp, buff2, outCount, ptr); - - if (!d->rs) - ptr = _saveBuffer(r, out_ptr, buff2, outCount, ptr); - - if (d->gain) - aMix(ptr++, 0, (u16)d->gain, buff2, output); - - prev_out_ptr = &r->input[d->output]; - } - - /* - * bump the master delay line input pointer - * modulo the length - */ - r->input += outCount; - if (r->input > &r->base[r->length]) - r->input -= r->length; - - /* - * output already in AL_AUX_R_OUT - * just copy to AL_AUX_L_OUT - */ - aDMEMMove(ptr++, output, AL_AUX_L_OUT, outCount<<1); - -#ifdef AUD_PROFILE - PROFILE_AUD(reverb_num, reverb_cnt, reverb_max, reverb_min); -#endif - return ptr; -} - -s32 alFxParam(void *filter, s32 paramID, void *param) -{ - if(paramID == AL_FILTER_SET_SOURCE) - { - ALFilter *f = (ALFilter *) filter; - f->source = (ALFilter*) param; - } - return 0; -} - -/* - * This routine gets called by alSynSetFXParam. No checking takes place to - * verify the validity of the paramID or the param value. input and output - * values must be 8 byte aligned, so round down any param passed. - */ -s32 alFxParamHdl(void *filter, s32 paramID, void *param) -{ - ALFx *f = (ALFx *) filter; - s32 p = (paramID - 2) % 8; - s32 s = (paramID - 2) / 8; - s32 val = *(s32*)param; - -#define INPUT_PARAM 0 -#define OUTPUT_PARAM 1 -#define FBCOEF_PARAM 2 -#define FFCOEF_PARAM 3 -#define GAIN_PARAM 4 -#define CHORUSRATE_PARAM 5 -#define CHORUSDEPTH_PARAM 6 -#define LPFILT_PARAM 7 - - switch(p) - { - case INPUT_PARAM: - f->delay[s].input = (u32)val & 0xFFFFFFF8; - break; - case OUTPUT_PARAM: - f->delay[s].output = (u32)val & 0xFFFFFFF8; - break; - case FFCOEF_PARAM: - f->delay[s].ffcoef = (s16)val; - break; - case FBCOEF_PARAM: - f->delay[s].fbcoef = (s16)val; - break; - case GAIN_PARAM: - f->delay[s].gain = (s16)val; - break; - case CHORUSRATE_PARAM: - /* f->delay[s].rsinc = ((f32)val)/0xffffff; */ - f->delay[s].rsinc = ((((f32)val)/1000) * RANGE)/alGlobals->drvr.outputRate; - break; - -/* - * the following constant is derived from: - * - * ratio = 2^(cents/1200) - * - * and therefore for hundredths of a cent - * x - * ln(ratio) = --------------- - * (120,000)/ln(2) - * where - * 120,000/ln(2) = 173123.40... - */ -#define CONVERT 173123.404906676 -#define LENGTH (f->delay[s].output - f->delay[s].input) - - case CHORUSDEPTH_PARAM: - /*f->delay[s].rsgain = (((f32)val) / CONVERT) * LENGTH; */ - f->delay[s].rsgain = (((f32)val) / CONVERT) * LENGTH; - break; - case LPFILT_PARAM: - if(f->delay[s].lp) - { - f->delay[s].lp->fc = (s16)val; - _init_lpfilter(f->delay[s].lp); - } - break; - } - return 0; -} - -Acmd *_loadOutputBuffer(ALFx *r, ALDelay *d, s32 buff, s32 incount, Acmd *p) -{ - Acmd *ptr = p; - s32 ratio, count, rbuff = AL_TEMP_2; - s16 *out_ptr; - f32 fincount, fratio, delta; - s32 ramalign = 0, length; - static f32 val=0.0, lastval=-10.0; - static f32 blob=0; -/* - * The following section implements the chorus resampling. Modulate where you pull - * the samples from, since you need varying amounts of samples. - */ - if (d->rs) { - length = d->output - d->input; - delta = _doModFunc(d, incount); /* get the number of samples to modulate by */ - /* - * find ratio of delta to delay length and quantize - * to same resolution as resampler - */ - delta /= length; /* convert delta from number of samples to a pitch ratio */ - delta = (s32)(delta * UNITY_PITCH); /* quantize to value microcode will use */ - delta = delta / UNITY_PITCH; - fratio = 1.0 - delta; /* pitch ratio needs to be centered around 1, not zero */ - - /* d->rs->delta is the difference between the fractional and integer value - * of the samples needed. fratio * incount + rs->delta gives the number of samples - * needed for this frame. - */ - fincount = d->rs->delta + (fratio * (f32)incount); - count = (s32) fincount; /* quantize to s32 */ - d->rs->delta = fincount - (f32)count; /* calculate the round off and store */ - - /* - * d->rsdelta is amount the out_ptr has deviated from its starting position. - * You calc the out_ptr by taking d->output - d->rsdelta, and then using the - * negative of that as an index into the delay buffer. loadBuffer that uses this - * value then bumps it up if it is below the delay buffer. - */ - out_ptr = &r->input[-(d->output - d->rsdelta)]; - ramalign = ((s32)out_ptr & 0x7) >> 1; /* calculate the number of samples needed - to align the buffer*/ -#ifdef _DEBUG -#if 0 - if(length > 0) { - if (length - d->rsdelta > (s32)r->length) { - __osError(ERR_ALMODDELAYOVERFLOW, 1, length - d->rsdelta - r->length); - } - } - else if(length < 0) { - if ((-length) - d->rsdelta > (s32)r->length) { - __osError(ERR_ALMODDELAYOVERFLOW, 1, (-length) - d->rsdelta - r->length); - } - } -#endif -#endif - /* load the rbuff with samples, note that there will be ramalign worth of - * samples at the begining which you don't care about. */ - ptr = _loadBuffer(r, out_ptr - ramalign, rbuff, count + ramalign, ptr); - - /* convert fratio to 16 bit fraction for microcode use */ - ratio = (s32)(fratio * UNITY_PITCH); - /* set the buffers, and do the resample */ - aSetBuffer(ptr++, 0, rbuff + (ramalign<<1), buff, incount<<1); - aResample(ptr++, d->rs->first, ratio, osVirtualToPhysical(d->rs->state)); - - d->rs->first = 0; /* turn off first time flag */ - d->rsdelta += count - incount; /* add the number of samples to d->rsdelta */ - } else { - out_ptr = &r->input[-d->output]; - ptr = _loadBuffer(r, out_ptr, buff, incount, ptr); - } - - return ptr; -} -/* - * This routine is for loading data from the delay line buff. If the - * address of curr_ptr < r->base, it will force it to be within r->base - * space, If the load goes past the end of r->base it will wrap around. - * Cause count bytes of data at curr_ptr (within the delay line) to be - * loaded into buff. (Buff is a dmem buffer) - */ -Acmd *_loadBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p) -{ - Acmd *ptr = p; - s32 after_end, before_end; - s16 *updated_ptr, *delay_end; - -#ifdef AUD_PROFILE - lastCnt[++cnt_index] = osGetCount(); -#endif - - delay_end = &r->base[r->length]; - -#ifdef _DEBUG - if(curr_ptr > delay_end) - __osError(ERR_ALMODDELAYOVERFLOW, 1, delay_end - curr_ptr); -#endif - - if (curr_ptr < r->base) - curr_ptr += r->length; - updated_ptr = curr_ptr + count; - - if (updated_ptr > delay_end) { - after_end = updated_ptr - delay_end; - before_end = delay_end - curr_ptr; - - aSetBuffer(ptr++, 0, buff, 0, before_end<<1); - aLoadBuffer(ptr++, osVirtualToPhysical(curr_ptr)); - aSetBuffer(ptr++, 0, buff+(before_end<<1), 0, after_end<<1); - aLoadBuffer(ptr++, osVirtualToPhysical(r->base)); - } else { - aSetBuffer(ptr++, 0, buff, 0, count<<1); - aLoadBuffer(ptr++, osVirtualToPhysical(curr_ptr)); - } - - aSetBuffer(ptr++, 0, 0, 0, count<<1); - -#ifdef AUD_PROFILE - PROFILE_AUD(load_num, load_cnt, load_max, load_min); -#endif - return ptr; - -} - -/* - * This routine is for writing data to the delay line buff. If the - * address of curr_ptr < r->base, it will force it to be within r->base - * space. If the write goes past the end of r->base, it will wrap around - * Cause count bytes of data at buff to be written to delay line, curr_ptr. - */ -Acmd *_saveBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p) -{ - Acmd *ptr = p; - s32 after_end, before_end; - s16 *updated_ptr, *delay_end; - -#ifdef AUD_PROFILE - lastCnt[++cnt_index] = osGetCount(); -#endif - - delay_end = &r->base[r->length]; - if (curr_ptr < r->base) /* probably just security */ - curr_ptr += r->length; /* shouldn't occur */ - updated_ptr = curr_ptr + count; - - if (updated_ptr > delay_end) { /* if the data wraps past end of r->base */ - after_end = updated_ptr - delay_end; - before_end = delay_end - curr_ptr; - - aSetBuffer(ptr++, 0, 0, buff, before_end<<1); - aSaveBuffer(ptr++, osVirtualToPhysical(curr_ptr)); - aSetBuffer(ptr++, 0, 0, buff+(before_end<<1), after_end<<1); - aSaveBuffer(ptr++, osVirtualToPhysical(r->base)); - aSetBuffer(ptr++, 0, 0, 0, count<<1); - } else { - aSetBuffer(ptr++, 0, 0, buff, count<<1); - aSaveBuffer(ptr++, osVirtualToPhysical(curr_ptr)); - } - -#ifdef AUD_PROFILE - PROFILE_AUD(save_num, save_cnt, save_max, save_min); -#endif - return ptr; - -} - -Acmd *_filterBuffer(ALLowPass *lp, s32 buff, s32 count, Acmd *p) -{ - Acmd *ptr = p; - - aSetBuffer(ptr++, 0, buff, buff, count<<1); - aLoadADPCM(ptr++, 32, osVirtualToPhysical(lp->fcvec.fccoef)); - aPoleFilter(ptr++, lp->first, lp->fgain, osVirtualToPhysical(lp->fstate)); - lp->first = 0; - - return ptr; -} - - - -/* - * Generate a triangle wave from -1 to 1, and find the current position - * in the wave. (Rate of the wave is controlled by d->rsinc, which is chorus - * rate) Multiply the current triangle wave value by d->rsgain, (chorus depth) - * which is expressed in number of samples back from output pointer the chorus - * should go at it's full chorus. In otherwords, this function returns a number - * of samples the output pointer should modulate backwards. - */ -f32 _doModFunc(ALDelay *d, s32 count) -{ - f32 val; - - /* - * generate bipolar sawtooth - * from -RANGE to +RANGE - */ - d->rsval += d->rsinc * count; - d->rsval = (d->rsval > RANGE) ? d->rsval-(RANGE*2) : d->rsval; - - /* - * convert to monopolar triangle - * from 0 to RANGE - */ - val = d->rsval; - val = (val < 0) ? -val : val; - - /* - * convert to bipolar triangle - * from -1 to 1 - */ - val -= RANGE/2; - - return(d->rsgain * val); -} diff --git a/src/core1/audio/save.c b/src/core1/audio/save.c deleted file mode 100644 index 7d8754d4..00000000 --- a/src/core1/audio/save.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include "synthInternals.h" - -Acmd *alSavePull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, - Acmd *p) - -{ - Acmd *ptr = p; - ALSave *f = (ALSave *)filter; - ALFilter *source = f->filter.source; - - ptr = (*source->handler)(source, outp, outCount, sampleOffset, ptr); - - aSetBuffer (ptr++, 0, 0, 0, outCount<<1); - aInterleave(ptr++, AL_MAIN_L_OUT, AL_MAIN_R_OUT); - aSetBuffer (ptr++, 0, 0, 0, outCount<<2); - aSaveBuffer(ptr++, f->dramout); - return ptr; -} - -s32 alSaveParam(void *filter, s32 paramID, void *param) -{ - ALSave *a = (ALSave *) filter; - ALFilter *f = (ALFilter *) filter; - s32 pp = (s32) param; - - switch (paramID) { - case (AL_FILTER_SET_SOURCE): - f->source = (ALFilter *) param; - break; - - case (AL_FILTER_SET_DRAM): - a->dramout = pp; - break; - - default: - break; - } - return 0; - -} diff --git a/src/core1/audio/seq.c b/src/core1/audio/seq.c deleted file mode 100644 index 496de64a..00000000 --- a/src/core1/audio/seq.c +++ /dev/null @@ -1,309 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern f64 D_80278D50; -extern f64 D_80278D58; - -#define IFF_FILE_HDR 0x4d546864 /* 'MThd' */ -#define IFF_TRACK_HDR 0x4d54726b /* 'MTrk' */ - -static s32 readVarLen(ALSeq *s); -static u8 read8(ALSeq *s); -static s16 read16(ALSeq *s); -static s32 read32(ALSeq *s); - -void alSeqNew(ALSeq *seq, u8 *ptr, s32 len) -{ - /* - * load the seqence pointed to by ptr - */ - seq->base = ptr; - seq->len = len; - seq->lastStatus = 0; - seq->lastTicks = 0; - seq->curPtr = ptr; - - if (read32(seq) != IFF_FILE_HDR) { -#ifdef _DEBUG - __osError(ERR_ALSEQNOTMIDI, 1, ptr); -#endif - return; - } - - read32(seq); /* skip the length field */ - - if (read16(seq) != 0) { -#ifdef _DEBUG - __osError(ERR_ALSEQNOTMIDI0, 1, ptr); -#endif - return; - } - - if (read16(seq) != 1) { -#ifdef _DEBUG - __osError(ERR_ALSEQNUMTRACKS, 1, ptr); -#endif - return; - } - - seq->division = read16(seq); - if (seq->division & 0x8000) { -#ifdef _DEBUG - __osError(ERR_ALSEQTIME, 1, ptr); -#endif - return; - } - - seq->qnpt = 1.0/(f32)seq->division; - - if (read32(seq) != IFF_TRACK_HDR) { -#ifdef _DEBUG - __osError(ERR_ALSEQTRACKHDR, 1, ptr); -#endif - return; - } - - read32(seq); /* skip the length field */ - - seq->trackStart = seq->curPtr; -} - -void alSeqNextEvent(ALSeq *seq, ALEvent *event) -{ - u8 status; - s16 delta; - s32 len; - s32 deltaTicks; - s32 i; - -#ifdef _DEBUG - /* sct 1/17/96 - Warn if curPtr is beyond the end of sequence. */ - if (seq->curPtr >= seq->base + seq->len) - __osError(ERR_ALSEQOVERRUN, 0); -#endif - - deltaTicks = readVarLen(seq); /* read the delta time */ - seq->lastTicks += deltaTicks; - status = read8(seq); - -#if _DEBUG - /* - * System exclusives are not supported, so just skip them and read - * the next event - */ - if ((status == 0xf0) || (status == 0xf7)) { - __osError(ERR_ALSEQSYSEX, 0); - len = readVarLen(seq); - for (i = 0; i < len; i++) { - read8(seq); - } - alSeqNextEvent(seq,event); - return; - } -#endif - - if (status == AL_MIDI_Meta) { - u8 type = read8(seq); - - if (type == AL_MIDI_META_TEMPO) { - event->type = AL_TEMPO_EVT; - event->msg.tempo.ticks = deltaTicks; - event->msg.tempo.status = status; - event->msg.tempo.type = type; - event->msg.tempo.len = read8(seq); - event->msg.tempo.byte1 = read8(seq); - event->msg.tempo.byte2 = read8(seq); - event->msg.tempo.byte3 = read8(seq); - } else if (type == AL_MIDI_META_EOT) { - event->type = AL_SEQ_END_EVT; - event->msg.end.ticks = deltaTicks; - event->msg.end.status = status; - event->msg.end.type = type; - event->msg.end.len = read8(seq); - } else { -#ifdef _DEBUG - __osError(ERR_ALSEQMETA, 1, type); - len = readVarLen(seq); - for (i = 0; i < len; i++) { - read8(seq); - } - alSeqNextEvent(seq,event); - return; -#endif - } - - seq->lastStatus = 0; - - } else { - event->type = AL_SEQ_MIDI_EVT; - event->msg.midi.ticks = deltaTicks; - if (status & 0x80) { - event->msg.midi.status = status; - event->msg.midi.byte1 = read8(seq); - seq->lastStatus = status; - } else { - /* running status */ - event->msg.midi.status = seq->lastStatus; - event->msg.midi.byte1 = status; - } - - if (((event->msg.midi.status & 0xf0) != AL_MIDI_ProgramChange) && - ((event->msg.midi.status & 0xf0) != AL_MIDI_ChannelPressure)) { - event->msg.midi.byte2 = read8(seq); - } else { - event->msg.midi.byte2 = 0; - } - } -} - - -/* - Returns the delta time in ticks for the next event in the sequence. - Assumes that the sequence data pointer is pointing to the delta time. - - If the curPtr is at or beyond the end of the sequence, then return FALSE - to indicate no next event. - sct 11/6/95 -*/ -char __alSeqNextDelta (ALSeq *seq, s32 *pDeltaTicks) -{ - u8 * savedPtr; - - /* sct 1/16/96 - Put in safety check here to make sure we don't read past sequence data. */ - if (seq->curPtr >= seq->base + seq->len) - return FALSE; - - savedPtr = seq->curPtr; - *pDeltaTicks = readVarLen(seq); /* read the delta time */ - seq->curPtr = savedPtr; - - return TRUE; -} - -f32 alSeqTicksToSec(ALSeq *seq, s32 ticks, u32 tempo) -{ - return ((f32) (((f32)(ticks) * (f32)(tempo)) / - ((f32)(seq->division) * 1000000.0))); -} - -u32 alSeqSecToTicks(ALSeq *seq, f32 sec, u32 tempo) -{ - return (u32)(((sec * 1000000.0) * seq->division) / tempo); -} - -void alSeqNewMarker(ALSeq *seq, ALSeqMarker *m, u32 ticks) -{ - ALEvent evt; - u8 *savePtr, *lastPtr; - s32 saveTicks, lastTicks; - s16 saveStatus, lastStatus; - - /* does not check that ticks is within bounds */ - - if (ticks == 0) { /* common case */ - m->curPtr = seq->trackStart; - m->lastStatus = 0; - m->lastTicks = 0; - m->curTicks = 0; - return; - } else { - savePtr = seq->curPtr; - saveStatus = seq->lastStatus; - saveTicks = seq->lastTicks; - - seq->curPtr = seq->trackStart; - seq->lastStatus = 0; - seq->lastTicks = 0; - - do { - lastPtr = seq->curPtr; - lastStatus = seq->lastStatus; - lastTicks = seq->lastTicks; - - alSeqNextEvent(seq, &evt); - - if (evt.type == AL_SEQ_END_EVT) - { - lastPtr = seq->curPtr; - lastStatus = seq->lastStatus; - lastTicks = seq->lastTicks; - break; - } - - } while (seq->lastTicks < ticks); - - m->curPtr = lastPtr; - m->lastStatus = lastStatus; - m->lastTicks = lastTicks; - m->curTicks = seq->lastTicks; /* Used by test loop condition. */ - - seq->curPtr = savePtr; - seq->lastStatus = saveStatus; - seq->lastTicks = saveTicks; - - } -} - -s32 alSeqGetTicks(ALSeq *seq){ - return seq->lastTicks; -} - -void alSeqSetLoc(ALSeq *seq, ALSeqMarker *m){ - seq->curPtr = m->curPtr; - seq->lastStatus = m->lastStatus; - seq->lastTicks = m->lastTicks; -} - -void alSeqGetLoc(ALSeq *seq, ALSeqMarker *m){ - m->curPtr = seq->curPtr; - m->lastStatus = seq->lastStatus; - m->lastTicks = seq->lastTicks; -} - -/* non-aligned byte reading routines */ -static u8 read8(ALSeq *seq) -{ - return *seq->curPtr++; -} - -static s16 read16(ALSeq *seq) -{ - s16 tmp; - - tmp = *seq->curPtr++ << 8; - tmp |= *seq->curPtr++; - - return tmp; -} - -static s32 read32(ALSeq *seq) -{ - s32 tmp; - - tmp = *seq->curPtr++ << 24; - tmp |= *seq->curPtr++ << 16; - tmp |= *seq->curPtr++ << 8; - tmp |= *seq->curPtr++; - - return tmp; -} - -static s32 readVarLen(ALSeq *seq) -{ - s32 value; - s32 c; - - c = *seq->curPtr++; - value = c; - if ( c & 0x80 ) { - value &= 0x7f; - do { - c = *seq->curPtr++; - value = (value << 7) + (c & 0x7f); - } while (c & 0x80); - } - return (value); -} - - diff --git a/src/core1/audio/sl.c b/src/core1/audio/sl.c deleted file mode 100644 index 1e2b5342..00000000 --- a/src/core1/audio/sl.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -ALGlobals *alGlobals = NULL; - -void alInit(ALGlobals *g, ALSynConfig *c){ - if (!alGlobals) { /* already initialized? */ - alGlobals = g; - alSynNew(&alGlobals->drvr, c); - } -} - -void alClose(ALGlobals *glob) -{ - if (alGlobals) { - alSynDelete(&glob->drvr); - alGlobals = 0; - } -} - -void alLink(ALLink *ln, ALLink *to){ - ln->next = to->next; - ln->prev = to; - if (to->next) - to->next->prev = ln; - to->next = ln; -} - -void alUnlink(ALLink *ln){ - if (ln->next) - ln->next->prev = ln->prev; - if (ln->prev) - ln->prev->next = ln->next; -} diff --git a/src/core1/audio/synallocfx.c b/src/core1/audio/synallocfx.c deleted file mode 100644 index fca6277b..00000000 --- a/src/core1/audio/synallocfx.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "synthInternals.h" - -ALFxRef *alSynAllocFX(ALSynth *s, s16 bus, ALSynConfig *c, ALHeap *hp) -{ - alFxNew(&s->auxBus[bus].fx[0], c, hp); - alFxParam(&s->auxBus[bus].fx[0], AL_FILTER_SET_SOURCE, - &s->auxBus[bus]); - alMainBusParam(s->mainBus, AL_FILTER_ADD_SOURCE,&s->auxBus[bus].fx[0]); - - return (ALFxRef)(&s->auxBus[bus].fx[0]); -} diff --git a/src/core1/audio/syndelete.c b/src/core1/audio/syndelete.c deleted file mode 100644 index 8a30c697..00000000 --- a/src/core1/audio/syndelete.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void alSynDelete(ALSynth *drvr) -{ - drvr->head = 0; -} diff --git a/src/core1/audio/synthesizer.c b/src/core1/audio/synthesizer.c deleted file mode 100644 index 3e56a21c..00000000 --- a/src/core1/audio/synthesizer.c +++ /dev/null @@ -1,303 +0,0 @@ -#include -#include "synthInternals.h" - -#ifdef AUD_PROFILE -#include -extern u32 cnt_index, drvr_num, drvr_cnt, drvr_max, drvr_min, lastCnt[]; -extern u32 client_num, client_cnt, client_max, client_min; -#endif - -#ifndef MIN -# define MIN(a,b) (((a)<(b))?(a):(b)) -#endif - -#ifndef assert -#define assert(s) -#endif - -static s32 __nextSampleTime(ALSynth *drvr, ALPlayer **client); -static s32 _timeToSamplesNoRound(ALSynth *ALSynth, s32 micros); - -/*********************************************************************** - * Synthesis driver public interfaces - ***********************************************************************/ -void alSynNew(ALSynth *drvr, ALSynConfig *c) -{ - s32 i; - ALVoice *vv; - PVoice *pv; - ALVoice *vvoices; - PVoice *pvoices; - ALHeap *hp = c->heap; - ALSave *save; - ALFilter *sources; - ALParam *params; - ALParam *paramPtr; - - drvr->head = NULL; - drvr->numPVoices = c->maxPVoices; - drvr->curSamples = 0; - drvr->paramSamples = 0; - drvr->outputRate = c->outputRate; - drvr->maxOutSamples = AL_MAX_RSP_SAMPLES; - drvr->dma = (ALDMANew) c->dmaproc; - - save = alHeapAlloc(hp, 1, sizeof(ALSave)); - alSaveNew(save); - drvr->outputFilter = (ALFilter *)save; - - /* - * allocate and initialize the auxilliary effects bus. at present - * we only support 1 effects bus. - */ - drvr->auxBus = alHeapAlloc(hp, 1, sizeof(ALAuxBus)); - drvr->maxAuxBusses = 1; - sources = alHeapAlloc(hp, c->maxPVoices, sizeof(ALFilter *)); - alAuxBusNew(drvr->auxBus, sources, c->maxPVoices); - - /* - * allocate and initialize the main bus. - */ - drvr->mainBus = alHeapAlloc(hp, 1, sizeof(ALMainBus)); - sources = alHeapAlloc(hp, c->maxPVoices, sizeof(ALFilter *)); - alMainBusNew(drvr->mainBus, sources, c->maxPVoices); - - if (c->fxType != AL_FX_NONE){ - /* - * Allocate an effect and set parameters - */ - alSynAllocFX(drvr, 0, c, hp); - } else - /* - * Connect the aux bus to the main bus - */ - alMainBusParam(drvr->mainBus, AL_FILTER_ADD_SOURCE, &drvr->auxBus[0]); - - /* - * Build the physical voice lists - */ - drvr->pFreeList.next = 0; - drvr->pFreeList.prev = 0; - drvr->pLameList.next = 0; - drvr->pLameList.prev = 0; - drvr->pAllocList.next = 0; - drvr->pAllocList.prev = 0; - - pvoices = alHeapAlloc(hp, c->maxPVoices, sizeof(PVoice)); - for (i = 0; i < c->maxPVoices; i++) { - pv = &pvoices[i]; - alLink((ALLink *)pv, &drvr->pFreeList); - pv->vvoice = 0; - - alLoadNew(&pv->decoder, drvr->dma, hp); - alLoadParam(&pv->decoder, AL_FILTER_SET_SOURCE, 0); - - alResampleNew(&pv->resampler, hp); - alResampleParam(&pv->resampler, AL_FILTER_SET_SOURCE, &pv->decoder); - - alEnvmixerNew(&pv->envmixer, hp); - alEnvmixerParam(&pv->envmixer, AL_FILTER_SET_SOURCE, &pv->resampler); - - alAuxBusParam(drvr->auxBus, AL_FILTER_ADD_SOURCE, &pv->envmixer); - - pv->channelKnob = (ALFilter *)&pv->envmixer; - } - - alSaveParam(save, AL_FILTER_SET_SOURCE, drvr->mainBus); - - /* - * build the parameter update list - */ - params = alHeapAlloc(hp, c->maxUpdates, sizeof(ALParam)); - drvr->paramList = 0; - for (i = 0; i < c->maxUpdates; i++) { - paramPtr= ¶ms[i]; - paramPtr->next = drvr->paramList; - drvr->paramList = paramPtr; - } - - drvr->heap = hp; -} - -/* - * slAudioFrame() is called every video frame, and is based on the video - * frame interrupt. It is assumed to be an accurate time source for the - * clients. - */ -Acmd *alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen) -{ - ALPlayer *client; - ALFilter *output; - ALSynth *drvr = &alGlobals->drvr; - s16 tmp = 0; /* Starting buffer in DMEM */ - Acmd *cmdlEnd = cmdList; - Acmd *cmdPtr; - s32 nOut; - s16 *lOutBuf = outBuf; - -#ifdef AUD_PROFILE - lastCnt[++cnt_index] = osGetCount(); -#endif - - if (drvr->head == 0) { - *cmdLen = 0; - return cmdList; /* nothing to do */ - } - - /* - * run down list of clients and execute callback if needed this - * subframe. Here we do all the work for the frame at the - * start. Time offsets that occur before the next frame are - * executed "early". - */ - -#ifdef AUD_PROFILE - lastCnt[++cnt_index] = osGetCount(); -#endif - - /* - * paramSamples = time of next parameter change. - * curSamples = current sample time. - * so paramSamples - curSamples is the time until the next parameter change. - * if the next parameter change occurs within this frame time (outLen), - * then call back the client that contains the parameter change. - * Note, paramSamples must be rounded down to 16 sample boundary for use - * during the client handler. - */ - - for (drvr->paramSamples = __nextSampleTime(drvr, &client); - drvr->paramSamples - drvr->curSamples < outLen; - drvr->paramSamples = __nextSampleTime(drvr, &client)) - { - drvr->paramSamples &= ~0xf; - client->samplesLeft += _timeToSamplesNoRound(drvr, (*client->handler)(client)); - } - - /* for safety's sake, always store paramSamples aligned to 16 sample boundary. - * this way, if an voice handler routine gets called outside the ALVoiceHandler - * routine (alSynAllocVoice) it will get timestamped with an aligned value and - * will be processed immediately next audio frame. - */ - drvr->paramSamples &= ~0xf; - - -#ifdef AUD_PROFILE - PROFILE_AUD(client_num, client_cnt, client_max, client_min); -#endif - - /* - * Now build the command list in small chunks - */ - while (outLen > 0){ - nOut = MIN(drvr->maxOutSamples, outLen); - - /* - * construct the command list for each physical voice by calling - * the head of the filter chain. - */ - cmdPtr = cmdlEnd; - aSegment(cmdPtr++, 0, 0); - output = drvr->outputFilter; - (*output->setParam)(output, AL_FILTER_SET_DRAM, lOutBuf); - cmdlEnd = (*output->handler)(output, &tmp, nOut, drvr->curSamples, - cmdPtr); - - outLen -= nOut; - lOutBuf += nOut<<1; /* For Stereo */ - drvr->curSamples += nOut; - - } - *cmdLen = (s32) (cmdlEnd - cmdList); - - _collectPVoices(drvr); /* collect free physical voices */ - -#ifdef AUD_PROFILE - PROFILE_AUD(drvr_num, drvr_cnt, drvr_max, drvr_min); -#endif - return cmdlEnd; -} - -/*********************************************************************** - * Synthesis driver private interfaces - ***********************************************************************/ - -ALParam *__allocParam() -{ - ALParam *update = 0; - ALSynth *drvr = &alGlobals->drvr; - - if (drvr->paramList) { - update = drvr->paramList; - drvr->paramList = drvr->paramList->next; - update->next = 0; - } - return update; -} - -void __freeParam(ALParam *param) -{ - ALSynth *drvr = &alGlobals->drvr; - param->next = drvr->paramList; - drvr->paramList = param; -} - -void _collectPVoices(ALSynth *drvr) -{ - ALLink *dl; - PVoice *pv; - - while ((dl = drvr->pLameList.next) != 0) { - pv = (PVoice *)dl; - - /* ### remove from mixer */ - - alUnlink(dl); - alLink(dl, &drvr->pFreeList); - } -} - -void _freePVoice(ALSynth *drvr, PVoice *pvoice) -{ - /* - * move the voice from the allocated list to the lame list - */ - alUnlink((ALLink *)pvoice); - alLink((ALLink *)pvoice, &drvr->pLameList); -} - - -/* - Add 0.5 to adjust the average affect of - the truncation error produced by casting - a float to an int. -*/ -s32 _timeToSamplesNoRound(ALSynth *synth, s32 micros) -{ - f32 tmp = ((f32)micros) * synth->outputRate / 1000000.0 + 0.5; - - return (s32)tmp; -} - -s32 _timeToSamples(ALSynth *synth, s32 micros) -{ - return _timeToSamplesNoRound(synth, micros) & ~0xf; -} - -static s32 __nextSampleTime(ALSynth *drvr, ALPlayer **client) -{ - ALMicroTime delta = 0x7fffffff; /* max delta for s32 */ - ALPlayer *cl; - - assert(drvr->head); - *client = 0; - - for (cl = drvr->head; cl != 0; cl = cl->next) { - if ((cl->samplesLeft - drvr->curSamples) < delta) { - *client = cl; - delta = cl->samplesLeft - drvr->curSamples; - } - } - - return (*client)->samplesLeft; -} - diff --git a/src/core1/code_0.c b/src/core1/code_0.c index a730a34f..1854bad1 100644 --- a/src/core1/code_0.c +++ b/src/core1/code_0.c @@ -32,9 +32,9 @@ static u64 sDebugVar_8027BEF0; // never used extern u8 core2_TEXT_START[]; -void func_8023DA20(s32 arg0){ +void core1_main(s32 arg0){ bzero(&D_8027A130, core2_TEXT_START - (u8*)&D_8027A130); - osWriteBackDCacheAll(); + osWritebackDCacheAll(); sns_find_and_parse_payload(); osInitialize(); initThread_create(); diff --git a/src/core1/code_11AC0.c b/src/core1/code_11AC0.c index b9a294e4..c4350443 100644 --- a/src/core1/code_11AC0.c +++ b/src/core1/code_11AC0.c @@ -225,7 +225,7 @@ void musicInstruments_init(void){ size = soundfont2ctl_ROM_END - soundfont2ctl_ROM_START; bnk_f = malloc(size); - osWriteBackDCacheAll(); + osWritebackDCacheAll(); osPiStartDma(func_802405D0(), 0, 0, (u32)soundfont2ctl_ROM_START, bnk_f, size, func_802405C4()); osRecvMesg(func_802405C4(), 0, 1); //osRecvMesg D_80282104 = 0xAD; diff --git a/src/core1/code_1D00.c b/src/core1/code_1D00.c index a8b90efb..80c16e47 100644 --- a/src/core1/code_1D00.c +++ b/src/core1/code_1D00.c @@ -3,7 +3,7 @@ #include "functions.h" #include "variables.h" #include "version.h" -#include "2.0L/PR/sched.h" +#include "PR/sched.h" #include "n_libaudio.h" #define AUDIO_HEAP_SIZE VER_SELECT(0x21000, 0x23A00, 0x21000, 0x21000) diff --git a/src/core1/code_3250.c b/src/core1/code_3250.c index a9f89401..06f013bd 100644 --- a/src/core1/code_3250.c +++ b/src/core1/code_3250.c @@ -1,7 +1,7 @@ #include #include "core1/core1.h" -extern f32 gu_sqrtf(f32); +extern f32 sqrtf(f32); static void __guMtxF2L(float mf[4][4], Mtx *m) { @@ -56,7 +56,7 @@ void guLookAtReflectF(float mf[4][4], LookAt *l, zLook = zAt - zEye; /* Negate because positive Z is behind us: */ - len = -1.0 / gu_sqrtf (xLook*xLook + yLook*yLook + zLook*zLook); + len = -1.0 / sqrtf (xLook*xLook + yLook*yLook + zLook*zLook); xLook *= len; yLook *= len; zLook *= len; @@ -66,7 +66,7 @@ void guLookAtReflectF(float mf[4][4], LookAt *l, xRight = yUp * zLook - zUp * yLook; yRight = zUp * xLook - xUp * zLook; zRight = xUp * yLook - yUp * xLook; - len = 1.0 / gu_sqrtf (xRight*xRight + yRight*yRight + zRight*zRight); + len = 1.0 / sqrtf (xRight*xRight + yRight*yRight + zRight*zRight); xRight *= len; yRight *= len; zRight *= len; @@ -76,7 +76,7 @@ void guLookAtReflectF(float mf[4][4], LookAt *l, xUp = yLook * zRight - zLook * yRight; yUp = zLook * xRight - xLook * zRight; zUp = xLook * yRight - yLook * xRight; - len = 1.0 / gu_sqrtf (xUp*xUp + yUp*yUp + zUp*zUp); + len = 1.0 / sqrtf (xUp*xUp + yUp*yUp + zUp*zUp); xUp *= len; yUp *= len; zUp *= len; diff --git a/src/core1/code_5650.c b/src/core1/code_5650.c index be653e23..8decf10c 100644 --- a/src/core1/code_5650.c +++ b/src/core1/code_5650.c @@ -3,7 +3,7 @@ #include "functions.h" #include "variables.h" #include "n_libaudio.h" -#include "n_synth.h" +#include "n_audio/n_synth.h" void func_802444C0(N_AL_Struct81s *arg0); void func_80244050(ALEventQueue *arg0, N_AL_Struct81s *arg1, u16 arg2); diff --git a/src/core1/code_660.c b/src/core1/code_660.c index 22f28607..02b05a28 100644 --- a/src/core1/code_660.c +++ b/src/core1/code_660.c @@ -49,7 +49,7 @@ s32 D_80275764 = 9; //lbits s32 D_80275768 = 6; //dbits /* .data */ -extern struct huft D_803FBE00; +extern struct huft gGlobalHuffTable; struct huft *D_8027BF00; u8 pad_8027BF08[0x8]; u8 *D_8027BF10; //inbuf @@ -71,7 +71,7 @@ s32 rarezip_get_uncompressed_size(u8 *arg0) { } void rarezip_init(void){ - D_8027BF00 = &D_803FBE00; + D_8027BF00 = &gGlobalHuffTable; } void rarezip_inflate(u8 *src, u8 *dst){ diff --git a/src/core1/code_7F60.c b/src/core1/code_7F60.c index b3efda6c..aab43f6b 100644 --- a/src/core1/code_7F60.c +++ b/src/core1/code_7F60.c @@ -110,7 +110,7 @@ void guMtxCatF(f32 lmf[4][4], f32 rmf[4][4], f32 dst[4][4]) { static void _guNormalize(f32 *arg0, f32 *arg1, f32 *arg2) { f32 inv_len; - inv_len = 1.0f / gu_sqrtf((*arg0 * *arg0) + (*arg1 * *arg1) + (*arg2 * *arg2)); + inv_len = 1.0f / sqrtf((*arg0 * *arg0) + (*arg1 * *arg1) + (*arg2 * *arg2)); *arg0 *= inv_len; *arg1 *= inv_len; *arg2 *= inv_len; diff --git a/src/core1/code_CE60.c b/src/core1/code_CE60.c index 970b9f8e..2774fe81 100644 --- a/src/core1/code_CE60.c +++ b/src/core1/code_CE60.c @@ -44,7 +44,7 @@ bool core1_ce60_isPlayerInRange(s32 x, s32 z, s32 distance) { } f32 core1_ce60_getPlayerDistance(f32 x, f32 z) { - return gu_sqrtf((x - sPlayerPosition[0]) * (x - sPlayerPosition[0]) + (z - sPlayerPosition[2]) * (z - sPlayerPosition[2])); + return sqrtf((x - sPlayerPosition[0]) * (x - sPlayerPosition[0]) + (z - sPlayerPosition[2]) * (z - sPlayerPosition[2])); } bool core1_ce60_isPlayerInsideBoundingBox(s32 box_idx) { diff --git a/src/core1/debugtext.c b/src/core1/debugtext.c index e5e2efad..7d69ab9d 100644 --- a/src/core1/debugtext.c +++ b/src/core1/debugtext.c @@ -117,7 +117,7 @@ void drawPixel(s32 x, s32 y, s32 w, s32 h) { } } - osWriteBackDCacheAll(); + osWritebackDCacheAll(); } // Sets the color and draws a square @@ -223,7 +223,7 @@ void gcdebugText_clearText(void) { gFramebuffers[0][i] = 0; gFramebuffers[1][i] = 0; } - osWriteBackDCacheAll(); + osWritebackDCacheAll(); } } diff --git a/src/core1/gu/cosf.c b/src/core1/gu/cosf.c deleted file mode 100644 index 096a29a3..00000000 --- a/src/core1/gu/cosf.c +++ /dev/null @@ -1,137 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -#include "guint.h" - -/* ==================================================================== - * ==================================================================== - * - * Module: fcos.c - * $Revision: 1.2 $ - * $Date: 1995/07/12 17:47:57 $ - * $Author: jeffd $ - * $Source: /disk6/Master/cvsmdev2/PR/libultra/gu/cosf.c,v $ - * - * Revision history: - * 09-Jun-93 - Original Version - * - * Description: source code for fcos function - * - * ==================================================================== - * ==================================================================== - */ - -#pragma weak fcos = __cosf -#pragma weak cosf = __cosf -#define fcos __cosf - -/* coefficients for polynomial approximation of cos on +/- pi/2 */ - -static const du P[] = -{ -{0x3ff00000, 0x00000000}, -{0xbfc55554, 0xbc83656d}, -{0x3f8110ed, 0x3804c2a0}, -{0xbf29f6ff, 0xeea56814}, -{0x3ec5dbdf, 0x0e314bfe}, -}; - -static const du rpi = -{0x3fd45f30, 0x6dc9c883}; - -static const du pihi = -{0x400921fb, 0x50000000}; - -static const du pilo = -{0x3e6110b4, 0x611a6263}; - -static const fu zero = {0x00000000}; - - -/* ==================================================================== - * - * FunctionName fcos - * - * Description computes cosine of arg - * - * ==================================================================== - */ - -float -fcos( float x ) -{ -float absx; -double dx, xsq, poly; -double dn; -int n; -double result; -int ix, xpt; - - - ix = *(int *)&x; - xpt = (ix >> 22); - xpt &= 0x1ff; - - /* xpt is exponent(x) + 1 bit of mantissa */ - - - if ( xpt < 0x136 ) - { - /* |x| < 2^28 */ - - /* use the standard algorithm from Cody and Waite, doing - the computations in double precision - */ - - absx = ABS(x); - - dx = absx; - - dn = dx*rpi.d + 0.5; - n = ROUND(dn); - dn = n; - - dn -= 0.5; - - dx = dx - dn*pihi.d; - dx = dx - dn*pilo.d; /* dx = x - (n - 0.5)*pi */ - - xsq = dx*dx; - - poly = ((P[4].d*xsq + P[3].d)*xsq + P[2].d)*xsq + P[1].d; - - result = dx + (dx*xsq)*poly; - - /* negate result if n is odd */ - - if ( (n & 1) == 0 ) - return ( (float)result ); - - return ( -(float)result ); - } - - if ( x != x ) - { - /* x is a NaN; return a quiet NaN */ - -#ifdef _IP_NAN_SETS_ERRNO - - *__errnoaddr = EDOM; -#endif - - return ( __libm_qnan_f ); - } - - /* just give up and return 0.0 */ - - return ( zero.f ); -} diff --git a/src/core1/gu/guint.h b/src/core1/gu/guint.h deleted file mode 100644 index c3206dd5..00000000 --- a/src/core1/gu/guint.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -#include "mbi.h" -#include "gu.h" - -typedef union -{ - struct - { - unsigned int hi; - unsigned int lo; - } word; - - double d; -} du; - -typedef union -{ - unsigned int i; - float f; -} fu; - -#ifndef __GL_GL_H__ - -typedef float Matrix[4][4]; - -#endif - -#define ROUND(d) (int)(((d) >= 0.0) ? ((d) + 0.5) : ((d) - 0.5)) -#define ABS(d) ((d) > 0) ? (d) : -(d) - -extern float __libm_qnan_f; diff --git a/src/core1/gu/mtxutil.c b/src/core1/gu/mtxutil.c deleted file mode 100644 index e4ed67a9..00000000 --- a/src/core1/gu/mtxutil.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -void guMtxL2F(float mf[4][4], Mtx *m) -{ - int i, j; - unsigned int e1,e2; - unsigned int *ai,*af; - int q1,q2; - - ai=(unsigned int *) &m->m[0][0]; - af=(unsigned int *) &m->m[2][0]; - - for (i=0; i<4; i++) - for (j=0; j<2; j++) { - e1 = (*ai & 0xffff0000) | ((*af >> 16) & 0xffff); - e2 = ((*(ai++) << 16) & 0xffff0000) | ((u16)(*(af++) >> 0)); - q1 = *((int *)&e1); - q2 = *((int *)&e2); - - mf[i][j*2] = (f32)q1/65536.0f; - mf[i][j*2+1] = (f32)q2/65536.0f; - } -} - -void guMtxIdent(Mtx *m){ - float mf[4][4]; - - guMtxIdentF(mf); - guMtxF2L(mf, m); -} - -void guMtxIdentF(float mf[4][4]) -{ - int i, j; - - for (i=0; i<4; i++) - for (j=0; j<4; j++) - if (i == j) mf[i][j] = 1.0; - else mf[i][j] = 0.0; -} - - -void guMtxF2L(float mf[4][4], Mtx *m) -{ - int i, j; - int e1,e2; - int *ai,*af; - - - ai=(int *) &m->m[0][0]; - af=(int *) &m->m[2][0]; - - for (i=0; i<4; i++) - for (j=0; j<2; j++) { - e1=FTOFIX32(mf[i][j*2]); - e2=FTOFIX32(mf[i][j*2+1]); - *(ai++) = ( e1 & 0xffff0000 ) | ((e2 >> 16)&0xffff); - *(af++) = ((e1 << 16) & 0xffff0000) | (e2 & 0xffff); - } -} diff --git a/src/core1/gu/normalize.c b/src/core1/gu/normalize.c deleted file mode 100644 index 99475210..00000000 --- a/src/core1/gu/normalize.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -void guNormalize(float *x, float *y, float *z) -{ - float m; - - m = gu_sqrtf((*x)*(*x) + (*y)*(*y) + (*z)*(*z)); - m = (f32)1.0/ m; - *x *= m; - *y *= m; - *z *= m; -} diff --git a/src/core1/gu/ortho.c b/src/core1/gu/ortho.c deleted file mode 100644 index 71cb582a..00000000 --- a/src/core1/gu/ortho.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -void guOrthoF(float mf[4][4], float l, float r, float b, float t, float n, float f, float scale) -{ - int i, j; - - guMtxIdentF(mf); - - mf[0][0] = 2/(r-l); - mf[1][1] = 2/(t-b); - mf[2][2] = -2/(f-n); - mf[3][0] = -(r+l)/(r-l); - mf[3][1] = -(t+b)/(t-b); - mf[3][2] = -(f+n)/(f-n); - mf[3][3] = 1; - - for (i=0; i<4; i++) - for (j=0; j<4; j++) - mf[i][j] *= scale; -} - -void guOrtho(Mtx *m, float l, float r, float b, float t, float n, float f, float scale) -{ - float mf[4][4]; - - guOrthoF(mf, l, r, b, t, n, f, scale); - guMtxF2L(mf, m); -} diff --git a/src/core1/gu/rotate.c b/src/core1/gu/rotate.c deleted file mode 100644 index 157f3a5c..00000000 --- a/src/core1/gu/rotate.c +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -f32 sinf(f32); -f32 cosf(f32); - -void guRotateF(float mf[4][4], float a, float x, float y, float z) -{ - static f32 D_80285900 = 3.1415926 / 180.0; - float sine; - float cosine; - float ab, bc, ca, t; - - - guNormalize(&x, &y, &z); - a *= D_80285900; - sine = sinf(a); - cosine = cosf(a); - t = (1-cosine); - ab = x*y*t; - bc = y*z*t; - ca = z*x*t; - - guMtxIdentF(mf); - - t = x*x; - mf[0][0] = t+cosine*(1-t); - mf[2][1] = bc-x*sine; - mf[1][2] = bc+x*sine; - - t = y*y; - mf[1][1] = t+cosine*(1-t); - mf[2][0] = ca+y*sine; - mf[0][2] = ca-y*sine; - - t = z*z; - mf[2][2] = t+cosine*(1-t); - mf[1][0] = ab-z*sine; - mf[0][1] = ab+z*sine; -} - -void guRotate(Mtx *m, float a, float x, float y, float z) -{ - float mf[4][4]; - - guRotateF(mf, a, x, y, z); - guMtxF2L(mf, m); -} diff --git a/src/core1/gu/sinf.c b/src/core1/gu/sinf.c deleted file mode 100644 index c90c6f4c..00000000 --- a/src/core1/gu/sinf.c +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -#include "guint.h" - -/* ==================================================================== - * ==================================================================== - * - * Module: fsin.c - * $Revision: 1.2 $ - * $Date: 1995/07/12 17:48:01 $ - * $Author: jeffd $ - * $Source: /disk6/Master/cvsmdev2/PR/libultra/gu/sinf.c,v $ - * - * Revision history: - * 09-Jun-93 - Original Version - * - * Description: source code for fsin function - * - * ==================================================================== - * ==================================================================== - */ - -#pragma weak fsin = __sinf -#pragma weak sinf = __sinf -#define fsin __sinf - -/* coefficients for polynomial approximation of sin on +/- pi/2 */ - -static const du P[] = -{ -{0x3ff00000, 0x00000000}, -{0xbfc55554, 0xbc83656d}, -{0x3f8110ed, 0x3804c2a0}, -{0xbf29f6ff, 0xeea56814}, -{0x3ec5dbdf, 0x0e314bfe}, -}; - -static const du rpi = -{0x3fd45f30, 0x6dc9c883}; - -static const du pihi = -{0x400921fb, 0x50000000}; - -static const du pilo = -{0x3e6110b4, 0x611a6263}; - -static const fu zero = {0x00000000}; - - -/* ==================================================================== - * - * FunctionName fsin - * - * Description computes sine of arg - * - * ==================================================================== - */ - -float -sinf( float x ) -{ -double dx, xsq, poly; -double dn; -int n; -double result; -int ix, xpt; - - - ix = *(int *)&x; - xpt = (ix >> 22); - xpt &= 0x1ff; - - /* xpt is exponent(x) + 1 bit of mantissa */ - - if ( xpt < 0xff ) - { - /* |x| < 1.5 */ - - dx = x; - - if ( xpt >= 0xe6 ) - { - /* |x| >= 2^(-12) */ - - /* compute sin(x) with a standard polynomial approximation */ - - xsq = dx*dx; - - poly = ((P[4].d*xsq + P[3].d)*xsq + P[2].d)*xsq + P[1].d; - - result = dx + (dx*xsq)*poly; - - return ( (float)result ); - } - - return ( x ); - } - - if ( xpt < 0x136 ) - { - /* |x| < 2^28 */ - - dx = x; - - /* reduce argument to +/- pi/2 */ - - dn = dx*rpi.d; - - n = ROUND(dn); - dn = n; - - dx = dx - dn*pihi.d; - dx = dx - dn*pilo.d; /* dx = x - n*pi */ - - /* compute sin(dx) as before, negating result if n is odd - */ - - xsq = dx*dx; - - poly = ((P[4].d*xsq + P[3].d)*xsq + P[2].d)*xsq + P[1].d; - - result = dx + (dx*xsq)*poly; - - - if ( (n & 1) == 0 ) - return ( (float)result ); - - return ( -(float)result ); - } - - if ( x != x ) - { - /* x is a NaN; return a quiet NaN */ - -#ifdef _IP_NAN_SETS_ERRNO - - *__errnoaddr = EDOM; -#endif - - return ( __libm_qnan_f ); - } - - /* just give up and return 0.0 */ - - return ( zero.f ); -} - diff --git a/src/core1/gu/sqrtf.c b/src/core1/gu/sqrtf.c deleted file mode 100644 index 017d1e4c..00000000 --- a/src/core1/gu/sqrtf.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -float gu_sqrtf(float val){ - return sqrtf(val); -} diff --git a/src/core1/gu/translate.c b/src/core1/gu/translate.c deleted file mode 100644 index 609d5bb0..00000000 --- a/src/core1/gu/translate.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -void guTranslateF(float mf[4][4], float x, float y, float z) -{ - guMtxIdentF(mf); - - mf[3][0] = x; - mf[3][1] = y; - mf[3][2] = z; -} - - -void guTranslate(Mtx *m, float x, float y, float z) -{ - float mf[4][4]; - - guTranslateF(mf, x, y, z); - guMtxF2L(mf, m); -} diff --git a/src/core1/io/ai.c b/src/core1/io/ai.c deleted file mode 100644 index 4773f385..00000000 --- a/src/core1/io/ai.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -s32 __osAiDeviceBusy(void) -{ - register s32 status = IO_READ(AI_STATUS_REG); - if (status & AI_STATUS_FIFO_FULL) - - return 1; - - return 0; -} diff --git a/src/core1/io/aigetlen.c b/src/core1/io/aigetlen.c deleted file mode 100644 index a7404228..00000000 --- a/src/core1/io/aigetlen.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -u32 osAiGetLength(void) -{ - return IO_READ(AI_LEN_REG); -} diff --git a/src/core1/io/aisetfreq.c b/src/core1/io/aisetfreq.c deleted file mode 100644 index 78289793..00000000 --- a/src/core1/io/aisetfreq.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include "osint.h" - -s32 osAiSetFrequency(u32 frequency) -{ - register unsigned int dacRate; - register int bitRate; - register float f; - f = osViClock / (float)frequency + .5f; - dacRate = f; - if (dacRate < AI_MIN_DAC_RATE) - return -1; - bitRate = (dacRate / 66) & 0xFF; - if (bitRate > AI_MAX_BIT_RATE) - bitRate = AI_MAX_BIT_RATE; - IO_WRITE(AI_DACRATE_REG, dacRate - 1); - IO_WRITE(AI_BITRATE_REG, bitRate - 1); - IO_WRITE(AI_CONTROL_REG, AI_CONTROL_DMA_ON); - return osViClock / (s32)dacRate; -} diff --git a/src/core1/io/aisetnextbuf.c b/src/core1/io/aisetnextbuf.c deleted file mode 100644 index 9e23f8c2..00000000 --- a/src/core1/io/aisetnextbuf.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include "osint.h" - -s32 osAiSetNextBuffer(void *bufPtr, u32 size) -{ - static u8 hdwrBugFlag = 0; - char *bptr = bufPtr; - if (hdwrBugFlag != 0) - bptr -= 0x2000; - - if ((((u32)bufPtr + size) & 0x3fff) == 0x2000) - hdwrBugFlag = 1; - else - hdwrBugFlag = 0; - - if (__osAiDeviceBusy()) - return -1; - - IO_WRITE(AI_DRAM_ADDR_REG, osVirtualToPhysical(bptr)); - IO_WRITE(AI_LEN_REG, size); - return 0; -} diff --git a/src/core1/io/cartrominit.c b/src/core1/io/cartrominit.c deleted file mode 100644 index 7e8b2c8b..00000000 --- a/src/core1/io/cartrominit.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern OSPiHandle *__osPiTable; - -OSPiHandle CartRomHandle; -OSPiHandle *osCartRomInit(void) -{ - u32 domain; - u32 saveMask; - - domain = 0; - - if (CartRomHandle.baseAddress == PHYS_TO_K1(PI_DOM1_ADDR2)) - return &CartRomHandle; - - CartRomHandle.type = DEVICE_TYPE_CART; - CartRomHandle.baseAddress = PHYS_TO_K1(PI_DOM1_ADDR2); - osPiRawReadIo(NULL, &domain); - CartRomHandle.latency = domain & 0xff; - CartRomHandle.pulse = (domain >> 8) & 0xff; - CartRomHandle.pageSize = (domain >> 0x10) & 0xf; - CartRomHandle.relDuration = (domain >> 0x14) & 0xf; - CartRomHandle.domain = PI_DOMAIN1; - CartRomHandle.speed = 0; - - bzero(&CartRomHandle.transferInfo, sizeof(__OSTranxInfo)); - - saveMask = __osDisableInt(); - CartRomHandle.next = __osPiTable; - __osPiTable = &CartRomHandle; - __osRestoreInt(saveMask); - - return &CartRomHandle; -}//*/ diff --git a/src/core1/io/conteeplongread.c b/src/core1/io/conteeplongread.c deleted file mode 100644 index a116cfe7..00000000 --- a/src/core1/io/conteeplongread.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "controller.h" -s32 osEepromLongRead(OSMesgQueue *mq, u8 address, u8 *buffer, int length) -{ - s32 ret; - ret = 0; - while (length > 0) - { - ERRCK(osEepromRead(mq, address, buffer)); - length -= EEPROM_BLOCK_SIZE; - address++; - buffer += EEPROM_BLOCK_SIZE; - } - return ret; -} diff --git a/src/core1/io/conteeplongwrite.c b/src/core1/io/conteeplongwrite.c deleted file mode 100644 index 2a10b666..00000000 --- a/src/core1/io/conteeplongwrite.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include "controller.h" - -s32 osEepromLongWrite(OSMesgQueue *mq, u8 address, u8 *buffer, int length) -{ - s32 ret; - ret = 0; - while (length > 0) - { - ERRCK(osEepromWrite(mq, address, buffer)); - length -= EEPROM_BLOCK_SIZE; - address++; - buffer += EEPROM_BLOCK_SIZE; - osSetTimer(&__osEepromTimer, 12000 * osClockRate / 1000000, 0, &__osEepromTimerQ, &__osEepromTimerMsg); - osRecvMesg(&__osEepromTimerQ, NULL, OS_MESG_BLOCK); - } - return ret; -} diff --git a/src/core1/io/conteepread.c b/src/core1/io/conteepread.c deleted file mode 100644 index 600aa413..00000000 --- a/src/core1/io/conteepread.c +++ /dev/null @@ -1,106 +0,0 @@ -#include -#include "controller.h" -#include "siint.h" - -static void __osPackEepReadData(u8 address); -OSPifRam __osEepPifRam; // todo bss -s32 osEepromRead(OSMesgQueue *mq, u8 address, u8 *buffer) -{ - s32 ret; - int i; - u16 type; - u8 *ptr; - OSContStatus sdata; - __OSContEepromFormat eepromformat; - ret = 0; - i = 0; - ptr = (u8 *)&__osEepPifRam.ramarray; - __osSiGetAccess(); - ret = __osEepStatus(mq, &sdata); - type = sdata.type & (CONT_EEPROM | CONT_EEP16K); - - if (ret != 0) - { - __osSiRelAccess(); - return CONT_NO_RESPONSE_ERROR; - } - switch (type) - { - case CONT_EEPROM: - if (address > EEPROM_MAXBLOCKS) - { - __osSiRelAccess(); - return -1; - } - - break; - case CONT_EEPROM | CONT_EEP16K: - if (address > EEP16K_MAXBLOCKS) //not technically possible - { - __osSiRelAccess(); - return -1; - } - break; - default: - __osSiRelAccess(); - return CONT_NO_RESPONSE_ERROR; - break; - } - while (sdata.status & CONT_EEPROM_BUSY) - { - __osEepStatus(mq, &sdata); - } - __osPackEepReadData(address); - ret = __osSiRawStartDma(OS_WRITE, &__osEepPifRam); //send command to pif - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - for (i = 0; i < ARRLEN(__osEepPifRam.ramarray) + 1; i++) { - __osEepPifRam.ramarray[i] = 0xFF; - } - __osEepPifRam.pifstatus = 0; - ret = __osSiRawStartDma(OS_READ, &__osEepPifRam); //recv response - __osContLastCmd = CONT_CMD_READ_EEPROM; - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - for (i = 0; i < 4; i++) //skip the first 4 bytes - { - ptr++; - } - eepromformat = *(__OSContEepromFormat *)ptr; - - ret = CHNL_ERR(eepromformat); - - if (ret == 0) - for (i = 0; i < ARRLEN(eepromformat.data); i++) - *buffer++ = eepromformat.data[i]; - - __osSiRelAccess(); - return ret; -} - -static void __osPackEepReadData(u8 address) -{ - u8 *ptr; - __OSContEepromFormat eepromformat; - int i; - ptr = (u8 *)&__osEepPifRam.ramarray; - for (i = 0; i < ARRLEN(__osEepPifRam.ramarray) + 1; i++) - { - __osEepPifRam.ramarray[i] = CONT_CMD_NOP; - } - __osEepPifRam.pifstatus = CONT_CMD_EXE; - - eepromformat.txsize = CONT_CMD_READ_EEPROM_TX; - eepromformat.rxsize = CONT_CMD_READ_EEPROM_RX; - eepromformat.cmd = CONT_CMD_READ_EEPROM; - eepromformat.address = address; - for (i = 0; i < ARRLEN(eepromformat.data); i++) - { - eepromformat.data[i] = 0; - } - for (i = 0; i < 4; i++) //skip the first 4 bytes - { - *ptr++ = 0; - } - *(__OSContEepromFormat *)(ptr) = eepromformat; - ptr += sizeof(__OSContEepromFormat); - ptr[0] = CONT_CMD_END; -} diff --git a/src/core1/io/conteepwrite.c b/src/core1/io/conteepwrite.c deleted file mode 100644 index 435f6d5f..00000000 --- a/src/core1/io/conteepwrite.c +++ /dev/null @@ -1,167 +0,0 @@ -#include -#include "controller.h" -#include "siint.h" -#include - -static void __osPackEepWriteData(u8 address, u8 *buffer); -s32 osEepromWrite(OSMesgQueue *mq, u8 address, u8 *buffer) -{ - - s32 ret; - int i; - u16 type; - u8 *ptr; - __OSContEepromFormat eepromformat; - OSContStatus sdata; - - ret = 0; - ptr = (u8 *)&__osEepPifRam.ramarray; - __osSiGetAccess(); - ret = __osEepStatus(mq, &sdata); //why is this duplicated? - ret = __osEepStatus(mq, &sdata); - - type = sdata.type & (CONT_EEPROM | CONT_EEP16K); - - if (ret != 0) - { - __osSiRelAccess(); - return CONT_NO_RESPONSE_ERROR; - } - switch (type) - { - case CONT_EEPROM: - if (address > EEPROM_MAXBLOCKS) - { - __osSiRelAccess(); - return -1; - } - - break; - case CONT_EEPROM | CONT_EEP16K: - if (address > EEP16K_MAXBLOCKS) //not technically possible - { - __osSiRelAccess(); - return -1; - } - break; - default: - __osSiRelAccess(); - return CONT_NO_RESPONSE_ERROR; - break; - } - while (sdata.status & CONT_EEPROM_BUSY) - { - __osEepStatus(mq, &sdata); - } - __osPackEepWriteData(address, buffer); - ret = __osSiRawStartDma(OS_WRITE, &__osEepPifRam); //send command to pif - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - - for (i = 0; i < ARRLEN(__osEepPifRam.ramarray) + 1; i++) { - __osEepPifRam.ramarray[i] = 0xFF; - } - - __osEepPifRam.pifstatus = 0; - - ret = __osSiRawStartDma(OS_READ, &__osEepPifRam); //recv response - __osContLastCmd = CONT_CMD_WRITE_EEPROM; - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - for (i = 0; i < 4; i++) //skip the first 4 bytes - { - ptr++; - } - eepromformat = *(__OSContEepromFormat *)ptr; - - //probably indicates an error, from PIF - ret = CHNL_ERR(eepromformat); //TODO: remove magic constants - - __osSiRelAccess(); - return ret; -} -static void __osPackEepWriteData(u8 address, u8 *buffer) -{ - u8 *ptr; - __OSContEepromFormat eepromformat; - int i; - ptr = (u8 *)&__osEepPifRam.ramarray; - for (i = 0; i < ARRLEN(__osEepPifRam.ramarray) + 1; i++) - { - __osEepPifRam.ramarray[i] = CONT_CMD_NOP; - } - __osEepPifRam.pifstatus = CONT_CMD_EXE; - - eepromformat.txsize = CONT_CMD_WRITE_EEPROM_TX; - eepromformat.rxsize = CONT_CMD_WRITE_EEPROM_RX; - eepromformat.cmd = CONT_CMD_WRITE_EEPROM; - eepromformat.address = address; - for (i = 0; i < ARRLEN(eepromformat.data); i++) - { - eepromformat.data[i] = *buffer++; - } - for (i = 0; i < 4; i++) //skip the first 4 bytes - { - *ptr++ = 0; - } - *(__OSContEepromFormat *)(ptr) = eepromformat; - ptr += sizeof(__OSContEepromFormat); - ptr[0] = CONT_CMD_END; -} -s32 __osEepStatus(OSMesgQueue *mq, OSContStatus *data) -{ - s32 ret; - int i; - u8 *ptr; - __OSContRequesFormat requestformat; - - //addiu sp,sp,-48 - //lui t6,__osEepPifRam - //addiu t6,t6,__osEepPifRam - //sw ra,20(sp) - //sw a0,48(sp) - //sw a1,52(sp) - //sw zero,44(sp) - ret = 0; - //sw t6,36(sp) - ptr = (u8 *)__osEepPifRam.ramarray; - //could be bset or bzero intrinsic - for (i = 0; i < ARRLEN(__osEepPifRam.ramarray) + 1; i++) //still has the buffer overflow =/, just sets status to 0 - { - __osEepPifRam.ramarray[i] = 0; - } - __osEepPifRam.pifstatus = CONT_CMD_EXE; - ptr = (u8 *)__osEepPifRam.ramarray; - for (i = 0; i < 4; i++) //zero 4 bytes? - *ptr++ = 0; - requestformat.dummy = CONT_CMD_NOP; - requestformat.txsize = CONT_CMD_REQUEST_STATUS_TX; - requestformat.rxsize = CONT_CMD_REQUEST_STATUS_RX; - requestformat.cmd = CONT_CMD_REQUEST_STATUS; - requestformat.typeh = CONT_CMD_NOP; - requestformat.typel = CONT_CMD_NOP; - requestformat.status = CONT_CMD_NOP; - requestformat.dummy1 = CONT_CMD_NOP; - *(__OSContRequesFormat *)ptr = requestformat; - ptr += sizeof(__OSContRequesFormat); - *ptr = CONT_CMD_END; - - ret = __osSiRawStartDma(OS_WRITE, &__osEepPifRam); - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - __osContLastCmd = CONT_CMD_REQUEST_STATUS; - ret = __osSiRawStartDma(OS_READ, &__osEepPifRam); - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - - if (ret != 0) - return ret; - - ptr = (u8 *)&__osEepPifRam; - for (i = 0; i < 4; i++) - *ptr++ = 0; - - requestformat = *(__OSContRequesFormat *)ptr; - data->errno = CHNL_ERR(requestformat); - data->type = (requestformat.typel << 8) | requestformat.typeh; - data->status = requestformat.status; - if (data->errno != 0) - return data->errno; - return 0; -} diff --git a/src/core1/io/contpfs.c b/src/core1/io/contpfs.c deleted file mode 100644 index 7c4253c3..00000000 --- a/src/core1/io/contpfs.c +++ /dev/null @@ -1,302 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" -#include "controller.h" - -u16 __osSumcalc(u8 *ptr, int length) -{ - int i; - u32 sum; - u8 *tmp; - - sum = 0; - tmp = ptr; - for (i = 0; i < length; i++) - { - sum += *tmp++; - sum &= 0xffff; - } - return sum; -} - -s32 __osIdCheckSum(u16 *ptr, u16 *csum, u16 *icsum) -{ - u16 data; - u32 j; - data = 0; - *icsum = 0; - *csum = *icsum; - for (j = 0; j < 28; j += 2) - { - //feels like this should be a compiler optimization not manual.. - //but it doesn't match and I'm pretty sure this is just -O1 - data = *(u16 *)((u8 *)ptr + j); - //data = ptr[j] - *csum += data; - *icsum += ~data; - } - return 0; -} - -s32 __osRepairPackId(OSPfs *pfs, __OSPackId *badid, __OSPackId *newid) -{ - - s32 ret; - u8 temp[32]; - u8 comp[32]; - u8 mask; - int i; - int j; - u16 index[4]; - - ret = 0; - mask = 0; - SET_ACTIVEBANK_TO_ZERO; - newid->repaired = -1; - newid->random = osGetCount(); - newid->serial_mid = badid->serial_mid; - newid->serial_low = badid->serial_low; - for (j = 0; j < PFS_MAX_BANKS;) - { - pfs->activebank = j; - ERRCK(__osPfsSelectBank(pfs)) - ERRCK(__osContRamRead(pfs->queue, pfs->channel, 0, (u8*)&temp)); //TODO: fix magic number - temp[0] = j | 0x80; - for (i = 1; i < ARRLEN(temp); i++) - { - - temp[i] = ~temp[i]; - } - - ERRCK(__osContRamWrite(pfs->queue, pfs->channel, 0, (u8*)temp, FALSE)); //oddr 0, don't force - ERRCK(__osContRamRead(pfs->queue, pfs->channel, 0, (u8*)&comp)); - - for (i = 0; i < ARRLEN(temp); i++) - { - if (comp[i] != temp[i]) - break; - } - if (i != ARRLEN(temp)) - break; - if (j > 0) - { - pfs->activebank = 0; - ERRCK(__osPfsSelectBank(pfs)); - ERRCK(__osContRamRead(pfs->queue, pfs->channel, 0, (u8*)temp)); - if (temp[0] != 128) - break; //TODO: remove magic constant - } - j++; - } - pfs->activebank = 0; - ERRCK(__osPfsSelectBank(pfs)); - if (j > 0) - mask = 1; - else - mask = 0; - newid->deviceid = (badid->deviceid & (u16)~1) | mask; - newid->banks = j; - newid->version = badid->version; - __osIdCheckSum((u16*)newid, &newid->checksum, &newid->inverted_checksum); - index[0] = 1; - index[1] = 3; - index[2] = 4; - index[3] = 6; - for (i = 0; i < ARRLEN(index); i++) - { - ERRCK(__osContRamWrite(pfs->queue, pfs->channel, index[i], (u8*)newid, TRUE)); - } - ERRCK(__osContRamRead(pfs->queue, pfs->channel, 1, (u8*)temp)); - for (i = 0; i < ARRLEN(temp); i++) - { - if (temp[i] != ((u8 *)newid)[i]) - return PFS_ERR_ID_FATAL; - } - return 0; -} - -s32 __osCheckPackId(OSPfs *pfs, __OSPackId *temp) -{ - u16 index[4]; - s32 ret; - u16 sum; - u16 isum; - int i; - int j; - - ret = 0; - SET_ACTIVEBANK_TO_ZERO; - index[0] = 1; - index[1] = 3; - index[2] = 4; - index[3] = 6; - for (i = 1; i < ARRLEN(index); i++) - { - ERRCK(__osContRamRead(pfs->queue, pfs->channel, index[i], (u8*)temp)); - __osIdCheckSum((u16 *)temp, &sum, &isum); - if (temp->checksum == sum && temp->inverted_checksum == isum) - break; - } - if (i == ARRLEN(index)) - return PFS_ERR_ID_FATAL; - - for (j = 0; j < ARRLEN(index); j++) - { - if (j != i) - { - ERRCK(__osContRamWrite(pfs->queue, pfs->channel, index[j], (u8*)temp, TRUE)); - } - } - return 0; -} - -s32 __osGetId(OSPfs *pfs) -{ - int k; - u16 sum; - u16 isum; - u8 temp[32]; - __OSPackId newid; - s32 ret; - __OSPackId *id; - - SET_ACTIVEBANK_TO_ZERO; - ERRCK(__osContRamRead(pfs->queue, pfs->channel, 1, (u8*)temp)); - __osIdCheckSum((u16*)temp, &sum, &isum); - id = (__OSPackId*)temp; - if (id->checksum != sum || id->inverted_checksum != isum) - { - ret = __osCheckPackId(pfs, id); - if (ret == PFS_ERR_ID_FATAL) - { - ERRCK(__osRepairPackId(pfs, id, &newid)); - id = &newid; - } - else if (ret != 0) - { - return ret; - } - } - if ((id->deviceid & 1) == 0) //TODO: remove magic constant - { - ERRCK(__osRepairPackId(pfs, id, &newid)); - id = &newid; - if ((id->deviceid & 1) == 0) - return PFS_ERR_DEVICE; - } - for (k = 0; k < ARRLEN(pfs->id); k++) - { - pfs->id[k] = ((u8 *)id)[k]; - } - pfs->version = id->version; - pfs->banks = id->banks; - pfs->inode_start_page = pfs->banks * 2 + 3; //TODO: loads of magic constants.. - pfs->dir_size = 16; - pfs->inode_table = 8; - pfs->minode_table = pfs->banks * PFS_ONE_PAGE + 8; - pfs->dir_table = pfs->minode_table + pfs->banks * PFS_ONE_PAGE; - ERRCK(__osContRamRead(pfs->queue, pfs->channel, 7, pfs->label)); - return 0; -} - -s32 __osCheckId(OSPfs *pfs) -{ - int k; - u8 temp[32]; - s32 ret; - - SET_ACTIVEBANK_TO_ZERO; - ret = __osContRamRead(pfs->queue, pfs->channel, 1, (u8*)temp); - if (ret != 0) - { - if (ret != 2) - return ret; - else - ERRCK(__osContRamRead(pfs->queue, pfs->channel, 1, (u8*)temp)); - } - - for (k = 0; k < ARRLEN(temp); k++) - { - if (pfs->id[k] != temp[k]) - return PFS_ERR_NEW_PACK; - } - - return 0; -} - -s32 __osPfsRWInode(OSPfs *pfs, __OSInode *inode, u8 flag, u8 bank) -{ - u8 sum; - int j; - s32 ret; - int offset; - u8 *addr; - - SET_ACTIVEBANK_TO_ZERO; - - if (bank > 0) - offset = 1; - else - offset = pfs->inode_start_page; - - if (flag == PFS_WRITE) - inode->inode_page[0].inode_t.page = __osSumcalc((u8*)&inode->inode_page[offset], (-offset) * 2 + 256); - - for (j = 0; j < 8; j++) - { - addr = ((u8 *)inode->inode_page + j * 32); //TODO: don't like this =/ //maybe &inode->inode_table[j*PFS_ONE_PAGE].ipage or something - if (flag == PFS_WRITE) - { - ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->inode_table + bank * 8 + j, addr, FALSE); - ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->minode_table + bank * 8 + j, addr, FALSE); - } - else - { - ret = __osContRamRead(pfs->queue, pfs->channel, pfs->inode_table + bank * 8 + j, addr); - } - if (ret != 0) - return ret; - } - if (flag == PFS_READ) - { - sum = __osSumcalc((u8*)&inode->inode_page[offset], (-offset) * 2 + 256); - if (sum != inode->inode_page[0].inode_t.page) - { - for (j = 0; j < PFS_ONE_PAGE; j++) - { - addr = ((u8 *)inode->inode_page + j * 32); - ret = __osContRamRead(pfs->queue, pfs->channel, pfs->minode_table + bank * PFS_ONE_PAGE + j, addr); - } - if (sum != inode->inode_page[0].inode_t.page) - return PFS_ERR_INCONSISTENT; - for (j = 0; j < PFS_ONE_PAGE; j++) - { - addr = ((u8 *)inode->inode_page + j * 32); - ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->inode_table + bank * PFS_ONE_PAGE + j, addr, FALSE); - } - } - else - { - for (j = 0; j < PFS_ONE_PAGE; j++) - { - addr = ((u8 *)inode->inode_page + j * 32); - ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->minode_table + bank * PFS_ONE_PAGE + j, addr, FALSE); - } - } - } - return 0; -} - -s32 __osPfsSelectBank(OSPfs *pfs) -{ - u8 temp[BLOCKSIZE]; - int i; - s32 ret; - ret = 0; - for (i = 0; i < ARRLEN(temp); i++) - { - temp[i] = pfs->activebank; - } - ret = __osContRamWrite(pfs->queue, pfs->channel, 1024, (u8*)temp, FALSE); - return ret; -} diff --git a/src/core1/io/contramread.c b/src/core1/io/contramread.c deleted file mode 100644 index 2ae9602f..00000000 --- a/src/core1/io/contramread.c +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include "controller.h" -#include "siint.h" - -static void __osPackRamReadData(int channel, u16 address); -s32 __osContRamRead(OSMesgQueue *mq, int channel, u16 address, u8 *buffer) -{ - s32 ret; - int i; - u8 *ptr; - __OSContRamReadFormat ramreadformat; - int retry; - ret = 0; - ptr = (u8 *)&__osPfsPifRam; - retry = 2; - __osSiGetAccess(); - __osContLastCmd = CONT_CMD_READ_MEMPACK; - __osPackRamReadData(channel, address); - ret = __osSiRawStartDma(OS_WRITE, &__osPfsPifRam); - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - do - { - ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam); - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - ptr = (u8 *)&__osPfsPifRam; - if (channel != 0) - { - for (i = 0; i < channel; i++) - { - ptr++; - } - } - ramreadformat = *(__OSContRamReadFormat *)ptr; - ret = CHNL_ERR(ramreadformat); - if (ret == 0) - { - u8 c; - c = __osContDataCrc((u8*)&ramreadformat.data); - if (c != ramreadformat.datacrc) - { - ret = __osPfsGetStatus(mq, channel); - if (ret != 0) - { - __osSiRelAccess(); - return ret; - } - ret = PFS_ERR_CONTRFAIL; - } - else - { - for (i = 0; i < ARRLEN(ramreadformat.data); i++) - { - *buffer++ = ramreadformat.data[i]; - } - } - } - else - { - ret = PFS_ERR_NOPACK; - } - if (ret != PFS_ERR_CONTRFAIL) - break; - } while (retry-- >= 0); - __osSiRelAccess(); - return ret; -} - -static void __osPackRamReadData(int channel, u16 address) -{ - u8 *ptr; - __OSContRamReadFormat ramreadformat; - int i; - - ptr = (u8 *)__osPfsPifRam.ramarray; - - for (i = 0; i < ARRLEN(__osPfsPifRam.ramarray) + 1; i++) { // also clear pifstatus - __osPfsPifRam.ramarray[i] = 0; - } - - __osPfsPifRam.pifstatus = CONT_CMD_EXE; - ramreadformat.dummy = CONT_CMD_NOP; - ramreadformat.txsize = CONT_CMD_READ_MEMPACK_TX; - ramreadformat.rxsize = CONT_CMD_READ_MEMPACK_RX; - ramreadformat.cmd = CONT_CMD_READ_MEMPACK; - ramreadformat.address = (address << 0x5) | __osContAddressCrc(address); - ramreadformat.datacrc = CONT_CMD_NOP; - for (i = 0; i < ARRLEN(ramreadformat.data); i++) - { - ramreadformat.data[i] = CONT_CMD_NOP; - } - if (channel != 0) - { - for (i = 0; i < channel; i++) - { - *ptr++ = 0; - } - } - *(__OSContRamReadFormat *)ptr = ramreadformat; - ptr += sizeof(__OSContRamReadFormat); - ptr[0] = CONT_CMD_END; -} diff --git a/src/core1/io/contramwrite.c b/src/core1/io/contramwrite.c deleted file mode 100644 index 67ef6059..00000000 --- a/src/core1/io/contramwrite.c +++ /dev/null @@ -1,94 +0,0 @@ -#include -#include -#include "controller.h" -#include "siint.h" - -static void __osPackRamWriteData(int channel, u16 address, u8 *buffer); -s32 __osContRamWrite(OSMesgQueue *mq, int channel, u16 address, u8 *buffer, int force) -{ - s32 ret; - int i; - u8 *ptr; - __OSContRamReadFormat ramreadformat; - int retry; - - ret = 0; - ptr = (u8 *)&__osPfsPifRam; - retry = 2; - if (force != 1 && address < 7 && address != 0) - return 0; - __osSiGetAccess(); - __osContLastCmd = CONT_CMD_WRITE_MEMPACK; - __osPackRamWriteData(channel, address, buffer); - ret = __osSiRawStartDma(OS_WRITE, &__osPfsPifRam); - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - do - { - ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam); - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - ptr = (u8 *)&__osPfsPifRam; - if (channel != 0) - for (i = 0; i < channel; i++) - ptr++; - - ramreadformat = *(__OSContRamReadFormat *)ptr; - - ret = CHNL_ERR(ramreadformat); - if (ret == 0) - { - if (__osContDataCrc(buffer) != ramreadformat.datacrc) - { - ret = __osPfsGetStatus(mq, channel); - if (ret != 0) - { - __osSiRelAccess(); - return ret; - } - ret = PFS_ERR_CONTRFAIL; - } - } - else - { - ret = PFS_ERR_NOPACK; - } - if (ret != PFS_ERR_CONTRFAIL) - break; - } while ((retry-- >= 0)); - __osSiRelAccess(); - return ret; -} - -static void __osPackRamWriteData(int channel, u16 address, u8 *buffer) -{ - u8 *ptr; - __OSContRamReadFormat ramreadformat; - int i; - - ptr = (u8 *)__osPfsPifRam.ramarray; - - for (i = 0; i < ARRLEN(__osPfsPifRam.ramarray) + 1; i++) { // also clear pifstatus - __osPfsPifRam.ramarray[i] = 0; - } - - __osPfsPifRam.pifstatus = CONT_CMD_EXE; - ramreadformat.dummy = CONT_CMD_NOP; - ramreadformat.txsize = CONT_CMD_WRITE_MEMPACK_TX; - ramreadformat.rxsize = CONT_CMD_WRITE_MEMPACK_RX; - ramreadformat.cmd = CONT_CMD_WRITE_MEMPACK; - ramreadformat.address = (address << 0x5) | __osContAddressCrc(address); - ramreadformat.datacrc = CONT_CMD_NOP; - for (i = 0; i < ARRLEN(ramreadformat.data); i++) - { - ramreadformat.data[i] = *buffer++; - } - if (channel != 0) - { - for (i = 0; i < channel; i++) - { - *ptr++ = 0; - } - } - *(__OSContRamReadFormat *)ptr = ramreadformat; - ptr += sizeof(__OSContRamReadFormat); - ptr[0] = CONT_CMD_END; -} diff --git a/src/core1/io/contreaddata.c b/src/core1/io/contreaddata.c deleted file mode 100644 index 8dbfb6ce..00000000 --- a/src/core1/io/contreaddata.c +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include -#include "siint.h" -#include "controller.h" - -static void __osPackReadData(void); -s32 osContStartReadData(OSMesgQueue *mq) -{ - s32 ret; - int i; - - ret = 0; - __osSiGetAccess(); - if (__osContLastCmd != CONT_CMD_READ_BUTTON) - { - __osPackReadData(); - ret = __osSiRawStartDma(OS_WRITE, &__osContPifRam); - osRecvMesg(mq, NULL, OS_MESG_BLOCK); - } - for (i = 0; i < ARRLEN(__osContPifRam.ramarray) + 1; i++) - { - __osContPifRam.ramarray[i] = 0xFF; - } - __osContPifRam.pifstatus = 0; - ret = __osSiRawStartDma(OS_READ, &__osContPifRam); - - __osContLastCmd = CONT_CMD_READ_BUTTON; - __osSiRelAccess(); - return ret; -} - -void osContGetReadData(OSContPad *data) -{ - u8 *ptr; - __OSContReadFormat readformat; - int i; - ptr = (u8 *)&__osContPifRam.ramarray; - for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(__OSContReadFormat), data++) - { - readformat = *(__OSContReadFormat *)ptr; - data->errno = CHNL_ERR(readformat); - if (data->errno == 0) - { - data->button = readformat.button; - data->stick_x = readformat.stick_x; - data->stick_y = readformat.stick_y; - } - } -} - -static void __osPackReadData(void) -{ - u8 *ptr; - __OSContReadFormat readformat; - int i; - - ptr = (u8*)&__osContPifRam.ramarray; - for (i = 0; i < ARRLEN(__osContPifRam.ramarray) + 1; i++) - { - __osContPifRam.ramarray[i] = 0; - } - __osContPifRam.pifstatus = CONT_CMD_EXE; - readformat.dummy = CONT_CMD_NOP; - readformat.txsize = CONT_CMD_READ_BUTTON_TX; - readformat.rxsize = CONT_CMD_READ_BUTTON_RX; - readformat.cmd = CONT_CMD_READ_BUTTON; - readformat.button = -1; - readformat.stick_x = -1; - readformat.stick_y = -1; - for(i=0; i < __osMaxControllers; i++){ - *(__OSContReadFormat*)ptr = readformat; - ptr += sizeof(__OSContReadFormat); - } - *ptr = CONT_CMD_END; -} diff --git a/src/core1/io/controller.c b/src/core1/io/controller.c deleted file mode 100644 index 2bfb79e4..00000000 --- a/src/core1/io/controller.c +++ /dev/null @@ -1,95 +0,0 @@ -#include -#include -#include "controller.h" -#include "siint.h" - -#define HALF_A_SECOND OS_USEC_TO_CYCLES(500000) - -u32 __osContinitialized = 0; -OSPifRam __osContPifRam; -u8 __osContLastCmd; -u8 __osMaxControllers; -OSTimer __osEepromTimer; -OSMesgQueue __osEepromTimerQ; -OSMesg __osEepromTimerMsg; -s32 osContInit(OSMesgQueue *mq, u8 *bitpattern, OSContStatus *data) -{ - OSMesg dummy; - s32 ret; - OSTime t; - OSTimer mytimer; - OSMesgQueue timerMesgQueue; - - ret = 0; - if (__osContinitialized) - return ret; - __osContinitialized = TRUE; - t = osGetTime(); - if (500000 * osClockRate / 1000000 > t) - { - osCreateMesgQueue(&timerMesgQueue, &dummy, 1); - osSetTimer(&mytimer, 500000 * osClockRate / 1000000 - t, 0, &timerMesgQueue, &dummy); - osRecvMesg(&timerMesgQueue, &dummy, OS_MESG_BLOCK); - } - __osMaxControllers = MAXCONTROLLERS; - __osPackRequestData(CONT_CMD_REQUEST_STATUS); - - ret = __osSiRawStartDma(OS_WRITE, &__osContPifRam); - osRecvMesg(mq, &dummy, OS_MESG_BLOCK); - - ret = __osSiRawStartDma(OS_READ, &__osContPifRam); - osRecvMesg(mq, &dummy, OS_MESG_BLOCK); - __osContGetInitData(bitpattern, data); - __osContLastCmd = CONT_CMD_REQUEST_STATUS; - __osSiCreateAccessQueue(); - osCreateMesgQueue(&__osEepromTimerQ, &__osEepromTimerMsg, 1); - return ret; -} -void __osContGetInitData(u8 *pattern, OSContStatus *data) -{ - u8 *ptr; - __OSContRequesFormat requestformat; - int i; - u8 bits; - bits = 0; - ptr = (u8 *)&__osContPifRam; - for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(__OSContRequesFormat), data++) - { - requestformat = *(__OSContRequesFormat *)ptr; - data->errno = CHNL_ERR(requestformat); - if (data->errno == 0) - { - data->type = (requestformat.typel << 8) | requestformat.typeh; - data->status = requestformat.status; - bits |= 1 << i; - } - } - *pattern = bits; -} -void __osPackRequestData(u8 cmd) -{ - u8 *ptr; - __OSContRequesFormat requestformat; - int i; - for (i = 0; i < ARRLEN(__osContPifRam.ramarray) + 1; i++) - { - __osContPifRam.ramarray[i] = 0; - } - __osContPifRam.pifstatus = CONT_CMD_EXE; - ptr = (u8 *)&__osContPifRam.ramarray; - requestformat.dummy = CONT_CMD_NOP; - requestformat.txsize = CONT_CMD_REQUEST_STATUS_TX; - requestformat.rxsize = CONT_CMD_REQUEST_STATUS_RX; - requestformat.cmd = cmd; - requestformat.typeh = CONT_CMD_NOP; - requestformat.typel = CONT_CMD_NOP; - requestformat.status = CONT_CMD_NOP; - requestformat.dummy1 = CONT_CMD_NOP; - - for (i = 0; i < __osMaxControllers; i++) - { - *(__OSContRequesFormat *)ptr = requestformat; - ptr += sizeof(__OSContRequesFormat); - } - ptr[0] = CONT_CMD_END; -} diff --git a/src/core1/io/controller.h b/src/core1/io/controller.h deleted file mode 100755 index 3daa018b..00000000 --- a/src/core1/io/controller.h +++ /dev/null @@ -1,207 +0,0 @@ -#ifndef _CONTROLLER_H -#define _CONTROLLER_H -#include -#include - -//should go somewhere else but -#define ARRLEN(x) ((s32)(sizeof(x) / sizeof(x[0]))) -#define CHNL_ERR(format) ((format.rxsize & CHNL_ERR_MASK) >> 4) - -typedef struct -{ - /* 0x0 */ u32 ramarray[15]; - /* 0x3C */ u32 pifstatus; -} OSPifRam; - -typedef struct -{ - /* 0x0 */ u8 dummy; - /* 0x1 */ u8 txsize; - /* 0x2 */ u8 rxsize; - /* 0x3 */ u8 cmd; - /* 0x4 */ u16 button; - /* 0x6 */ s8 stick_x; - /* 0x7 */ s8 stick_y; -} __OSContReadFormat; - -typedef struct -{ - /* 0x0 */ u8 dummy; - /* 0x1 */ u8 txsize; - /* 0x2 */ u8 rxsize; - /* 0x3 */ u8 cmd; - /* 0x4 */ u8 typeh; - /* 0x5 */ u8 typel; - /* 0x6 */ u8 status; - /* 0x7 */ u8 dummy1; -} __OSContRequesFormat; - -typedef struct -{ - /* 0x0 */ u8 txsize; - /* 0x1 */ u8 rxsize; - /* 0x2 */ u8 cmd; - /* 0x3 */ u8 typeh; - /* 0x4 */ u8 typel; - /* 0x5 */ u8 status; -} __OSContRequesFormatShort; - -typedef struct -{ - /* 0x0 */ u8 dummy; - /* 0x1 */ u8 txsize; - /* 0x2 */ u8 rxsize; - /* 0x3 */ u8 cmd; - /* 0x4 */ u16 address; - /* 0x6 */ u8 data[BLOCKSIZE]; - /* 0x26 */ u8 datacrc; -} __OSContRamReadFormat; - -typedef union { - /* 0x0 */ struct - { - /* 0x0 */ u8 bank; - /* 0x1 */ u8 page; - } inode_t; - /* 0x0 */ u16 ipage; -} __OSInodeUnit; - -typedef struct -{ - /* 0x0 */ u32 game_code; - /* 0x4 */ u16 company_code; - /* 0x6 */ __OSInodeUnit start_page; - /* 0x8 */ u8 status; - /* 0x9 */ s8 reserved; - /* 0xA */ u16 data_sum; - /* 0xC */ u8 ext_name[PFS_FILE_EXT_LEN]; - /* 0x10 */ u8 game_name[PFS_FILE_NAME_LEN]; -} __OSDir; - -typedef struct -{ - /* 0x0 */ __OSInodeUnit inode_page[128]; -} __OSInode; - -typedef struct -{ - /* 0x0 */ u32 repaired; - /* 0x4 */ u32 random; - /* 0x8 */ u64 serial_mid; - /* 0x10 */ u64 serial_low; - /* 0x18 */ u16 deviceid; - /* 0x1A */ u8 banks; - /* 0x1B */ u8 version; - /* 0x1C */ u16 checksum; - /* 0x1E */ u16 inverted_checksum; -} __OSPackId; - -typedef struct -{ - /* 0x0 */ u8 txsize; - /* 0x1 */ u8 rxsize; - /* 0x2 */ u8 cmd; - /* 0x3 */ u8 address; - /* 0x4 */ u8 data[EEPROM_BLOCK_SIZE]; -} __OSContEepromFormat; - -//from: http://en64.shoutwiki.com/wiki/SI_Registers_Detailed#CONT_CMD_Usage -#define CONT_CMD_REQUEST_STATUS 0 -#define CONT_CMD_READ_BUTTON 1 -#define CONT_CMD_READ_MEMPACK 2 -#define CONT_CMD_WRITE_MEMPACK 3 -#define CONT_CMD_READ_EEPROM 4 -#define CONT_CMD_WRITE_EEPROM 5 -#define CONT_CMD_RESET 0xff - -#define CONT_CMD_REQUEST_STATUS_TX 1 -#define CONT_CMD_READ_BUTTON_TX 1 -#define CONT_CMD_READ_MEMPACK_TX 3 -#define CONT_CMD_WRITE_MEMPACK_TX 35 -#define CONT_CMD_READ_EEPROM_TX 2 -#define CONT_CMD_WRITE_EEPROM_TX 10 -#define CONT_CMD_RESET_TX 1 - -#define CONT_CMD_REQUEST_STATUS_RX 3 -#define CONT_CMD_READ_BUTTON_RX 4 -#define CONT_CMD_READ_MEMPACK_RX 33 -#define CONT_CMD_WRITE_MEMPACK_RX 1 -#define CONT_CMD_READ_EEPROM_RX 8 -#define CONT_CMD_WRITE_EEPROM_RX 1 -#define CONT_CMD_RESET_RX 3 - -#define CONT_CMD_NOP 0xff -#define CONT_CMD_END 0xfe //indicates end of a command -#define CONT_CMD_EXE 1 //set pif ram status byte to this to do a command - -#define DIR_STATUS_EMPTY 0 -#define DIR_STATUS_UNKNOWN 1 -#define DIR_STATUS_OCCUPIED 2 - - -typedef struct -{ - /* 0x0 */ __OSInode inode; - /* 0x100 */ u8 bank; - /* 0x101 */ u8 map[256]; -} __OSInodeCache; - -extern s32 __osEepStatus(OSMesgQueue *, OSContStatus *); -u16 __osSumcalc(u8 *ptr, int length); -s32 __osIdCheckSum(u16 *ptr, u16 *csum, u16 *icsum); -s32 __osRepairPackId(OSPfs *pfs, __OSPackId *badid, __OSPackId *newid); -s32 __osCheckPackId(OSPfs *pfs, __OSPackId *temp); -s32 __osGetId(OSPfs *pfs); -s32 __osCheckId(OSPfs *pfs); -s32 __osPfsRWInode(OSPfs *pfs, __OSInode *inode, u8 flag, u8 bank); -s32 __osPfsSelectBank(OSPfs *pfs); -s32 __osPfsDeclearPage(OSPfs *pfs, __OSInode *inode, int file_size_in_pages, int *first_page, u8 bank, int *decleared, int *last_page); -s32 __osPfsReleasePages(OSPfs *pfs, __OSInode *inode, u8 start_page, u16 *sum, u8 bank, __OSInodeUnit *last_page, int flag); -s32 __osBlockSum(OSPfs *pfs, u8 page_no, u16 *sum, u8 bank); -s32 __osContRamRead(OSMesgQueue *mq, int channel, u16 address, u8 *buffer); -s32 __osContRamWrite(OSMesgQueue *mq, int channel, u16 address, u8 *buffer, int force); -void __osContGetInitData(u8 *pattern, OSContStatus *data); -void __osPackRequestData(u8 cmd); -void __osPfsRequestData(u8 cmd); -void __osPfsGetInitData(u8* pattern, OSContStatus* data); -u8 __osContAddressCrc(u16 addr); -u8 __osContDataCrc(u8 *data); -s32 __osPfsGetStatus(OSMesgQueue *queue, int channel); - -extern u8 __osContLastCmd; -extern OSTimer __osEepromTimer; -extern OSMesg __osEepromTimerMsg; -extern OSMesgQueue __osEepromTimerQ; -extern OSPifRam __osEepPifRam; -extern OSPifRam __osContPifRam; -extern OSPifRam __osPfsPifRam; -extern u8 __osMaxControllers; - -//some version of this almost certainly existed since there's plenty of times where it's used right before a return 0 -#define ERRCK(fn) \ - ret = fn; \ - if (ret != 0) \ - return ret; - -#define SET_ACTIVEBANK_TO_ZERO \ - if (pfs->activebank != 0) \ - { \ - pfs->activebank = 0; \ - ERRCK(__osPfsSelectBank(pfs)) \ - } - -#define PFS_CHECK_ID \ - if (__osCheckId(pfs) == PFS_ERR_NEW_PACK) \ - return PFS_ERR_NEW_PACK; -#endif - -#define PFS_CHECK_STATUS \ - if ((pfs->status & PFS_INITIALIZED) == 0) \ - return PFS_ERR_INVALID; - -#define PFS_GET_STATUS \ - __osSiGetAccess(); \ - ret = __osPfsGetStatus(queue, channel); \ - __osSiRelAccess(); \ - if (ret != 0) \ - return ret; diff --git a/src/core1/io/contsetch.c b/src/core1/io/contsetch.c deleted file mode 100644 index 50540087..00000000 --- a/src/core1/io/contsetch.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include "controller.h" -#include "siint.h" - -s32 osContSetCh(u8 ch) -{ - s32 ret; - ret = 0; - __osSiGetAccess(); - if (ch > MAXCONTROLLERS) - { - __osMaxControllers = 4; - } - else - { - __osMaxControllers = ch; - } - __osContLastCmd = CONT_CMD_END; //TODO: is this right? - __osSiRelAccess(); - return ret; -} diff --git a/src/core1/io/crc.c b/src/core1/io/crc.c deleted file mode 100644 index 22fb09a8..00000000 --- a/src/core1/io/crc.c +++ /dev/null @@ -1,47 +0,0 @@ -#include - -u8 __osContAddressCrc(u16 addr) -{ - u8 temp; - u8 temp2; - int i; - temp = 0; - for (i = 0; i < 16; i++) - { - if (temp & 0x10) - temp2 = 21; - else - temp2 = 0; - - temp <<= 1; - temp |= (u8)((addr & 0x400) ? 1 : 0); - addr <<= 1; - temp ^= temp2; - } - return temp & 0x1f; -} -u8 __osContDataCrc(u8 *data) -{ - u8 temp; - u8 temp2; - int i; - int j; - temp = 0; - for (i = 0; i <= 32; i++, data++) - { - for (j = 7; j >= 0; j--) - { - if (temp & 0x80) - temp2 = 133; - else - temp2 = 0; - temp <<= 1; - if (i == 32) - temp &= -1; - else - temp |= ((*data & (1 << j)) ? 1 : 0); - temp ^= temp2; - } - } - return temp; -} diff --git a/src/core1/io/devmgr.c b/src/core1/io/devmgr.c deleted file mode 100644 index d0dc1c0b..00000000 --- a/src/core1/io/devmgr.c +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include "piint.h" - -void __osDevMgrMain(void *args) -{ - OSIoMesg *mb; - OSMesg em; - OSMesg dummy; - s32 ret; - OSDevMgr *dm; - s32 messageSend; - - messageSend = 0; - mb = NULL; - ret = 0; - dm = (OSDevMgr *)args; - while (TRUE) - { - osRecvMesg(dm->cmdQueue, (OSMesg)&mb, OS_MESG_BLOCK); - if (mb->piHandle != NULL && - mb->piHandle->type == DEVICE_TYPE_64DD && - (mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_0 || - mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_1)) - { - __OSBlockInfo *blockInfo; - __OSTranxInfo *info; - info = &mb->piHandle->transferInfo; - blockInfo = &info->block[info->blockNum]; - info->sectorNum = -1; - if (info->transferMode != LEO_SECTOR_MODE) - { - blockInfo->dramAddr = (void *)((u32)blockInfo->dramAddr - blockInfo->sectorSize); - } - if (info->transferMode == LEO_TRACK_MODE && mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_0) - messageSend = 1; - else - messageSend = 0; - osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK); - __osResetGlobalIntMask(OS_IM_PI); - osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, (info->bmCtlShadow | 0x80000000)); - while (TRUE) - { - - osRecvMesg(dm->evtQueue, &em, OS_MESG_BLOCK); - info = &mb->piHandle->transferInfo; - blockInfo = &info->block[info->blockNum]; - if (blockInfo->errStatus == LEO_ERROR_29) - { - u32 stat; - osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_RESET); //TODO: remove magic constants - osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow); - osEPiRawReadIo(mb->piHandle, LEO_STATUS, &stat); - - if (stat & LEO_STATUS_MECHANIC_INTERRUPT) //TODO: remove magic constants - { - osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_CLR_MECHANIC_INTR); - } - - blockInfo->errStatus = LEO_ERROR_4; - IO_WRITE(PI_STATUS_REG, PI_CLR_INTR); - __osSetGlobalIntMask(OS_IM_PI | SR_IBIT4); - } - osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK); - - if (messageSend != 1) - break; - if (mb->piHandle->transferInfo.block[0].errStatus != LEO_ERROR_GOOD) - break; - messageSend = 0; - } - osSendMesg(dm->acsQueue, NULL, OS_MESG_NOBLOCK); - if (mb->piHandle->transferInfo.blockNum == 1) - osYieldThread(); - } - else - { - switch (mb->hdr.type) - { - case OS_MESG_TYPE_DMAREAD: - osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK); - ret = dm->dma(OS_READ, mb->devAddr, mb->dramAddr, mb->size); - break; - case OS_MESG_TYPE_DMAWRITE: - osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK); - ret = dm->dma(OS_WRITE, mb->devAddr, mb->dramAddr, mb->size); - break; - case OS_MESG_TYPE_EDMAREAD: - osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK); - ret = dm->edma(mb->piHandle, OS_READ, mb->devAddr, mb->dramAddr, - mb->size); - break; - case OS_MESG_TYPE_EDMAWRITE: - osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK); - ret = dm->edma(mb->piHandle, OS_WRITE, mb->devAddr, mb->dramAddr, - mb->size); - break; - case OS_MESG_TYPE_LOOPBACK: - osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK); - ret = -1; - break; - default: - ret = -1; - break; - } - if (ret == 0) - { - osRecvMesg(dm->evtQueue, &em, OS_MESG_BLOCK); - osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK); - osSendMesg(dm->acsQueue, NULL, OS_MESG_NOBLOCK); - } - } - } -} diff --git a/src/core1/io/dpgetstat.c b/src/core1/io/dpgetstat.c deleted file mode 100644 index a1c32f08..00000000 --- a/src/core1/io/dpgetstat.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -u32 osDpGetStatus(){ - return IO_READ(DPC_STATUS_REG); -} diff --git a/src/core1/io/dpsetstat.c b/src/core1/io/dpsetstat.c deleted file mode 100644 index eb0cd4cb..00000000 --- a/src/core1/io/dpsetstat.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -void osDpSetStatus(u32 data) -{ - IO_WRITE(DPC_STATUS_REG, data); -} diff --git a/src/core1/io/epirawdma.c b/src/core1/io/epirawdma.c deleted file mode 100644 index 19ef62c1..00000000 --- a/src/core1/io/epirawdma.c +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern OSPiHandle *__osCurrentHandle[2]; - -#define OS_RAMROM_STACKSIZE 1024 - -#ifndef WAIT_ON_IOBUSY -#define WAIT_ON_IOBUSY(stat) \ - stat = IO_READ(PI_STATUS_REG); \ - while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \ - stat = IO_READ(PI_STATUS_REG); -#endif - -#define UPDATE_REG(reg, var) \ - if (cHandle->var != pihandle->var) \ - IO_WRITE(reg, pihandle->var); - -#define EPI_SYNC(pihandle, stat, domain) \ - \ - WAIT_ON_IOBUSY(stat) \ - \ - domain = pihandle->domain; \ - if (__osCurrentHandle[domain] != pihandle) \ - { \ - OSPiHandle *cHandle = __osCurrentHandle[domain]; \ - if (domain == PI_DOMAIN1) \ - { \ - UPDATE_REG(PI_BSD_DOM1_LAT_REG, latency); \ - UPDATE_REG(PI_BSD_DOM1_PGS_REG, pageSize); \ - UPDATE_REG(PI_BSD_DOM1_RLS_REG, relDuration); \ - UPDATE_REG(PI_BSD_DOM1_PWD_REG, pulse); \ - } \ - else \ - { \ - UPDATE_REG(PI_BSD_DOM2_LAT_REG, latency); \ - UPDATE_REG(PI_BSD_DOM2_PGS_REG, pageSize); \ - UPDATE_REG(PI_BSD_DOM2_RLS_REG, relDuration); \ - UPDATE_REG(PI_BSD_DOM2_PWD_REG, pulse); \ - } \ - __osCurrentHandle[domain] = pihandle; \ - } - -s32 osEPiRawStartDma(OSPiHandle *pihandle, s32 direction, u32 devAddr, void *dramAddr, u32 size) -{ - u32 stat; - u32 domain; - - EPI_SYNC(pihandle, stat, domain); - - IO_WRITE(PI_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); - IO_WRITE(PI_CART_ADDR_REG, K1_TO_PHYS(pihandle->baseAddress | devAddr)); - switch (direction) - { - case OS_READ: - IO_WRITE(PI_WR_LEN_REG, size - 1); - break; - case OS_WRITE: - IO_WRITE(PI_RD_LEN_REG, size - 1); - break; - default: - return -1; - } - return 0; -} diff --git a/src/core1/io/epirawread.c b/src/core1/io/epirawread.c deleted file mode 100644 index 75766a72..00000000 --- a/src/core1/io/epirawread.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include "piint.h" - -s32 osEPiRawReadIo(OSPiHandle *pihandle, u32 devAddr, u32 *data) -{ - register u32 stat; - register u32 domain; - - WAIT_ON_IOBUSY(stat); - - *data = IO_READ(pihandle->baseAddress | devAddr); - return 0; -} diff --git a/src/core1/io/epirawwrite.c b/src/core1/io/epirawwrite.c deleted file mode 100644 index e7e474f0..00000000 --- a/src/core1/io/epirawwrite.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include "piint.h" - -s32 osEPiRawWriteIo(OSPiHandle *pihandle, u32 devAddr, u32 data) -{ - register u32 stat; - register u32 domain; - - WAIT_ON_IOBUSY(stat); - - IO_WRITE(pihandle->baseAddress | devAddr, data); - return 0; -} diff --git a/src/core1/io/leodiskinit.c b/src/core1/io/leodiskinit.c deleted file mode 100644 index a0381c88..00000000 --- a/src/core1/io/leodiskinit.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include - -OSPiHandle LeoDiskHandle; -OSPiHandle *__osDiskHandle; -OSPiHandle *osLeoDiskInit() -{ - u32 saveMask; - LeoDiskHandle.type = DEVICE_TYPE_64DD; - LeoDiskHandle.baseAddress = PHYS_TO_K1(PI_DOM2_ADDR1); - LeoDiskHandle.latency = 3; - LeoDiskHandle.pulse = 6; - LeoDiskHandle.pageSize = 6; - LeoDiskHandle.relDuration = 2; - LeoDiskHandle.domain = PI_DOMAIN2; - IO_WRITE(PI_BSD_DOM2_LAT_REG, LeoDiskHandle.latency); - IO_WRITE(PI_BSD_DOM2_PWD_REG, LeoDiskHandle.pulse); - IO_WRITE(PI_BSD_DOM2_PGS_REG, LeoDiskHandle.pageSize); - IO_WRITE(PI_BSD_DOM2_RLS_REG, LeoDiskHandle.relDuration); - LeoDiskHandle.speed = 0; - bzero(&LeoDiskHandle.transferInfo, sizeof(__OSTranxInfo)); - saveMask = __osDisableInt(); - LeoDiskHandle.next = __osPiTable; - __osPiTable = &LeoDiskHandle; - __osDiskHandle = &LeoDiskHandle; - __osRestoreInt(saveMask); - return &LeoDiskHandle; -} diff --git a/src/core1/io/leointerrupt.c b/src/core1/io/leointerrupt.c deleted file mode 100644 index 678855c9..00000000 --- a/src/core1/io/leointerrupt.c +++ /dev/null @@ -1,214 +0,0 @@ -#include -#include "osint.h" -#include "piint.h" - -#define WAIT_ON_IOBUSY2(stat) \ - stat = IO_READ(PI_STATUS_REG); \ - while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \ - stat = IO_READ(PI_STATUS_REG); - -static void __osLeoResume(void); -static void __osLeoAbnormalResume(void); - -extern OSThread *__osRunQueue; -extern OSIntMask __OSGlobalIntMask; -extern OSPiHandle *__osDiskHandle; - -u8 leoDiskStack[OS_PIM_STACKSIZE]; -s32 __osLeoInterrupt() -{ - u32 stat; - volatile u32 pi_stat; - u32 bm_stat; - __OSTranxInfo *info; - __OSBlockInfo *blockInfo; - stat = 0; - info = &__osDiskHandle->transferInfo; - blockInfo = &info->block[info->blockNum]; - pi_stat = IO_READ(PI_STATUS_REG); - if (pi_stat & PI_STATUS_DMA_BUSY) - { - __OSGlobalIntMask = __OSGlobalIntMask & ~SR_IBIT4; //cartridge interrupt - blockInfo->errStatus = LEO_ERROR_29; - __osLeoResume(); - return 1; - } - WAIT_ON_IOBUSY(pi_stat); - stat = IO_READ(LEO_STATUS); - if (stat & LEO_STATUS_MECHANIC_INTERRUPT) - { - WAIT_ON_IOBUSY(pi_stat); - IO_WRITE(LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_CLR_MECHANIC_INTR); - blockInfo->errStatus = LEO_ERROR_GOOD; - return 0; - } - if (info->cmdType == LEO_CMD_TYPE_2) - return 1; - if (stat & LEO_STATUS_BUFFER_MANAGER_ERROR) - { - WAIT_ON_IOBUSY(pi_stat); - stat = IO_READ(LEO_STATUS); - blockInfo->errStatus = LEO_ERROR_22; - __osLeoResume(); - IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); - __OSGlobalIntMask |= OS_IM_PI; - return 1; - } - if (info->cmdType == LEO_CMD_TYPE_1) - { - if ((stat & LEO_STATUS_DATA_REQUEST) == 0) - { - if (info->sectorNum + 1 != info->transferMode * 85) - { - blockInfo->errStatus = LEO_ERROR_24; - __osLeoAbnormalResume(); - return 1; - } - IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); - __OSGlobalIntMask |= OS_IM_PI; - blockInfo->errStatus = LEO_ERROR_GOOD; - __osLeoResume(); - return 1; - } - blockInfo->dramAddr = (void *)((u32)blockInfo->dramAddr + blockInfo->sectorSize); - info->sectorNum++; - osEPiRawStartDma(__osDiskHandle, OS_WRITE, LEO_SECTOR_BUFF, blockInfo->dramAddr, blockInfo->sectorSize); - return 1; - } - if (info->cmdType == LEO_CMD_TYPE_0) - { - if (info->transferMode == LEO_SECTOR_MODE) - { - if ((s32)blockInfo->C1ErrNum + 17 < info->sectorNum) - { - blockInfo->errStatus = LEO_ERROR_GOOD; - __osLeoAbnormalResume(); - return 1; - } - if ((stat & LEO_STATUS_DATA_REQUEST) == 0) - { - blockInfo->errStatus = LEO_ERROR_23; - __osLeoAbnormalResume(); - return 1; - } - } - else - { - blockInfo->dramAddr = (void *)((u32)blockInfo->dramAddr + blockInfo->sectorSize); - } - bm_stat = IO_READ(LEO_BM_STATUS); - if ((bm_stat & LEO_BM_STATUS_C1SINGLE && bm_stat & LEO_BM_STATUS_C1DOUBLE) || bm_stat & LEO_BM_STATUS_MICRO) - { - if (blockInfo->C1ErrNum > 3) - { - if (info->transferMode != LEO_SECTOR_MODE || info->sectorNum > 0x52) - { - blockInfo->errStatus = LEO_ERROR_23; - __osLeoAbnormalResume(); - return 1; - } - } - else - { - int errNum = blockInfo->C1ErrNum; - blockInfo->C1ErrSector[errNum] = info->sectorNum + 1; - } - blockInfo->C1ErrNum += 1; - } - if (stat & LEO_STATUS_C2_TRANSFER) - { - if (info->sectorNum + 1 != 88) - { - blockInfo->errStatus = LEO_ERROR_24; - __osLeoAbnormalResume(); - } - if (info->transferMode == LEO_TRACK_MODE && info->blockNum == 0) - { - info->blockNum = 1; - info->sectorNum = -1; - info->block[1].dramAddr = (void *)((u32)info->block[1].dramAddr - info->block[1].sectorSize); - - blockInfo->errStatus = LEO_ERROR_22; - } - else - { - IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); - __OSGlobalIntMask |= OS_IM_PI; - info->cmdType = LEO_CMD_TYPE_2; - blockInfo->errStatus = LEO_ERROR_GOOD; - } - osEPiRawStartDma(__osDiskHandle, OS_READ, LEO_C2_BUFF, blockInfo->C2Addr, blockInfo->sectorSize * 4); - return 1; - } - - if (info->sectorNum == -1 && info->transferMode == LEO_TRACK_MODE && info->blockNum == 1) - { - __OSBlockInfo *bptr = &info->block[0]; - if (bptr->C1ErrNum == 0) - { - if (((u32 *)bptr->C2Addr)[0] | ((u32 *)bptr->C2Addr)[1] | ((u32 *)bptr->C2Addr)[2] | ((u32 *)bptr->C2Addr)[3]) - { - bptr->errStatus = LEO_ERROR_24; - __osLeoAbnormalResume(); - return 1; - } - } - bptr->errStatus = 0; - __osLeoResume(); - } - info->sectorNum++; - if (stat & LEO_STATUS_DATA_REQUEST) - { - if (info->sectorNum > 0x54) - { - blockInfo->errStatus = LEO_ERROR_24; - __osLeoAbnormalResume(); - return 1; - } - osEPiRawStartDma(__osDiskHandle, 0, LEO_SECTOR_BUFF, blockInfo->dramAddr, blockInfo->sectorSize); - blockInfo->errStatus = LEO_ERROR_GOOD; - return 1; - } - if (info->sectorNum <= 0x54) - { - blockInfo->errStatus = LEO_ERROR_24; - __osLeoAbnormalResume(); - return 1; - } - return 1; - } - blockInfo->errStatus = LEO_ERROR_4; - __osLeoAbnormalResume(); - return 1; -} - -static void __osLeoAbnormalResume(void) -{ - __OSTranxInfo *info; - u32 pi_stat; - info = &__osDiskHandle->transferInfo; - pi_stat = pi_stat; - WAIT_ON_IOBUSY2(pi_stat); - IO_WRITE(LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_RESET); - WAIT_ON_IOBUSY2(pi_stat); - IO_WRITE(LEO_BM_CTL, info->bmCtlShadow); - __osLeoResume(); - IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); - __OSGlobalIntMask |= OS_IM_PI; -} - -static void __osLeoResume(void) -{ - __OSEventState *es; - OSMesgQueue *mq; - s32 last; - es = &__osEventStateTab[OS_EVENT_PI]; - mq = es->messageQueue; - if (mq == NULL || MQ_IS_FULL(mq)) - return; - last = (mq->first + mq->validCount) % mq->msgCount; - mq->msg[last] = es->message; - mq->validCount++; - if (mq->mtqueue->next != NULL) - __osEnqueueThread(&__osRunQueue, __osPopThread(&mq->mtqueue)); -} diff --git a/src/core1/io/motor.c b/src/core1/io/motor.c deleted file mode 100644 index 984b322e..00000000 --- a/src/core1/io/motor.c +++ /dev/null @@ -1,170 +0,0 @@ -#include -#include "controller.h" -#include "siint.h" - -static void _MakeMotorData(int channel, u16 address, u8 *buffer, OSPifRam *mdata); -// u32 __osMotorinitialized[MAXCONTROLLERS] = {0, 0, 0, 0}; -OSPifRam _MotorStopData[MAXCONTROLLERS]; -OSPifRam _MotorStartData[MAXCONTROLLERS]; -u8 _motorstopbuf[32]; -u8 _motorstartbuf[32]; -s32 osMotorStop(OSPfs *pfs) -{ - int i; - s32 ret; - u8 *ptr; - __OSContRamReadFormat ramreadformat; - - ptr = (u8 *)&__osPfsPifRam; - - // if (!__osMotorinitialized[pfs->channel]) - // return PFS_ERR_INVALID; - - __osSiGetAccess(); - - __osContLastCmd = CONT_CMD_WRITE_MEMPACK; - __osSiRawStartDma(OS_WRITE, &_MotorStopData[pfs->channel]); - osRecvMesg(pfs->queue, NULL, OS_MESG_BLOCK); - ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam); - osRecvMesg(pfs->queue, NULL, OS_MESG_BLOCK); - ptr = (u8 *)&__osPfsPifRam; - - if (pfs->channel != 0) - for (i = 0; i < pfs->channel; i++) - ptr++; - - ramreadformat = *(__OSContRamReadFormat *)ptr; - ret = CHNL_ERR(ramreadformat); - if (ret == 0 && ramreadformat.datacrc != 0) //!= __osContDataCrc((u8*)&_motorstopbuf)) - { - ret = PFS_ERR_CONTRFAIL; - } - __osSiRelAccess(); - return ret; -} - -s32 osMotorStart(OSPfs *pfs) -{ - - int i; - s32 ret; - u8 *ptr; - __OSContRamReadFormat ramreadformat; - - ptr = (u8 *)&__osPfsPifRam; - - // if (!__osMotorinitialized[pfs->channel]) - // return PFS_ERR_INVALID; - - __osSiGetAccess(); - - __osContLastCmd = CONT_CMD_WRITE_MEMPACK; - __osSiRawStartDma(OS_WRITE, &_MotorStartData[pfs->channel]); - osRecvMesg(pfs->queue, NULL, OS_MESG_BLOCK); - ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam); - osRecvMesg(pfs->queue, NULL, OS_MESG_BLOCK); - ptr = (u8 *)&__osPfsPifRam; - - if (pfs->channel != 0) - for (i = 0; i < pfs->channel; i++) - ptr++; - - ramreadformat = *(__OSContRamReadFormat *)ptr; - ret = CHNL_ERR(ramreadformat); - if (ret == 0 && ramreadformat.datacrc != 0xEB)//__osContDataCrc((u8*)&_motorstartbuf)) - { - ret = PFS_ERR_CONTRFAIL; - } - __osSiRelAccess(); - return ret; -} - -static void _MakeMotorData(int channel, u16 address, u8 *buffer, OSPifRam *mdata) -{ - u8 *ptr; - __OSContRamReadFormat ramreadformat; - int i; - - ptr = (u8 *)mdata->ramarray; - for (i = 0; i < ARRLEN(mdata->ramarray); i++) - mdata->ramarray[i] = 0; - mdata->pifstatus = CONT_CMD_EXE; - ramreadformat.dummy = CONT_CMD_NOP; - ramreadformat.txsize = CONT_CMD_WRITE_MEMPACK_TX; - ramreadformat.rxsize = CONT_CMD_WRITE_MEMPACK_RX; - ramreadformat.cmd = CONT_CMD_WRITE_MEMPACK; - - ramreadformat.address = (address << 0x5) | __osContAddressCrc(address); - ramreadformat.datacrc = CONT_CMD_NOP; - for (i = 0; i < ARRLEN(ramreadformat.data); i++) - - ramreadformat.data[i] = *buffer++; - if (channel != 0) - { - for (i = 0; i < channel; i++) - { - *ptr++ = 0; - } - } - *(__OSContRamReadFormat *)ptr = ramreadformat; - ptr += sizeof(__OSContRamReadFormat); - ptr[0] = CONT_CMD_END; -} - -s32 osMotorInit(OSMesgQueue *mq, OSPfs *pfs, int channel) -{ - int i; - s32 ret; - u8 temp[32]; - pfs->queue = mq; - pfs->channel = channel; - pfs->status = 0; - pfs->activebank = 128; - - for (i = 0; i < ARRLEN(temp); i++) - temp[i] = 0x80; - - ret = __osContRamWrite(mq, channel, 1024, temp, FALSE); - if (ret == 2) //TODO: remove magic constant - ret = __osContRamWrite(mq, channel, 1024, temp, FALSE); - if (ret != 0) - return ret; - - ret = __osContRamRead(mq, channel, 1024, temp); - if (ret == 2) - ret = PFS_ERR_CONTRFAIL; //is this right? - if (ret != 0) - return ret; - if (temp[31] != 0x80) - return PFS_ERR_DEVICE; - - // for (i = 0; i < ARRLEN(temp); i++) - // temp[i] = 128; - - // ret = __osContRamWrite(mq, channel, 1024, temp, FALSE); - // if (ret == 2) - // ret = __osContRamWrite(mq, channel, 1024, temp, FALSE); - // if (ret != 0) - // return ret; - - // ret = __osContRamRead(mq, channel, 1024, temp); - // if (ret == 2) - // ret = PFS_ERR_CONTRFAIL; - // if (ret != 0) - // return ret; - // if (temp[31] != 128) - // return PFS_ERR_DEVICE; - - // if (!__osMotorinitialized[channel]) - // { - for (i = 0; i < ARRLEN(_motorstartbuf); i++) - { - _motorstartbuf[i] = 1; - _motorstopbuf[i] = 0; - } - _MakeMotorData(channel, 1536, _motorstartbuf, &_MotorStartData[channel]); - _MakeMotorData(channel, 1536, _motorstopbuf, &_MotorStopData[channel]); - // __osMotorinitialized[channel] = 1; - // } - return 0; -} diff --git a/src/core1/io/pfschecker.c b/src/core1/io/pfschecker.c deleted file mode 100644 index 3b36a0b4..00000000 --- a/src/core1/io/pfschecker.c +++ /dev/null @@ -1,207 +0,0 @@ -#include -#include "controller.h" - -s32 corrupted_init(OSPfs *pfs, __OSInodeCache *cache); -s32 corrupted(OSPfs *pfs, __OSInodeUnit fpage, __OSInodeCache *cache); -s32 osPfsChecker(OSPfs *pfs) -{ - int j; //1156 - s32 ret; //1152 - __OSInodeUnit next_page; - __OSInode checked_inode; - __OSInode tmp_inode; //636 - __OSDir tmp_dir; - __OSInodeUnit file_next_node[16]; - __OSInodeCache cache; //56 - int fixed; //52 - u8 bank; //51 - s32 cc; //44 - s32 cl; //40 - int offset; //36 - - fixed = 0; - ret = __osCheckId(pfs); - if (ret == PFS_ERR_NEW_PACK) - ret = __osGetId(pfs); - if (ret != 0) - return ret; - ERRCK(corrupted_init(pfs, &cache)); - for (j = 0; j < pfs->dir_size; j++) - { - ERRCK(__osContRamRead(pfs->queue, pfs->channel, pfs->dir_table + j, (u8*)&tmp_dir)); - if (tmp_dir.company_code != 0 && tmp_dir.game_code != 0) - { - next_page = tmp_dir.start_page; - cc = 0; - cl = 0; - bank = 255; - while (next_page.ipage >= pfs->inode_start_page && next_page.inode_t.bank < pfs->banks && next_page.inode_t.page > 0 && next_page.inode_t.page < 128) - { - if (bank != next_page.inode_t.bank) - { - bank = next_page.inode_t.bank; - ret = __osPfsRWInode(pfs, &tmp_inode, OS_READ, bank); - if (ret != 0 && ret != PFS_ERR_INCONSISTENT) - return ret; - } - cc = corrupted(pfs, next_page, &cache) - cl; - if (cc != 0) - break; - cl = 1; - next_page = tmp_inode.inode_page[next_page.inode_t.page]; - } - if (cc == 0 && next_page.ipage == 1) - continue; - - tmp_dir.company_code = 0; - tmp_dir.game_code = 0; - tmp_dir.start_page.ipage = 0; - tmp_dir.status = DIR_STATUS_EMPTY; - tmp_dir.data_sum = 0; - SET_ACTIVEBANK_TO_ZERO; - ERRCK(__osContRamWrite(pfs->queue, pfs->channel, pfs->dir_table + j, (u8*)&tmp_dir, FALSE)); - fixed++; - } - else - { - if (tmp_dir.company_code == 0 && tmp_dir.game_code == 0) - continue; - tmp_dir.company_code = 0; - tmp_dir.game_code = 0; - tmp_dir.start_page.ipage = 0; - tmp_dir.status = DIR_STATUS_EMPTY; - tmp_dir.data_sum = 0; - - SET_ACTIVEBANK_TO_ZERO; - ERRCK(__osContRamWrite(pfs->queue, pfs->channel, pfs->dir_table + j, (u8*)&tmp_dir, FALSE)); - fixed++; - } - } - for (j = 0; j < pfs->dir_size; j++) - { - ERRCK(__osContRamRead(pfs->queue, pfs->channel, pfs->dir_table + j, (u8*)&tmp_dir)); - - if (tmp_dir.company_code != 0 && tmp_dir.game_code != 0 && - tmp_dir.start_page.ipage >= ((__OSInodeUnit *)&(pfs->inode_start_page) + 1)->ipage) //weird - { - file_next_node[j].ipage = tmp_dir.start_page.ipage; - } - else - { - file_next_node[j].ipage = 0; - } - } - for (bank = 0; bank < pfs->banks; bank++) - { - ret = __osPfsRWInode(pfs, &tmp_inode, 0, bank); - if (ret != 0 && ret != PFS_ERR_INCONSISTENT) - return ret; - if (bank > 0) - { - offset = 1; - } - else - { - offset = pfs->inode_start_page; - } - for (j = 0; j < offset; j++) - { - checked_inode.inode_page[j].ipage = tmp_inode.inode_page[j].ipage; - } - for (; j < 128; j++) - { - checked_inode.inode_page[j].ipage = 3; - } - for (j = 0; j < pfs->dir_size; j++) - { - while (file_next_node[j].inode_t.bank == bank && file_next_node[j].ipage >= ((__OSInodeUnit *)&(pfs->inode_start_page) + 1)->ipage) - { - u8 pp = file_next_node[j].inode_t.page; - file_next_node[j] = checked_inode.inode_page[pp] = tmp_inode.inode_page[pp]; - } - } - ERRCK(__osPfsRWInode(pfs, &checked_inode, OS_WRITE, bank)); - } - if (fixed) - pfs->status |= PFS_CORRUPTED; - else - pfs->status &= ~PFS_CORRUPTED; - - return 0; -} - -s32 corrupted_init(OSPfs *pfs, __OSInodeCache *cache) -{ - int i; - int n; - int offset; - u8 bank; - __OSInodeUnit tpage; - __OSInode tmp_inode; - s32 ret; - - for (i = 0; i < ARRLEN(cache->map); i++) - cache->map[i] = 0; - cache->bank = -1; - for (bank = 0; bank < pfs->banks; bank++) - { - if (bank > 0) - offset = 1; - else - offset = pfs->inode_start_page; - - ret = __osPfsRWInode(pfs, &tmp_inode, OS_READ, bank); - if (ret != 0 && ret != PFS_ERR_INCONSISTENT) - return ret; - for (i = offset; i < ARRLEN(tmp_inode.inode_page); i++) - { - tpage = tmp_inode.inode_page[i]; - if (tpage.ipage >= pfs->inode_start_page && tpage.inode_t.bank != bank) - { - n = (tpage.inode_t.page / 4) + ((tpage.inode_t.bank % PFS_ONE_PAGE) * BLOCKSIZE); - cache->map[n] |= 1 << (bank % PFS_ONE_PAGE); - } - } - } - return 0; -} - -s32 corrupted(OSPfs *pfs, __OSInodeUnit fpage, __OSInodeCache *cache) -{ - int j; - int n; - int hit; - u8 bank; - int offset; - s32 ret; - - hit = 0; - ret = 0; - n = (fpage.inode_t.page / 4) + (fpage.inode_t.bank % 8) * BLOCKSIZE; - for (bank = 0; bank < pfs->banks; bank++) - { - if (bank > 0) - offset = 1; - else - offset = pfs->inode_start_page; - if (bank == fpage.inode_t.bank || cache->map[n] & (1 << (bank % 8))) - { - if (bank != cache->bank) - { - ret = __osPfsRWInode(pfs, &cache->inode, 0, bank); - if (ret != 0 && ret != PFS_ERR_INCONSISTENT) - return ret; - cache->bank = bank; - } - - for (j = offset; hit < 2 && (j < ARRLEN(cache->inode.inode_page)); j++) - { - if (cache->inode.inode_page[j].ipage == fpage.ipage) - hit++; - } - if (1 < hit) - return PFS_ERR_NEW_PACK; - } - } - return hit; -} diff --git a/src/core1/io/pfsgetstatus.c b/src/core1/io/pfsgetstatus.c deleted file mode 100644 index c5d65051..00000000 --- a/src/core1/io/pfsgetstatus.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include "controller.h" -#include "siint.h" - -extern OSPifRam __osPfsPifRam; -s32 __osPfsGetStatus(OSMesgQueue *queue, int channel) -{ - s32 ret; - OSMesg dummy; - u8 pattern; - OSContStatus data[4]; - ret = 0; - __osPfsRequestData(CONT_CMD_REQUEST_STATUS); - ret = __osSiRawStartDma(OS_WRITE, &__osPfsPifRam); - osRecvMesg(queue, &dummy, OS_MESG_BLOCK); - ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam); - osRecvMesg(queue, &dummy, OS_MESG_BLOCK); - __osPfsGetInitData(&pattern, data); - if (((data[channel].status & CONT_CARD_ON) != 0) && ((data[channel].status & CONT_CARD_PULL) != 0)) - return PFS_ERR_NEW_PACK; - if ((data[channel].errno != 0) || ((data[channel].status & CONT_CARD_ON) == 0)) - return PFS_ERR_NOPACK; - if ((data[channel].status & CONT_ADDR_CRC_ER) != 0) - return PFS_ERR_CONTRFAIL; - return ret; -} diff --git a/src/core1/io/pfsinit.c b/src/core1/io/pfsinit.c deleted file mode 100644 index 46d70cb5..00000000 --- a/src/core1/io/pfsinit.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include "controller.h" -#include "siint.h" - -s32 osPfsInit(OSMesgQueue *queue, OSPfs *pfs, int channel) -{ - s32 ret; - ret = 0; - __osSiGetAccess(); - ret = __osPfsGetStatus(queue, channel); - __osSiRelAccess(); - if (ret != 0) - return ret; - - pfs->queue = queue; - pfs->channel = channel; - pfs->status = 0; - pfs->activebank = -1; - ERRCK(__osGetId(pfs)); - - ret = osPfsChecker(pfs); - pfs->status |= PFS_INITIALIZED; - return ret; -} diff --git a/src/core1/io/pfsisplug.c b/src/core1/io/pfsisplug.c deleted file mode 100644 index 1e5be720..00000000 --- a/src/core1/io/pfsisplug.c +++ /dev/null @@ -1,99 +0,0 @@ -#include -#include "controller.h" -#include "siint.h" - -OSPifRam __osPfsPifRam; // TODO bss -s32 osPfsIsPlug(OSMesgQueue *queue, u8 *pattern) -{ - s32 ret; - OSMesg dummy; - u8 bitpattern; - OSContStatus data[MAXCONTROLLERS]; - int channel; - u8 bits; - int crc_error_cnt; - ret = 0; - bits = 0; - crc_error_cnt = 3; - __osSiGetAccess(); - while (TRUE) - { - __osPfsRequestData(CONT_CMD_REQUEST_STATUS); - ret = __osSiRawStartDma(OS_WRITE, &__osPfsPifRam); - osRecvMesg(queue, &dummy, OS_MESG_BLOCK); - ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam); - osRecvMesg(queue, &dummy, OS_MESG_BLOCK); - __osPfsGetInitData(&bitpattern, data); - for (channel = 0; channel < __osMaxControllers; channel++) - { - if ((data[channel].status & CONT_ADDR_CRC_ER) == 0) - { - crc_error_cnt--; - break; - } - } - if (__osMaxControllers == channel) - crc_error_cnt = 0; - if (crc_error_cnt < 1) - { - for (channel = 0; channel < __osMaxControllers; channel++) - { - if (data[channel].errno == 0 && (data[channel].status & CONT_CARD_ON) != 0) - bits |= 1 << channel; - } - __osSiRelAccess(); - *pattern = bits; - return ret; - } - } -} -void __osPfsRequestData(u8 cmd) -{ - u8 *ptr; - __OSContRequesFormat requestformat; - int i; - __osContLastCmd = cmd; - - for (i = 0; i < ARRLEN(__osPfsPifRam.ramarray) + 1; i++) { // also clear pifstatus - __osPfsPifRam.ramarray[i] = 0; - } - - __osPfsPifRam.pifstatus = CONT_CMD_EXE; - ptr = (u8 *)&__osPfsPifRam; - requestformat.dummy = CONT_CMD_NOP; - requestformat.txsize = CONT_CMD_REQUEST_STATUS_TX; - requestformat.rxsize = CONT_CMD_REQUEST_STATUS_RX; - requestformat.cmd = cmd; - requestformat.typeh = CONT_CMD_NOP; - requestformat.typel = CONT_CMD_NOP; - requestformat.status = CONT_CMD_NOP; - requestformat.dummy1 = CONT_CMD_NOP; - for (i = 0; i < __osMaxControllers; i++) - { - *(__OSContRequesFormat *)ptr = requestformat; - ptr += sizeof(__OSContRequesFormat); - } - *ptr = CONT_CMD_END; -} -void __osPfsGetInitData(u8 *pattern, OSContStatus *data) -{ - u8 *ptr; - __OSContRequesFormat requestformat; - int i; - u8 bits; - bits = 0; - ptr = (u8 *)&__osPfsPifRam; - for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(__OSContRequesFormat)) - { - requestformat = *(__OSContRequesFormat *)ptr; - data->errno = CHNL_ERR(requestformat); - if (data->errno == 0) - { - data->type = (requestformat.typel << 8) | (requestformat.typeh); - data->status = requestformat.status; - bits |= 1 << i; - } - data++; - } - *pattern = bits; -} diff --git a/src/core1/io/piacs.c b/src/core1/io/piacs.c deleted file mode 100644 index 0ec4264f..00000000 --- a/src/core1/io/piacs.c +++ /dev/null @@ -1,24 +0,0 @@ -#include - -#define PI_Q_BUF_LEN 1 -u32 __osPiAccessQueueEnabled = 0; -OSMesg piAccessBuf[PI_Q_BUF_LEN]; // todo bss -OSMesgQueue __osPiAccessQueue; -void __osPiCreateAccessQueue(void) -{ - - __osPiAccessQueueEnabled = 1; - osCreateMesgQueue(&__osPiAccessQueue, piAccessBuf, PI_Q_BUF_LEN); - osSendMesg(&__osPiAccessQueue, NULL, OS_MESG_NOBLOCK); -} -void __osPiGetAccess(void) -{ - OSMesg dummyMesg; - if (!__osPiAccessQueueEnabled) - __osPiCreateAccessQueue(); - osRecvMesg(&__osPiAccessQueue, &dummyMesg, OS_MESG_BLOCK); -} -void __osPiRelAccess(void) -{ - osSendMesg(&__osPiAccessQueue, NULL, OS_MESG_NOBLOCK); -} diff --git a/src/core1/io/pigetcmdq.c b/src/core1/io/pigetcmdq.c deleted file mode 100644 index 7f643890..00000000 --- a/src/core1/io/pigetcmdq.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern OSDevMgr __osPiDevMgr; - -OSMesgQueue *osPiGetCmdQueue(void){ - if (!__osPiDevMgr.active) - return NULL; - return __osPiDevMgr.cmdQueue; -} diff --git a/src/core1/io/pimgr.c b/src/core1/io/pimgr.c deleted file mode 100644 index c9635f74..00000000 --- a/src/core1/io/pimgr.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include "piint.h" - - -extern u32 __osPiAccessQueueEnabled; - -OSDevMgr __osPiDevMgr = {0}; -OSPiHandle *__osPiTable = NULL; -OSPiHandle *__osCurrentHandle[2] = {&CartRomHandle, &LeoDiskHandle}; - -/* .bss */ -OSThread piThread; -char piThreadStack[OS_PIM_STACKSIZE]; -OSMesgQueue piEventQueue; -OSMesg piEventBuf; - -void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt) -{ - u32 savedMask; - OSPri oldPri; - OSPri myPri; - if (!__osPiDevMgr.active) - { - osCreateMesgQueue(cmdQ, cmdBuf, cmdMsgCnt); - osCreateMesgQueue(&piEventQueue, (OSMesg*)&piEventBuf, 1); - if (!__osPiAccessQueueEnabled) - __osPiCreateAccessQueue(); - osSetEventMesg(OS_EVENT_PI, &piEventQueue, (OSMesg)0x22222222); - oldPri = -1; - myPri = osGetThreadPri(NULL); - if (myPri < pri) - { - oldPri = myPri; - osSetThreadPri(NULL, pri); - } - savedMask = __osDisableInt(); - __osPiDevMgr.active = 1; - __osPiDevMgr.thread = &piThread; - __osPiDevMgr.cmdQueue = cmdQ; - __osPiDevMgr.evtQueue = &piEventQueue; - __osPiDevMgr.acsQueue = &__osPiAccessQueue; - __osPiDevMgr.dma = osPiRawStartDma; - __osPiDevMgr.edma = osEPiRawStartDma; - osCreateThread(&piThread, 0, __osDevMgrMain, &__osPiDevMgr, &piThreadStack[OS_PIM_STACKSIZE], pri); - osStartThread(&piThread); - __osRestoreInt(savedMask); - if (oldPri != -1) - { - osSetThreadPri(NULL, oldPri); - } - } -} diff --git a/src/core1/io/pirawdma.c b/src/core1/io/pirawdma.c deleted file mode 100644 index da9105e3..00000000 --- a/src/core1/io/pirawdma.c +++ /dev/null @@ -1,28 +0,0 @@ -#include - -#ifndef WAIT_ON_IOBUSY -#define WAIT_ON_IOBUSY(stat) \ - stat = IO_READ(PI_STATUS_REG); \ - while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \ - stat = IO_READ(PI_STATUS_REG); -#endif - -s32 osPiRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size) -{ - register u32 stat; - WAIT_ON_IOBUSY(stat); - IO_WRITE(PI_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); - IO_WRITE(PI_CART_ADDR_REG, K1_TO_PHYS((u32)osRomBase | devAddr)); - switch (direction) - { - case OS_READ: - IO_WRITE(PI_WR_LEN_REG, size - 1); - break; - case OS_WRITE: - IO_WRITE(PI_RD_LEN_REG, size - 1); - break; - default: - return -1; - } - return 0; -} diff --git a/src/core1/io/pirawread.c b/src/core1/io/pirawread.c deleted file mode 100644 index 33795911..00000000 --- a/src/core1/io/pirawread.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "piint.h" - -s32 osPiRawReadIo(u32 devAddr, u32 *data) -{ - register u32 stat; - WAIT_ON_IOBUSY(stat); - *data = IO_READ((u32)osRomBase | devAddr); - return 0; -} - diff --git a/src/core1/io/piread.c b/src/core1/io/piread.c deleted file mode 100644 index 5ce83c18..00000000 --- a/src/core1/io/piread.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "piint.h" - -s32 osPiReadIo(u32 devAddr, u32 *data) -{ - register s32 ret; - __osPiGetAccess(); - ret = osPiRawReadIo(devAddr, data); - __osPiRelAccess(); - return ret; -} diff --git a/src/core1/io/si.c b/src/core1/io/si.c deleted file mode 100644 index 8f821b6f..00000000 --- a/src/core1/io/si.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -int __osSiDeviceBusy() -{ - register u32 stat = IO_READ(SI_STATUS_REG); - if (stat & (SI_STATUS_DMA_BUSY | SI_STATUS_RD_BUSY)) - return 1; - return 0; -} diff --git a/src/core1/io/siacs.c b/src/core1/io/siacs.c deleted file mode 100644 index 737ee103..00000000 --- a/src/core1/io/siacs.c +++ /dev/null @@ -1,24 +0,0 @@ -#include - -#define SI_Q_BUF_LEN 1 -u32 __osSiAccessQueueEnabled = 0; -OSMesg siAccessBuf[SI_Q_BUF_LEN]; -OSMesgQueue __osSiAccessQueue; - -void __osSiCreateAccessQueue(void) -{ - __osSiAccessQueueEnabled = 1; - osCreateMesgQueue(&__osSiAccessQueue, siAccessBuf, SI_Q_BUF_LEN); - osSendMesg(&__osSiAccessQueue, NULL, OS_MESG_NOBLOCK); -} -void __osSiGetAccess(void) -{ - OSMesg dummyMesg; - if (!__osSiAccessQueueEnabled) - __osSiCreateAccessQueue(); - osRecvMesg(&__osSiAccessQueue, &dummyMesg, OS_MESG_BLOCK); -} -void __osSiRelAccess(void) -{ - osSendMesg(&__osSiAccessQueue, NULL, OS_MESG_NOBLOCK); -} diff --git a/src/core1/io/siint.h b/src/core1/io/siint.h deleted file mode 100644 index 45bf56bf..00000000 --- a/src/core1/io/siint.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _SIINT_H -#define _SIINT_H -#include -#include - -void __osSiGetAccess(void); -void __osSiRelAccess(void); -int __osSiDeviceBusy(void); -void __osSiCreateAccessQueue(void); -#endif diff --git a/src/core1/io/sirawdma.c b/src/core1/io/sirawdma.c deleted file mode 100644 index 40d92261..00000000 --- a/src/core1/io/sirawdma.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -s32 __osSiRawStartDma(s32 direction, void *dramAddr) -{ - if (__osSiDeviceBusy()) - return -1; - - if (direction == OS_WRITE) - osWritebackDCache(dramAddr, 64); - - IO_WRITE(SI_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); - - if (direction == OS_READ) - IO_WRITE(SI_PIF_ADDR_RD64B_REG, 0x1FC007C0); - else - IO_WRITE(SI_PIF_ADDR_WR64B_REG, 0x1FC007C0); - - if (direction == OS_READ) - osInvalDCache(dramAddr, 64);//bzero(dramAddr, 64); - - return 0; -} diff --git a/src/core1/io/sirawread.c b/src/core1/io/sirawread.c deleted file mode 100644 index 5cecb6c9..00000000 --- a/src/core1/io/sirawread.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -s32 __osSiRawReadIo(u32 devAddr, u32 *data) -{ - if (__osSiDeviceBusy()) - return -1; - *data = IO_READ(devAddr); - return 0; -} diff --git a/src/core1/io/sirawwrite.c b/src/core1/io/sirawwrite.c deleted file mode 100644 index 74027b87..00000000 --- a/src/core1/io/sirawwrite.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -s32 __osSiRawWriteIo(u32 devAddr, u32 data) -{ - - if (__osSiDeviceBusy()) - return -1; - IO_WRITE(devAddr, data); - return 0; -} diff --git a/src/core1/io/sp.c b/src/core1/io/sp.c deleted file mode 100644 index 7b7d8c22..00000000 --- a/src/core1/io/sp.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include -#include "osint.h" - -int __osSpDeviceBusy() -{ - register u32 stat = IO_READ(SP_STATUS_REG); - if (stat & (SP_STATUS_DMA_BUSY | SP_STATUS_DMA_FULL | SP_STATUS_IO_FULL)) - return 1; - return 0; -} diff --git a/src/core1/io/spgetstat.c b/src/core1/io/spgetstat.c deleted file mode 100644 index 826e50e9..00000000 --- a/src/core1/io/spgetstat.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -u32 __osSpGetStatus() -{ - return IO_READ(SP_STATUS_REG); -} diff --git a/src/core1/io/sprawdma.c b/src/core1/io/sprawdma.c deleted file mode 100644 index 26f77be3..00000000 --- a/src/core1/io/sprawdma.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include "osint.h" - -s32 __osSpRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size) -{ - if (__osSpDeviceBusy()) - return -1; - IO_WRITE(SP_MEM_ADDR_REG, devAddr); - IO_WRITE(SP_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); - if (direction == OS_READ) - IO_WRITE(SP_WR_LEN_REG, size - 1); - else - IO_WRITE(SP_RD_LEN_REG, size - 1); - return 0; -} diff --git a/src/core1/io/spsetpc.c b/src/core1/io/spsetpc.c deleted file mode 100644 index 94c35ff2..00000000 --- a/src/core1/io/spsetpc.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -s32 __osSpSetPc(u32 data) -{ - register u32 stat = IO_READ(SP_STATUS_REG); - if (!(stat & SP_STATUS_HALT)) - return -1; - else - { - IO_WRITE(SP_PC_REG, data); - } - return 0; -} diff --git a/src/core1/io/spsetstat.c b/src/core1/io/spsetstat.c deleted file mode 100644 index 408eac48..00000000 --- a/src/core1/io/spsetstat.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -void __osSpSetStatus(u32 data){ - IO_WRITE(SP_STATUS_REG, data); -} diff --git a/src/core1/io/sptask.c b/src/core1/io/sptask.c deleted file mode 100644 index 2051dfe8..00000000 --- a/src/core1/io/sptask.c +++ /dev/null @@ -1,63 +0,0 @@ -#include - -#define _osVirtualToPhysical(ptr) \ - if (ptr != NULL) \ - { \ - ptr = (void *)osVirtualToPhysical(ptr); \ - } - -OSTask tmp_task; // TODO bss (static) - -static OSTask *_VirtualToPhysicalTask(OSTask *intp) -{ - OSTask *tp; - tp = &tmp_task; - bcopy(intp, tp, sizeof(OSTask)); - - _osVirtualToPhysical(tp->t.ucode); - _osVirtualToPhysical(tp->t.ucode_data); - _osVirtualToPhysical(tp->t.dram_stack); - _osVirtualToPhysical(tp->t.output_buff); - _osVirtualToPhysical(tp->t.output_buff_size); - _osVirtualToPhysical(tp->t.data_ptr); - _osVirtualToPhysical(tp->t.yield_data_ptr); - return tp; -} -void osSpTaskLoad(OSTask *intp) -{ - - OSTask *tp; - tp = _VirtualToPhysicalTask(intp); - if (tp->t.flags & OS_TASK_YIELDED) - { - tp->t.ucode_data = tp->t.yield_data_ptr; - tp->t.ucode_data_size = tp->t.yield_data_size; - intp->t.flags &= ~OS_TASK_YIELDED; - if (tp->t.flags & OS_TASK_LOADABLE) - tp->t.ucode = (u64 *)IO_READ((u32)intp->t.yield_data_ptr + OS_YIELD_DATA_SIZE - 4); - } - osWritebackDCache(tp, sizeof(OSTask)); - __osSpSetStatus(SP_CLR_YIELD | SP_CLR_YIELDED | SP_CLR_TASKDONE | SP_SET_INTR_BREAK); - while (__osSpSetPc(SP_IMEM_START) == -1) - ; - - while (__osSpRawStartDma(1, (SP_IMEM_START - sizeof(*tp)), tp, - sizeof(OSTask)) == -1) - ; - - while (__osSpDeviceBusy()) - ; - - while (__osSpRawStartDma(1, SP_IMEM_START, tp->t.ucode_boot, - tp->t.ucode_boot_size) == -1) - ; -} -void osSpTaskStartGo(OSTask *tp) -{ - - while (__osSpDeviceBusy()) - ; - - __osSpSetStatus(SP_SET_INTR_BREAK | SP_CLR_SSTEP | SP_CLR_BROKE | SP_CLR_HALT); - -} diff --git a/src/core1/io/sptaskyield.c b/src/core1/io/sptaskyield.c deleted file mode 100644 index 61d62f5c..00000000 --- a/src/core1/io/sptaskyield.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -void osSpTaskYield(void) -{ - __osSpSetStatus(SP_SET_YIELD); -} diff --git a/src/core1/io/sptaskyielded.c b/src/core1/io/sptaskyielded.c deleted file mode 100644 index f036be12..00000000 --- a/src/core1/io/sptaskyielded.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include - -OSYieldResult osSpTaskYielded(OSTask *tp) -{ - u32 status; - OSYieldResult result; - status = __osSpGetStatus(); - if (status & SP_STATUS_YIELDED) - result = OS_TASK_YIELDED; - else - result = 0; - if (status & SP_STATUS_YIELD) - { - tp->t.flags |= result; - tp->t.flags &= ~(OS_TASK_DP_WAIT); - } - return result; -} diff --git a/src/core1/io/vi.c b/src/core1/io/vi.c deleted file mode 100644 index 1b33e077..00000000 --- a/src/core1/io/vi.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include -#include "viint.h" - -static __OSViContext vi[2] = {0}; -__OSViContext *__osViCurr = &vi[0]; -__OSViContext *__osViNext = &vi[1]; -void __osViInit(void) -{ - bzero(vi, sizeof(vi)); - __osViCurr = &vi[0]; - __osViNext = &vi[1]; - __osViNext->retraceCount = 1; - __osViCurr->retraceCount = 1; - __osViNext->framep = (void*)K0BASE; - __osViCurr->framep = (void*)K0BASE; - if (osTvType == OS_TV_TYPE_PAL) - { - __osViNext->modep = &osViModePalLan1; - } - else if (osTvType == OS_TV_TYPE_MPAL) - { - __osViNext->modep = &osViModeMpalLan1; - } - else - { - __osViNext->modep = &osViModeNtscLan1; - } - __osViNext->state = VI_STATE_BLACK; - __osViNext->control = __osViNext->modep->comRegs.ctrl; - while (IO_READ(VI_CURRENT_REG) > 10) //wait for vsync? - ; - IO_WRITE(VI_CONTROL_REG, 0); //pixel size blank (no data, no sync) - __osViSwapContext(); -} diff --git a/src/core1/io/viblack.c b/src/core1/io/viblack.c deleted file mode 100644 index 37190a08..00000000 --- a/src/core1/io/viblack.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" -#include "viint.h" - -void osViBlack(u8 active) -{ - register u32 saveMask = __osDisableInt(); - if (active) - __osViNext->state |= VI_STATE_BLACK; - else - __osViNext->state &= ~VI_STATE_BLACK; - __osRestoreInt(saveMask); -} diff --git a/src/core1/io/vigetcurrcontext.c b/src/core1/io/vigetcurrcontext.c deleted file mode 100644 index b2fe98ea..00000000 --- a/src/core1/io/vigetcurrcontext.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "viint.h" - -__OSViContext *__osViGetCurrentContext(void) -{ - return __osViCurr; -} diff --git a/src/core1/io/vigetcurrframebuf.c b/src/core1/io/vigetcurrframebuf.c deleted file mode 100644 index 62c74896..00000000 --- a/src/core1/io/vigetcurrframebuf.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "viint.h" - -void *osViGetCurrentFramebuffer(void) -{ - register u32 saveMask; - void *framep; - saveMask = __osDisableInt(); - framep = __osViCurr->framep; - __osRestoreInt(saveMask); - return framep; -} diff --git a/src/core1/io/vigetnextframebuf.c b/src/core1/io/vigetnextframebuf.c deleted file mode 100644 index 5b580ba9..00000000 --- a/src/core1/io/vigetnextframebuf.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" -#include "viint.h" - -void *osViGetNextFramebuffer(void) -{ - register u32 saveMask; - void *framep; - saveMask = __osDisableInt(); - framep = __osViNext->framep; - __osRestoreInt(saveMask); - return framep; -} diff --git a/src/core1/io/vimgr.c b/src/core1/io/vimgr.c deleted file mode 100644 index 63804bbe..00000000 --- a/src/core1/io/vimgr.c +++ /dev/null @@ -1,109 +0,0 @@ -#include -#include -#include "viint.h" -#include "osint.h" - -OSDevMgr __osViDevMgr = {0}; - -/* .bss */ -/*static*/ OSThread viThread; -/*static*/ unsigned char viThreadStack[OS_VIM_STACKSIZE]; -/*static*/ OSMesgQueue viEventQueue; -/*static*/ OSMesg viEventBuf[5]; -/*static*/ OSIoMesg viRetraceMsg; -/*static*/ OSIoMesg viCounterMsg; - -static void viMgrMain(void *arg); -void osCreateViManager(OSPri pri) -{ - u32 savedMask; - OSPri oldPri; - OSPri myPri; - if (__osViDevMgr.active == 0) - { - __osTimerServicesInit(); - osCreateMesgQueue(&viEventQueue, viEventBuf, 5); - viRetraceMsg.hdr.type = OS_MESG_TYPE_VRETRACE; - viRetraceMsg.hdr.pri = OS_MESG_PRI_NORMAL; - viRetraceMsg.hdr.retQueue = NULL; - viCounterMsg.hdr.type = OS_MESG_TYPE_COUNTER; - viCounterMsg.hdr.pri = OS_MESG_PRI_NORMAL; - viCounterMsg.hdr.retQueue = NULL; - osSetEventMesg(OS_EVENT_VI, &viEventQueue, &viRetraceMsg); - osSetEventMesg(OS_EVENT_COUNTER, &viEventQueue, &viCounterMsg); - oldPri = -1; - myPri = osGetThreadPri(NULL); - if (myPri < pri) - { - oldPri = myPri; - osSetThreadPri(NULL, pri); - } - savedMask = __osDisableInt(); - __osViDevMgr.active = 1; - __osViDevMgr.thread = &viThread; - __osViDevMgr.cmdQueue = &viEventQueue; - __osViDevMgr.evtQueue = &viEventQueue; - __osViDevMgr.acsQueue = NULL; - __osViDevMgr.dma = NULL; - __osViDevMgr.edma = NULL; - osCreateThread(&viThread, 0, viMgrMain, &__osViDevMgr, &viThreadStack[OS_VIM_STACKSIZE], pri); - __osViInit(); - osStartThread(&viThread); - __osRestoreInt(savedMask); - if (oldPri != -1) - { - osSetThreadPri(0, oldPri); - } - } -} -u16 retrace; -static void viMgrMain(void *arg) -{ - __OSViContext *vc; - OSDevMgr *dm; - OSIoMesg *mb; - // static u16 retrace; - s32 first; - u32 count; - - mb = NULL; - first = 0; - vc = __osViGetCurrentContext(); - retrace = vc->retraceCount; - if (retrace == 0) - retrace = 1; - dm = (OSDevMgr *)arg; - while (TRUE) - { - osRecvMesg(dm->evtQueue, (OSMesg)&mb, OS_MESG_BLOCK); - switch (mb->hdr.type) - { - case OS_MESG_TYPE_VRETRACE: - __osViSwapContext(); - retrace--; - if (retrace == 0) - { - vc = __osViGetCurrentContext(); - if (vc->msgq != NULL) - osSendMesg(vc->msgq, vc->msg, OS_MESG_NOBLOCK); - retrace = vc->retraceCount; - } - __osViIntrCount++; - if (first) - { - - count = osGetCount(); - __osCurrentTime = count; - first = 0; - } - count = __osBaseCounter; - __osBaseCounter = osGetCount(); - count = __osBaseCounter - count; - __osCurrentTime = __osCurrentTime + count; - break; - case OS_MESG_TYPE_COUNTER: - __osTimerInterrupt(); - break; - } - } -} diff --git a/src/core1/io/vimodempallan1.c b/src/core1/io/vimodempallan1.c deleted file mode 100644 index 3246075b..00000000 --- a/src/core1/io/vimodempallan1.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include "viint.h" - -OSViMode osViModeMpalLan1 = { - OS_VI_MPAL_LAN1, // type - { - // comRegs - VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | - VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | 0x3000, // ctrl - WIDTH(320), // width - BURST(57, 30, 5, 70), // burst - VSYNC(525), // vSync - HSYNC(3089, 4), // hSync - LEAP(3097, 3098), // leap - HSTART(108, 748), // hStart - SCALE(2, 0), // xScale - VCURRENT(0), // vCurrent - }, - {// fldRegs - { - //[0] - ORIGIN(640), // origin - SCALE(1, 0), // yScale - HSTART(37, 511), // vStart - BURST(4, 2, 14, 0), // vBurst - VINTR(2), // vIntr - }, - { - //[1] - ORIGIN(640), // origin - SCALE(1, 0), // yScale - HSTART(37, 511), // vStart - BURST(4, 2, 14, 0), // vBurst - VINTR(2), // vIntr - }}}; diff --git a/src/core1/io/vimodentsclan1.c b/src/core1/io/vimodentsclan1.c deleted file mode 100644 index 696cd683..00000000 --- a/src/core1/io/vimodentsclan1.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include "viint.h" - -OSViMode osViModeNtscLan1 = { - OS_VI_NTSC_LAN1, // type - { - // comRegs - VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | - VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | 0x3000, // ctrl - WIDTH(320), // width - BURST(57, 34, 5, 62), // burst - VSYNC(525), // vSync - HSYNC(3093, 0), // hSync - LEAP(3093, 3093), // leap - HSTART(108, 748), // hStart - SCALE(2, 0), // xScale - VCURRENT(0), // vCurrent - }, - {// fldRegs - { - //[0] - ORIGIN(640), // origin - SCALE(1, 0), // yScale - HSTART(37, 511), // vStart - BURST(4, 2, 14, 0), // vBurst - VINTR(2), // vIntr - }, - { - //[1] - ORIGIN(640), // origin - SCALE(1, 0), // yScale - HSTART(37, 511), // vStart - BURST(4, 2, 14, 0), // vBurst - VINTR(2), // vIntr - }}}; diff --git a/src/core1/io/vimodepallan1.c b/src/core1/io/vimodepallan1.c deleted file mode 100644 index 35f8496c..00000000 --- a/src/core1/io/vimodepallan1.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include "viint.h" - -OSViMode osViModePalLan1 = { - OS_VI_PAL_LAN1, // type - { - // comRegs - VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | - VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | 0x3000, // ctrl - WIDTH(320), // width - BURST(58, 30, 4, 69), // burst - VSYNC(625), // vSync - HSYNC(3177, 23), // hSync - LEAP(3183, 3181), // leap - HSTART(128, 768), // hStart - SCALE(2, 0), // xScale - VCURRENT(0), // vCurrent - }, - {// fldRegs - { - //[0] - ORIGIN(640), // origin - SCALE(1, 0), // yScale - HSTART(95, 569), // vStart - BURST(107, 2, 9, 0), // vBurst - VINTR(2), // vIntr - }, - { - //[1] - ORIGIN(640), // origin - SCALE(1, 0), // yScale - HSTART(95, 569), // vStart - BURST(107, 2, 9, 0), // vBurst - VINTR(2), // vIntr - }}}; diff --git a/src/core1/io/visetevent.c b/src/core1/io/visetevent.c deleted file mode 100644 index 28ae7d12..00000000 --- a/src/core1/io/visetevent.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" -#include "viint.h" - -void osViSetEvent(OSMesgQueue *mq, OSMesg m, u32 retraceCount){ - register u32 saveMask; - saveMask = __osDisableInt(); - __osViNext->msgq = mq; - __osViNext->msg = m; - __osViNext->retraceCount = retraceCount; - __osRestoreInt(saveMask); -} diff --git a/src/core1/io/visetmode.c b/src/core1/io/visetmode.c deleted file mode 100644 index 7c1d43a6..00000000 --- a/src/core1/io/visetmode.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "viint.h" - -void osViSetMode(OSViMode *modep) -{ - register u32 saveMask; - saveMask = __osDisableInt(); - __osViNext->modep = modep; - __osViNext->state = VI_STATE_01; - __osViNext->control = __osViNext->modep->comRegs.ctrl; - __osRestoreInt(saveMask); -} diff --git a/src/core1/io/visetspecial.c b/src/core1/io/visetspecial.c deleted file mode 100644 index 31e027ae..00000000 --- a/src/core1/io/visetspecial.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include "viint.h" - -void osViSetSpecialFeatures(u32 func){ - - register u32 saveMask; - saveMask = __osDisableInt(); - if ((func & OS_VI_GAMMA_ON) != 0) { - __osViNext->control |= VI_CTRL_GAMMA_ON; - } - if ((func & OS_VI_GAMMA_OFF) != 0) { - __osViNext->control &= ~VI_CTRL_GAMMA_ON; - } - if ((func & OS_VI_GAMMA_DITHER_ON) != 0) { - __osViNext->control |= VI_CTRL_GAMMA_DITHER_ON; - } - if ((func & OS_VI_GAMMA_DITHER_OFF) != 0) { - __osViNext->control &= ~VI_CTRL_GAMMA_DITHER_ON; - } - if ((func & OS_VI_DIVOT_ON) != 0) { - __osViNext->control |= VI_CTRL_DIVOT_ON; - } - if ((func & OS_VI_DIVOT_OFF) != 0) { - __osViNext->control &= ~VI_CTRL_DIVOT_ON; - } - if ((func & OS_VI_DITHER_FILTER_ON) != 0) { - __osViNext->control |= VI_CTRL_DITHER_FILTER_ON; - __osViNext->control &= ~VI_CTRL_ANTIALIAS_MASK; - } - if ((func & OS_VI_DITHER_FILTER_OFF) != 0) { - __osViNext->control &= ~VI_CTRL_DITHER_FILTER_ON; - __osViNext->control |= __osViNext->modep->comRegs.ctrl & VI_CTRL_ANTIALIAS_MASK; - } - __osViNext->state |= VI_STATE_08; - - __osRestoreInt(saveMask); -} diff --git a/src/core1/io/viswapbuf.c b/src/core1/io/viswapbuf.c deleted file mode 100644 index e29eb463..00000000 --- a/src/core1/io/viswapbuf.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" -#include "viint.h" - -void osViSwapBuffer(void* frameBufPtr){ - u32 saveMask = __osDisableInt(); - __osViNext->framep = frameBufPtr; - __osViNext->state |= VI_STATE_10; - __osRestoreInt(saveMask); -} diff --git a/src/core1/io/viswapcontext.c b/src/core1/io/viswapcontext.c deleted file mode 100644 index 34795453..00000000 --- a/src/core1/io/viswapcontext.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include "viint.h" - -void __osViSwapContext() -{ - register OSViMode *vm; - register __OSViContext *vc; - u32 origin; - u32 hStart; - u32 nomValue; - u32 field; - - field = 0; - vc = __osViNext; - vm = vc->modep; - - field = IO_READ(VI_CURRENT_REG) & 1; //field num - - origin = osVirtualToPhysical(vc->framep) + (vm->fldRegs[field].origin); - if (vc->state & VI_STATE_XSCALE_UPDATED) - { - vc->x.scale |= (vm->comRegs.xScale & ~VI_SCALE_MASK); - } - else - { - vc->x.scale = vm->comRegs.xScale; - } - if (vc->state & VI_STATE_YSCALE_UPDATED) - { - nomValue = vm->fldRegs[field].yScale & VI_SCALE_MASK; - vc->y.scale = vc->y.factor * nomValue; - vc->y.scale |= vm->fldRegs[field].yScale & ~VI_SCALE_MASK; - } - else - { - vc->y.scale = vm->fldRegs[field].yScale; - } - hStart = vm->comRegs.hStart; - if (vc->state & VI_STATE_BLACK) - { - hStart = 0; - } - if (vc->state & VI_STATE_REPEATLINE) - { - vc->y.scale = 0; - origin = osVirtualToPhysical(vc->framep); - } - if (vc->state & VI_STATE_FADE) - { - vc->y.scale = (vc->y.offset << VI_SUBPIXEL_SH) & (VI_2_10_FPART_MASK << VI_SUBPIXEL_SH); - origin = osVirtualToPhysical(vc->framep); - } - IO_WRITE(VI_ORIGIN_REG, origin); - IO_WRITE(VI_WIDTH_REG, vm->comRegs.width); - IO_WRITE(VI_BURST_REG, vm->comRegs.burst); - IO_WRITE(VI_V_SYNC_REG, vm->comRegs.vSync); - IO_WRITE(VI_H_SYNC_REG, vm->comRegs.hSync); - IO_WRITE(VI_LEAP_REG, vm->comRegs.leap); - IO_WRITE(VI_H_START_REG, hStart); - IO_WRITE(VI_V_START_REG, vm->fldRegs[field].vStart); - IO_WRITE(VI_V_BURST_REG, vm->fldRegs[field].vBurst); - IO_WRITE(VI_INTR_REG, vm->fldRegs[field].vIntr); - IO_WRITE(VI_X_SCALE_REG, vc->x.scale); - IO_WRITE(VI_Y_SCALE_REG, vc->y.scale); - IO_WRITE(VI_CONTROL_REG, vc->control); - - __osViNext = __osViCurr; - __osViCurr = vc; - *__osViNext = *__osViCurr; -} diff --git a/src/core1/ll.c b/src/core1/ll.c deleted file mode 100644 index a50fc92d..00000000 --- a/src/core1/ll.c +++ /dev/null @@ -1,53 +0,0 @@ -unsigned long long __ull_rshift(unsigned long long a0, unsigned long long a1) -{ - return a0 >> a1; -} -unsigned long long __ull_rem(unsigned long long a0, unsigned long long a1) -{ - return a0 % a1; -} -unsigned long long __ull_div(unsigned long long a0, unsigned long long a1) -{ - return a0 / a1; -} - -unsigned long long __ll_lshift(unsigned long long a0, unsigned long long a1) -{ - return a0 << a1; -} - -long long __ll_rem(unsigned long long a0, long long a1) -{ - return a0 % a1; -} - -long long __ll_div(long long a0, long long a1) -{ - return a0 / a1; -} - -unsigned long long __ll_mul(unsigned long long a0, unsigned long long a1) -{ - return a0 * a1; -} - -void __ull_divremi(unsigned long long *div, unsigned long long *rem, unsigned long long a2, unsigned short a3) -{ - *div = a2 / a3; - *rem = a2 % a3; -} -long long __ll_mod(long long a0, long long a1) -{ - long long tmp = a0 % a1; - if ((tmp < 0 && a1 > 0) || (tmp > 0 && a1 < 0)) - { - - tmp += a1; - } - return tmp; -} - -long long __ll_rshift(long long a0, long long a1) -{ - return a0 >> a1; -} diff --git a/src/core1/ll_cvt.c b/src/core1/ll_cvt.c deleted file mode 100644 index c8470bf0..00000000 --- a/src/core1/ll_cvt.c +++ /dev/null @@ -1,39 +0,0 @@ -long long __d_to_ll(double a0) -{ - return a0; -} - -long long __f_to_ll(float a0) -{ - return a0; -} - -unsigned long long __d_to_ull(double a0) -{ - return a0; -} - -unsigned long long __f_to_ull(float a0) -{ - return a0; -} - -double __ll_to_d(long long a0) -{ - return a0; -} - -float __ll_to_f(long long a0) -{ - return a0; -} - -double __ull_to_d(unsigned long long a0) -{ - return a0; -} - -float __ull_to_f(unsigned long long a0) -{ - return a0; -} diff --git a/src/core1/ml.c b/src/core1/ml.c index d1d7d7d7..5c8f0245 100644 --- a/src/core1/ml.c +++ b/src/core1/ml.c @@ -181,7 +181,7 @@ void ml_vec3f_normalize_copy(f32 arg0[3], f32 arg1[3]) if (length_squared != 0) { - inverse = 1.0 / gu_sqrtf(length_squared); + inverse = 1.0 / sqrtf(length_squared); ml_vec3f_scale_copy(arg0, arg1, inverse); } else @@ -196,14 +196,14 @@ void ml_vec3f_normalize(f32 vec[3]) if (length_squared != 0) { - f32 inverse = 1.0 / gu_sqrtf(length_squared); + f32 inverse = 1.0 / sqrtf(length_squared); TUPLE_SCALE(vec, inverse) } } void ml_vec2f_normalize(f32 vec[2]) { - f32 length = gu_sqrtf(_SQ2(vec[0], vec[1])); + f32 length = sqrtf(_SQ2(vec[0], vec[1])); if (length != 0) { @@ -214,7 +214,7 @@ void ml_vec2f_normalize(f32 vec[2]) void ml_3f_normalize(f32 *x, f32 *y, f32 *z) { - f32 length = gu_sqrtf(_SQ3(*x, *y, *z)); + f32 length = sqrtf(_SQ3(*x, *y, *z)); if (length != 0) { @@ -333,7 +333,7 @@ void ml_vec3f_set_length(f32 vec[3], f32 length) { //ml_f_sin_of_angle_between_points_2D f32 func_80256AB4(f32 x1, f32 y1, f32 x2, f32 y2) { - f32 val = gu_sqrtf(y1 * y1 + x1 * x1) * gu_sqrtf(x2 * x2 + y2 * y2); + f32 val = sqrtf(y1 * y1 + x1 * x1) * sqrtf(x2 * x2 + y2 * y2); if (val) return (y1 * x2 - x1 * y2) / val; @@ -471,7 +471,7 @@ void func_8025727C(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, f32 *o1, f32 dz = z2 - z1; ft2 = (dx * dx) + (dz * dz); - horz_dist = gu_sqrtf(ft2); + horz_dist = sqrtf(ft2); if (horz_dist > 0.01) { @@ -489,7 +489,7 @@ void func_8025727C(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, f32 *o1, f32 } - dist = gu_sqrtf((dy * dy) + ft2); + dist = sqrtf((dy * dy) + ft2); if (dist > 0.01) { @@ -788,7 +788,7 @@ int func_80257F18(f32 src[3], f32 target[3], f32 *yaw) *yaw = 0; TUPLE_DIFF_COPY(diff, target, src) - h = gu_sqrtf(_SQ2(diff[2], diff[0])); + h = sqrtf(_SQ2(diff[2], diff[0])); if (h < 0.01) // (f64) 0.01 return 0; @@ -813,7 +813,7 @@ int func_8025801C(f32 target[3], f32 *yaw) *yaw = 0; TUPLE_COPY(diff, target) - h = gu_sqrtf(_SQ2(diff[2], diff[0])); + h = sqrtf(_SQ2(diff[2], diff[0])); if (h < 0.01) // (f64) 0.01 return 0; @@ -836,7 +836,7 @@ int func_80258108(f32 vec[3], f32 *arg1, f32 *arg2) *arg1 = 0; *arg2 = 0; - horz_len = gu_sqrtf(_SQ2(vec[2], vec[0])); + horz_len = sqrtf(_SQ2(vec[2], vec[0])); if (horz_len < 0.01) return 0; @@ -860,7 +860,7 @@ int func_80258210(f32 x, f32 y, f32 *dst) *dst = 0; - tmp = gu_sqrtf(_SQ2(y, x)); + tmp = sqrtf(_SQ2(y, x)); if (tmp < 0.01) return FALSE; @@ -916,7 +916,7 @@ f32 ml_vec3f_horizontal_distance_zero_likely(f32 vec1[3], f32 vec2[3]) { f32 dZ = vec1[2] - vec2[2]; if (dX != 0 || dZ != 0) { - return gu_sqrtf(_SQ2(dX, dZ)); + return sqrtf(_SQ2(dX, dZ)); } return 0; @@ -942,7 +942,7 @@ f32 ml_vec3f_length(f32 vec1[3], f32 vec2[3]) val = _SQ3(val, dY, dZ); if (val != 0) - return gu_sqrtf(val); + return sqrtf(val); return 0; } @@ -1040,7 +1040,7 @@ void func_80258A4C(f32 vec1[3], f32 arg1, f32 vec2[3], f32 *arg3, f32 *arg4, f32 TUPLE_DIFF_COPY(t1, vec2, vec1) t1[1] = 0; - *arg3 = gu_sqrtf(_SQ3(t1[0], t1[1], t1[2])); + *arg3 = sqrtf(_SQ3(t1[0], t1[1], t1[2])); t2[2] = 0; t2[1] = 0; diff --git a/src/core1/audio/code_21A80.c b/src/core1/n_audio/code_21A80.c similarity index 100% rename from src/core1/audio/code_21A80.c rename to src/core1/n_audio/code_21A80.c diff --git a/src/core1/audio/code_21B50.c b/src/core1/n_audio/code_21B50.c similarity index 100% rename from src/core1/audio/code_21B50.c rename to src/core1/n_audio/code_21B50.c diff --git a/include/n_abi.h b/src/core1/n_audio/n_abi.h similarity index 100% rename from include/n_abi.h rename to src/core1/n_audio/n_abi.h diff --git a/src/core1/audio/n_adpcm.c b/src/core1/n_audio/n_adpcm.c similarity index 100% rename from src/core1/audio/n_adpcm.c rename to src/core1/n_audio/n_adpcm.c diff --git a/src/core1/audio/n_auxbus.c b/src/core1/n_audio/n_auxbus.c similarity index 100% rename from src/core1/audio/n_auxbus.c rename to src/core1/n_audio/n_auxbus.c diff --git a/include/n_cseqp.h b/src/core1/n_audio/n_cseqp.h similarity index 100% rename from include/n_cseqp.h rename to src/core1/n_audio/n_cseqp.h diff --git a/src/core1/audio/n_csplayer.c b/src/core1/n_audio/n_csplayer.c similarity index 99% rename from src/core1/audio/n_csplayer.c rename to src/core1/n_audio/n_csplayer.c index 5561155c..d962cdfe 100644 --- a/src/core1/audio/n_csplayer.c +++ b/src/core1/n_audio/n_csplayer.c @@ -6,7 +6,6 @@ #include "seqp.h" #include "file_and_line.h" -extern void func_8033F000(const char *, const char *, int); void n_alSynSetVol( N_ALVoice *v, s16 volume, ALMicroTime t); s16 __n_vsVol(ALVoiceState *voice, ALSeqPlayer *seqp); ALVoiceState *__n_lookupVoice(ALSeqPlayer *, u8, u8); diff --git a/src/core1/audio/n_csq.c b/src/core1/n_audio/n_csq.c similarity index 100% rename from src/core1/audio/n_csq.c rename to src/core1/n_audio/n_csq.c diff --git a/src/core1/audio/n_drvrNew.c b/src/core1/n_audio/n_drvrNew.c similarity index 100% rename from src/core1/audio/n_drvrNew.c rename to src/core1/n_audio/n_drvrNew.c diff --git a/src/core1/audio/n_env.c b/src/core1/n_audio/n_env.c similarity index 100% rename from src/core1/audio/n_env.c rename to src/core1/n_audio/n_env.c diff --git a/src/core1/audio/n_envresample.c b/src/core1/n_audio/n_envresample.c similarity index 100% rename from src/core1/audio/n_envresample.c rename to src/core1/n_audio/n_envresample.c diff --git a/src/core1/audio/n_load.c b/src/core1/n_audio/n_load.c similarity index 100% rename from src/core1/audio/n_load.c rename to src/core1/n_audio/n_load.c diff --git a/src/core1/audio/n_mainbus.c b/src/core1/n_audio/n_mainbus.c similarity index 100% rename from src/core1/audio/n_mainbus.c rename to src/core1/n_audio/n_mainbus.c diff --git a/src/core1/audio/n_resample.c b/src/core1/n_audio/n_resample.c similarity index 100% rename from src/core1/audio/n_resample.c rename to src/core1/n_audio/n_resample.c diff --git a/src/core1/audio/n_resample_add01.c_ b/src/core1/n_audio/n_resample_add01.c_ similarity index 100% rename from src/core1/audio/n_resample_add01.c_ rename to src/core1/n_audio/n_resample_add01.c_ diff --git a/src/core1/audio/n_reverb.c b/src/core1/n_audio/n_reverb.c similarity index 100% rename from src/core1/audio/n_reverb.c rename to src/core1/n_audio/n_reverb.c diff --git a/src/core1/n_reverb_add01.c_ b/src/core1/n_audio/n_reverb_add01.c_ similarity index 100% rename from src/core1/n_reverb_add01.c_ rename to src/core1/n_audio/n_reverb_add01.c_ diff --git a/src/core1/n_reverb_add02.c_ b/src/core1/n_audio/n_reverb_add02.c_ similarity index 100% rename from src/core1/n_reverb_add02.c_ rename to src/core1/n_audio/n_reverb_add02.c_ diff --git a/src/core1/n_reverb_add03.c_ b/src/core1/n_audio/n_reverb_add03.c_ similarity index 100% rename from src/core1/n_reverb_add03.c_ rename to src/core1/n_audio/n_reverb_add03.c_ diff --git a/src/core1/n_reverb_add04.c_ b/src/core1/n_audio/n_reverb_add04.c_ similarity index 100% rename from src/core1/n_reverb_add04.c_ rename to src/core1/n_audio/n_reverb_add04.c_ diff --git a/src/core1/audio/n_save.c b/src/core1/n_audio/n_save.c similarity index 100% rename from src/core1/audio/n_save.c rename to src/core1/n_audio/n_save.c diff --git a/src/core1/audio/n_save_add01.c_ b/src/core1/n_audio/n_save_add01.c_ similarity index 100% rename from src/core1/audio/n_save_add01.c_ rename to src/core1/n_audio/n_save_add01.c_ diff --git a/src/core1/audio/n_seq.c b/src/core1/n_audio/n_seq.c similarity index 100% rename from src/core1/audio/n_seq.c rename to src/core1/n_audio/n_seq.c diff --git a/src/core1/audio/n_seqplayer.c b/src/core1/n_audio/n_seqplayer.c similarity index 100% rename from src/core1/audio/n_seqplayer.c rename to src/core1/n_audio/n_seqplayer.c diff --git a/src/core1/audio/n_sl.c b/src/core1/n_audio/n_sl.c similarity index 100% rename from src/core1/audio/n_sl.c rename to src/core1/n_audio/n_sl.c diff --git a/src/core1/audio/n_synaddplayer.c b/src/core1/n_audio/n_synaddplayer.c similarity index 100% rename from src/core1/audio/n_synaddplayer.c rename to src/core1/n_audio/n_synaddplayer.c diff --git a/src/core1/audio/n_synallocfx.c b/src/core1/n_audio/n_synallocfx.c similarity index 100% rename from src/core1/audio/n_synallocfx.c rename to src/core1/n_audio/n_synallocfx.c diff --git a/src/core1/audio/n_synallocvoice.c b/src/core1/n_audio/n_synallocvoice.c similarity index 100% rename from src/core1/audio/n_synallocvoice.c rename to src/core1/n_audio/n_synallocvoice.c diff --git a/src/core1/audio/n_syndelete.c b/src/core1/n_audio/n_syndelete.c similarity index 100% rename from src/core1/audio/n_syndelete.c rename to src/core1/n_audio/n_syndelete.c diff --git a/src/core1/audio/n_synfreevoice.c b/src/core1/n_audio/n_synfreevoice.c similarity index 100% rename from src/core1/audio/n_synfreevoice.c rename to src/core1/n_audio/n_synfreevoice.c diff --git a/src/core1/audio/n_synsetfxmix.c b/src/core1/n_audio/n_synsetfxmix.c similarity index 100% rename from src/core1/audio/n_synsetfxmix.c rename to src/core1/n_audio/n_synsetfxmix.c diff --git a/src/core1/audio/n_synsetpan.c b/src/core1/n_audio/n_synsetpan.c similarity index 100% rename from src/core1/audio/n_synsetpan.c rename to src/core1/n_audio/n_synsetpan.c diff --git a/src/core1/audio/n_synsetpitch.c b/src/core1/n_audio/n_synsetpitch.c similarity index 100% rename from src/core1/audio/n_synsetpitch.c rename to src/core1/n_audio/n_synsetpitch.c diff --git a/src/core1/audio/n_synsetpriority.c b/src/core1/n_audio/n_synsetpriority.c similarity index 100% rename from src/core1/audio/n_synsetpriority.c rename to src/core1/n_audio/n_synsetpriority.c diff --git a/src/core1/audio/n_synsetvol.c b/src/core1/n_audio/n_synsetvol.c similarity index 100% rename from src/core1/audio/n_synsetvol.c rename to src/core1/n_audio/n_synsetvol.c diff --git a/src/core1/audio/n_synstartvoice.c b/src/core1/n_audio/n_synstartvoice.c similarity index 100% rename from src/core1/audio/n_synstartvoice.c rename to src/core1/n_audio/n_synstartvoice.c diff --git a/src/core1/audio/n_synstartvoiceparam.c b/src/core1/n_audio/n_synstartvoiceparam.c similarity index 100% rename from src/core1/audio/n_synstartvoiceparam.c rename to src/core1/n_audio/n_synstartvoiceparam.c diff --git a/src/core1/audio/n_synstopvoice.c b/src/core1/n_audio/n_synstopvoice.c similarity index 100% rename from src/core1/audio/n_synstopvoice.c rename to src/core1/n_audio/n_synstopvoice.c diff --git a/include/n_synth.h b/src/core1/n_audio/n_synth.h similarity index 100% rename from include/n_synth.h rename to src/core1/n_audio/n_synth.h diff --git a/src/core1/audio/n_synthesizer.c b/src/core1/n_audio/n_synthesizer.c similarity index 100% rename from src/core1/audio/n_synthesizer.c rename to src/core1/n_audio/n_synthesizer.c diff --git a/src/core1/os/createmesgqueue.c b/src/core1/os/createmesgqueue.c deleted file mode 100644 index 97ad6a04..00000000 --- a/src/core1/os/createmesgqueue.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern struct __osThreadTail -{ - OSThread *next; - OSPri priority; -} __osThreadTail; - -void osCreateMesgQueue(OSMesgQueue *mq, OSMesg *msg, s32 msgCount) -{ - mq->mtqueue = (OSThread *)&__osThreadTail; - mq->fullqueue = (OSThread *)&__osThreadTail; - mq->validCount = 0; - mq->first = 0; - mq->msgCount = msgCount; - mq->msg = msg; -} diff --git a/src/core1/os/createthread.c b/src/core1/os/createthread.c deleted file mode 100644 index 80748844..00000000 --- a/src/core1/os/createthread.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -void __osCleanupThread(void); -extern OSThread *__osActiveQueue; -void osCreateThread(OSThread *t, OSId id, void (*entry)(void *), void *arg, void *sp, OSPri p) -{ - register u32 saveMask; - OSIntMask mask; - t->id = id; - t->priority = p; - t->next = NULL; - t->queue = NULL; - t->context.pc = (u32)entry; - t->context.a0 = (u64)arg; - t->context.sp = (u64)sp - 16; - t->context.ra = (u64)__osCleanupThread; - // t->context.ra = (u64)func_8026ABE0; - mask = OS_IM_ALL; - t->context.sr = SR_IMASK | SR_EXL | SR_IE; - t->context.rcp = (mask & RCP_IMASK) >> RCP_IMASKSHIFT; - t->context.fpcsr = (u32)(FPCSR_FS | FPCSR_EV); - t->fp = 0; - t->state = OS_STATE_STOPPED; - t->flags = 0; - saveMask = __osDisableInt(); - t->tlnext = __osActiveQueue; - __osActiveQueue = t; - __osRestoreInt(saveMask); -} diff --git a/src/core1/os/destroythread.c b/src/core1/os/destroythread.c deleted file mode 100644 index 69e57803..00000000 --- a/src/core1/os/destroythread.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern OSThread *__osRunningThread; -extern OSThread *__osActiveQueue; -extern void __osDispatchThread(void); - -void osDestroyThread(OSThread *t) -{ - register u32 saveMask; - register OSThread *pred; - register OSThread *succ; - saveMask = __osDisableInt(); - if (t == NULL) - { - t = __osRunningThread; - } - else - { - if (t->state != OS_STATE_STOPPED) - { - __osDequeueThread(t->queue, t); - } - } - if (__osActiveQueue == t) - { - __osActiveQueue = __osActiveQueue->tlnext; - } - else - { - pred = __osActiveQueue; - while (succ = pred->tlnext) - { - if (succ == t) - { - pred->tlnext = t->tlnext; - break; - } - pred = succ; - } - } - if (t == __osRunningThread) - { - __osDispatchThread(); - } - __osRestoreInt(saveMask); -} diff --git a/src/core1/os/getthreadpri.c b/src/core1/os/getthreadpri.c deleted file mode 100644 index efeaf729..00000000 --- a/src/core1/os/getthreadpri.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern OSThread *__osRunningThread; - -OSPri osGetThreadPri(OSThread *thread) -{ - if (thread == NULL) - thread = __osRunningThread; - return thread->priority; -} diff --git a/src/core1/os/gettime.c b/src/core1/os/gettime.c deleted file mode 100644 index 0f4b981c..00000000 --- a/src/core1/os/gettime.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include "osint.h" - - -OSTime osGetTime() -{ - u32 tmptime; - u32 elapseCount; - OSTime currentCount; - register u32 saveMask; - saveMask = __osDisableInt(); - tmptime = osGetCount(); - elapseCount = tmptime - __osBaseCounter; - currentCount = __osCurrentTime; - __osRestoreInt(saveMask); - return currentCount + elapseCount; -} diff --git a/src/core1/os/initialize.c b/src/core1/os/initialize.c deleted file mode 100644 index a721101e..00000000 --- a/src/core1/os/initialize.c +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - - -typedef struct -{ - /* 0x0 */ unsigned int inst1; - /* 0x4 */ unsigned int inst2; - /* 0x8 */ unsigned int inst3; - /* 0xC */ unsigned int inst4; -} __osExceptionVector; -// extern __osExceptionVector __osExceptionPreamble; -// extern __osExceptionVector D_8026A2E0; - -extern void (*func_8026A2E0)(void); - -OSTime osClockRate = OS_CLOCK_RATE; -s32 osViClock = VI_NTSC_CLOCK; -u32 __osShutdown = 0; -u32 __OSGlobalIntMask = OS_IM_ALL; -/* .bss */ -u32 __osFinalrom; - -void __osInitialize_common() -{ - u32 pifdata; - u32 clock = 0; - __osFinalrom = TRUE; - __osSetSR(__osGetSR() | SR_CU1); //enable fpu - __osSetFpcCsr(FPCSR_FS | FPCSR_EV); //flush denorm to zero, enable invalid operation - - while (__osSiRawReadIo(PIF_RAM_END - 3, &pifdata)) //last byte of joychannel ram - { - ; - } - while (__osSiRawWriteIo(PIF_RAM_END - 3, pifdata | 8)) - { - ; //todo: magic contant - } - *(__osExceptionVector *)UT_VEC = *(__osExceptionVector *)&func_8026A2E0; //__osExceptionPreamble; - *(__osExceptionVector *)XUT_VEC = *(__osExceptionVector *)&func_8026A2E0; //__osExceptionPreamble; - *(__osExceptionVector *)ECC_VEC = *(__osExceptionVector *)&func_8026A2E0; //__osExceptionPreamble; - *(__osExceptionVector *)E_VEC = *(__osExceptionVector *)&func_8026A2E0; //__osExceptionPreamble; - osWritebackDCache((void *)UT_VEC, E_VEC - UT_VEC + sizeof(__osExceptionVector)); - osInvalICache((void *)UT_VEC, E_VEC - UT_VEC + sizeof(__osExceptionVector)); - osMapTLBRdb(); - osPiRawReadIo(4, &clock); //TODO: remove magic constant; - clock &= ~0xf; //clear lower 4 bits - if (clock != 0) - { - osClockRate = clock; - } - osClockRate = osClockRate * 3 / 4; - if (osResetType == 0 /*cold reset */) - { - bzero(osAppNMIBuffer, OS_APP_NMI_BUFSIZE); - } - if (osTvType == OS_TV_PAL) - { - osViClock = VI_PAL_CLOCK; - } - else if (osTvType == OS_TV_MPAL) - { - osViClock = VI_MPAL_CLOCK; - } - else - { - osViClock = VI_NTSC_CLOCK; - } -} diff --git a/src/core1/os/jammesg.c b/src/core1/os/jammesg.c deleted file mode 100644 index aa777886..00000000 --- a/src/core1/os/jammesg.c +++ /dev/null @@ -1,31 +0,0 @@ -#include - -extern OSThread *__osRunningThread; - -s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag) -{ - register u32 saveMask = __osDisableInt(); - while (mq->validCount >= mq->msgCount) - { - if (flag == OS_MESG_BLOCK) - { - __osRunningThread->state = OS_STATE_WAITING; - __osEnqueueAndYield(&mq->fullqueue); - } - else - { - __osRestoreInt(saveMask); - return -1; - } - } - - mq->first = (mq->first + mq->msgCount - 1) % mq->msgCount; - mq->msg[mq->first] = msg; - mq->validCount++; - if (mq->mtqueue->next != NULL) - { - osStartThread(__osPopThread(&mq->mtqueue)); - } - __osRestoreInt(saveMask); - return 0; -} diff --git a/src/core1/os/kdebugserver.c b/src/core1/os/kdebugserver.c deleted file mode 100644 index 9686ad6e..00000000 --- a/src/core1/os/kdebugserver.c +++ /dev/null @@ -1,4 +0,0 @@ -#include - -//not included in final rom, but __osThreadSave is here for some reason -OSThread __osThreadSave; diff --git a/src/core1/os/pidma.c b/src/core1/os/pidma.c deleted file mode 100644 index 61adc721..00000000 --- a/src/core1/os/pidma.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern OSDevMgr __osPiDevMgr; - -s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, u32 devAddr, void *dramAddr, u32 size, OSMesgQueue *mq) -{ - register s32 ret; - if (!__osPiDevMgr.active) - return -1; - if (direction == OS_READ) - mb->hdr.type = OS_MESG_TYPE_DMAREAD; - else - mb->hdr.type = OS_MESG_TYPE_DMAWRITE; - mb->hdr.pri = priority; - mb->hdr.retQueue = mq; - mb->dramAddr = dramAddr; - mb->devAddr = devAddr; - mb->size = size; - mb->piHandle = NULL; - if (priority == OS_MESG_PRI_HIGH) - { - ret = osJamMesg(osPiGetCmdQueue(), (OSMesg)mb, OS_MESG_NOBLOCK); - } - else - { - ret = osSendMesg(osPiGetCmdQueue(), (OSMesg)mb, OS_MESG_NOBLOCK); - } - return ret; -} diff --git a/src/core1/os/recvmesg.c b/src/core1/os/recvmesg.c deleted file mode 100644 index d8dccc69..00000000 --- a/src/core1/os/recvmesg.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern OSThread *__osRunningThread;//_osRunningThread; - -s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flags) -{ - register u32 saveMask; - saveMask = __osDisableInt(); - - while (MQ_IS_EMPTY(mq)) - { - if (flags == OS_MESG_NOBLOCK) - { - __osRestoreInt(saveMask); - return -1; - } - __osRunningThread->state = OS_STATE_WAITING; - __osEnqueueAndYield(&mq->mtqueue); - } - - if (msg != NULL) - { - *msg = mq->msg[mq->first]; - } - mq->first = (mq->first + 1) % mq->msgCount; - mq->validCount--; - if (mq->fullqueue->next != NULL) - { - osStartThread(__osPopThread(&mq->fullqueue)); - } - __osRestoreInt(saveMask); - return 0; -} diff --git a/src/core1/os/resetglobalintmask.c b/src/core1/os/resetglobalintmask.c deleted file mode 100644 index d849dfd7..00000000 --- a/src/core1/os/resetglobalintmask.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -void __osResetGlobalIntMask(OSHWIntr interrupt) -{ - register u32 saveMask = __osDisableInt(); - - //not sure about these constants, SR_IBIT3 is external level 3 INT0, which I think corresponds to the rcp - //os.h has several masks defined that end in 401 but non that are just 401 - __OSGlobalIntMask &= ~(interrupt & ~(SR_IBIT3 | SR_IE)); - - __osRestoreInt(saveMask); -} diff --git a/src/core1/os/sendmesg.c b/src/core1/os/sendmesg.c deleted file mode 100644 index aea77379..00000000 --- a/src/core1/os/sendmesg.c +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern OSThread *__osRunningThread; - -s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flags) -{ - register u32 saveMask; - register s32 last; - saveMask = __osDisableInt(); - while (MQ_IS_FULL(mq)) - { - if (flags == OS_MESG_BLOCK) - { - __osRunningThread->state = OS_STATE_WAITING; - __osEnqueueAndYield(&mq->fullqueue); - } - else - { - __osRestoreInt(saveMask); - return -1; - } - } - last = (mq->first + mq->validCount) % mq->msgCount; - mq->msg[last] = msg; - mq->validCount++; - if (mq->mtqueue->next != NULL) - { - osStartThread(__osPopThread(&mq->mtqueue)); - } - __osRestoreInt(saveMask); - return 0; -} diff --git a/src/core1/os/seteventmesg.c b/src/core1/os/seteventmesg.c deleted file mode 100644 index a95b6158..00000000 --- a/src/core1/os/seteventmesg.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include "osint.h" - -__OSEventState __osEventStateTab[OS_NUM_EVENTS]; -void osSetEventMesg(OSEvent event, OSMesgQueue *mq, OSMesg msg) -{ - register u32 saveMask = __osDisableInt(); - __OSEventState *es; - - es = &__osEventStateTab[event]; - es->messageQueue = mq; - es->message = msg; - __osRestoreInt(saveMask); -} diff --git a/src/core1/os/setglobalintmask.c b/src/core1/os/setglobalintmask.c deleted file mode 100644 index 3fda389a..00000000 --- a/src/core1/os/setglobalintmask.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -void __osSetGlobalIntMask(OSHWIntr mask) -{ - register u32 saveMask = __osDisableInt(); - __OSGlobalIntMask |= mask; - __osRestoreInt(saveMask); -} diff --git a/src/core1/os/settimer.c b/src/core1/os/settimer.c deleted file mode 100644 index 6dbf92d5..00000000 --- a/src/core1/os/settimer.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include "osint.h" -int osSetTimer(OSTimer *t, OSTime value, OSTime interval, OSMesgQueue *mq, OSMesg msg) -{ - OSTime time; - t->next = NULL; - t->prev = NULL; - t->interval = interval; - if(value != 0) t->value = value; - else t->value = interval; - t->mq = mq; - t->msg = msg; - time = __osInsertTimer(t); - if(__osTimerList->next == t) { - __osSetTimerIntr(time); - } - return 0; -} - diff --git a/src/core1/os/settreadpri.c b/src/core1/os/settreadpri.c deleted file mode 100644 index c4cf1bac..00000000 --- a/src/core1/os/settreadpri.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern OSThread *__osRunningThread; -extern OSThread *__osRunQueue; - -void osSetThreadPri(OSThread *t, OSPri pri) -{ - register u32 saveMask = __osDisableInt(); - if (t == NULL) - t = __osRunningThread; - if (t->priority != pri) - { - t->priority = pri; - if (t != __osRunningThread && t->state != OS_STATE_STOPPED) - { - __osDequeueThread(t->queue, t); - __osEnqueueThread(t->queue, t); - } - if (__osRunningThread->priority < __osRunQueue->priority) - { - __osRunningThread->state = OS_STATE_RUNNABLE; - __osEnqueueAndYield(&__osRunQueue); - } - } - __osRestoreInt(saveMask); -} diff --git a/src/core1/os/startthread.c b/src/core1/os/startthread.c deleted file mode 100644 index 7158bbdf..00000000 --- a/src/core1/os/startthread.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -extern OSThread * __osRunQueue; -extern OSThread * __osRunningThread; - -void osStartThread(OSThread *t) -{ - register u32 saveMask = __osDisableInt(); - switch (t->state) - { - case OS_STATE_WAITING: - t->state = OS_STATE_RUNNABLE; - __osEnqueueThread(&__osRunQueue, t); - break; - case OS_STATE_STOPPED: - if (t->queue == NULL || t->queue == &__osRunQueue) - { - t->state = OS_STATE_RUNNABLE; - __osEnqueueThread(&__osRunQueue, t); - } - else - { - t->state = OS_STATE_WAITING; - __osEnqueueThread(t->queue, t); - __osEnqueueThread(&__osRunQueue, __osPopThread(t->queue)); - } - break; - } - if (__osRunningThread == NULL) - { - __osDispatchThread(); - } - else - { - if (__osRunningThread->priority < __osRunQueue->priority) - { - __osRunningThread->state = OS_STATE_RUNNABLE; - __osEnqueueAndYield(&__osRunQueue); - } - } - __osRestoreInt(saveMask); -} diff --git a/src/core1/os/stopthread.c b/src/core1/os/stopthread.c deleted file mode 100644 index a5a2cdef..00000000 --- a/src/core1/os/stopthread.c +++ /dev/null @@ -1,30 +0,0 @@ -#include - -extern OSThread *__osRunningThread; - -void osStopThread(OSThread *t) -{ - register u32 saveMask = __osDisableInt(); - register u16 state; - if (t == NULL) - { - state = OS_STATE_RUNNING; - } - else - { - state = t->state; - } - switch (state) - { - case OS_STATE_RUNNING: - __osRunningThread->state = OS_STATE_STOPPED; - __osEnqueueAndYield(NULL); - break; - case OS_STATE_RUNNABLE: - case OS_STATE_WAITING: - t->state = OS_STATE_STOPPED; - __osDequeueThread(t->queue, t); - break; - } - __osRestoreInt(saveMask); -} diff --git a/src/core1/os/stoptimer.c b/src/core1/os/stoptimer.c deleted file mode 100644 index 9bdf8dab..00000000 --- a/src/core1/os/stoptimer.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include "osint.h" - -int osStopTimer(OSTimer *t) -{ - register u32 savedMask; - OSTimer *timep; - - if (t->next == NULL) - return -1; - savedMask = __osDisableInt(); - timep = t->next; - if (timep != __osTimerList) - { - timep->value += t->value; - } - t->prev->next = t->next; - t->next->prev = t->prev; - t->next = NULL; - t->prev = NULL; - if (__osTimerList->next == __osTimerList) - { - __osSetCompare(0); - } - __osRestoreInt(savedMask); - return 0; -} diff --git a/src/core1/os/thread.c b/src/core1/os/thread.c deleted file mode 100644 index 102f88db..00000000 --- a/src/core1/os/thread.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include "osint.h" - -struct __osThreadTail __osThreadTail = {0, -1}; -OSThread *__osRunQueue = (OSThread *)&__osThreadTail; -OSThread *__osActiveQueue = (OSThread *)&__osThreadTail; -OSThread *__osRunningThread = {0}; -OSThread *__osFaultedThread = {0}; -void __osDequeueThread(OSThread **queue, OSThread *t) -{ - register OSThread *pred; - register OSThread *succ; - pred = (OSThread *)queue; //this is actually legit.. - succ = pred->next; - while (succ != NULL) - { - if (succ == t) - { - pred->next = t->next; - return; - } - pred = succ; - succ = pred->next; - } -} - diff --git a/src/core1/os/timerintr.c b/src/core1/os/timerintr.c deleted file mode 100644 index 156f2b28..00000000 --- a/src/core1/os/timerintr.c +++ /dev/null @@ -1,99 +0,0 @@ -#include -#include "osint.h" - -OSTimer *__osTimerList = &__osBaseTimer; -OSTimer __osBaseTimer; -OSTime __osCurrentTime; -u32 __osBaseCounter; -u32 __osViIntrCount; -u32 __osTimerCounter; -void __osTimerServicesInit(void) -{ - __osCurrentTime = 0; - __osBaseCounter = 0; - __osViIntrCount = 0; - __osTimerList->prev = __osTimerList; - __osTimerList->next = __osTimerList->prev; - __osTimerList->value = 0; - __osTimerList->interval = __osTimerList->value; - __osTimerList->mq = NULL; - __osTimerList->msg = 0; -} - -void __osTimerInterrupt(void) -{ - OSTimer *t; - u32 count; - u32 elapsed_cycles; - - if (__osTimerList->next == __osTimerList) - return; - while (1) - { - t = __osTimerList->next; - if (t == __osTimerList) - { - __osSetCompare(0); - __osTimerCounter = 0; - break; - } - count = osGetCount(); - elapsed_cycles = count - __osTimerCounter; - __osTimerCounter = count; - if (elapsed_cycles < t->value) - { - t->value -= elapsed_cycles; - __osSetTimerIntr(t->value); - return; - } - else - { - t->prev->next = t->next; - t->next->prev = t->prev; - t->next = NULL; - t->prev = NULL; - if (t->mq != NULL) - { - osSendMesg(t->mq, t->msg, OS_MESG_NOBLOCK); - } - if (t->interval != 0) - { - t->value = t->interval; - __osInsertTimer(t); - } - } - } -} -// -void __osSetTimerIntr(OSTime tim) -{ - OSTime NewTime; - u32 savedMask; - savedMask = __osDisableInt(); - __osTimerCounter = osGetCount(); - NewTime = tim + __osTimerCounter; - __osSetCompare(NewTime); - __osRestoreInt(savedMask); -} -OSTime __osInsertTimer(OSTimer *t) -{ - OSTimer *timep; - OSTime tim; - u32 savedMask; - savedMask = __osDisableInt(); - for (timep = __osTimerList->next, tim = t->value; - timep != __osTimerList && tim > timep->value; - tim -= timep->value, timep = timep->next) - { - ; - } - t->value = tim; - if (timep != __osTimerList) - timep->value -= tim; - t->next = timep; - t->prev = timep->prev; - timep->prev->next = t; - timep->prev = t; - __osRestoreInt(savedMask); - return tim; -} diff --git a/src/core1/os/virtualtophysical.c b/src/core1/os/virtualtophysical.c deleted file mode 100644 index e952a60b..00000000 --- a/src/core1/os/virtualtophysical.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include "osint.h" - -u32 osVirtualToPhysical(void *addr) -{ - if (IS_KSEG0(addr)) - { - return K0_TO_PHYS(addr); - } - else if (IS_KSEG1(addr)) - { - return K1_TO_PHYS(addr); - } - else - { - return __osProbeTLB(addr); - } -} diff --git a/src/core1/os/yieldthread.c b/src/core1/os/yieldthread.c deleted file mode 100644 index 9dcf6c72..00000000 --- a/src/core1/os/yieldthread.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include "osint.h" - -void osYieldThread(void){ - register u32 saveMask = __osDisableInt(); - __osRunningThread->state = OS_STATE_RUNNABLE; - __osEnqueueAndYield(&__osRunQueue); - __osRestoreInt(saveMask); -} diff --git a/src/core1/overlay.c b/src/core1/overlay.c index 3cb11bc6..b54db7f4 100644 --- a/src/core1/overlay.c +++ b/src/core1/overlay.c @@ -24,7 +24,7 @@ void overlay_load( u32 sp2C; u32 *tmp; - osWriteBackDCacheAll(); + osWritebackDCacheAll(); osInvalDCache(ram_start, ram_end - ram_start); osInvalICache(ram_start, ram_end - ram_start); @@ -50,7 +50,7 @@ void overlay_load( if(bss_start){ bzero(bss_start, bss_end - bss_start); - osWriteBackDCacheAll(); + osWritebackDCacheAll(); tmp = (u32*) bss_start; tmp[0] = sp2C; tmp[1] = sp30; diff --git a/src/core1/syncprintf.c b/src/core1/syncprintf.c deleted file mode 100644 index 55aecf1a..00000000 --- a/src/core1/syncprintf.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -void osSyncPrintf(const char *fmt, ...) -{ - int ans; - va_list ap; - // these functions intentionally left blank. ifdeffed out in rom release -} -void rmonPrintf(const char *fmt, ...) -{ - int ans; - va_list ap; -} diff --git a/src/core1/audio/code_219D0.c b/src/core1/ultra/audio/code_219D0.c similarity index 100% rename from src/core1/audio/code_219D0.c rename to src/core1/ultra/audio/code_219D0.c diff --git a/src/core1/audio/code_21AF0.c b/src/core1/ultra/audio/code_21AF0.c similarity index 100% rename from src/core1/audio/code_21AF0.c rename to src/core1/ultra/audio/code_21AF0.c diff --git a/include/cseq.h b/src/core1/ultra/audio/cseq.h similarity index 100% rename from include/cseq.h rename to src/core1/ultra/audio/cseq.h diff --git a/include/cseqp.h b/src/core1/ultra/audio/cseqp.h similarity index 100% rename from include/cseqp.h rename to src/core1/ultra/audio/cseqp.h diff --git a/include/initfx.h b/src/core1/ultra/audio/initfx.h similarity index 100% rename from include/initfx.h rename to src/core1/ultra/audio/initfx.h diff --git a/src/core1/ultra/audio/seq.h b/src/core1/ultra/audio/seq.h new file mode 100644 index 00000000..479b3396 --- /dev/null +++ b/src/core1/ultra/audio/seq.h @@ -0,0 +1,9 @@ + + +#ifndef __seq__ +#define __seq__ + +char __alSeqNextDelta (ALSeq *seq, s32 *pDeltaTicks); + + +#endif /* __seq__ */ diff --git a/src/core1/ultra/audio/seqp.h b/src/core1/ultra/audio/seqp.h new file mode 100755 index 00000000..c9ab02ba --- /dev/null +++ b/src/core1/ultra/audio/seqp.h @@ -0,0 +1,37 @@ + + +#define KILL_TIME 50000 /* 50 ms */ + +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif + +#ifndef MAX +#define MAX(a,b) (((a)>(b))?(a):(b)) +#endif + +ALVoiceState *__mapVoice(ALSeqPlayer *, u8, u8, u8); +void __unmapVoice(ALSeqPlayer *seqp, ALVoice *voice); +char __voiceNeedsNoteKill(ALSeqPlayer *seqp, ALVoice *voice, ALMicroTime killTime); /* sct 1/5/96 */ + +ALVoiceState *__lookupVoice(ALSeqPlayer *, u8, u8); +ALSound *__lookupSound(ALSeqPlayer *, u8, u8, u8); +ALSound *__lookupSoundQuick(ALSeqPlayer *, u8, u8, u8); + +s16 __vsVol(ALVoiceState *voice, ALSeqPlayer *seqp); +ALMicroTime __vsDelta(ALVoiceState *voice, ALMicroTime t); +ALPan __vsPan(ALVoiceState *voice, ALSeqPlayer *seqp); + +void __initFromBank(ALSeqPlayer *seqp, ALBank *b); +void __initChanState(ALSeqPlayer *seqp); +void __resetPerfChanState(ALSeqPlayer *seqp, s32 chan); +void __setInstChanState(ALSeqPlayer *seqp, ALInstrument *inst, s32 chan); + +void __seqpPrintVoices(ALSeqPlayer *); +void __seqpReleaseVoice(ALSeqPlayer *seqp, ALVoice *voice, + ALMicroTime deltaTime); + +void __seqpStopOsc(ALSeqPlayer *seqp, ALVoiceState *vs); + +void __postNextSeqEvent(ALSeqPlayer *seqp); /* sct 11/7/95 */ + diff --git a/include/synthInternals.h b/src/core1/ultra/audio/synthInternals.h similarity index 97% rename from include/synthInternals.h rename to src/core1/ultra/audio/synthInternals.h index d25bb944..c6c476c7 100755 --- a/include/synthInternals.h +++ b/src/core1/ultra/audio/synthInternals.h @@ -24,6 +24,7 @@ #define __audioInternals__ #include +#include /* * filter message ids @@ -317,12 +318,10 @@ typedef struct PVoice_s { ALFilter *channelKnob; ALLoadFilter decoder; ALResampler resampler; - ALEnvMixer envmixer; + ALEnvMixer envmixer; s32 offset; } PVoice; - - /* * prototypes for private driver functions */ @@ -331,10 +330,15 @@ void __freeParam(ALParam *param); void _freePVoice(ALSynth *drvr, PVoice *pvoice); void _collectPVoices(ALSynth *drvr); -s32 _timeToSamples(ALSynth *drvr, s32 micros); +s32 _timeToSamples(ALSynth *ALSynth, s32 micros); ALMicroTime _samplesToTime(ALSynth *synth, s32 samples); +// This was renamed to have a leading underscore in 2.0J +#if BUILD_VERSION < VERSION_J +#define _init_lpfilter init_lpfilter +#endif +void _init_lpfilter(ALLowPass *lp); #endif diff --git a/src/core1/viewport.c b/src/core1/viewport.c index 11cf7586..1e1bfbaf 100644 --- a/src/core1/viewport.c +++ b/src/core1/viewport.c @@ -479,7 +479,7 @@ bool viewport_func_8024E030(f32 pos[3], f32 *arg1) return FALSE; } - temp_f2 = gu_sqrtf((delta[1] * delta[1]) + (delta[2] * delta[2])) * sinf(fovy_radians); + temp_f2 = sqrtf((delta[1] * delta[1]) + (delta[2] * delta[2])) * sinf(fovy_radians); temp_f2_2 = (((f32) gFramebufferWidth) / ((f32) gFramebufferHeight)) * temp_f2; arg1[0] = (f32) (((delta[0] / temp_f2_2) + 1) * (((f32) gFramebufferWidth) / 2)); diff --git a/src/core2/ba/anim.c b/src/core2/ba/anim.c index af0d67d7..0c3a558b 100644 --- a/src/core2/ba/anim.c +++ b/src/core2/ba/anim.c @@ -55,7 +55,7 @@ void __baanim_update_scaleToHorizontalVelocity(void) { scale = (baAnimScale.scalable_duration != 0) ? baAnimScale.duration_scale : 1.0f; baphysics_get_velocity(velocity); - temp_f12 = ml_mapRange_f(gu_sqrtf(velocity[0]*velocity[0] + velocity[2] * velocity[2]), baAnimScale.velocity_min, baAnimScale.velocity_max, baAnimScale.duration_min * scale, baAnimScale.duration_max * scale); + temp_f12 = ml_mapRange_f(sqrtf(velocity[0]*velocity[0] + velocity[2] * velocity[2]), baAnimScale.velocity_min, baAnimScale.velocity_max, baAnimScale.duration_min * scale, baAnimScale.duration_max * scale); anctrl_setDuration(playerAnimCtrl, ml_clamp_f(temp_f12, baAnimMinDuration, baAnimMaxDuration)); anctrl_update(playerAnimCtrl); } diff --git a/src/core2/ba/physics.c b/src/core2/ba/physics.c index 3d4a6929..46e799f4 100644 --- a/src/core2/ba/physics.c +++ b/src/core2/ba/physics.c @@ -365,7 +365,7 @@ f32 baphysics_get_vertical_velocity(void){ } f32 baphysics_get_horizontal_velocity(void){ - return gu_sqrtf(s_player_velocity[0]*s_player_velocity[0] + s_player_velocity[2]*s_player_velocity[2]); + return sqrtf(s_player_velocity[0]*s_player_velocity[0] + s_player_velocity[2]*s_player_velocity[2]); } f32 baphysics_get_horizontal_velocity_percentage(void){ diff --git a/src/core2/bastick.c b/src/core2/bastick.c index b3bb2bf8..746969b2 100644 --- a/src/core2/bastick.c +++ b/src/core2/bastick.c @@ -82,7 +82,7 @@ void bastick_update(void) { if (bastick.locked_at_zero) { bastick.value[0] = bastick.value[1] = 0.0f; } - bastick.distance = gu_sqrtf(bastick.value[0]*bastick.value[0] + bastick.value[1]*bastick.value[1]); + bastick.distance = sqrtf(bastick.value[0]*bastick.value[0] + bastick.value[1]*bastick.value[1]); if (bastick.distance != 0.0f) { bastick.zeroed_count = 0; bastick.nonzero_count = (s32) (bastick.nonzero_count + 1); diff --git a/src/core2/bs/bSwim.c b/src/core2/bs/bSwim.c index 85b9a079..548f63f7 100644 --- a/src/core2/bs/bSwim.c +++ b/src/core2/bs/bSwim.c @@ -26,7 +26,7 @@ void func_802A7140() { f32 func_802A716C() { f32 sp24[3]; baphysics_get_velocity(sp24); - ml_map_f(gu_sqrtf((sp24[0] * sp24[0]) + (sp24[1] * sp24[1]) + (sp24[2] * sp24[2])), 50.0f, 200.0f, 0.0f, 1.0f); + ml_map_f(sqrtf((sp24[0] * sp24[0]) + (sp24[1] * sp24[1]) + (sp24[2] * sp24[2])), 50.0f, 200.0f, 0.0f, 1.0f); } void func_802A71D8(void) { diff --git a/src/core2/bs/crouch.c b/src/core2/bs/crouch.c index c4e0d3a0..a7bf8925 100644 --- a/src/core2/bs/crouch.c +++ b/src/core2/bs/crouch.c @@ -68,7 +68,7 @@ void bscrouch_init(void){ batimer_set(0, 0.7f); batimer_set(1, 0.2f); baphysics_get_velocity(sp28); - D_8037D400 = gu_sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); + D_8037D400 = sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); if(140.0f < D_8037D400) basfx_80299AAC(); diff --git a/src/core2/bs/dronegoto.c b/src/core2/bs/dronegoto.c index 3b149557..f45fed5e 100644 --- a/src/core2/bs/dronegoto.c +++ b/src/core2/bs/dronegoto.c @@ -70,7 +70,7 @@ void func_802AECE4(void){ yaw_setIdeal(sp2C); } - if( 250.0f <= gu_sqrtf(sp20[0]*sp20[0] + sp20[2]*sp20[2]) + if( 250.0f <= sqrtf(sp20[0]*sp20[0] + sp20[2]*sp20[2]) && anctrl_getIndex(aCtrl) == ASSET_3_ANIM_BSWALK ){ anctrl_reset(aCtrl); diff --git a/src/core2/bs/turn.c b/src/core2/bs/turn.c index 2a0dfc39..223ad36e 100644 --- a/src/core2/bs/turn.c +++ b/src/core2/bs/turn.c @@ -24,7 +24,7 @@ void bsturn_init(void){ func_8029957C(2); baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); baphysics_get_velocity(sp28); - bsturn_starting_horizontal_velocity = gu_sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); + bsturn_starting_horizontal_velocity = sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); func_8030EBC8(SFX_19_BANJO_LANDING_08, 0.95f, 1.05f, 0x7530, 0x7d00); D_8037D594 = 0; } diff --git a/src/core2/ch/flotsam.c b/src/core2/ch/flotsam.c index b6e442bd..80cab5cf 100644 --- a/src/core2/ch/flotsam.c +++ b/src/core2/ch/flotsam.c @@ -102,7 +102,7 @@ void func_8035C080(Actor *this, s32 next_state){ sp64[1] = sp54[1] - this->position_y;\ sp64[2] = sp54[2] - this->position_z; sp64[1] = 0.0f; - sp60 = gu_sqrtf(sp64[0]*sp64[0] + sp64[1]*sp64[1] + sp64[2]*sp64[2]); + sp60 = sqrtf(sp64[0]*sp64[0] + sp64[1]*sp64[1] + sp64[2]*sp64[2]); if(next_state == 4 && sp60 <= 250.0f){ local->unk1C[0] = sp54[0];\ @@ -275,7 +275,7 @@ void func_8035C8F4(Actor *this){ sp40[0] = plyr_pos[0] - this->position_x; sp40[1] = plyr_pos[1] - this->position_y; sp40[2] = plyr_pos[2] - this->position_z; - sp3C = gu_sqrtf(sp40[0]*sp40[0] + sp40[1]*sp40[1] + sp40[2]*sp40[2]); + sp3C = sqrtf(sp40[0]*sp40[0] + sp40[1]*sp40[1] + sp40[2]*sp40[2]); if(local->pCtrl_8){ particleEmitter_update(local->pCtrl_8); } diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index b4895779..d43c42a4 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -194,13 +194,13 @@ void *calculateGameSelectCameraPosition(f32 from[3], f32 to[3], f32 deltaTime) { delta[2] = to[2] - from[2]; dummy_index = dummy_index^1; - sqrt_totals = gu_sqrtf((delta[0] * delta[0]) + (delta[1] * delta[1]) + (delta[2] * delta[2])); + sqrt_totals = sqrtf((delta[0] * delta[0]) + (delta[1] * delta[1]) + (delta[2] * delta[2])); if (sqrt_totals < 10.0f) { sqrt_totals = 500.0f; } - bounciness = 1.0 + (9.0f / gu_sqrtf(sqrt_totals)); + bounciness = 1.0 + (9.0f / sqrtf(sqrt_totals)); sin_bounciness_half_pi = sinf(bounciness * 1.5707963267948966); for (i = 0; i < 3; i++) { diff --git a/src/core2/code_12F30.c b/src/core2/code_12F30.c index 7c5c0ed1..d2eeb41e 100644 --- a/src/core2/code_12F30.c +++ b/src/core2/code_12F30.c @@ -186,8 +186,8 @@ void func_80299EC0(f32 arg0[3]) { spD4[1] = spA0[1] - sp48[1][1]; spD4[2] = spA0[2] - sp48[1][2]; - f2 = gu_sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) - / (gu_sqrtf(spB8[0]*spB8[0] + spB8[1]*spB8[1] + spB8[2]*spB8[2]) + 0.01); + f2 = sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) + / (sqrtf(spB8[0]*spB8[0] + spB8[1]*spB8[1] + spB8[2]*spB8[2]) + 0.01); for(i = 0; i < 3; i++){ arg0[i] = sp7C[1][i] + (sp7C[2][i] - sp7C[1][i]) * f2; } @@ -196,8 +196,8 @@ void func_80299EC0(f32 arg0[3]) { spD4[1] = spA0[1] - sp48[0][1]; spD4[2] = spA0[2] - sp48[0][2]; - f2 = 1 - (gu_sqrtf(spE0[0]*spE0[0] + spE0[1]*spE0[1] + spE0[2]*spE0[2]) - / (gu_sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) + 0.01)); + f2 = 1 - (sqrtf(spE0[0]*spE0[0] + spE0[1]*spE0[1] + spE0[2]*spE0[2]) + / (sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) + 0.01)); for(i = 0; i < 3; i++){ arg0[i] = arg0[i] + (sp7C[0][i] - arg0[i]) * f2; } diff --git a/src/core2/code_14420.c b/src/core2/code_14420.c index dc4429c4..810f81d6 100644 --- a/src/core2/code_14420.c +++ b/src/core2/code_14420.c @@ -321,7 +321,7 @@ void func_8029B73C(f32 arg0[3], f32 arg1, f32 arg2, f32 arg3, f32 arg4) { temp_f20 = (sp30[0]*sp30[0] + sp30[1]*sp30[1] + sp30[2]*sp30[2]); if (!((arg3 * arg3) < temp_f20)) { - temp_f20 = gu_sqrtf(temp_f20); + temp_f20 = sqrtf(temp_f20); ml_vec3f_set_length_copy(sp30, sp30, ml_min_f(time_getDelta() * arg4, arg3 - temp_f20)); ml_vec3f_add(sp3C, sp3C, sp30); func_8028FAB0(sp3C); @@ -377,14 +377,14 @@ f32 func_8029B9FC(void){ f32 sp1C[3]; func_8029B984(sp1C); - return gu_sqrtf(sp1C[0]*sp1C[0] + sp1C[1]*sp1C[1] + sp1C[2]*sp1C[2]); + return sqrtf(sp1C[0]*sp1C[0] + sp1C[1]*sp1C[1] + sp1C[2]*sp1C[2]); } f32 func_8029BA44(void){ f32 sp1C[3]; func_8029B984(sp1C); - return gu_sqrtf(sp1C[0]*sp1C[0] + sp1C[2]*sp1C[2]); + return sqrtf(sp1C[0]*sp1C[0] + sp1C[2]*sp1C[2]); } enum bs_e func_8029BA80(void){ diff --git a/src/core2/code_34790.c b/src/core2/code_34790.c index e3ff9f56..59762c3d 100644 --- a/src/core2/code_34790.c +++ b/src/core2/code_34790.c @@ -84,7 +84,7 @@ bool func_802BB884(f32 arg0[3], f32 *arg1) { player_getPosition(sp24); sp24[1] += 50.0f; ml_vec3f_diff_copy(sp18, arg0, sp24); - *arg1 = gu_sqrtf(sp18[0]*sp18[0] + sp18[1]*sp18[1] + sp18[2]*sp18[2]); + *arg1 = sqrtf(sp18[0]*sp18[0] + sp18[1]*sp18[1] + sp18[2]*sp18[2]); return TRUE; } diff --git a/src/core2/code_41FB0.c b/src/core2/code_41FB0.c index 64193721..a5051e0a 100644 --- a/src/core2/code_41FB0.c +++ b/src/core2/code_41FB0.c @@ -326,7 +326,7 @@ void bundle_update(Actor *actor) { } ml_vec3f_scale(bundle->velocity, bundle_info->bounce_factor); - speed = gu_sqrtf((bundle->velocity[0] * bundle->velocity[0]) + (bundle->velocity[1] * bundle->velocity[1]) + (bundle->velocity[2] * bundle->velocity[2])); + speed = sqrtf((bundle->velocity[0] * bundle->velocity[0]) + (bundle->velocity[1] * bundle->velocity[1]) + (bundle->velocity[2] * bundle->velocity[2])); if (((speed < 200.0f) && (sp40[1] > 0.75)) || (speed < 10.0f)) { bundle->state = BUNDLE_STATE_2_YAWING; diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index 2e677b66..a44f027d 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -202,7 +202,7 @@ void chBeeSwarm_802CF1C8(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3, f32 ar arg6[0] = arg0[0] - arg1[0]; arg6[1] = arg0[1] - arg1[1]; arg6[2] = arg0[2] - arg1[2]; - temp_f12 = gu_sqrtf(arg6[0]*arg6[0] + arg6[1]*arg6[1] + arg6[2]*arg6[2]); + temp_f12 = sqrtf(arg6[0]*arg6[0] + arg6[1]*arg6[1] + arg6[2]*arg6[2]); if (temp_f12 < (2 * arg4)) { chBeeSwarm_802CF174(arg6, temp_f12, 8 * arg3); } else { @@ -215,7 +215,7 @@ void chBeeSwarm_802CF1C8(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3, f32 ar arg2[0] += arg6[0] * sp4C; arg2[1] += arg6[1] * sp4C; arg2[2] += arg6[2] * sp4C; - temp_f12 = gu_sqrtf(arg2[0]*arg2[0] + arg2[1]*arg2[1] + arg2[2]*arg2[2]); + temp_f12 = sqrtf(arg2[0]*arg2[0] + arg2[1]*arg2[1] + arg2[2]*arg2[2]); if (arg3 < temp_f12) { chBeeSwarm_802CF174(arg2, temp_f12, arg3); } @@ -546,7 +546,7 @@ void chBeeSwarm_update(Actor *this) { sfxsource_set_fade_distances(this->unk44_31, 500.0f, 1500.0f); sfxsource_set_position(this->unk44_31, this->position); sfxSource_func_8030E2C4(this->unk44_31); - sfxsource_setSampleRate(this->unk44_31, (s32)(((gu_sqrtf(this->velocity[0] * this->velocity[0] + this->velocity[1] * this->velocity[1] + this->velocity[2] * this->velocity[2]) / this->actor_specific_1_f) * 8000.0f) + 2000.0f)); + sfxsource_setSampleRate(this->unk44_31, (s32)(((sqrtf(this->velocity[0] * this->velocity[0] + this->velocity[1] * this->velocity[1] + this->velocity[2] * this->velocity[2]) / this->actor_specific_1_f) * 8000.0f) + 2000.0f)); } } } diff --git a/src/core2/code_637D0.c b/src/core2/code_637D0.c index 677f32d3..ded30b19 100644 --- a/src/core2/code_637D0.c +++ b/src/core2/code_637D0.c @@ -145,7 +145,7 @@ s32 func_802EAD5C(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 sp34[0] = sp4C[0] - sp5C[0]; sp34[1] = sp4C[1] - sp5C[1]; sp34[2] = sp4C[2] - sp5C[2]; - if (!( gu_sqrtf(sp34[0]*sp34[0] + sp34[1]*sp34[1] + sp34[2]*sp34[2]) >= ((arg6 / scale) + temp_f20))) { + if (!( sqrtf(sp34[0]*sp34[0] + sp34[1]*sp34[1] + sp34[2]*sp34[2]) >= ((arg6 / scale) + temp_f20))) { return i_ptr->unk8; } } @@ -299,8 +299,8 @@ s32 func_802EB458(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 sp74[0] = arg6[0] - (sp98[0] + (sp80[0] * temp_f0)); sp74[1] = arg6[1] - (sp98[1] + (sp80[1] * temp_f0)); sp74[2] = arg6[2] - (sp98[2] + (sp80[2] * temp_f0)); - temp_f20 = gu_sqrtf(((sp74[0] * sp74[0]) + (sp74[1] * sp74[1])) + (sp74[2] * sp74[2])); - if (!((temp_f20 - arg7) > gu_sqrtf(((sp68[0] * sp68[0]) + (sp68[1] * sp68[1])) + (sp68[2] * sp68[2])))) + temp_f20 = sqrtf(((sp74[0] * sp74[0]) + (sp74[1] * sp74[1])) + (sp74[2] * sp74[2])); + if (!((temp_f20 - arg7) > sqrtf(((sp68[0] * sp68[0]) + (sp68[1] * sp68[1])) + (sp68[2] * sp68[2])))) { return i_ptr->unkD; } @@ -344,7 +344,7 @@ s32 func_802EB8A0(BKModelUnk14List *arg0, f32 *position, f32 *rotation, f32 scal sp44[0] = sp5C[0] - sp68[0]; sp44[1] = sp5C[1] - sp68[1]; sp44[2] = sp5C[2] - sp68[2]; - temp_f0 = gu_sqrtf(sp44[0]*sp44[0] + sp44[1]*sp44[1] + sp44[2]*sp44[2]); + temp_f0 = sqrtf(sp44[0]*sp44[0] + sp44[1]*sp44[1] + sp44[2]*sp44[2]); if ((arg7 + temp_f0 >= ml_vec3f_distance(sp68, sp74))) { return (s32) i_ptr->unk8; } diff --git a/src/core2/code_6A4B0.c b/src/core2/code_6A4B0.c index 6937d57e..d7c2ac15 100644 --- a/src/core2/code_6A4B0.c +++ b/src/core2/code_6A4B0.c @@ -134,7 +134,7 @@ void func_802F1934(Struct_Core2_6A4B0_2 * arg0, s32 arg1){ arg0->tmem_ptr = (u16*)((s32)arg0->tmem_ptr + 1); } func_80253010(arg0->tmem_ptr, gFramebuffers[arg1], gFramebufferWidth*gFramebufferHeight*sizeof(u16)); - osWriteBackDCacheAll(); + osWritebackDCacheAll(); } void func_802F1A08(s32 arg0) { } diff --git a/src/core2/code_70F20.c b/src/core2/code_70F20.c index aa4991f4..a8a0dd5b 100644 --- a/src/core2/code_70F20.c +++ b/src/core2/code_70F20.c @@ -26,7 +26,7 @@ void func_802F7EB0(struct3s *this){ sp4C[1] = randf2(200.0f, 300.0f); sp4C[2] = -tmpf; - if(gu_sqrtf(this->unk10[0]*this->unk10[0] + this->unk10[1]*this->unk10[1] + this->unk10[2]*this->unk10[2]) < 5.0f){ + if(sqrtf(this->unk10[0]*this->unk10[0] + this->unk10[1]*this->unk10[1] + this->unk10[2]*this->unk10[2]) < 5.0f){ ml_vec3f_yaw_rotate_copy(sp4C, sp4C, randf2(0.0f, 360.0f)); } else{ diff --git a/src/core2/code_77E50.c b/src/core2/code_77E50.c index 7abc743a..c49b6a80 100644 --- a/src/core2/code_77E50.c +++ b/src/core2/code_77E50.c @@ -33,5 +33,5 @@ void func_802FEF48(BKModelBin *model_bin){ } }; - osWriteBackDCacheAll(); + osWritebackDCacheAll(); } diff --git a/src/core2/code_9C170.c b/src/core2/code_9C170.c index 51041c5b..1d03ade6 100644 --- a/src/core2/code_9C170.c +++ b/src/core2/code_9C170.c @@ -205,7 +205,7 @@ f32 func_80323A48(f32 arg0[3], s32 arg1, f32 arg2, f32 arg3, f32 arg4) { func_80341180(var_f24, arg1, 3, arg0, &spDC); ml_vec3f_diff_copy(spC4, spDC, spE8); func_80258CDC(spD0, spC4); - var_f22 = var_f26 + gu_sqrtf(spD0[0]*spD0[0] + spD0[1]*spD0[1] + spD0[2]*spD0[2]); + var_f22 = var_f26 + sqrtf(spD0[0]*spD0[0] + spD0[1]*spD0[1] + spD0[2]*spD0[2]); } } else { func_80341180(var_f24, arg1, 3, arg0, spDC); @@ -231,7 +231,7 @@ f32 func_80323A48(f32 arg0[3], s32 arg1, f32 arg2, f32 arg3, f32 arg4) { func_80341180((f32) var_f24, arg1, 3, arg0, &spDC); ml_vec3f_diff_copy(&spC4, &spDC, &spE8); func_80258CDC(&spD0, &spC4); - var_f22 = var_f26 + gu_sqrtf(spD0[0]*spD0[0] + spD0[1]*spD0[1] + spD0[2]*spD0[2]); + var_f22 = var_f26 + sqrtf(spD0[0]*spD0[0] + spD0[1]*spD0[1] + spD0[2]*spD0[2]); } else { func_80341180(var_f24, arg1, 3, arg0, &spDC); var_f22 = var_f26 + ml_vec3f_length(&spF4, &spDC); diff --git a/src/core2/code_A4D00.c b/src/core2/code_A4D00.c index fc19fb81..ce72ccb0 100644 --- a/src/core2/code_A4D00.c +++ b/src/core2/code_A4D00.c @@ -205,7 +205,7 @@ bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3) { ml_vec3f_copy(arg0->position, arg1); } else if (var_fp != NULL) { - temp_f20 = gu_sqrtf((sp284[0] * sp284[0]) + (sp284[1] * sp284[1]) + (sp284[2] * sp284[2])); + temp_f20 = sqrtf((sp284[0] * sp284[0]) + (sp284[1] * sp284[1]) + (sp284[2] * sp284[2])); arg0->position[0] = var_fp->unk0[0]; arg0->position[1] = var_fp->unk0[1]; arg0->position[2] = var_fp->unk0[2]; diff --git a/src/core2/code_B8070.c b/src/core2/code_B8070.c deleted file mode 100644 index 501d801c..00000000 --- a/src/core2/code_B8070.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -void func_8033F000(const char *string, const char *file){} diff --git a/src/core2/code_B9090.c b/src/core2/code_B9090.c index b0c66c8e..79ce94f7 100644 --- a/src/core2/code_B9090.c +++ b/src/core2/code_B9090.c @@ -95,7 +95,7 @@ void func_80340200(Struct83s *self, f32 position[3], f32 arg2[3], f32 arg3, f32 sp58[1] /= 100000.0f; sp58[2] /= 100000.0f; } - if (gu_sqrtf(LENGTH_SQ_VEC3F(sp58)) < 0.001) { + if (sqrtf(LENGTH_SQ_VEC3F(sp58)) < 0.001) { self->unk1A = 0; return; } diff --git a/src/core2/code_BE2C0.c b/src/core2/code_BE2C0.c index 6be762c5..ac46029b 100644 --- a/src/core2/code_BE2C0.c +++ b/src/core2/code_BE2C0.c @@ -169,7 +169,7 @@ void func_80345A44(f32 arg0[4], MtxF* arg1) { temp_f0 = arg1->m[0][0] + arg1->m[1][1] + arg1->m[2][2]; if (temp_f0 > 0.0) { - temp_f2 = gu_sqrtf(temp_f0 + 1.0); + temp_f2 = sqrtf(temp_f0 + 1.0); arg0[3] = temp_f2 * 0.5; temp_f2 = (0.5 / temp_f2); arg0[0] = (arg1->m[1][2] - arg1->m[2][1]) * temp_f2; @@ -187,7 +187,7 @@ void func_80345A44(f32 arg0[4], MtxF* arg1) { temp_a0 = D_80371ED0[var_a0]; temp_a2 = D_80371ED0[temp_a0]; - temp_f2 = gu_sqrtf((arg1->m[var_a0][var_a0] - (arg1->m[temp_a0][temp_a0] + arg1->m[temp_a2][temp_a2])) + 1.0); + temp_f2 = sqrtf((arg1->m[var_a0][var_a0] - (arg1->m[temp_a0][temp_a0] + arg1->m[temp_a2][temp_a2])) + 1.0); arg0[var_a0] = temp_f2 * 0.5; temp_f2 = (0.5 / temp_f2); arg0[3] = (arg1->m[temp_a0][temp_a2] - arg1->m[temp_a2][temp_a0]) * temp_f2; diff --git a/src/core2/code_C0E60.c b/src/core2/code_C0E60.c index 0f758d7d..c3f8c195 100644 --- a/src/core2/code_C0E60.c +++ b/src/core2/code_C0E60.c @@ -97,7 +97,7 @@ void func_80347E60(Struct81s *arg0) { } else { var_f12 = temp_f0; } - temp_f26 = gu_sqrtf(var_f12); + temp_f26 = sqrtf(var_f12); for(var_s0 = 0; var_s0 != 2; var_s0++){ if (((randf() * 3.0f) / 2) < temp_f26) { func_80355C60(actor->position, 1.0f); diff --git a/src/core2/code_C89C0.c b/src/core2/code_C89C0.c index 7b834ddb..bf7c5945 100644 --- a/src/core2/code_C89C0.c +++ b/src/core2/code_C89C0.c @@ -67,7 +67,7 @@ void func_8034F950(Struct_core2_C89C0_0 *arg0) { arg0->unk24[i] = (arg0->unk24[i] < -100.0f) ? -100.0f : arg0->unk24[i]; } } - temp_f0 = gu_sqrtf(sp7C[0]*sp7C[0] + sp7C[1]*sp7C[1] + sp7C[2]*sp7C[2]); + temp_f0 = sqrtf(sp7C[0]*sp7C[0] + sp7C[1]*sp7C[1] + sp7C[2]*sp7C[2]); arg0->unk34 = (temp_f0 > 200.0f) ? 1.0f : (f32)(temp_f0 / 200.0); sp70[0] = -1.0f; sp70[1] = 0.0f; diff --git a/src/core2/fx/honeycarrierscore.c b/src/core2/fx/honeycarrierscore.c index 94f60d7a..09ad60af 100644 --- a/src/core2/fx/honeycarrierscore.c +++ b/src/core2/fx/honeycarrierscore.c @@ -239,7 +239,7 @@ void fxhoneycarrierscore_update(s32 arg0, struct8s *arg1){ } break; case 2://L802FECD4 - D_803815E0 *= gu_sqrtf(D_803815E0); + D_803815E0 *= sqrtf(D_803815E0); D_803815DC *= 1.1; D_803815E4 = _76D90_MIN((D_803815E4 + (400.0*sp24)), 255.0); if(D_803815E0 < 0.1){ diff --git a/src/core2/modelRender.c b/src/core2/modelRender.c index ffed8de8..41a7f165 100644 --- a/src/core2/modelRender.c +++ b/src/core2/modelRender.c @@ -856,7 +856,7 @@ void func_80338B50(Gfx **gfx, Mtx **mtx, void *arg2){ if(cmd->subgeo_offset_1C){ mlMtx_apply_vec3f(D_80383C98, cmd->unk10); - dist = gu_sqrtf(D_80383C98[0]*D_80383C98[0] + D_80383C98[1]*D_80383C98[1] + D_80383C98[2]*D_80383C98[2]); + dist = sqrtf(D_80383C98[0]*D_80383C98[0] + D_80383C98[1]*D_80383C98[1] + D_80383C98[2]*D_80383C98[2]); if(cmd->min_C < dist && dist <= cmd->max_8){ func_80339124(gfx, mtx, (BKGeoList*)((s32)cmd + cmd->subgeo_offset_1C)); } @@ -1087,7 +1087,7 @@ BKModelBin *modelRender_draw(Gfx **gfx, Mtx **mtx, f32 position[3], f32 rotation spD0 = D_803837C8.unk8; spD4 = D_803837C8.unk4; } - camera_focus_distance = gu_sqrtf(camera_focus[0]*camera_focus[0] + camera_focus[1]*camera_focus[1] + camera_focus[2]*camera_focus[2]); + camera_focus_distance = sqrtf(camera_focus[0]*camera_focus[0] + camera_focus[1]*camera_focus[1] + camera_focus[2]*camera_focus[2]); if( 4000.0f <= camera_focus_distance && spD4*scale*D_8038370C*50.0f < D_80383708){ D_80383708 = spD4*scale*D_8038370C*50.0f; } diff --git a/src/core2/nc/ba/fly.c b/src/core2/nc/ba/fly.c index cade9b5c..cefd7d2b 100644 --- a/src/core2/nc/ba/fly.c +++ b/src/core2/nc/ba/fly.c @@ -55,7 +55,7 @@ void ncbafly_update(void) { } sp38 = time_getDelta(); ml_vec3f_diff_copy(sp48, sp6C, sp84); - sp44 = gu_sqrtf(sp48[0]*sp48[0] + sp48[1]*sp48[1] + sp48[2]*sp48[2]); + sp44 = sqrtf(sp48[0]*sp48[0] + sp48[1]*sp48[1] + sp48[2]*sp48[2]); temp_f10 = (sp3C - sp44) * sp38; sp44 += func_80259198(temp_f10 * D_8037DB10, sp38 * D_8037DB14); func_8025727C(sp84[0], sp84[1], sp84[2], sp6C[0], sp6C[1], sp6C[2], &sp54[0], &sp54[1]); diff --git a/src/core2/nc/dynamicCam1.c b/src/core2/nc/dynamicCam1.c index fd28a665..9f73167c 100644 --- a/src/core2/nc/dynamicCam1.c +++ b/src/core2/nc/dynamicCam1.c @@ -30,7 +30,7 @@ void ncDynamicCam1_update(void) { sp3C = func_802BD8D4(); temp_f20 = time_getDelta(); ml_vec3f_diff_copy(sp50, sp74, sp8C); - sp4C = gu_sqrtf((sp50[0] * sp50[0]) + (sp50[2] * sp50[2])); + sp4C = sqrtf((sp50[0] * sp50[0]) + (sp50[2] * sp50[2])); sp4C += func_80259198((sp3C - sp4C) * temp_f20 * 2, temp_f20 * 120.0f); func_8025801C(sp50, &sp48); sp40 = func_80259198(mlDiffDegF(mlNormalizeAngle(180.0f + player_getYaw()), sp48) * (temp_f20 * 1), temp_f20 * 50.0f); diff --git a/src/core2/nc/dynamicCam11.c b/src/core2/nc/dynamicCam11.c index 9b78cf65..ab041e6e 100644 --- a/src/core2/nc/dynamicCam11.c +++ b/src/core2/nc/dynamicCam11.c @@ -38,7 +38,7 @@ void ncDynamicCam11_update(void) { ncDynamicCamera_getPosition(sp58); ml_vec3f_diff_copy(sp24, sp58, sp64); sp24[1] = 0.0f; - sp20 = gu_sqrtf( sp24[0]*sp24[0] + sp24[2]*sp24[2] ); + sp20 = sqrtf( sp24[0]*sp24[0] + sp24[2]*sp24[2] ); if (sp20 < D_8037DAE0) { sp20 = D_8037DAE0; } @@ -47,7 +47,7 @@ void ncDynamicCam11_update(void) { } ml_vec3f_diff_copy(sp34, D_8037DAC0, sp64); sp34[1] = 0.0f; - sp30 = gu_sqrtf(sp34[0]*sp34[0] + sp34[2]*sp34[2]); + sp30 = sqrtf(sp34[0]*sp34[0] + sp34[2]*sp34[2]); if (sp30 < sp20) { sp20 = sp30; } diff --git a/src/core2/nc/dynamicCam13.c b/src/core2/nc/dynamicCam13.c index 0798d448..c46b7e51 100644 --- a/src/core2/nc/dynamicCam13.c +++ b/src/core2/nc/dynamicCam13.c @@ -31,7 +31,7 @@ void func_802C069C(void) { ncDynamicCamera_getPosition(sp34); func_802C02D4(sp1C); ml_vec3f_diff_copy(sp28, sp34, sp1C); - D_8037DBA0 = gu_sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); + D_8037DBA0 = sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); func_8025801C(sp28, &D_8037DBA8); D_8037DBAC = 0.0f; } @@ -66,7 +66,7 @@ void ncDynamicCam13_update(void) { sp44 = time_getDelta(); func_802BDB30(D_8037DBA4, &D_8037DBA8, &D_8037DBAC, 800.0f, 160.0f, 100.0f); ml_vec3f_diff_copy(sp6C, sp54, sp84); - sp40 = gu_sqrtf(sp6C[0] * sp6C[0] + sp6C[2]*sp6C[2]); + sp40 = sqrtf(sp6C[0] * sp6C[0] + sp6C[2]*sp6C[2]); sp40 = sp40 + (func_802BD8D4() - sp40)* sp44 * 2; func_80256E24(sp60, 0.0f, D_8037DBA8, 0.0f, 0.0f, sp40); ml_vec3f_add(sp78, sp84, sp60); diff --git a/src/core2/nc/dynamicCam3.c b/src/core2/nc/dynamicCam3.c index 250c6e30..dcac915e 100644 --- a/src/core2/nc/dynamicCam3.c +++ b/src/core2/nc/dynamicCam3.c @@ -38,7 +38,7 @@ void ncDynamicCam3_update(void) { sp30 = time_getDelta(); if (sp30); ml_vec3f_diff_copy(sp40, sp64, sp7C); - sp3C = gu_sqrtf(sp40[0]*sp40[0] + sp40[2]*sp40[2]); + sp3C = sqrtf(sp40[0]*sp40[0] + sp40[2]*sp40[2]); sp3C += func_80259198(sp30*(sp34 - sp3C)*2 , sp30 * 800.0f); func_8025727C(sp7C[0], sp7C[1], sp7C[2], sp64[0], sp64[1], sp64[2], &sp4C[0], &sp4C[1]); sp40[1] = sp30 * 0.77 * mlDiffDegF(mlNormalizeAngle(player_getYaw() + 180.0f), sp4C[1]); diff --git a/src/core2/nc/dynamicCam5.c b/src/core2/nc/dynamicCam5.c index 8e9875cc..d4e83146 100644 --- a/src/core2/nc/dynamicCam5.c +++ b/src/core2/nc/dynamicCam5.c @@ -30,7 +30,7 @@ void ncDynamicCam5_update(void) { player_getPosition(sp74); sp74[1] += 60.0f; ml_vec3f_diff_copy(sp5C, sp44, sp74); - sp30 = ml_map_f(D_8037DABC, 0.2f, 0.5f, gu_sqrtf(sp5C[0] * sp5C[0] + sp5C[1] * sp5C[1] + sp5C[2] * sp5C[2]), 300.0f); + sp30 = ml_map_f(D_8037DABC, 0.2f, 0.5f, sqrtf(sp5C[0] * sp5C[0] + sp5C[1] * sp5C[1] + sp5C[2] * sp5C[2]), 300.0f); D_8037DABC += time_getDelta(); ml_vec3f_scale_copy(sp50, D_8037DAB0, sp30); ml_vec3f_diff_copy(sp68, sp74, sp50); diff --git a/src/core2/nc/dynamicCam8.c b/src/core2/nc/dynamicCam8.c index 6d5fc497..aa047cdb 100644 --- a/src/core2/nc/dynamicCam8.c +++ b/src/core2/nc/dynamicCam8.c @@ -51,7 +51,7 @@ void ncDynamicCam8_update(void) { ml_vec3f_diff_copy(sp50, sp5C, sp44); func_802BC434(sp38, sp5C, sp44); func_802BC434(sp2C, sp5C, sp20); - if (gu_sqrtf(sp50[0]*sp50[0] + sp50[2]*sp50[2]) < 100.0f) { + if (sqrtf(sp50[0]*sp50[0] + sp50[2]*sp50[2]) < 100.0f) { sp38[1] = sp2C[1]; } func_802BD904(sp38); diff --git a/src/core2/nc/dynamicCam9.c b/src/core2/nc/dynamicCam9.c index 99de8693..45e00c7c 100644 --- a/src/core2/nc/dynamicCam9.c +++ b/src/core2/nc/dynamicCam9.c @@ -26,7 +26,7 @@ f32 ncDynamicCam9_func_802C09E8(void) { d_pos[0] = D_8037DBB0[0] - player_position[0]; d_pos[1] = 0.0f; d_pos[2] = D_8037DBB0[2] - player_position[2]; - return ml_min_f(gu_sqrtf(d_pos[0]*d_pos[0] + d_pos[2]*d_pos[2]), D_8037DBBC) / D_8037DBBC; + return ml_min_f(sqrtf(d_pos[0]*d_pos[0] + d_pos[2]*d_pos[2]), D_8037DBBC) / D_8037DBBC; } void ncDynamicCam9_func_802C0A60(f32 arg0[3]) { diff --git a/src/core2/nc/dynamicCamA.c b/src/core2/nc/dynamicCamA.c index 14432334..45f1dc34 100644 --- a/src/core2/nc/dynamicCamA.c +++ b/src/core2/nc/dynamicCamA.c @@ -32,7 +32,7 @@ bool ncDynamicCamA_func_802C1DB0(f32 arg0) { ncDynamicCamera_getPosition(camera_position); func_802C02D4(sp28); ml_vec3f_diff_copy(sp34, camera_position, sp28); - D_80365DAC = gu_sqrtf(sp34[0]*sp34[0] + sp34[2]*sp34[2]); + D_80365DAC = sqrtf(sp34[0]*sp34[0] + sp34[2]*sp34[2]); func_8025801C(sp34, &D_80365DA4); D_80365DA8 = 0.0f; D_80365DA0 = mlNormalizeAngle(D_80365DA4 + arg0); @@ -96,7 +96,7 @@ void ncDynamicCamA_update(void) { func_802BDCE0(D_80365DA0, &D_80365DA4, &D_80365DA8, 50.0f, 3.0f); D_80365DB0 = (mlAbsF(D_80365DA0 - D_80365DA4) < 0.5); ml_vec3f_diff_copy(sp60, sp9C, spB4); - D_80365DAC = gu_sqrtf(sp60[0]*sp60[0] + sp60[2]*sp60[2]); + D_80365DAC = sqrtf(sp60[0]*sp60[0] + sp60[2]*sp60[2]); func_802BDE88(&D_80365DB4, &D_80365DAC, func_802BD8D4(), 0.01f, 0.008f); func_80256E24(sp90, 0.0f, D_80365DA4, 0.0f, 0.0f, D_80365DAC); ml_vec3f_add(spA8, spB4, sp90); @@ -119,7 +119,7 @@ void ncDynamicCamA_update(void) { if (sp7C != 0) { ncDynamicCamera_getPosition(sp44); ml_vec3f_diff_copy(sp50, sp44, spB4); - D_80365DAC = gu_sqrtf((sp50[0] * sp50[0]) + (sp50[2] * sp50[2])); + D_80365DAC = sqrtf((sp50[0] * sp50[0]) + (sp50[2] * sp50[2])); } if (sp78 != 0) { D_80365DB0 = 1; diff --git a/src/core2/nc/dynamicCamF.c b/src/core2/nc/dynamicCamF.c index 4656ce03..15b61081 100644 --- a/src/core2/nc/dynamicCamF.c +++ b/src/core2/nc/dynamicCamF.c @@ -24,7 +24,7 @@ void ncDynamicCamF_update(void){ player_getPosition(player_position); ml_vec3f_diff_copy(d_position, __playerStartPosition, player_position); - if( !(gu_sqrtf(d_position[0]*d_position[0] + d_position[1]*d_position[1] + d_position[2]*d_position[2]) < 2.0f)){ + if( !(sqrtf(d_position[0]*d_position[0] + d_position[1]*d_position[1] + d_position[2]*d_position[2]) < 2.0f)){ func_80291488(2); ncDynamicCamera_setState(0xB); func_802BE720(); diff --git a/src/core2/nc/dynamicCamera.c b/src/core2/nc/dynamicCamera.c index 25299a3f..c5bacfb3 100644 --- a/src/core2/nc/dynamicCamera.c +++ b/src/core2/nc/dynamicCamera.c @@ -131,7 +131,7 @@ s32 func_802BC84C(s32 arg0){ ml_vec3f_diff_copy(d_target, player_position, camera_position); ml_vec3f_normalize_copy(target_direction, d_target); ml_vec3f_copy(sp44, player_position); - target_distance = gu_sqrtf(d_target[0]*d_target[0] + d_target[1]*d_target[1] + d_target[2]*d_target[2]); + target_distance = sqrtf(d_target[0]*d_target[0] + d_target[1]*d_target[1] + d_target[2]*d_target[2]); if (1500.0f < target_distance) { ml_vec3f_scale_copy(d_target, target_direction, 1500.0f); ml_vec3f_add(sp44, camera_position, d_target); @@ -186,7 +186,7 @@ void func_802BCA58(void) { ml_vec3f_diff_copy(sp34, player_position, cameraPosition); sp4C = player_getYaw(); sp48 = ml_map_f(mlAbsF((f32) (mlNormalizeAngle(cameraRotation[1] - sp4C) - 180.0)), 0.0f, 180.0f, D_8037D97C, D_8037D980); - func_80256E24(D_8037D9A8, 0.0f, sp4C, 0.0f, 0.0f, ml_map_f(gu_sqrtf(sp34[0]*sp34[0] + sp34[2]*sp34[2]), 300.0f, 450.0f, 0.0f, sp48)); + func_80256E24(D_8037D9A8, 0.0f, sp4C, 0.0f, 0.0f, ml_map_f(sqrtf(sp34[0]*sp34[0] + sp34[2]*sp34[2]), 300.0f, 450.0f, 0.0f, sp48)); ml_vec3f_diff_copy(sp34, D_8037D9A8, D_8037D9B8); if (func_802BC428()) { ml_vec3f_copy(D_8037D9B8, D_8037D9A8); diff --git a/src/core2/string.c b/src/core2/string.c index ae794853..bece738d 100644 --- a/src/core2/string.c +++ b/src/core2/string.c @@ -1,10 +1,7 @@ #include -#include "functions.h" -#include "variables.h" +#include "core2/string.h" -#include "string.h" - -void strcat(char *dst, char *src){ +void strcat(char *dst, const char *src){ while(*(dst) != '\0'){ dst++; } @@ -91,7 +88,7 @@ void _strIToA(char *str, s32 num, char prefix){ *str = '\0'; } -s32 strcmp(const char *str1, const char *str2){ +int strcmp(const char *str1, const char *str2){ while (*str1 && *str2 && *str1 == *str2) { str1++; str2++; @@ -105,7 +102,7 @@ s32 strcmp(const char *str1, const char *str2){ return 1; } -void strcpy(char *dst, char *src){ +void *strcpy(char *dst, const char *src){ while(*(src) != '\0'){ *(dst++) = *(src++); } @@ -113,9 +110,9 @@ void strcpy(char *dst, char *src){ } -s32 strlen(char *str){ +int strlen(const char *str){ char v0; - s32 len; + int len; len = 0; v0 = *(str++); @@ -156,7 +153,7 @@ void strcpyToTok(char *arg0, char *arg1, char *arg2){ *arg1 = '\0'; } -void strToUpper(char *str){ +char *strupr(char *str){ char *ret = str; while (*ret != '\0'){ if ((*ret >= 0x61) && (*ret < 0x7B)){ diff --git a/src/core2/ultra/debug/assert.c b/src/core2/ultra/debug/assert.c new file mode 100644 index 00000000..8420e235 --- /dev/null +++ b/src/core2/ultra/debug/assert.c @@ -0,0 +1,17 @@ +#include "os.h" +#include "PRinternal/osint.h" +#include "osint_debug.h" + +void __assertBreak(void); + +#ifdef BKDIFFS +void __assert(const char* exp, const char* filename) { // For some reason, the third parameter "line" is missing in the implementation, but it's in the declaration +} +#else +void __assert(const char* exp, const char* filename, int line) { +#ifndef _FINALROM + osSyncPrintf("\nASSERTION FAULT: %s, %d: \"%s\"\n", filename, line, exp); + __assertBreak; // Doesn't actually do anything, but is needed for matching +#endif +} +#endif diff --git a/src/core2/ultra/debug/osint_debug.h b/src/core2/ultra/debug/osint_debug.h new file mode 100644 index 00000000..6d644f2f --- /dev/null +++ b/src/core2/ultra/debug/osint_debug.h @@ -0,0 +1,11 @@ +#include "PR/os_internal.h" + +extern s32 __osThprofFlag; +extern void (*__osThprofFunc)(OSThread*); +extern u32 __osThprofLastTimer; +extern u32 __osThprofCount; +extern __OSThreadprofile_s thprof[]; +extern u64 __osThprofHeap[]; +extern void* __osThprofStack; + +void osThreadProfileCallback(OSThread*); diff --git a/src/done/bk_boot_1050.c b/src/done/bk_boot_1050.c deleted file mode 100644 index a48701c0..00000000 --- a/src/done/bk_boot_1050.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include "rarezip.h" - -#define ENTRY_STACK_LEN 0x2000 -#define ENTRY_STACK_LEN_U64 (ENTRY_STACK_LEN / sizeof(u64)) - -u64 gEntryStack[ENTRY_STACK_LEN_U64]; - -extern u8 core1_rzip_ROM_START[]; -extern u8 core1_rzip_ROM_END[]; -extern u8 D_8002D500; -extern u8 core1_VRAM; -extern u32 D_803FFE00[4]; - -void func_80000594(u8 **, u8 **); -void func_8023DA20(s32); - -void func_80000450(s32 arg0){ - u8 *tmp; - u8 *dst; - - tmp = &D_8002D500; - dst = &core1_VRAM; - osInitialize(); - osPiRawStartDma(OS_READ, core1_rzip_ROM_START, tmp, core1_rzip_ROM_END - core1_rzip_ROM_START); - while(osPiGetStatus() & PI_STATUS_DMA_BUSY); - func_8000055C(); - func_80000594(&tmp, &dst); - D_803FFE00[0] = crc1; - D_803FFE00[1] = crc2; - func_80000594(&tmp, &dst); - D_803FFE00[2] = crc1; - D_803FFE00[3] = crc2; - overlay_table_init(); - (&func_8023DA20)(arg0); - -} diff --git a/src/done/cartrominit.c b/src/done/cartrominit.c deleted file mode 100644 index b23a9d43..00000000 --- a/src/done/cartrominit.c +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -OSPiHandle CartRomHandle; -OSPiHandle *osCartRomInit(void) -{ - u32 domain; - u32 saveMask; - - domain = 0; - - if (CartRomHandle.baseAddress == PHYS_TO_K1(PI_DOM1_ADDR2)) - return &CartRomHandle; - - CartRomHandle.type = DEVICE_TYPE_CART; - CartRomHandle.baseAddress = PHYS_TO_K1(PI_DOM1_ADDR2); - osPiRawReadIo(NULL, &domain); - CartRomHandle.latency = domain & 0xff; - CartRomHandle.pulse = (domain >> 8) & 0xff; - CartRomHandle.pageSize = (domain >> 0x10) & 0xf; - CartRomHandle.relDuration = (domain >> 0x14) & 0xf; - CartRomHandle.domain = PI_DOMAIN1; - CartRomHandle.speed = 0; - - bzero(&CartRomHandle.transferInfo, sizeof(__OSTranxInfo)); - - saveMask = __osDisableInt(); - CartRomHandle.next = __osPiTable; - __osPiTable = &CartRomHandle; - __osRestoreInt(saveMask); - - return &CartRomHandle; -} diff --git a/src/done/createmesgqueue.c b/src/done/createmesgqueue.c deleted file mode 100644 index 683ffc0c..00000000 --- a/src/done/createmesgqueue.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern OSThread __osThreadTail; - -void osCreateMesgQueue(OSMesgQueue *mq, OSMesg *msg, s32 msgCount) -{ - mq->mtqueue = (OSThread *)&__osThreadTail; - mq->fullqueue = (OSThread *)&__osThreadTail; - mq->validCount = 0; - mq->first = 0; - mq->msgCount = msgCount; - mq->msg = msg; -} diff --git a/src/done/createthread.c b/src/done/createthread.c deleted file mode 100644 index 889830f4..00000000 --- a/src/done/createthread.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -#define __osCleanupThread __osCleanupThread - -void __osCleanupThread(void); -extern OSThread *__osActiveQueue; -void osCreateThread(OSThread *t, OSId id, void (*entry)(void *), void *arg, void *sp, OSPri p) -{ - register u32 saveMask; - OSIntMask mask; - t->id = id; - t->priority = p; - t->next = NULL; - t->queue = NULL; - t->context.pc = (u32)entry; - t->context.a0 = (u64)arg; - t->context.sp = (u64)sp - 16; - t->context.ra = (u64)__osCleanupThread; - mask = OS_IM_ALL; - t->context.sr = SR_IMASK | SR_EXL | SR_IE; - t->context.rcp = (mask & RCP_IMASK) >> RCP_IMASKSHIFT; - t->context.fpcsr = (u32)(FPCSR_FS | FPCSR_EV); - t->fp = 0; - t->state = OS_STATE_STOPPED; - t->flags = 0; - saveMask = __osDisableInt(); - t->tlnext = __osActiveQueue; - __osActiveQueue = t; - __osRestoreInt(saveMask); -} diff --git a/src/done/destroythread.c b/src/done/destroythread.c deleted file mode 100644 index 03182f46..00000000 --- a/src/done/destroythread.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include "osint.h" - -void osDestroyThread(OSThread *t) -{ - register u32 saveMask; - register OSThread *pred; - register OSThread *succ; - saveMask = __osDisableInt(); - if (t == NULL) - { - t = __osRunningThread; - } - else - { - if (t->state != OS_STATE_STOPPED) - { - __osDequeueThread(t->queue, t); - } - } - if (__osActiveQueue == t) - { - __osActiveQueue = __osActiveQueue->tlnext; - } - else - { - pred = __osActiveQueue; - succ = pred->tlnext; - while (succ) - { - if (succ == t) - { - pred->tlnext = t->tlnext; - break; - } - pred = succ; - succ = pred->tlnext; - } - } - if (t == __osRunningThread) - { - __osDispatchThread(); - } - __osRestoreInt(saveMask); -} diff --git a/src/done/devmgr.c b/src/done/devmgr.c deleted file mode 100644 index d0dc1c0b..00000000 --- a/src/done/devmgr.c +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include "piint.h" - -void __osDevMgrMain(void *args) -{ - OSIoMesg *mb; - OSMesg em; - OSMesg dummy; - s32 ret; - OSDevMgr *dm; - s32 messageSend; - - messageSend = 0; - mb = NULL; - ret = 0; - dm = (OSDevMgr *)args; - while (TRUE) - { - osRecvMesg(dm->cmdQueue, (OSMesg)&mb, OS_MESG_BLOCK); - if (mb->piHandle != NULL && - mb->piHandle->type == DEVICE_TYPE_64DD && - (mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_0 || - mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_1)) - { - __OSBlockInfo *blockInfo; - __OSTranxInfo *info; - info = &mb->piHandle->transferInfo; - blockInfo = &info->block[info->blockNum]; - info->sectorNum = -1; - if (info->transferMode != LEO_SECTOR_MODE) - { - blockInfo->dramAddr = (void *)((u32)blockInfo->dramAddr - blockInfo->sectorSize); - } - if (info->transferMode == LEO_TRACK_MODE && mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_0) - messageSend = 1; - else - messageSend = 0; - osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK); - __osResetGlobalIntMask(OS_IM_PI); - osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, (info->bmCtlShadow | 0x80000000)); - while (TRUE) - { - - osRecvMesg(dm->evtQueue, &em, OS_MESG_BLOCK); - info = &mb->piHandle->transferInfo; - blockInfo = &info->block[info->blockNum]; - if (blockInfo->errStatus == LEO_ERROR_29) - { - u32 stat; - osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_RESET); //TODO: remove magic constants - osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow); - osEPiRawReadIo(mb->piHandle, LEO_STATUS, &stat); - - if (stat & LEO_STATUS_MECHANIC_INTERRUPT) //TODO: remove magic constants - { - osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_CLR_MECHANIC_INTR); - } - - blockInfo->errStatus = LEO_ERROR_4; - IO_WRITE(PI_STATUS_REG, PI_CLR_INTR); - __osSetGlobalIntMask(OS_IM_PI | SR_IBIT4); - } - osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK); - - if (messageSend != 1) - break; - if (mb->piHandle->transferInfo.block[0].errStatus != LEO_ERROR_GOOD) - break; - messageSend = 0; - } - osSendMesg(dm->acsQueue, NULL, OS_MESG_NOBLOCK); - if (mb->piHandle->transferInfo.blockNum == 1) - osYieldThread(); - } - else - { - switch (mb->hdr.type) - { - case OS_MESG_TYPE_DMAREAD: - osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK); - ret = dm->dma(OS_READ, mb->devAddr, mb->dramAddr, mb->size); - break; - case OS_MESG_TYPE_DMAWRITE: - osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK); - ret = dm->dma(OS_WRITE, mb->devAddr, mb->dramAddr, mb->size); - break; - case OS_MESG_TYPE_EDMAREAD: - osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK); - ret = dm->edma(mb->piHandle, OS_READ, mb->devAddr, mb->dramAddr, - mb->size); - break; - case OS_MESG_TYPE_EDMAWRITE: - osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK); - ret = dm->edma(mb->piHandle, OS_WRITE, mb->devAddr, mb->dramAddr, - mb->size); - break; - case OS_MESG_TYPE_LOOPBACK: - osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK); - ret = -1; - break; - default: - ret = -1; - break; - } - if (ret == 0) - { - osRecvMesg(dm->evtQueue, &em, OS_MESG_BLOCK); - osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK); - osSendMesg(dm->acsQueue, NULL, OS_MESG_NOBLOCK); - } - } - } -} diff --git a/src/done/epirawdma.c b/src/done/epirawdma.c deleted file mode 100644 index 8c316803..00000000 --- a/src/done/epirawdma.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" -#include "piint.h" - -extern OSPiHandle *__osCurrentHandle[2]; - -s32 osEPiRawStartDma(OSPiHandle *pihandle, s32 direction, u32 devAddr, void *dramAddr, u32 size) -{ - u32 stat; - u32 domain; - - EPI_SYNC(pihandle, stat, domain); - - IO_WRITE(PI_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); - IO_WRITE(PI_CART_ADDR_REG, K1_TO_PHYS(pihandle->baseAddress | devAddr)); - switch (direction) - { - case OS_READ: - IO_WRITE(PI_WR_LEN_REG, size - 1); - break; - case OS_WRITE: - IO_WRITE(PI_RD_LEN_REG, size - 1); - break; - default: - return -1; - } - return 0; -} diff --git a/src/done/epirawread.c b/src/done/epirawread.c deleted file mode 100644 index 75766a72..00000000 --- a/src/done/epirawread.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include "piint.h" - -s32 osEPiRawReadIo(OSPiHandle *pihandle, u32 devAddr, u32 *data) -{ - register u32 stat; - register u32 domain; - - WAIT_ON_IOBUSY(stat); - - *data = IO_READ(pihandle->baseAddress | devAddr); - return 0; -} diff --git a/src/done/epirawwrite.c b/src/done/epirawwrite.c deleted file mode 100644 index e7e474f0..00000000 --- a/src/done/epirawwrite.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include "piint.h" - -s32 osEPiRawWriteIo(OSPiHandle *pihandle, u32 devAddr, u32 data) -{ - register u32 stat; - register u32 domain; - - WAIT_ON_IOBUSY(stat); - - IO_WRITE(pihandle->baseAddress | devAddr, data); - return 0; -} diff --git a/src/done/getthreadpri.c b/src/done/getthreadpri.c deleted file mode 100644 index adb1da40..00000000 --- a/src/done/getthreadpri.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" -#include "osint.h" - -OSPri osGetThreadPri(OSThread *thread) -{ - if (thread == NULL) - thread = __osRunningThread; - return thread->priority; -} diff --git a/src/done/inflate.c b/src/done/inflate.c deleted file mode 100644 index 896d96e6..00000000 --- a/src/done/inflate.c +++ /dev/null @@ -1,585 +0,0 @@ -#include -#include "rarezip.h" - -u8 border[] = { /* Order of the bit length code lengths */ - 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; -/*static*/ u16 cplens[] = { /* Copy lengths for literal codes 257..285 */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - /* note: see note #13 above about the 258 in this list. */ - -/*static*/ u8 cplext[] = { /* Extra bits for literal codes 257..285 */ - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, - 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */ - -/*static*/ u16 cpdist[] = { /* Copy offsets for distance codes 0..29 */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577}; - -/*static*/ u8 cpdext[] = { /* Extra bits for distance codes */ - 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, - 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, - 12, 12, 13, 13}; - -u16 mask_bits[] = { - 0x0000, - 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, - 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff -}; - -s32 lbits = 9; -s32 dbits = 6; - -u8 *inbuf; -u8 *D_80007284; -u32 inptr; -u32 wp; -struct huft *D_80007290; //unk -u32 bb; -u32 bk; -u32 crc1; -u32 crc2; -u32 hufts; - -int huft_build(b, n, s, d, e, t, m) -unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ -unsigned n; /* number of codes (assumed <= N_MAX) */ -unsigned s; /* number of simple-valued codes (0..s-1) */ -u16 *d; /* list of base values for non-simple codes */ -u16 *e; /* list of extra bits for non-simple codes */ -struct huft **t; /* result: starting table */ -int *m; /* maximum lookup bits, returns actual */ -/* Given a list of code lengths and a maximum table size, make a set of - tables to decode that set of codes. Return zero on success, one if - the given code set is incomplete (the tables are still built in this - case), two if the input is invalid (all zero length codes or an - oversubscribed set of lengths), and three if not enough memory. */ -{ - unsigned a; /* counter for codes of length k */ - unsigned c[BMAX+1]; /* bit length count table */ - unsigned f; /* i repeats in table every f entries */ - int g; /* maximum code length */ - int h; /* table level */ - register unsigned i; /* counter, current code */ - register unsigned j; /* counter */ - register int k; /* number of bits in current code */ - int l; /* bits per table (returned in m) */ - register unsigned *p; /* pointer into c[], b[], or v[] */ - register struct huft *q; /* points to current table */ - struct huft r; /* table entry for structure assignment */ - struct huft *u[BMAX]; /* table stack */ - unsigned v[N_MAX]; /* values in order of bit length */ - register int w; /* bits before this table == (l * h) */ - unsigned x[BMAX+1]; /* bit offsets, then code stack */ - unsigned *xp; /* pointer into x */ - int y; /* number of dummy codes added */ - unsigned z; /* number of entries in current table */ - - - /* Generate counts for each bit length */ - bzero(c, sizeof(c)); - p = b; i = n; - do { - c[*p]++; /* assume all entries <= BMAX */ - p++; /* Can't combine with above line (Solaris bug) */ - } while (--i); - if (c[0] == n) /* null input--all zero length codes */ - { - *t = (struct huft *)NULL; - *m = 0; - return 0; - } - - - /* Find minimum and maximum length, bound *m by those */ - l = *m; - for (j = 1; j <= BMAX; j++) - if (c[j]) - break; - k = j; /* minimum code length */ - if ((unsigned)l < j) - l = j; - for (i = BMAX; i; i--) - if (c[i]) - break; - g = i; /* maximum code length */ - if ((unsigned)l > i) - l = i; - *m = l; - - - /* Adjust last length count to fill out codes, if needed */ - for (y = 1 << j; j < i; j++, y <<= 1){ - (y -= c[j]); - } - y -= c[i]; - c[i] += y; - - - /* Generate starting offsets into the value table for each length */ - x[1] = j = 0; - p = c + 1; xp = x + 2; - while (--i) { /* note that i == g from above */ - *xp++ = (j += *p++); - } - - - /* Make a table of values in order of bit lengths */ - p = b; i = 0; - do { - if ((j = *p++) != 0) - v[x[j]++] = i; - } while (++i < n); - - - /* Generate the Huffman codes and for each, make the table entries */ - x[0] = i = 0; /* first Huffman code is zero */ - p = v; /* grab values in bit order */ - h = -1; /* no tables yet--level -1 */ - w = -l; /* bits decoded == (l * h) */ - u[0] = (struct huft *)NULL; /* just to keep compilers happy */ - q = (struct huft *)NULL; /* ditto */ - z = 0; /* ditto */ - - /* go through the bit lengths (k already is bits in shortest code) */ - for (; k <= g; k++) - { - a = c[k]; - while (a--) - { - /* here i is the Huffman code of length k bits for value *p */ - /* make tables up to required level */ - while (k > w + l) - { - h++; - w += l; /* previous table always l bits */ - - /* compute minimum size table less than or equal to l bits */ - z = (z = g - w) > (unsigned)l ? l : z; /* upper limit on table size */ - if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ - { /* too few codes for k-w bit table */ - f -= a + 1; /* deduct codes from patterns left */ - xp = c + k; - while (++j < z) /* try smaller tables up to z bits */ - { - if ((f <<= 1) <= *++xp) - break; /* enough codes to use up j bits */ - f -= *xp; /* else deduct codes from patterns */ - } - } - z = 1 << j; /* table entries for j-bit table */ - - /* allocate and link in new table */ - q = D_80007290 + hufts; - - hufts += z + 1; /* track memory usage */ - *t = q + 1; /* link to list for huft_free() */ - *(t = &(q->v.t)) = (struct huft *)NULL; - u[h] = ++q; /* table starts after link */ - - /* connect to last table, if there is one */ - if (h) - { - x[h] = i; /* save pattern for backing up */ - r.b = (u8)l; /* bits to dump before this table */ - r.e = (u8)(16 + j); /* bits in this table */ - r.v.t = q; /* pointer to this table */ - j = i >> (w - l); /* (get around Turbo C bug) */ - u[h-1][j] = r; /* connect to last table */ - } - } - - /* set up table entry in r */ - r.b = (u8)(k - w); - if (p >= v + n) - r.e = 99; /* out of values--invalid code */ - else if (*p < s) - { - r.e = (u8)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ - r.v.n = *p; /* simple code is just the value */ - p++; /* one compiler does not like *p++ */ - } - else - { - r.e = *((u8 *)e + (*p - s)); /* non-simple--look up in lists */ - r.v.n = d[*p++ - s]; - } - - /* fill code-like entries with r */ - f = 1 << (k - w); - for (j = i >> w; j < z; j += f) - q[j] = r; - - /* backwards increment the k-bit code i */ - for (j = 1 << (k - 1); i & j; j >>= 1) - i ^= j; - i ^= j; - - /* backup over finished tables */ - while ((i & ((1 << w) - 1)) != x[h]) - { - h--; /* don't need to update q */ - w -= l; - } - } - } - - - /* Return true (1) if we were given an incomplete table */ - return y != 0 && g != 1; -} - -//^inflate_codes -/* static */ int inflate_codes(struct huft *tl, struct huft *td, s32 bl, s32 bd) -{ - register unsigned e; /* table entry flag/number of extra bits */ - unsigned n, d; /* length and index for copy */ - unsigned w; /* current window position */ - struct huft *t; /* pointer to table entry */ - unsigned ml, md; /* masks for bl and bd bits */ - register u32 b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - register u8 tmp; - - /* make local copies of globals */ - b = bb; /* initialize bit buffer */ - k = bk; - w = wp; /* initialize window position */ - - /* inflate the coded data */ - ml = mask_bits[bl]; /* precompute masks for speed */ - md = mask_bits[bd]; - - for (;;) /* do until end of block */ - {//L80000D78 - NEEDBITS((unsigned)bl) - if ((e = (t = tl + ((unsigned)b & ml))->e) > 16) - do { - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16); - DUMPBITS(t->b) - if (e == 16) /* then it's a literal */ - { - - tmp = (u8)t->v.n; - D_80007284[w++] = tmp; - crc1 += tmp; - crc2 ^= tmp << (crc1 & 0x17); - } - else /* it's an EOB or a length */ - {//L80000EAC - /* exit if end of block */ - if (e == 15) - break; - - /* get length of block to copy */ - NEEDBITS(e) //L80000EAC - L80000ED8 - n = t->v.n + ((unsigned)b & mask_bits[e]); - DUMPBITS(e); - - /* decode distance of block to copy */ - NEEDBITS((unsigned)bd)//L80000F04 - L80000F2C - if ((e = (t = td + ((unsigned)b & md))->e) > 16) - do { - DUMPBITS(t->b) - e -= 16; - NEEDBITS(e) - } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16); - //L80000FC8 - DUMPBITS(t->b) - NEEDBITS(e) //L80000FE0 - L80001008 - d = w - t->v.n - ((unsigned)b & mask_bits[e]); - DUMPBITS(e) - - /* do the copy */ - do{ - tmp = D_80007284[d++]; - D_80007284[w++] = tmp; - crc1 += tmp; - crc2 ^= tmp << (crc1 & 0x17); - }while(--n); - } - } - /* restore the globals from the locals */ - wp = w; /* restore global window pointer */ - bb = b; /* restore global bit buffer */ - bk = k; - /* done */ - return 0; -} - -/* static */ int inflate_stored(void) -/* "decompress" an inflated type 0 (stored) block. */ -{ - unsigned n; /* number of bytes in block */ - unsigned w; /* current window position */ - register u32 b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - - /* make local copies of globals */ - b = bb; /* initialize bit buffer */ - k = bk; - w = wp; /* initialize window position */ - - - /* go to byte boundary */ - n = k & 7; - DUMPBITS(n); - - - /* get the length and its complement */ - NEEDBITS(16) - n = ((unsigned)b & 0xffff); - DUMPBITS(16) - NEEDBITS(16) - DUMPBITS(16) - - - /* read and output the compressed data */ - while (n--) - { - NEEDBITS(8) - D_80007284[w++] = (u8) b; - crc1 += b & 0xFF; - crc2 ^= (b &0xFF) << (crc1 & 0x17); - DUMPBITS(8) - } - - /* restore the globals from the locals */ - wp = w; /* restore global window pointer */ - bb = b; /* restore global bit buffer */ - bk = k; - return 0; -} - -/* static */ int inflate_fixed(void) -/* decompress an inflated type 1 (fixed Huffman codes) block. We should - either replace this with a custom decoder, or at least precompute the - Huffman tables. */ -{ - int i; /* temporary variable */ - struct huft *tl; /* literal/length code table */ - struct huft *td; /* distance code table */ - int bl; /* lookup bits for tl */ - int bd; /* lookup bits for td */ - unsigned l[288]; /* length list for huft_build */ - - - /* set up literal table */ - for (i = 0; i < 144; i++) - l[i] = 8; - for (; i < 256; i++) - l[i] = 9; - for (; i < 280; i++) - l[i] = 7; - for (; i < 288; i++) /* make a complete, but wrong code set */ - l[i] = 8; - bl = 7; - huft_build(l, 288, 257, cplens, cplext, &tl, &bl); - - /* set up distance table */ - for (i = 0; i < 30; i++) /* make an incomplete code set */ - l[i] = 5; - bd = 5; - huft_build(l, 30, 0, cpdist, cpdext, &td, &bd); - - /* decompress until an end-of-block code */ - inflate_codes(tl, td, bl, bd); - - return 0; -} - -/* static */ int inflate_dynamic(void)/* decompress an inflated type 2 (dynamic Huffman codes) block. */ -{ - int i; /* temporary variables */ - unsigned j; - unsigned l; /* last length */ - unsigned m; /* mask for bit lengths table */ - unsigned n; /* number of lengths to get */ - struct huft *tl; /* literal/length code table */ - struct huft *td; /* distance code table */ - int bl; /* lookup bits for tl */ - int bd; /* lookup bits for td */ - unsigned nb; /* number of bit length codes */ - unsigned nl; /* number of literal/length codes */ - unsigned nd; /* number of distance codes */ - - register unsigned k; /* number of bits in bit buffer */ - - register u32 b; /* bit buffer */ - - unsigned ll[286+30]; /* literal/length and distance code lengths */ - - /* make local bit buffer */ - b = bb; - k = bk; - - - /* read in table lengths */ - NEEDBITS(5) - nl = 257 + ((unsigned)b & 0x1f); /* number of literal/length codes */ - DUMPBITS(5) - NEEDBITS(5) - nd = 1 + ((unsigned)b & 0x1f); /* number of distance codes */ - DUMPBITS(5) - NEEDBITS(4) - nb = 4 + ((unsigned)b & 0xf); /* number of bit length codes */ - DUMPBITS(4) - - /* read in bit-length-code lengths */ - for (j = 0; j < nb; j++) - { - NEEDBITS(3) - ll[border[j]] = (unsigned)b & 7; - DUMPBITS(3) - } - for (; j < 19; j++) - ll[border[j]] = 0; - - - /* build decoding table for trees--single level, 7 bit lookup */ - bl = 7; - huft_build(ll, 19, 19, NULL, NULL, &tl, &bl); - - - /* read in literal and distance code lengths */ - n = nl + nd; - m = mask_bits[bl]; - i = l = 0; - while ((unsigned)i < n) - { - NEEDBITS((unsigned)bl) - j = (td = tl + ((unsigned)b & m))->b; - DUMPBITS(j) - j = td->v.n; - if (j < 16) /* length of code in bits (0..15) */ - ll[i++] = l = j; /* save last length in l */ - else if (j == 16) /* repeat last length 3 to 6 times */ - { - NEEDBITS(2) - j = 3 + ((unsigned)b & 3); - DUMPBITS(2) - while (j--) - ll[i++] = l; - } - else if (j == 17) /* 3 to 10 zero length codes */ - { - NEEDBITS(3) - j = 3 + ((unsigned)b & 7); - DUMPBITS(3) - while (j--) - ll[i++] = 0; - l = 0; - } - else /* j == 18: 11 to 138 zero length codes */ - { - NEEDBITS(7) - j = 11 + ((unsigned)b & 0x7f); - DUMPBITS(7) - while (j--) - ll[i++] = 0; - l = 0; - } - } - - /* restore the global bit buffer */ - bb = b; - bk = k; - - /* build the decoding tables for literal/length and distance codes */ - bl = lbits; - huft_build(ll, nl, 257, cplens, cplext, &tl, &bl); - bd = dbits; - huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd); - - /* decompress until an end-of-block code */ - inflate_codes(tl, td, bl, bd); - - return 0; -} - -/* static */ int inflate_block(int *e) -/* decompress an inflated block */ -{ - u32 t; /* block type */ - register u32 b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ - - - /* make local bit buffer */ - b = bb; - k = bk; - - - /* read in last block bit */ - NEEDBITS(1) - *e = (int)b & 1; - DUMPBITS(1) - - - /* read in block type */ - NEEDBITS(2) - t = (unsigned)b & 3; - DUMPBITS(2) - - - /* restore the global bit buffer */ - bb = b; - bk = k; - - - /* inflate that block type */ - if (t == 2) - return inflate_dynamic(); - if (t == 0) - return inflate_stored(); - if (t == 1) - return inflate_fixed(); - - - /* bad block type */ - return 2; -} - -/* decompress an inflated entry */ -int bkboot_inflate(void) //int inflate() -{ - int e; /* last block flag */ - int r; /* result code */ - unsigned h; /* maximum struct huft's malloc'ed */ - - /* initialize window, bit buffer */ - wp = 0; - bk = 0; - bb = 0; - - crc1 = 0; - crc2 = -1; - - /* decompress until the last block */ - h = 0; - do { - hufts = 0; - if ((r = inflate_block(&e)) != 0) - return r; - if (hufts > h) - h = hufts; - } while (!e); - - /* Undo too much lookahead. The next read will be byte aligned so we - * can discard unused bits in the last meaningful byte. - */ - while (bk >= 8) { - bk -= 8; - inptr--; - } - - /* return success */ - #ifdef DEBUG - fprintf(stderr, "<%u> ", h); - #endif /* DEBUG */ - return 0; -} diff --git a/src/done/initialize.c b/src/done/initialize.c deleted file mode 100644 index dbc4f6e2..00000000 --- a/src/done/initialize.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -OSTime osClockRate = OS_CLOCK_RATE; -s32 osViClock = VI_NTSC_CLOCK; -u32 __osShutdown = 0; -u32 __OSGlobalIntMask = OS_IM_ALL; - -u32 __osFinalrom; - -typedef struct -{ - /* 0x0 */ unsigned int inst1; - /* 0x4 */ unsigned int inst2; - /* 0x8 */ unsigned int inst3; - /* 0xC */ unsigned int inst4; -} __osExceptionVector; -extern __osExceptionVector __osExceptionPreamble; - -// osInitialize -void __osInitialize_common() -{ - u32 pifdata; - u32 clock = 0; - __osFinalrom = TRUE; - __osSetSR(__osGetSR() | SR_CU1); //enable fpu - __osSetFpcCsr(FPCSR_FS | FPCSR_EV); //flush denorm to zero, enable invalid operation - - while (__osSiRawReadIo(PIF_RAM_END - 3, &pifdata)) //last byte of joychannel ram - { - ; - } - while (__osSiRawWriteIo(PIF_RAM_END - 3, pifdata | 8)) - { - ; //todo: magic contant - } - *(__osExceptionVector *)UT_VEC = __osExceptionPreamble; - *(__osExceptionVector *)XUT_VEC = __osExceptionPreamble; - *(__osExceptionVector *)ECC_VEC = __osExceptionPreamble; - *(__osExceptionVector *)E_VEC = __osExceptionPreamble; - osWritebackDCache((void *)UT_VEC, E_VEC - UT_VEC + sizeof(__osExceptionVector)); - osInvalICache((void *)UT_VEC, E_VEC - UT_VEC + sizeof(__osExceptionVector)); - osMapTLBRdb(); - osPiRawReadIo(4, &clock); //TODO: remove magic constant; - clock &= ~0xf; //clear lower 4 bits - if (clock != 0) - { - osClockRate = clock; - } - osClockRate = osClockRate * 3 / 4; - if (osResetType == 0 /*cold reset */) - { - bzero(osAppNMIBuffer, OS_APP_NMI_BUFSIZE); - } - if (osTvType == OS_TV_PAL) - { - osViClock = VI_PAL_CLOCK; - } - else if (osTvType == OS_TV_MPAL) - { - osViClock = VI_MPAL_CLOCK; - } - else - { - osViClock = VI_NTSC_CLOCK; - } -} diff --git a/src/done/kdebugserver.c b/src/done/kdebugserver.c deleted file mode 100644 index 3c42a6e9..00000000 --- a/src/done/kdebugserver.c +++ /dev/null @@ -1,3 +0,0 @@ -#include - -OSThread __osThreadSave; diff --git a/src/done/leodiskinit.c b/src/done/leodiskinit.c deleted file mode 100644 index a0381c88..00000000 --- a/src/done/leodiskinit.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include - -OSPiHandle LeoDiskHandle; -OSPiHandle *__osDiskHandle; -OSPiHandle *osLeoDiskInit() -{ - u32 saveMask; - LeoDiskHandle.type = DEVICE_TYPE_64DD; - LeoDiskHandle.baseAddress = PHYS_TO_K1(PI_DOM2_ADDR1); - LeoDiskHandle.latency = 3; - LeoDiskHandle.pulse = 6; - LeoDiskHandle.pageSize = 6; - LeoDiskHandle.relDuration = 2; - LeoDiskHandle.domain = PI_DOMAIN2; - IO_WRITE(PI_BSD_DOM2_LAT_REG, LeoDiskHandle.latency); - IO_WRITE(PI_BSD_DOM2_PWD_REG, LeoDiskHandle.pulse); - IO_WRITE(PI_BSD_DOM2_PGS_REG, LeoDiskHandle.pageSize); - IO_WRITE(PI_BSD_DOM2_RLS_REG, LeoDiskHandle.relDuration); - LeoDiskHandle.speed = 0; - bzero(&LeoDiskHandle.transferInfo, sizeof(__OSTranxInfo)); - saveMask = __osDisableInt(); - LeoDiskHandle.next = __osPiTable; - __osPiTable = &LeoDiskHandle; - __osDiskHandle = &LeoDiskHandle; - __osRestoreInt(saveMask); - return &LeoDiskHandle; -} diff --git a/src/done/leointerrupt.c b/src/done/leointerrupt.c deleted file mode 100644 index 4e9a1b2f..00000000 --- a/src/done/leointerrupt.c +++ /dev/null @@ -1,215 +0,0 @@ -#include -#include "osint.h" -#include "piint.h" - -#define WAIT_ON_IOBUSY2(stat) \ - stat = IO_READ(PI_STATUS_REG); \ - while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \ - stat = IO_READ(PI_STATUS_REG); - -static void __osLeoResume(void); -static void __osLeoAbnormalResume(void); - -extern OSThread *__osRunQueue; -extern OSIntMask __OSGlobalIntMask; -extern OSPiHandle *__osDiskHandle; - -u8 leoDiskStack[OS_PIM_STACKSIZE]; - -s32 __osLeoInterrupt() -{ - u32 stat; - volatile u32 pi_stat; - u32 bm_stat; - __OSTranxInfo *info; - __OSBlockInfo *blockInfo; - stat = 0; - info = &__osDiskHandle->transferInfo; - blockInfo = &info->block[info->blockNum]; - pi_stat = IO_READ(PI_STATUS_REG); - if (pi_stat & PI_STATUS_DMA_BUSY) - { - __OSGlobalIntMask = __OSGlobalIntMask & ~SR_IBIT4; //cartridge interrupt - blockInfo->errStatus = LEO_ERROR_29; - __osLeoResume(); - return 1; - } - WAIT_ON_IOBUSY(pi_stat); - stat = IO_READ(LEO_STATUS); - if (stat & LEO_STATUS_MECHANIC_INTERRUPT) - { - WAIT_ON_IOBUSY(pi_stat); - IO_WRITE(LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_CLR_MECHANIC_INTR); - blockInfo->errStatus = LEO_ERROR_GOOD; - return 0; - } - if (info->cmdType == LEO_CMD_TYPE_2) - return 1; - if (stat & LEO_STATUS_BUFFER_MANAGER_ERROR) - { - WAIT_ON_IOBUSY(pi_stat); - stat = IO_READ(LEO_STATUS); - blockInfo->errStatus = LEO_ERROR_22; - __osLeoResume(); - IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); - __OSGlobalIntMask |= OS_IM_PI; - return 1; - } - if (info->cmdType == LEO_CMD_TYPE_1) - { - if ((stat & LEO_STATUS_DATA_REQUEST) == 0) - { - if (info->sectorNum + 1 != info->transferMode * 85) - { - blockInfo->errStatus = LEO_ERROR_24; - __osLeoAbnormalResume(); - return 1; - } - IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); - __OSGlobalIntMask |= OS_IM_PI; - blockInfo->errStatus = LEO_ERROR_GOOD; - __osLeoResume(); - return 1; - } - blockInfo->dramAddr = (void *)((u32)blockInfo->dramAddr + blockInfo->sectorSize); - info->sectorNum++; - osEPiRawStartDma(__osDiskHandle, OS_WRITE, LEO_SECTOR_BUFF, blockInfo->dramAddr, blockInfo->sectorSize); - return 1; - } - if (info->cmdType == LEO_CMD_TYPE_0) - { - if (info->transferMode == LEO_SECTOR_MODE) - { - if ((s32)blockInfo->C1ErrNum + 17 < info->sectorNum) - { - blockInfo->errStatus = LEO_ERROR_GOOD; - __osLeoAbnormalResume(); - return 1; - } - if ((stat & LEO_STATUS_DATA_REQUEST) == 0) - { - blockInfo->errStatus = LEO_ERROR_23; - __osLeoAbnormalResume(); - return 1; - } - } - else - { - blockInfo->dramAddr = (void *)((u32)blockInfo->dramAddr + blockInfo->sectorSize); - } - bm_stat = IO_READ(LEO_BM_STATUS); - if ((bm_stat & LEO_BM_STATUS_C1SINGLE && bm_stat & LEO_BM_STATUS_C1DOUBLE) || bm_stat & LEO_BM_STATUS_MICRO) - { - if (blockInfo->C1ErrNum > 3) - { - if (info->transferMode != LEO_SECTOR_MODE || info->sectorNum > 0x52) - { - blockInfo->errStatus = LEO_ERROR_23; - __osLeoAbnormalResume(); - return 1; - } - } - else - { - int errNum = blockInfo->C1ErrNum; - blockInfo->C1ErrSector[errNum] = info->sectorNum + 1; - } - blockInfo->C1ErrNum += 1; - } - if (stat & LEO_STATUS_C2_TRANSFER) - { - if (info->sectorNum + 1 != 88) - { - blockInfo->errStatus = LEO_ERROR_24; - __osLeoAbnormalResume(); - } - if (info->transferMode == LEO_TRACK_MODE && info->blockNum == 0) - { - info->blockNum = 1; - info->sectorNum = -1; - info->block[1].dramAddr = (void *)((u32)info->block[1].dramAddr - info->block[1].sectorSize); - - blockInfo->errStatus = LEO_ERROR_22; - } - else - { - IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); - __OSGlobalIntMask |= OS_IM_PI; - info->cmdType = LEO_CMD_TYPE_2; - blockInfo->errStatus = LEO_ERROR_GOOD; - } - osEPiRawStartDma(__osDiskHandle, OS_READ, LEO_C2_BUFF, blockInfo->C2Addr, blockInfo->sectorSize * 4); - return 1; - } - - if (info->sectorNum == -1 && info->transferMode == LEO_TRACK_MODE && info->blockNum == 1) - { - __OSBlockInfo *bptr = &info->block[0]; - if (bptr->C1ErrNum == 0) - { - if (((u32 *)bptr->C2Addr)[0] | ((u32 *)bptr->C2Addr)[1] | ((u32 *)bptr->C2Addr)[2] | ((u32 *)bptr->C2Addr)[3]) - { - bptr->errStatus = LEO_ERROR_24; - __osLeoAbnormalResume(); - return 1; - } - } - bptr->errStatus = 0; - __osLeoResume(); - } - info->sectorNum++; - if (stat & LEO_STATUS_DATA_REQUEST) - { - if (info->sectorNum > 0x54) - { - blockInfo->errStatus = LEO_ERROR_24; - __osLeoAbnormalResume(); - return 1; - } - osEPiRawStartDma(__osDiskHandle, 0, LEO_SECTOR_BUFF, blockInfo->dramAddr, blockInfo->sectorSize); - blockInfo->errStatus = LEO_ERROR_GOOD; - return 1; - } - if (info->sectorNum <= 0x54) - { - blockInfo->errStatus = LEO_ERROR_24; - __osLeoAbnormalResume(); - return 1; - } - return 1; - } - blockInfo->errStatus = LEO_ERROR_4; - __osLeoAbnormalResume(); - return 1; -} - -static void __osLeoAbnormalResume(void) -{ - __OSTranxInfo *info; - u32 pi_stat; - info = &__osDiskHandle->transferInfo; - pi_stat = pi_stat; - WAIT_ON_IOBUSY2(pi_stat); - IO_WRITE(LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_RESET); - WAIT_ON_IOBUSY2(pi_stat); - IO_WRITE(LEO_BM_CTL, info->bmCtlShadow); - __osLeoResume(); - IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); - __OSGlobalIntMask |= OS_IM_PI; -} - -static void __osLeoResume(void) -{ - __OSEventState *es; - OSMesgQueue *mq; - s32 last; - es = &__osEventStateTab[OS_EVENT_PI]; - mq = es->messageQueue; - if (mq == NULL || MQ_IS_FULL(mq)) - return; - last = (mq->first + mq->validCount) % mq->msgCount; - mq->msg[last] = es->message; - mq->validCount++; - if (mq->mtqueue->next != NULL) - __osEnqueueThread(&__osRunQueue, __osPopThread(&mq->mtqueue)); -} diff --git a/src/done/ll.c b/src/done/ll.c deleted file mode 100644 index d183b3eb..00000000 --- a/src/done/ll.c +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -unsigned long long __ull_rshift(unsigned long long a0, unsigned long long a1) -{ - return a0 >> a1; -} -unsigned long long __ull_rem(unsigned long long a0, unsigned long long a1) -{ - return a0 % a1; -} -unsigned long long __ull_div(unsigned long long a0, unsigned long long a1) -{ - return a0 / a1; -} - -unsigned long long __ll_lshift(unsigned long long a0, unsigned long long a1) -{ - return a0 << a1; -} - -long long __ll_rem(unsigned long long a0, long long a1) -{ - return a0 % a1; -} - -long long __ll_div(long long a0, long long a1) -{ - return a0 / a1; -} - -unsigned long long __ll_mul(unsigned long long a0, unsigned long long a1) -{ - return a0 * a1; -} - -void __ull_divremi(unsigned long long *div, unsigned long long *rem, unsigned long long a2, unsigned short a3) -{ - *div = a2 / a3; - *rem = a2 % a3; -} -long long __ll_mod(long long a0, long long a1) -{ - long long tmp = a0 % a1; - if ((tmp < 0 && a1 > 0) || (tmp > 0 && a1 < 0)) - { - - tmp += a1; - } - return tmp; -} - -long long __ll_rshift(long long a0, long long a1) -{ - return a0 >> a1; -} diff --git a/src/done/piacs.c b/src/done/piacs.c deleted file mode 100644 index 69938b2c..00000000 --- a/src/done/piacs.c +++ /dev/null @@ -1,24 +0,0 @@ -#include - -#define PI_Q_BUF_LEN 1 -u32 __osPiAccessQueueEnabled = 0; -static OSMesg piAccessBuf[PI_Q_BUF_LEN]; -OSMesgQueue __osPiAccessQueue; -void __osPiCreateAccessQueue(void) -{ - - __osPiAccessQueueEnabled = 1; - osCreateMesgQueue(&__osPiAccessQueue, piAccessBuf, PI_Q_BUF_LEN); - osSendMesg(&__osPiAccessQueue, NULL, OS_MESG_NOBLOCK); -} -void __osPiGetAccess(void) -{ - OSMesg dummyMesg; - if (!__osPiAccessQueueEnabled) - __osPiCreateAccessQueue(); - osRecvMesg(&__osPiAccessQueue, &dummyMesg, OS_MESG_BLOCK); -} -void __osPiRelAccess(void) -{ - osSendMesg(&__osPiAccessQueue, NULL, OS_MESG_NOBLOCK); -} diff --git a/src/done/pigetstat.c b/src/done/pigetstat.c deleted file mode 100644 index d6e339b3..00000000 --- a/src/done/pigetstat.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -u32 osPiGetStatus(void) { - return IO_READ(PI_STATUS_REG); -} diff --git a/src/done/pimgr.c b/src/done/pimgr.c deleted file mode 100644 index b4e5cc64..00000000 --- a/src/done/pimgr.c +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include "piint.h" - - -extern u32 __osPiAccessQueueEnabled; - -OSDevMgr __osPiDevMgr = {0}; -OSPiHandle *__osPiTable = NULL; -OSPiHandle *__osCurrentHandle[2] = {&CartRomHandle, &LeoDiskHandle}; -static OSThread piThread; -static char piThreadStack[OS_PIM_STACKSIZE]; -static OSMesgQueue piEventQueue; -static OSMesg piEventBuf; - -void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt) -{ - u32 savedMask; - OSPri oldPri; - OSPri myPri; - if (!__osPiDevMgr.active) - { - osCreateMesgQueue(cmdQ, cmdBuf, cmdMsgCnt); - osCreateMesgQueue(&piEventQueue, (OSMesg*)&piEventBuf, 1); - if (!__osPiAccessQueueEnabled) - __osPiCreateAccessQueue(); - osSetEventMesg(OS_EVENT_PI, &piEventQueue, (OSMesg)0x22222222); - oldPri = -1; - myPri = osGetThreadPri(NULL); - if (myPri < pri) - { - oldPri = myPri; - osSetThreadPri(NULL, pri); - } - savedMask = __osDisableInt(); - __osPiDevMgr.active = 1; - __osPiDevMgr.thread = &piThread; - __osPiDevMgr.cmdQueue = cmdQ; - __osPiDevMgr.evtQueue = &piEventQueue; - __osPiDevMgr.acsQueue = &__osPiAccessQueue; - __osPiDevMgr.dma = osPiRawStartDma; - __osPiDevMgr.edma = osEPiRawStartDma; - osCreateThread(&piThread, 0, __osDevMgrMain, &__osPiDevMgr, &piThreadStack[OS_PIM_STACKSIZE], pri); - osStartThread(&piThread); - __osRestoreInt(savedMask); - if (oldPri != -1) - { - osSetThreadPri(NULL, oldPri); - } - } -} diff --git a/src/done/pirawdma.c b/src/done/pirawdma.c deleted file mode 100644 index 4db24a95..00000000 --- a/src/done/pirawdma.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -#define WAIT_ON_IOBUSY(stat) \ - stat = IO_READ(PI_STATUS_REG); \ - while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \ - stat = IO_READ(PI_STATUS_REG); - -s32 osPiRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size) -{ - register u32 stat; - WAIT_ON_IOBUSY(stat); - IO_WRITE(PI_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); - IO_WRITE(PI_CART_ADDR_REG, K1_TO_PHYS((u32)osRomBase | devAddr)); - switch (direction) - { - case OS_READ: - IO_WRITE(PI_WR_LEN_REG, size - 1); - break; - case OS_WRITE: - IO_WRITE(PI_RD_LEN_REG, size - 1); - break; - default: - return -1; - } - return 0; -} diff --git a/src/done/pirawread.c b/src/done/pirawread.c deleted file mode 100644 index 33795911..00000000 --- a/src/done/pirawread.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "piint.h" - -s32 osPiRawReadIo(u32 devAddr, u32 *data) -{ - register u32 stat; - WAIT_ON_IOBUSY(stat); - *data = IO_READ((u32)osRomBase | devAddr); - return 0; -} - diff --git a/src/done/rarezip.c b/src/done/rarezip.c deleted file mode 100644 index a044602f..00000000 --- a/src/done/rarezip.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include "rarezip.h" - -struct huft *D_80007270; - -u32 func_800005C0(u8*, u8*, struct huft *); -u32 func_80000618(u8**, u8**, struct huft *); - -extern void *D_803FBE00; - -u32 func_80000550(u8*arg0){ - return *((u32*)(arg0 +2)); -} - -void func_8000055C(void){ - D_80007270 = (struct huft*) &D_803FBE00; -} - -u32 func_80000570(u8 *inPtr, u8 *outPtr){ - return func_800005C0(inPtr, outPtr, D_80007270); -} - -//rareunzip -u32 func_80000594(u8 **inPtr, u8 **outPtr){ - return func_80000618(inPtr, outPtr, D_80007270); -} - -void func_800005B8(void){} - -u32 func_800005C0(u8* in, u8* out, struct huft *arg2){ - inbuf = in; //inbuf - D_80007284 = out; //slide - D_80007290 = arg2; - inbuf += 6; //skip 6 byte bk header - wp = 0; //wp - inptr = 0; //inptr - - bkboot_inflate(); //inflate - return wp; //return uncompressed size -} - -u32 func_80000618(u8 **inPtr, u8 **outPtr, struct huft *arg2){ - u32 size = func_800005C0(*inPtr, *outPtr, arg2); - *outPtr += wp; - *outPtr = ((u32)(*outPtr) & 0xF) ? (u8 *) ((u32)(*outPtr) & ~0xF) + 0x10 : *outPtr; - *inPtr += inptr + 6; - return size; -} diff --git a/src/done/recvmesg.c b/src/done/recvmesg.c deleted file mode 100644 index 26509ad3..00000000 --- a/src/done/recvmesg.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include "osint.h" - -s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flags) -{ - register u32 saveMask; - saveMask = __osDisableInt(); - - while (MQ_IS_EMPTY(mq)) - { - if (flags == OS_MESG_NOBLOCK) - { - __osRestoreInt(saveMask); - return -1; - } - __osRunningThread->state = OS_STATE_WAITING; - __osEnqueueAndYield(&mq->mtqueue); - } - - if (msg != NULL) - { - *msg = mq->msg[mq->first]; - } - mq->first = (mq->first + 1) % mq->msgCount; - mq->validCount--; - if (mq->fullqueue->next != NULL) - { - osStartThread(__osPopThread(&mq->fullqueue)); - } - __osRestoreInt(saveMask); - return 0; -} diff --git a/src/done/resetglobalintmask.c b/src/done/resetglobalintmask.c deleted file mode 100644 index d849dfd7..00000000 --- a/src/done/resetglobalintmask.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -void __osResetGlobalIntMask(OSHWIntr interrupt) -{ - register u32 saveMask = __osDisableInt(); - - //not sure about these constants, SR_IBIT3 is external level 3 INT0, which I think corresponds to the rcp - //os.h has several masks defined that end in 401 but non that are just 401 - __OSGlobalIntMask &= ~(interrupt & ~(SR_IBIT3 | SR_IE)); - - __osRestoreInt(saveMask); -} diff --git a/src/done/sendmesg.c b/src/done/sendmesg.c deleted file mode 100644 index b0588ce4..00000000 --- a/src/done/sendmesg.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include "osint.h" - -s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flags) -{ - register u32 saveMask; - register s32 last; - saveMask = __osDisableInt(); - while (MQ_IS_FULL(mq)) - { - if (flags == OS_MESG_BLOCK) - { - __osRunningThread->state = OS_STATE_WAITING; - __osEnqueueAndYield(&mq->fullqueue); - } - else - { - __osRestoreInt(saveMask); - return -1; - } - } - last = (mq->first + mq->validCount) % mq->msgCount; - mq->msg[last] = msg; - mq->validCount++; - if (mq->mtqueue->next != NULL) - { - osStartThread(__osPopThread(&mq->mtqueue)); - } - __osRestoreInt(saveMask); - return 0; -} diff --git a/src/done/seteventmesg.c b/src/done/seteventmesg.c deleted file mode 100644 index 5911e2f5..00000000 --- a/src/done/seteventmesg.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include "osint.h" -__OSEventState __osEventStateTab[OS_NUM_EVENTS]; -void osSetEventMesg(OSEvent event, OSMesgQueue *mq, OSMesg msg) -{ - register u32 saveMask = __osDisableInt(); - __OSEventState *es; - - es = &__osEventStateTab[event]; - es->messageQueue = mq; - es->message = msg; - __osRestoreInt(saveMask); -} diff --git a/src/done/setglobalintmask.c b/src/done/setglobalintmask.c deleted file mode 100644 index 3fda389a..00000000 --- a/src/done/setglobalintmask.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -void __osSetGlobalIntMask(OSHWIntr mask) -{ - register u32 saveMask = __osDisableInt(); - __OSGlobalIntMask |= mask; - __osRestoreInt(saveMask); -} diff --git a/src/done/setthreadpri.c b/src/done/setthreadpri.c deleted file mode 100644 index b80f9b3d..00000000 --- a/src/done/setthreadpri.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include "osint.h" - -void osSetThreadPri(OSThread *t, OSPri pri) -{ - register u32 saveMask = __osDisableInt(); - if (t == NULL) - t = __osRunningThread; - if (t->priority != pri) - { - t->priority = pri; - if (t != __osRunningThread && t->state != OS_STATE_STOPPED) - { - __osDequeueThread(t->queue, t); - __osEnqueueThread(t->queue, t); - } - if (__osRunningThread->priority < __osRunQueue->priority) - { - __osRunningThread->state = OS_STATE_RUNNABLE; - __osEnqueueAndYield(&__osRunQueue); - } - } - __osRestoreInt(saveMask); -} diff --git a/src/done/si.c b/src/done/si.c deleted file mode 100644 index 8f821b6f..00000000 --- a/src/done/si.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -int __osSiDeviceBusy() -{ - register u32 stat = IO_READ(SI_STATUS_REG); - if (stat & (SI_STATUS_DMA_BUSY | SI_STATUS_RD_BUSY)) - return 1; - return 0; -} diff --git a/src/done/sirawread.c b/src/done/sirawread.c deleted file mode 100644 index 5cecb6c9..00000000 --- a/src/done/sirawread.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -s32 __osSiRawReadIo(u32 devAddr, u32 *data) -{ - if (__osSiDeviceBusy()) - return -1; - *data = IO_READ(devAddr); - return 0; -} diff --git a/src/done/sirawwrite.c b/src/done/sirawwrite.c deleted file mode 100644 index bf64a5b4..00000000 --- a/src/done/sirawwrite.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -s32 __osSiRawWriteIo(u32 devAddr, u32 data) -{ - if (__osSiDeviceBusy()) - return -1; - IO_WRITE(devAddr, data); - return 0; -} diff --git a/src/done/startthread.c b/src/done/startthread.c deleted file mode 100644 index 8103a989..00000000 --- a/src/done/startthread.c +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include "osint.h" - -void osStartThread(OSThread *t) -{ - register u32 saveMask = __osDisableInt(); - switch (t->state) - { - case OS_STATE_WAITING: - t->state = OS_STATE_RUNNABLE; - __osEnqueueThread(&__osRunQueue, t); - break; - case OS_STATE_STOPPED: - if (t->queue == NULL || t->queue == &__osRunQueue) - { - t->state = OS_STATE_RUNNABLE; - __osEnqueueThread(&__osRunQueue, t); - } - else - { - t->state = OS_STATE_WAITING; - __osEnqueueThread(t->queue, t); - __osEnqueueThread(&__osRunQueue, __osPopThread(t->queue)); - } - break; - } - if (__osRunningThread == NULL) - { - __osDispatchThread(); - } - else - { - if (__osRunningThread->priority < __osRunQueue->priority) - { - __osRunningThread->state = OS_STATE_RUNNABLE; - __osEnqueueAndYield(&__osRunQueue); - } - } - __osRestoreInt(saveMask); -} diff --git a/src/done/thread.c b/src/done/thread.c deleted file mode 100644 index f413c573..00000000 --- a/src/done/thread.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include "osint.h" - -struct __osThreadTail __osThreadTail = {0, -1}; -OSThread *__osRunQueue = (OSThread *)&__osThreadTail; -OSThread *__osActiveQueue = (OSThread *)&__osThreadTail; -OSThread *__osRunningThread = {0}; -OSThread *__osFaultedThread = {0}; -void __osDequeueThread(OSThread **queue, OSThread *t) -{ - register OSThread *pred; - register OSThread *succ; - pred = (OSThread *)queue; //this is actually legit.. - succ = pred->next; - while (succ != NULL) - { - if (succ == t) - { - pred->next = t->next; - return; - } - pred = succ; - succ = pred->next; - } -} diff --git a/src/done/virtualtophysical.c b/src/done/virtualtophysical.c deleted file mode 100644 index e952a60b..00000000 --- a/src/done/virtualtophysical.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include "osint.h" - -u32 osVirtualToPhysical(void *addr) -{ - if (IS_KSEG0(addr)) - { - return K0_TO_PHYS(addr); - } - else if (IS_KSEG1(addr)) - { - return K1_TO_PHYS(addr); - } - else - { - return __osProbeTLB(addr); - } -} diff --git a/src/done/yieldthread.c b/src/done/yieldthread.c deleted file mode 100644 index 9dcf6c72..00000000 --- a/src/done/yieldthread.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include "osint.h" - -void osYieldThread(void){ - register u32 saveMask = __osDisableInt(); - __osRunningThread->state = OS_STATE_RUNNABLE; - __osEnqueueAndYield(&__osRunQueue); - __osRestoreInt(saveMask); -} diff --git a/src/fight/chfinalboss.c b/src/fight/chfinalboss.c index c4b7c104..bb2b771c 100644 --- a/src/fight/chfinalboss.c +++ b/src/fight/chfinalboss.c @@ -527,7 +527,7 @@ bool chfinalboss_flyTo(Actor *this, f32 arg1[3], f32 v_max, f32 arg3, f32 arg4, this->velocity[1] += (diff[1] * dt); this->velocity[2] += (diff[2] * dt); - if (v_max < gu_sqrtf(LENGTH_SQ_VEC3F(this->velocity))) { + if (v_max < sqrtf(LENGTH_SQ_VEC3F(this->velocity))) { ml_vec3f_set_length(this->velocity, v_max); } @@ -652,7 +652,7 @@ void chfinalboss_func_80387B00(Actor *this) { this->velocity_z = this->position_z - sp28[2]; this->velocity_y = 0; - local->unk14 = gu_sqrtf( + local->unk14 = sqrtf( (this->velocity_z * this->velocity_z) + ((this->velocity_x * this->velocity_x) + (this->velocity_y * (this->velocity_y))) diff --git a/src/lair/code_AD70.c b/src/lair/code_AD70.c index e1c2e294..d4c06da6 100644 --- a/src/lair/code_AD70.c +++ b/src/lair/code_AD70.c @@ -165,9 +165,9 @@ void func_80391810(Actor *this, s32 next_state) { switch (next_state) { case 1: sp34 = (this->position[1] + this->actor_specific_1_f) - this->unk1C[1]; - this->velocity[1] = gu_sqrtf(this->actor_specific_1_f * 2000.0); + this->velocity[1] = sqrtf(this->actor_specific_1_f * 2000.0); local->unk0 = -this->velocity[1] / -1000.0f; - local->unk0 += gu_sqrtf((sp34 * -2.0) / -1000.0); + local->unk0 += sqrtf((sp34 * -2.0) / -1000.0); this->velocity[0] = this->unk1C[0] - this->position[0]; this->velocity[2] = this->unk1C[2] - this->position[2]; this->velocity[0] /= local->unk0; diff --git a/symbol_addrs.pal.txt b/symbol_addrs.pal.txt index 3a18fbc1..710b7afe 100644 --- a/symbol_addrs.pal.txt +++ b/symbol_addrs.pal.txt @@ -20,7 +20,7 @@ func_80253034 = 0x80252c84; ___osGetSR = 0x8025AC30; func_8025C29C = 0x8025beec; bzero = 0x80263790; // allow_duplicated:true -osWriteBackDCacheAll = 0x80263830; +osWritebackDCacheAll = 0x80263830; osWritebackDCache = 0x80264740; // allow_duplicated:true osInvalDCache = 0x802647C0; osSetIntMask = 0x80265120; @@ -28,7 +28,7 @@ osInvalICache = 0x80268060; // allow_duplicated:true __osSetSR = 0x80269db0; // allow_duplicated:true __osGetSR = 0x80269dc0; // allow_duplicated:true __osSetFpcCsr = 0x80269dd0; // allow_duplicated:true -func_8026A2E0 = 0x80269e80; +__osExceptionPreamble = 0x80269e80; __osEnqueueAndYield = 0x8026a4ac; __osEnqueueThread = 0x8026a5ac; __osPopThread = 0x8026a5f4; diff --git a/symbol_addrs.us.v10.txt b/symbol_addrs.us.v10.txt index 0bbf3f6f..52e64fee 100644 --- a/symbol_addrs.us.v10.txt +++ b/symbol_addrs.us.v10.txt @@ -17,7 +17,7 @@ __osRestoreInt = 0x80003FE0; // allow_duplicated:true bk_boot_BSS_START = 0x80005270; ___osGetSR = 0x8025AFE0; bzero = 0x80263B40; // allow_duplicated:true -osWriteBackDCacheAll = 0x80263BE0; +osWritebackDCacheAll = 0x80263BE0; osVirtualToPhysical = 0x802646A0; osRecvMesg = 0x80264550; osPiStartDma = 0x802647D0;