diff --git a/.gitignore b/.gitignore index 2d621cc..52b38c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,17 @@ -*.n64 -*.exe +# Generated by splat +asm/ +bin/ +assets/ + +# Build directory +build/ + +.vscode/ +__pycache__/ + +*.o +*.z64 +*.ld +*.csv + +undefined_funcs.txt diff --git a/.gitmodules b/.gitmodules index 1f6ef18..4a33b83 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,24 +1,3 @@ -[submodule "stadiumgs/0x1e40000"] - path = stadiumgs/0x1e40000 - url = https://github.com/iimarckus/stadiumgs-0x1e40000 -[submodule "stadiumgs/0x1718000"] - path = stadiumgs/0x1718000 - url = https://github.com/iimarckus/stadiumgs-0x1718000 -[submodule "stadiumgs/0x1898000"] - path = stadiumgs/0x1898000 - url = https://github.com/iimarckus/stadiumgs-0x1898000 -[submodule "stadiumgs/0x2000000"] - path = stadiumgs/0x2000000 - url = https://github.com/iimarckus/stadiumgs-0x2000000 -[submodule "stadiumgs/faces"] - path = stadiumgs/faces - url = https://github.com/iimarckus/stadiumgs-faces -[submodule "stadiumgs/0x3fd5000"] - path = stadiumgs/0x3fd5000 - url = https://github.com/iimarckus/stadiumgs-0x3fd5000 -[submodule "stadiumgs/0x3fed000"] - path = stadiumgs/0x3fed000 - url = https://github.com/iimarckus/stadiumgs-0x3fed000 -[submodule "stadiumgs/gameboy"] - path = stadiumgs/gameboy - url = https://github.com/iimarckus/stadiumgs-gameboy +[submodule "tools/n64splat"] + path = tools/n64splat + url = https://github.com/ethteck/n64splat.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..135c072 --- /dev/null +++ b/Makefile @@ -0,0 +1,106 @@ +BASEROM = baserom.z64 +TARGET = pokemonstadium +NON_MATCHING = 0 + +# Fail early if baserom does not exist +ifeq ($(wildcard $(BASEROM)),) +$(error Baserom `$(BASEROM)' not found.) +endif + +BUILD_DIR := build +ROM := $(TARGET).z64 +ELF := $(BUILD_DIR)/$(TARGET).elf +LD_SCRIPT := $(TARGET).ld +LD_MAP := $(BUILD_DIR)/$(TARGET).map +ASM_DIRS := asm asm/os +DATA_DIRS := bin assets +SRC_DIRS := $(shell find src -type d) + +C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) +S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s)) +DATA_FILES := $(foreach dir,$(DATA_DIRS),$(wildcard $(dir)/*.bin)) + +# Object files +O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.c.o)) \ + $(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.s.o)) \ + $(foreach file,$(DATA_FILES),$(BUILD_DIR)/$(file:.bin=.bin.o)) \ + +SPLAT_YAML := splat.yaml +SPLAT = $(PYTHON) tools/n64splat/split.py --target $(BASEROM) --basedir . $(SPLAT_YAML) + +##################### Compiler Options ####################### +CROSS = mips-linux-gnu- +AS = $(CROSS)as +LD = $(CROSS)ld +OBJDUMP = $(CROSS)objdump +OBJCOPY = $(CROSS)objcopy +CPP := cpp + +#CC := $(QEMU_IRIX) -L tools/ido7.1_compiler tools/ido7.1_compiler/usr/bin/cc +#CC_OLD := $(QEMU_IRIX) -L tools/ido5.3_compiler tools/ido5.3_compiler/usr/bin/cc + +CC = tools/ido_recomp/linux/7.1/cc +CC_OLD = tools/ido_recomp/linux/5.3/cc + +ASFLAGS = -EB -mtune=vr4300 -march=vr4300 -Iinclude +CFLAGS = -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -Wab,-r4300_mul -D _LANGUAGE_C +LDFLAGS = -T undefined_syms_auto.txt -T undefined_funcs_auto.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/$(TARGET).map --no-check-sections + +OPTFLAGS := -O2 + +######################## Targets ############################# + +$(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(DATA_DIRS) $(COMPRESSED_DIRS) $(MAP_DIRS) $(BGM_DIRS),$(shell mkdir -p build/$(dir))) + +build/src/os/O1/%.o: OPTFLAGS := -O1 + +default: all + +LD_SCRIPT = $(TARGET).ld + +all: $(BUILD_DIR) $(TARGET).z64 verify + +clean: + rm -rf asm bin assets $(BUILD_DIR) $(TARGET).z64 + +submodules: + git submodule update --init --recursive + +split: + rm -rf $(DATA_DIRS) $(ASM_DIRS) && ./tools/n64splat/split.py --target baserom.z64 --basedir . $(SPLAT_YAML) + +setup: clean submodules split + +$(BUILD_DIR): + echo $(C_FILES) + mkdir $(BUILD_DIR) + +$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT) + @mkdir -p $(shell dirname $@) + $(CPP) -P -DBUILD_DIR=$(BUILD_DIR) -o $@ $< + +$(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf + $(OBJCOPY) $< $@ -O binary + +$(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) + @$(LD) $(LDFLAGS) -o $@ + +$(BUILD_DIR)/%.c.o: %.c + $(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $^ + +$(BUILD_DIR)/%.s.o: %.s + $(AS) $(ASFLAGS) -o $@ $< + +$(BUILD_DIR)/%.bin.o: %.bin + $(LD) -r -b binary -o $@ $< + +# final z64 updates checksum +$(TARGET).z64: $(BUILD_DIR)/$(TARGET).bin + @cp $< $@ + +verify: $(TARGET).z64 + md5sum -c checksum.md5 + +.PHONY: all clean default split setup + +print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true diff --git a/README.md b/README.md new file mode 100644 index 0000000..3379283 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# pokemonstadium +A WIP decomp of Pokemon Stadium. + +Note: To use this repository, you must already have a rom for the game. + +# To use +1. Place the US Pokemon Stadium rom into the root of the repository as "baserom.z64". +2. Set up tools and extract the rom: `make setup` +3. Re-assemble the rom: `make` diff --git a/checksum.md5 b/checksum.md5 new file mode 100644 index 0000000..56fd807 --- /dev/null +++ b/checksum.md5 @@ -0,0 +1 @@ +ed1378bc12115f71209a77844965ba50 pokemonstadium.z64 diff --git a/diff.py b/diff.py new file mode 100644 index 0000000..0e1da09 --- /dev/null +++ b/diff.py @@ -0,0 +1,1289 @@ +#!/usr/bin/env python3 +import sys + +def fail(msg): + print(msg, file=sys.stderr) + sys.exit(1) + +# Prefer to use diff_settings.py from the current working directory +sys.path.insert(0, ".") +try: + import diff_settings +except ModuleNotFoundError: + fail("Unable to find diff_settings.py in the same directory.") +sys.path.pop(0) + +# ==== COMMAND-LINE ==== + +try: + import argcomplete # type: ignore +except ModuleNotFoundError: + argcomplete = None +import argparse + +parser = argparse.ArgumentParser(description="Diff MIPS assembly.") + +start_argument = parser.add_argument("start", help="Function name or address to start diffing from.") +if argcomplete: + def complete_symbol(**kwargs): + prefix = kwargs["prefix"] + if prefix == "": + # skip reading the map file, which would + # result in a lot of useless completions + return [] + parsed_args = kwargs["parsed_args"] + config = {} + diff_settings.apply(config, parsed_args) + mapfile = config.get("mapfile") + if not mapfile: + return [] + completes = [] + with open(mapfile) as f: + data = f.read() + # assume symbols are prefixed by a space character + search = f" {prefix}" + pos = data.find(search) + while pos != -1: + # skip the space character in the search string + pos += 1 + # assume symbols are suffixed by either a space + # character or a (unix-style) line return + spacePos = data.find(" ", pos) + lineReturnPos = data.find("\n", pos) + if lineReturnPos == -1: + endPos = spacePos + elif spacePos == -1: + endPos = lineReturnPos + else: + endPos = min(spacePos, lineReturnPos) + if endPos == -1: + match = data[pos:] + pos = -1 + else: + match = data[pos:endPos] + pos = data.find(search, endPos) + completes.append(match) + return completes + start_argument.completer = complete_symbol + +parser.add_argument("end", nargs="?", help="Address to end diff at.") +parser.add_argument( + "-o", + dest="diff_obj", + action="store_true", + help="Diff .o files rather than a whole binary. This makes it possible to see symbol names. (Recommended)", +) +parser.add_argument( + "-e", + "--elf", + dest="diff_elf_symbol", + help="Diff a given function in two ELFs, one being stripped and the other one non-stripped. Requires objdump from binutils 2.33+.", +) +parser.add_argument( + "--source", + action="store_true", + help="Show source code (if possible). Only works with -o and -e.", +) +parser.add_argument( + "--inlines", + action="store_true", + help="Show inline function calls (if possible). Only works with -o and -e.", +) +parser.add_argument( + "--base-asm", + dest="base_asm", + metavar="FILE", + help="Read assembly from given file instead of configured base img.", +) +parser.add_argument( + "--write-asm", + dest="write_asm", + metavar="FILE", + help="Write the current assembly output to file, e.g. for use with --base-asm.", +) +parser.add_argument( + "-m", + "--make", + dest="make", + action="store_true", + help="Automatically run 'make' on the .o file or binary before diffing.", +) +parser.add_argument( + "-l", + "--skip-lines", + dest="skip_lines", + type=int, + default=0, + help="Skip the first N lines of output.", +) +parser.add_argument( + "-s", + "--stop-jr-ra", + dest="stop_jrra", + action="store_true", + help="Stop disassembling at the first 'jr ra'. Some functions have multiple return points, so use with care!", +) +parser.add_argument( + "-i", + "--ignore-large-imms", + dest="ignore_large_imms", + action="store_true", + help="Pretend all large enough immediates are the same.", +) +parser.add_argument( + "-B", + "--no-show-branches", + dest="show_branches", + action="store_false", + help="Don't visualize branches/branch targets.", +) +parser.add_argument( + "-S", + "--base-shift", + dest="base_shift", + type=str, + default="0", + help="Diff position X in our img against position X + shift in the base img. " + 'Arithmetic is allowed, so e.g. |-S "0x1234 - 0x4321"| is a reasonable ' + "flag to pass if it is known that position 0x1234 in the base img syncs " + "up with position 0x4321 in our img. Not supported together with -o.", +) +parser.add_argument( + "-w", + "--watch", + dest="watch", + action="store_true", + help="Automatically update when source/object files change. " + "Recommended in combination with -m.", +) +parser.add_argument( + "-3", + "--threeway", + dest="threeway", + action="store_true", + help="Show a three-way diff between target asm, current asm, and asm " + "prior to -w rebuild. Requires -w.", +) +parser.add_argument( + "--width", + dest="column_width", + type=int, + default=50, + help="Sets the width of the left and right view column.", +) +parser.add_argument( + "--algorithm", + dest="algorithm", + default="levenshtein", + choices=["levenshtein", "difflib"], + help="Diff algorithm to use.", +) +parser.add_argument( + "--max-size", + "--max-lines", + dest="max_lines", + type=int, + default=1024, + help="The maximum length of the diff, in lines.", +) + +# Project-specific flags, e.g. different versions/make arguments. +if hasattr(diff_settings, "add_custom_arguments"): + diff_settings.add_custom_arguments(parser) # type: ignore + +if argcomplete: + argcomplete.autocomplete(parser) + +# ==== IMPORTS ==== + +import re +import os +import ast +import subprocess +import difflib +import string +import itertools +import threading +import queue +import time +from typing import Any, Dict, List, NamedTuple, Optional, Set, Tuple, Union + + +MISSING_PREREQUISITES = ( + "Missing prerequisite python module {}. " + "Run `python3 -m pip install --user colorama ansiwrap watchdog python-Levenshtein cxxfilt` to install prerequisites (cxxfilt only needed with --source)." +) + +try: + from colorama import Fore, Style, Back # type: ignore + import ansiwrap # type: ignore + import watchdog # type: ignore +except ModuleNotFoundError as e: + fail(MISSING_PREREQUISITES.format(e.name)) + +# ==== CONFIG ==== + +args = parser.parse_args() + +# Set imgs, map file and make flags in a project-specific manner. +config: Dict[str, Any] = {} +diff_settings.apply(config, args) + +arch = config.get("arch", "mips") +baseimg = config.get("baseimg", None) +myimg = config.get("myimg", None) +mapfile = config.get("mapfile", None) +makeflags = config.get("makeflags", []) +source_directories = config.get("source_directories", None) +objdump_executable = config.get("objdump_executable", None) + +MAX_FUNCTION_SIZE_LINES = args.max_lines +MAX_FUNCTION_SIZE_BYTES = MAX_FUNCTION_SIZE_LINES * 4 + +COLOR_ROTATION = [ + Fore.MAGENTA, + Fore.CYAN, + Fore.GREEN, + Fore.RED, + Fore.LIGHTYELLOW_EX, + Fore.LIGHTMAGENTA_EX, + Fore.LIGHTCYAN_EX, + Fore.LIGHTGREEN_EX, + Fore.LIGHTBLACK_EX, +] + +BUFFER_CMD = ["tail", "-c", str(10 ** 9)] +LESS_CMD = ["less", "-SRic", "-#6"] + +DEBOUNCE_DELAY = 0.1 +FS_WATCH_EXTENSIONS = [".c", ".h"] + +# ==== LOGIC ==== + +if args.algorithm == "levenshtein": + try: + import Levenshtein # type: ignore + except ModuleNotFoundError as e: + fail(MISSING_PREREQUISITES.format(e.name)) + +if args.source: + try: + import cxxfilt # type: ignore + except ModuleNotFoundError as e: + fail(MISSING_PREREQUISITES.format(e.name)) + +if objdump_executable is None: + for objdump_cand in ["mips-linux-gnu-objdump", "mips64-elf-objdump"]: + try: + subprocess.check_call( + [objdump_cand, "--version"], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) + objdump_executable = objdump_cand + break + except subprocess.CalledProcessError: + pass + except FileNotFoundError: + pass + +if not objdump_executable: + fail( + "Missing binutils; please ensure mips-linux-gnu-objdump or mips64-elf-objdump exist, or configure objdump_executable." + ) + + +def eval_int(expr, emsg=None): + try: + ret = ast.literal_eval(expr) + if not isinstance(ret, int): + raise Exception("not an integer") + return ret + except Exception: + if emsg is not None: + fail(emsg) + return None + + +def eval_line_num(expr): + return int(expr.strip().replace(":", ""), 16) + + +def run_make(target, capture_output=False): + if capture_output: + return subprocess.run( + ["make"] + makeflags + [target], + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, + ) + else: + subprocess.check_call(["make"] + makeflags + [target]) + + +def restrict_to_function(dump, fn_name): + out = [] + search = f"<{fn_name}>:" + found = False + for line in dump.split("\n"): + if found: + if len(out) >= MAX_FUNCTION_SIZE_LINES: + break + out.append(line) + elif search in line: + found = True + return "\n".join(out) + + +def maybe_get_objdump_source_flags(): + if not args.source: + return [] + + flags = [ + "--source", + "--source-comment=| ", + "-l", + ] + + if args.inlines: + flags.append("--inlines") + + return flags + + +def run_objdump(cmd): + flags, target, restrict = cmd + out = subprocess.check_output( + [objdump_executable] + arch_flags + flags + [target], universal_newlines=True + ) + if restrict is not None: + return restrict_to_function(out, restrict) + return out + + +base_shift = eval_int( + args.base_shift, "Failed to parse --base-shift (-S) argument as an integer." +) + + +def search_map_file(fn_name): + if not mapfile: + fail(f"No map file configured; cannot find function {fn_name}.") + + try: + with open(mapfile) as f: + lines = f.read().split("\n") + except Exception: + fail(f"Failed to open map file {mapfile} for reading.") + + try: + cur_objfile = None + ram_to_rom = None + cands = [] + last_line = "" + for line in lines: + if line.startswith(" .text"): + cur_objfile = line.split()[3] + if "load address" in line: + tokens = last_line.split() + line.split() + ram = int(tokens[1], 0) + rom = int(tokens[5], 0) + ram_to_rom = rom - ram + if line.endswith(" " + fn_name): + ram = int(line.split()[0], 0) + if cur_objfile is not None and ram_to_rom is not None: + cands.append((cur_objfile, ram + ram_to_rom)) + last_line = line + except Exception as e: + import traceback + + traceback.print_exc() + fail(f"Internal error while parsing map file") + + if len(cands) > 1: + fail(f"Found multiple occurrences of function {fn_name} in map file.") + if len(cands) == 1: + return cands[0] + return None, None + + +def dump_elf(): + if not baseimg or not myimg: + fail("Missing myimg/baseimg in config.") + if base_shift: + fail("--base-shift not compatible with -e") + + start_addr = eval_int(args.start, "Start address must be an integer expression.") + + if args.end is not None: + end_addr = eval_int(args.end, "End address must be an integer expression.") + else: + end_addr = start_addr + MAX_FUNCTION_SIZE_BYTES + + flags1 = [ + f"--start-address={start_addr}", + f"--stop-address={end_addr}", + ] + + flags2 = [ + f"--disassemble={args.diff_elf_symbol}", + ] + + objdump_flags = ["-drz", "-j", ".text"] + return ( + myimg, + (objdump_flags + flags1, baseimg, None), + (objdump_flags + flags2 + maybe_get_objdump_source_flags(), myimg, None), + ) + + +def dump_objfile(): + if base_shift: + fail("--base-shift not compatible with -o") + if args.end is not None: + fail("end address not supported together with -o") + if args.start.startswith("0"): + fail("numerical start address not supported with -o; pass a function name") + + objfile, _ = search_map_file(args.start) + if not objfile: + fail("Not able to find .o file for function.") + + if args.make: + run_make(objfile) + + if not os.path.isfile(objfile): + fail(f"Not able to find .o file for function: {objfile} is not a file.") + + refobjfile = "expected/" + objfile + if not os.path.isfile(refobjfile): + fail(f'Please ensure an OK .o file exists at "{refobjfile}".') + + objdump_flags = ["-drz"] + return ( + objfile, + (objdump_flags, refobjfile, args.start), + (objdump_flags + maybe_get_objdump_source_flags(), objfile, args.start), + ) + + +def dump_binary(): + if not baseimg or not myimg: + fail("Missing myimg/baseimg in config.") + if args.make: + run_make(myimg) + start_addr = eval_int(args.start) + if start_addr is None: + _, start_addr = search_map_file(args.start) + if start_addr is None: + fail("Not able to find function in map file.") + if args.end is not None: + end_addr = eval_int(args.end, "End address must be an integer expression.") + else: + end_addr = start_addr + MAX_FUNCTION_SIZE_BYTES + objdump_flags = ["-Dz", "-bbinary", "-mmips", "-EB"] + flags1 = [ + f"--start-address={start_addr + base_shift}", + f"--stop-address={end_addr + base_shift}", + ] + flags2 = [f"--start-address={start_addr}", f"--stop-address={end_addr}"] + return ( + myimg, + (objdump_flags + flags1, baseimg, None), + (objdump_flags + flags2, myimg, None), + ) + + +# Alignment with ANSI colors is broken, let's fix it. +def ansi_ljust(s, width): + needed = width - ansiwrap.ansilen(s) + if needed > 0: + return s + " " * needed + else: + return s + + +if arch == "mips": + re_int = re.compile(r"[0-9]+") + re_comment = re.compile(r"<.*?>") + re_reg = re.compile(r"\$?\b(a[0-3]|t[0-9]|s[0-8]|at|v[01]|f[12]?[0-9]|f3[01]|k[01]|fp|ra)\b") + re_sprel = re.compile(r"(?<=,)([0-9]+|0x[0-9a-f]+)\(sp\)") + re_large_imm = re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}") + re_imm = re.compile(r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(sp)|%(lo|hi)\([^)]*\)") + forbidden = set(string.ascii_letters + "_") + arch_flags = ["-m", "mips:4300"] + branch_likely_instructions = { + "beql", + "bnel", + "beqzl", + "bnezl", + "bgezl", + "bgtzl", + "blezl", + "bltzl", + "bc1tl", + "bc1fl", + } + branch_instructions = branch_likely_instructions.union( + {"b", "beq", "bne", "beqz", "bnez", "bgez", "bgtz", "blez", "bltz", "bc1t", "bc1f"} + ) + instructions_with_address_immediates = branch_instructions.union({"jal", "j"}) +elif arch == "aarch64": + re_int = re.compile(r"[0-9]+") + re_comment = re.compile(r"(<.*?>|//.*$)") + # GPRs and FP registers: X0-X30, W0-W30, [DSHQ]0..31 + # The zero registers and SP should not be in this list. + re_reg = re.compile(r"\$?\b([dshq][12]?[0-9]|[dshq]3[01]|[xw][12]?[0-9]|[xw]30)\b") + re_sprel = re.compile(r"sp, #-?(0x[0-9a-fA-F]+|[0-9]+)\b") + re_large_imm = re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}") + re_imm = re.compile(r"(? 0 else imm + if "R_MIPS_LO16" in row: + repl = f"%lo({repl})" + elif "R_MIPS_HI16" in row: + # Ideally we'd pair up R_MIPS_LO16 and R_MIPS_HI16 to generate a + # correct addend for each, but objdump doesn't give us the order of + # the relocations, so we can't find the right LO16. :( + repl = f"%hi({repl})" + else: + assert "R_MIPS_26" in row, f"unknown relocation type '{row}'" + return before + repl + after + + +def pad_mnemonic(line): + if "\t" not in line: + return line + mn, args = line.split("\t", 1) + return f"{mn:<7s} {args}" + + +class Line(NamedTuple): + mnemonic: str + diff_row: str + original: str + line_num: str + branch_target: Optional[str] + source_lines: List[str] + comment: Optional[str] + + +def process(lines): + skip_next = False + source_lines = [] + if not args.diff_obj: + lines = lines[7:] + if lines and not lines[-1]: + lines.pop() + + output = [] + stop_after_delay_slot = False + for row in lines: + if args.diff_obj and (">:" in row or not row): + continue + + if args.source and (row and row[0] != " "): + source_lines.append(row) + continue + + if "R_AARCH64_" in row: + # TODO: handle relocation + continue + + if "R_MIPS_" in row: + # N.B. Don't transform the diff rows, they already ignore immediates + # if output[-1].diff_row != "": + # output[-1] = output[-1].replace(diff_row=process_mips_reloc(row, output[-1].row_with_imm)) + new_original = process_mips_reloc(row, output[-1].original) + output[-1] = output[-1]._replace(original=new_original) + continue + + m_comment = re.search(re_comment, row) + comment = m_comment[0] if m_comment else None + row = re.sub(re_comment, "", row) + row = row.rstrip() + tabs = row.split("\t") + row = "\t".join(tabs[2:]) + line_num = tabs[0].strip() + row_parts = row.split("\t", 1) + mnemonic = row_parts[0].strip() + if mnemonic not in instructions_with_address_immediates: + row = re.sub(re_int, lambda s: hexify_int(row, s), row) + original = row + if skip_next: + skip_next = False + row = "" + mnemonic = "" + if mnemonic in branch_likely_instructions: + skip_next = True + row = re.sub(re_reg, "", row) + row = re.sub(re_sprel, "addr(sp)", row) + row_with_imm = row + if mnemonic in instructions_with_address_immediates: + row = row.strip() + row, _ = split_off_branch(row) + row += "" + else: + row = normalize_imms(row) + + branch_target = None + if mnemonic in branch_instructions: + target = row_parts[1].strip().split(",")[-1] + if mnemonic in branch_likely_instructions: + target = hex(int(target, 16) - 4)[2:] + branch_target = target.strip() + + output.append( + Line( + mnemonic=mnemonic, + diff_row=row, + original=original, + line_num=line_num, + branch_target=branch_target, + source_lines=source_lines, + comment=comment, + ) + ) + source_lines = [] + + if args.stop_jrra and mnemonic == "jr" and row_parts[1].strip() == "ra": + stop_after_delay_slot = True + elif stop_after_delay_slot: + break + + return output + + +def format_single_line_diff(line1, line2, column_width): + return f"{ansi_ljust(line1,column_width)}{line2}" + + +class SymbolColorer: + def __init__(self, base_index): + self.color_index = base_index + self.symbol_colors = {} + + def color_symbol(self, s, t=None): + try: + color = self.symbol_colors[s] + except: + color = COLOR_ROTATION[self.color_index % len(COLOR_ROTATION)] + self.color_index += 1 + self.symbol_colors[s] = color + t = t or s + return f"{color}{t}{Fore.RESET}" + + +def maybe_normalize_large_imms(row): + if args.ignore_large_imms: + row = re.sub(re_large_imm, "", row) + return row + + +def normalize_imms(row): + return re.sub(re_imm, "", row) + + +def normalize_stack(row): + return re.sub(re_sprel, "addr(sp)", row) + + +def split_off_branch(line): + parts = line.split(",") + if len(parts) < 2: + parts = line.split(None, 1) + off = len(line) - len(parts[-1]) + return line[:off], line[off:] + + +def color_imms(out1, out2): + g1 = [] + g2 = [] + re.sub(re_imm, lambda s: g1.append(s.group()), out1) + re.sub(re_imm, lambda s: g2.append(s.group()), out2) + if len(g1) == len(g2): + diffs = [x != y for (x, y) in zip(g1, g2)] + it = iter(diffs) + + def maybe_color(s): + return f"{Fore.LIGHTBLUE_EX}{s}{Style.RESET_ALL}" if next(it) else s + + out1 = re.sub(re_imm, lambda s: maybe_color(s.group()), out1) + it = iter(diffs) + out2 = re.sub(re_imm, lambda s: maybe_color(s.group()), out2) + return out1, out2 + + +def color_branch_imms(br1, br2): + if br1 != br2: + br1 = f"{Fore.LIGHTBLUE_EX}{br1}{Style.RESET_ALL}" + br2 = f"{Fore.LIGHTBLUE_EX}{br2}{Style.RESET_ALL}" + return br1, br2 + + +def diff_sequences_difflib(seq1, seq2): + differ = difflib.SequenceMatcher(a=seq1, b=seq2, autojunk=False) + return differ.get_opcodes() + + +def diff_sequences(seq1, seq2): + if ( + args.algorithm != "levenshtein" + or len(seq1) * len(seq2) > 4 * 10 ** 8 + or len(seq1) + len(seq2) >= 0x110000 + ): + return diff_sequences_difflib(seq1, seq2) + + # The Levenshtein library assumes that we compare strings, not lists. Convert. + # (Per the check above we know we have fewer than 0x110000 unique elements, so chr() works.) + remapping = {} + + def remap(seq): + seq = seq[:] + for i in range(len(seq)): + val = remapping.get(seq[i]) + if val is None: + val = chr(len(remapping)) + remapping[seq[i]] = val + seq[i] = val + return "".join(seq) + + seq1 = remap(seq1) + seq2 = remap(seq2) + return Levenshtein.opcodes(seq1, seq2) + + +class OutputLine: + base: Optional[str] + fmt2: str + key2: str + + def __init__(self, base: Optional[str], fmt2: str, key2: str) -> None: + self.base = base + self.fmt2 = fmt2 + self.key2 = key2 + + def __eq__(self, other: object) -> bool: + if not isinstance(other, OutputLine): + return NotImplemented + return self.key2 == other.key2 + + def __hash__(self) -> int: + return hash(self.key2) + + +def do_diff(basedump: str, mydump: str) -> List[OutputLine]: + output: List[OutputLine] = [] + + lines1 = process(basedump.split("\n")) + lines2 = process(mydump.split("\n")) + + sc1 = SymbolColorer(0) + sc2 = SymbolColorer(0) + sc3 = SymbolColorer(4) + sc4 = SymbolColorer(4) + sc5 = SymbolColorer(0) + sc6 = SymbolColorer(0) + bts1: Set[str] = set() + bts2: Set[str] = set() + + if args.show_branches: + for (lines, btset, sc) in [ + (lines1, bts1, sc5), + (lines2, bts2, sc6), + ]: + for line in lines: + bt = line.branch_target + if bt is not None: + btset.add(bt + ":") + sc.color_symbol(bt + ":") + + for (tag, i1, i2, j1, j2) in diff_sequences( + [line.mnemonic for line in lines1], [line.mnemonic for line in lines2] + ): + for line1, line2 in itertools.zip_longest(lines1[i1:i2], lines2[j1:j2]): + if tag == "replace": + if line1 is None: + tag = "insert" + elif line2 is None: + tag = "delete" + elif tag == "insert": + assert line1 is None + elif tag == "delete": + assert line2 is None + + line_color1 = line_color2 = sym_color = Fore.RESET + line_prefix = " " + if line1 and line2 and line1.diff_row == line2.diff_row: + if maybe_normalize_large_imms( + line1.original + ) == maybe_normalize_large_imms(line2.original): + out1 = line1.original + out2 = line2.original + elif line1.diff_row == "": + out1 = f"{Style.BRIGHT}{Fore.LIGHTBLACK_EX}{line1.original}" + out2 = f"{Style.BRIGHT}{Fore.LIGHTBLACK_EX}{line2.original}" + else: + mnemonic = line1.original.split()[0] + out1, out2 = line1.original, line2.original + branch1 = branch2 = "" + if mnemonic in instructions_with_address_immediates: + out1, branch1 = split_off_branch(line1.original) + out2, branch2 = split_off_branch(line2.original) + branchless1 = out1 + branchless2 = out2 + out1, out2 = color_imms(out1, out2) + + same_relative_target = False + if line1.branch_target is not None and line2.branch_target is not None: + relative_target1 = eval_line_num(line1.branch_target) - eval_line_num(line1.line_num) + relative_target2 = eval_line_num(line2.branch_target) - eval_line_num(line2.line_num) + same_relative_target = relative_target1 == relative_target2 + + if not same_relative_target: + branch1, branch2 = color_branch_imms(branch1, branch2) + + out1 += branch1 + out2 += branch2 + if normalize_imms(branchless1) == normalize_imms(branchless2): + if not same_relative_target: + # only imms differences + sym_color = Fore.LIGHTBLUE_EX + line_prefix = "i" + else: + out1 = re.sub( + re_sprel, lambda s: sc3.color_symbol(s.group()), out1, + ) + out2 = re.sub( + re_sprel, lambda s: sc4.color_symbol(s.group()), out2, + ) + if normalize_stack(branchless1) == normalize_stack(branchless2): + # only stack differences (luckily stack and imm + # differences can't be combined in MIPS, so we + # don't have to think about that case) + sym_color = Fore.YELLOW + line_prefix = "s" + else: + # regs differences and maybe imms as well + out1 = re.sub( + re_reg, lambda s: sc1.color_symbol(s.group()), out1 + ) + out2 = re.sub( + re_reg, lambda s: sc2.color_symbol(s.group()), out2 + ) + line_color1 = line_color2 = sym_color = Fore.YELLOW + line_prefix = "r" + elif line1 and line2: + line_prefix = "|" + line_color1 = Fore.LIGHTBLUE_EX + line_color2 = Fore.LIGHTBLUE_EX + sym_color = Fore.LIGHTBLUE_EX + out1 = line1.original + out2 = line2.original + elif line1: + line_prefix = "<" + line_color1 = sym_color = Fore.RED + out1 = line1.original + out2 = "" + elif line2: + line_prefix = ">" + line_color2 = sym_color = Fore.GREEN + out1 = "" + out2 = line2.original + + if args.source and line2 and line2.comment: + out2 += f" {line2.comment}" + + def format_part(out: str, line: Optional[Line], line_color: str, btset: Set[str], sc: SymbolColorer) -> Optional[str]: + if line is None: + return None + in_arrow = " " + out_arrow = "" + if args.show_branches: + if line.line_num in btset: + in_arrow = sc.color_symbol(line.line_num, "~>") + line_color + if line.branch_target is not None: + out_arrow = " " + sc.color_symbol(line.branch_target + ":", "~>") + out = pad_mnemonic(out) + return f"{line_color}{line.line_num} {in_arrow} {out}{Style.RESET_ALL}{out_arrow}" + + part1 = format_part(out1, line1, line_color1, bts1, sc5) + part2 = format_part(out2, line2, line_color2, bts2, sc6) + key2 = line2.original if line2 else "" + + mid = f"{sym_color}{line_prefix}" + + if line2: + for source_line in line2.source_lines: + color = Style.DIM + # File names and function names + if source_line and source_line[0] != "|": + color += Style.BRIGHT + # Function names + if source_line.endswith("():"): + # Underline. Colorama does not provide this feature, unfortunately. + color += "\u001b[4m" + try: + source_line = cxxfilt.demangle( + source_line[:-3], external_only=False + ) + except: + pass + output.append(OutputLine(None, f" {color}{source_line}{Style.RESET_ALL}", source_line)) + + fmt2 = mid + " " + (part2 or "") + output.append(OutputLine(part1, fmt2, key2)) + + return output + + +def chunk_diff(diff: List[OutputLine]) -> List[Union[List[OutputLine], OutputLine]]: + cur_right: List[OutputLine] = [] + chunks: List[Union[List[OutputLine], OutputLine]] = [] + for output_line in diff: + if output_line.base is not None: + chunks.append(cur_right) + chunks.append(output_line) + cur_right = [] + else: + cur_right.append(output_line) + chunks.append(cur_right) + return chunks + + +def format_diff(old_diff: List[OutputLine], new_diff: List[OutputLine]) -> Tuple[str, List[str]]: + old_chunks = chunk_diff(old_diff) + new_chunks = chunk_diff(new_diff) + output: List[Tuple[str, OutputLine, OutputLine]] = [] + assert len(old_chunks) == len(new_chunks), "same target" + empty = OutputLine("", "", "") + for old_chunk, new_chunk in zip(old_chunks, new_chunks): + if isinstance(old_chunk, list): + assert isinstance(new_chunk, list) + if not old_chunk and not new_chunk: + # Most of the time lines sync up without insertions/deletions, + # and there's no interdiffing to be done. + continue + differ = difflib.SequenceMatcher(a=old_chunk, b=new_chunk, autojunk=False) + for (tag, i1, i2, j1, j2) in differ.get_opcodes(): + if tag in ["equal", "replace"]: + for i, j in zip(range(i1, i2), range(j1, j2)): + output.append(("", old_chunk[i], new_chunk[j])) + elif tag == "insert": + for j in range(j1, j2): + output.append(("", empty, new_chunk[j])) + else: + for i in range(i1, i2): + output.append(("", old_chunk[i], empty)) + else: + assert isinstance(new_chunk, OutputLine) + # old_chunk.base and new_chunk.base have the same text since + # both diffs are based on the same target, but they might + # differ in color. Use the new version. + output.append((new_chunk.base or "", old_chunk, new_chunk)) + + # TODO: status line, with e.g. approximate permuter score? + width = args.column_width + if args.threeway: + header_line = "TARGET".ljust(width) + " CURRENT".ljust(width) + " PREVIOUS" + diff_lines = [ + ansi_ljust(base, width) + + ansi_ljust(new.fmt2, width) + + (old.fmt2 or "-" if old != new else "") + for (base, old, new) in output + ] + else: + header_line = "" + diff_lines = [ + ansi_ljust(base, width) + new.fmt2 + for (base, old, new) in output + if base or new.key2 + ] + return header_line, diff_lines + + +def debounced_fs_watch(targets, outq, debounce_delay): + import watchdog.events # type: ignore + import watchdog.observers # type: ignore + + class WatchEventHandler(watchdog.events.FileSystemEventHandler): + def __init__(self, queue, file_targets): + self.queue = queue + self.file_targets = file_targets + + def on_modified(self, ev): + if isinstance(ev, watchdog.events.FileModifiedEvent): + self.changed(ev.src_path) + + def on_moved(self, ev): + if isinstance(ev, watchdog.events.FileMovedEvent): + self.changed(ev.dest_path) + + def should_notify(self, path): + for target in self.file_targets: + if path == target: + return True + if args.make and any( + path.endswith(suffix) for suffix in FS_WATCH_EXTENSIONS + ): + return True + return False + + def changed(self, path): + if self.should_notify(path): + self.queue.put(time.time()) + + def debounce_thread(): + listenq = queue.Queue() + file_targets = [] + event_handler = WatchEventHandler(listenq, file_targets) + observer = watchdog.observers.Observer() + observed = set() + for target in targets: + if os.path.isdir(target): + observer.schedule(event_handler, target, recursive=True) + else: + file_targets.append(target) + target = os.path.dirname(target) or "." + if target not in observed: + observed.add(target) + observer.schedule(event_handler, target) + observer.start() + while True: + t = listenq.get() + more = True + while more: + delay = t + debounce_delay - time.time() + if delay > 0: + time.sleep(delay) + # consume entire queue + more = False + try: + while True: + t = listenq.get(block=False) + more = True + except queue.Empty: + pass + outq.put(t) + + th = threading.Thread(target=debounce_thread, daemon=True) + th.start() + + +class Display: + def __init__(self, basedump, mydump): + self.basedump = basedump + self.mydump = mydump + self.emsg = None + self.last_diff_output = None + + def run_less(self): + if self.emsg is not None: + output = self.emsg + else: + diff_output = do_diff(self.basedump, self.mydump) + last_diff_output = self.last_diff_output or diff_output + self.last_diff_output = diff_output + header, diff_lines = format_diff(last_diff_output, diff_output) + header_lines = [header] if header else [] + output = "\n".join(header_lines + diff_lines[args.skip_lines :]) + + # Pipe the output through 'tail' and only then to less, to ensure the + # write call doesn't block. ('tail' has to buffer all its input before + # it starts writing.) This also means we don't have to deal with pipe + # closure errors. + buffer_proc = subprocess.Popen( + BUFFER_CMD, stdin=subprocess.PIPE, stdout=subprocess.PIPE + ) + less_proc = subprocess.Popen(LESS_CMD, stdin=buffer_proc.stdout) + buffer_proc.stdin.write(output.encode()) + buffer_proc.stdin.close() + buffer_proc.stdout.close() + return (buffer_proc, less_proc) + + def run_sync(self): + proca, procb = self.run_less() + procb.wait() + proca.wait() + + def run_async(self, watch_queue): + self.watch_queue = watch_queue + self.ready_queue = queue.Queue() + self.pending_update = None + dthread = threading.Thread(target=self.display_thread) + dthread.start() + self.ready_queue.get() + + def display_thread(self): + proca, procb = self.run_less() + self.less_proc = procb + self.ready_queue.put(0) + while True: + ret = procb.wait() + proca.wait() + self.less_proc = None + if ret != 0: + # fix the terminal + os.system("tput reset") + if ret != 0 and self.pending_update is not None: + # killed by program with the intent to refresh + msg, error = self.pending_update + self.pending_update = None + if not error: + self.mydump = msg + self.emsg = None + else: + self.emsg = msg + proca, procb = self.run_less() + self.less_proc = procb + self.ready_queue.put(0) + else: + # terminated by user, or killed + self.watch_queue.put(None) + self.ready_queue.put(0) + break + + def progress(self, msg): + # Write message to top-left corner + sys.stdout.write("\x1b7\x1b[1;1f{}\x1b8".format(msg + " ")) + sys.stdout.flush() + + def update(self, text, error): + if not error and not self.emsg and text == self.mydump: + self.progress("Unchanged. ") + return + self.pending_update = (text, error) + if not self.less_proc: + return + self.less_proc.kill() + self.ready_queue.get() + + def terminate(self): + if not self.less_proc: + return + self.less_proc.kill() + self.ready_queue.get() + + +def main(): + if args.diff_elf_symbol: + make_target, basecmd, mycmd = dump_elf() + elif args.diff_obj: + make_target, basecmd, mycmd = dump_objfile() + else: + make_target, basecmd, mycmd = dump_binary() + + if args.write_asm is not None: + mydump = run_objdump(mycmd) + with open(args.write_asm, "w") as f: + f.write(mydump) + print(f"Wrote assembly to {args.write_asm}.") + sys.exit(0) + + if args.base_asm is not None: + with open(args.base_asm) as f: + basedump = f.read() + else: + basedump = run_objdump(basecmd) + + mydump = run_objdump(mycmd) + + display = Display(basedump, mydump) + + if not args.watch: + display.run_sync() + else: + if not args.make: + yn = input( + "Warning: watch-mode (-w) enabled without auto-make (-m). You will have to run make manually. Ok? (Y/n) " + ) + if yn.lower() == "n": + return + if args.make: + watch_sources = None + if hasattr(diff_settings, "watch_sources_for_target"): + watch_sources = diff_settings.watch_sources_for_target(make_target) + watch_sources = watch_sources or source_directories + if not watch_sources: + fail("Missing source_directories config, don't know what to watch.") + else: + watch_sources = [make_target] + q = queue.Queue() + debounced_fs_watch(watch_sources, q, DEBOUNCE_DELAY) + display.run_async(q) + last_build = 0 + try: + while True: + t = q.get() + if t is None: + break + if t < last_build: + continue + last_build = time.time() + if args.make: + display.progress("Building...") + ret = run_make(make_target, capture_output=True) + if ret.returncode != 0: + display.update( + ret.stderr.decode("utf-8-sig", "replace") + or ret.stdout.decode("utf-8-sig", "replace"), + error=True, + ) + continue + mydump = run_objdump(mycmd) + display.update(mydump, error=False) + except KeyboardInterrupt: + display.terminate() + + +main() diff --git a/diff_settings.py b/diff_settings.py new file mode 100644 index 0000000..cc62fa5 --- /dev/null +++ b/diff_settings.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +def apply(config, args): + config['baseimg'] = 'baserom.z64' + config['myimg'] = 'pokemonstadium.z64' + config['mapfile'] = 'build/pokemonstadium.map' + config['source_directories'] = ['.'] diff --git a/include/PR/PRimage.h b/include/PR/PRimage.h new file mode 100644 index 0000000..407894f --- /dev/null +++ b/include/PR/PRimage.h @@ -0,0 +1,126 @@ +/************************************************************************** + * + * $Revision: 1.4 $ + * $Date: 1997/11/26 00:30:50 $ + * $Source: /disk6/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/PR/R4300.h b/include/PR/R4300.h new file mode 100644 index 0000000..932694d --- /dev/null +++ b/include/PR/R4300.h @@ -0,0 +1,453 @@ +/************************************************************************** + * * + * 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: /disk6/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/PR/abi.h b/include/PR/abi.h new file mode 100644 index 0000000..2102bc8 --- /dev/null +++ b/include/PR/abi.h @@ -0,0 +1,410 @@ +#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: /disk6/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/PR/gbi.h b/include/PR/gbi.h new file mode 100644 index 0000000..b418e03 --- /dev/null +++ b/include/PR/gbi.h @@ -0,0 +1,4378 @@ + +/************************************************************************** + * * + * 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.128 $ + * $Date: 1997/11/26 00:30:51 $ + * $Source: /disk6/Master/cvsmdev2/PR/include/gbi.h,v $ + * + **************************************************************************/ + +#ifndef _GBI_H_ +#define _GBI_H_ + +/* + * 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 +#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_SUBMODULE 0xd6 + +#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_LINE3D 0x07 +#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_2x +# 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_TEXTURE_ENABLE 0x00000002 /* Microcode use only */ +#define G_SHADE 0x00000004 /* enable Gouraud interp */ +/* rest of low byte reserved for setup ucode */ +#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 */ +#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_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_2x +/* 0,2,4,6 are reserved by G_MTX */ +# 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_2x +# 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 +#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 +#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((ofs)/8,16,8)| \ + _SHIFTL(((len)-1)/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((ofs)/8,16,8)| \ + _SHIFTL(((len)-1)/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_2x +# 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 */ + +/* + * F3DEX_GBI: G_VTX GBI format was changed to support 64 vertice. + * + * +--------+--------+------+---------------+ + * G_VTX | cmd:8 | v0:8 | n:6 | length:10 | + * +-+---+--+--------+------+---------------+ + * | |seg| address | + * +-+---+----------------------------------+ + */ +#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)) +# 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_2x +# 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_2x +#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)) +#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 + +/*** + *** 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) \ +} + +#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) \ +} + +/*** + *** 1 Quadrangle + ***/ +#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)) + +#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/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_2x +ERROR!! gSPInsertMatrix 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_2x +#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 + +/* + * Lighting Macros + */ +#ifdef F3DEX_GBI_2x +# 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_2x +# define gSPLight(pkt, l, n) \ + gDma2p((pkt),G_MOVEMEM,(l),sizeof(Light),G_MV_LIGHT,(n)*3+3) +# define gsSPLight(l, n) \ + gsDma2p( G_MOVEMEM,(l),sizeof(Light),G_MV_LIGHT,(n)*3+3) +#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_LOOKATX,0) +# define gsSPLookAtX(l) \ + gsDma2p( G_MOVEMEM,(l),sizeof(Light),G_MV_LOOKATX,0) +# define gSPLookAtY(pkt, l) \ + gDma2p((pkt),G_MOVEMEM,(l),sizeof(Light),G_MV_LOOKATY,0) +# define gsSPLookAtY(l) \ + gsDma2p( G_MOVEMEM,(l),sizeof(Light),G_MV_LOOKATY,0) +#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 gsDPSetHilite1Tile(tile, hilite, width, height) \ + gsDPSetTileSize(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) +#define gsDPSetHilite2Tile(tile, hilite, width, height) \ + gsDPSetTileSize(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))) + +/* + * 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)) \ +} + + +#define gSPPerspNormalize(pkt, s) \ + gMoveWd(pkt, G_MW_PERSPNORM, 0, (s)) +#define gsSPPerspNormalize(s) \ + gsMoveWd( G_MW_PERSPNORM, 0, (s)) + +#ifdef F3DEX_GBI_2x +# 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_2x +/* + * 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(pkt, 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_2x +#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) | _SHIFTL(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/PR/gs2dex.h b/include/PR/gs2dex.h new file mode 100644 index 0000000..7e2b2c6 --- /dev/null +++ b/include/PR/gs2dex.h @@ -0,0 +1,364 @@ +/*--------------------------------------------------------------------- + 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.15 1997/10/17 08:19:07 yasu Exp $ + ---------------------------------------------------------------------*/ + +#ifndef _GS2DEX_H_ +#define _GS2DEX_H_ + +#ifdef _LANGUAGE_C_PLUS_PLUS +extern "C" { +#endif + +/*===========================================================================* + * 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; /* The x-coordinate of the upper-left position of the texture. (u11.5)*/ + u16 imageW; /* The width of the texture. (u10.2)*/ + s16 frameX; /* The upper-left position of the transferred frame. (s10.2)*/ + u16 frameW; /* The width of the transferred frame. (u10.2)*/ + + u16 imageY; /* The y-coordinate of the upper-left position of the texture. (u11.5)*/ + u16 imageH; /* The height of the texture. (u10.2)*/ + s16 frameY; /* The upper-left position of the transferred frame. (s10.2)*/ + u16 frameH; /* The height of the transferred frame. (u10.2)*/ + + u64 *imagePtr; /* The texture source address on DRAM. */ + u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */ + u8 imageFmt; /* The format of the texel. G_IM_FMT_* */ + u8 imageSiz; /* The size of the texel G_IM_SIZ_* */ + u16 imagePal; /* The pallet number. */ + u16 imageFlip; /* The right & left inversion of the image. Inverted by G_BG_FLAG_FLIPS*/ + + /* Because the following are set in the initialization routine guS2DInitBg(), the user doesn't + have to set it.*/ + u16 tmemW; /* The TMEM width and Work size of the frame 1 line. + At LoadBlock, GS_PIX2TMEM(imageW/4,imageSiz) + At LoadTile GS_PIX2TMEM(frameW/4,imageSiz)+1 */ + u16 tmemH; /* The height of TMEM loadable at a time. (s13.2) The 4 times value. + When the normal texture, 512/tmemW*4 + When the CI texture, 256/tmemW*4 */ + u16 tmemLoadSH; /* The SH value + At LoadBlock, tmemSize/2-1 + At LoadTile, tmemW*16-1 */ + u16 tmemLoadTH; /* The TH value or the Stride value + At LoadBlock, GS_CALC_DXT(tmemW) + At LoadTile, tmemH-1 */ + u16 tmemSizeW; /* The skip value of imagePtr for image 1-line. + At LoadBlock, tmemW*2 + At LoadTile, GS_PIX2TMEM(imageW/4,imageSiz)*2 */ + u16 tmemSize; /* The skip value of imagePtr for 1-loading. + = tmemSizeW*tmemH */ +} uObjBg_t; /* 40 bytes */ + +/* Scalable background plane */ +typedef struct { + u16 imageX; /* The x-coordinate of the upper-left position of the texture. (u11.5)*/ + u16 imageW; /* The width of the texture. (u10.2)*/ + s16 frameX; /* The upper-left position of the transferred frame. (s10.2)*/ + u16 frameW; /* The width of the transferred frame. (u10.2)*/ + + u16 imageY; /* The y-coordinate of the upper-left position of the texture. (u11.5)*/ + u16 imageH; /* The height of the texture. (u10.2)*/ + s16 frameY; /* The upper-left position of the transferred frame. (s10.2)*/ + u16 frameH; /* The height of the transferred frame. (u10.2)*/ + + u64 *imagePtr; /* The texture source address on DRAM. */ + u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */ + u8 imageFmt; /* The format of the texel. G_IM_FMT_* */ + u8 imageSiz; /* The size of the texel G_IM_SIZ_* */ + u16 imagePal; /* The pallet number. */ + u16 imageFlip; /* The right & left inversion of the image. Inverted by G_BG_FLAG_FLIPS*/ + + u16 scaleW; /* The scale value of the X-direction. (u5.10)*/ + u16 scaleH; /* The scale value of the Y-direction. (u5.10)*/ + s32 imageYorig; /* The start point of drawing on the 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 /* The inversion to the S-direction. */ +#define G_OBJ_FLAG_FLIPT 1<<4 /* The inversion to the T-direction. */ + +typedef struct { + s16 objX; /* The x-coordinate of the upper-left end. s10.2 OBJ */ + u16 scaleW; /* Scaling of the u5.10 width direction. */ + u16 imageW; /* The width of the u10.5 texture. (The length of the S-direction.) */ + u16 paddingX; /* Unused. Always 0. */ + s16 objY; /* The y-coordinate of the s10.2 OBJ upper-left end. */ + u16 scaleH; /* Scaling of the u5.10 height direction. */ + u16 imageH; /* The height of the u10.5 texture. (The length of the T-direction.)*/ + u16 paddingY; /* Unused. Always 0. */ + u16 imageStride; /* The folding width of the texel. (In units of 64bit word.) */ + u16 imageAdrs; /* The texture header position in TMEM. (In units of 64bit word.) */ + u8 imageFmt; /* The format of the texel. G_IM_FMT_* */ + u8 imageSiz; /* The size of the texel. G_IM_SIZ_* */ + u8 imagePal; /*The 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; /* The texture source address on DRAM. */ + u16 tmem; /* The transferred TMEM word address. (8byteWORD) */ + u16 tsize; /* The Texture size. Specified by the macro GS_TB_TSIZE(). */ + u16 tline; /* The width of the Texture 1-line. Specified by the 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; /* The texture source address on DRAM. */ + u16 tmem; /* The loaded texture source address on DRAM. (8byteWORD) */ + u16 twidth; /* The width of the Texture. Specified by the macro GS_TT_TWIDTH() */ + u16 theight; /* The height of the Texture. Specified by the macro GS_TT_THEIGHT()*/ + u16 sid; /* STATE ID Multiplied 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; /* the texture source address on DRAM. */ + u16 phead; /* The pallet number of the load header. Between 256 and 511. */ + u16 pnum; /* The loading pallet number -1. */ + u16 zero; /* Assign 0 all the time. */ + u16 sid; /* STATE ID Multiplied 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 */ +#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 + + +/*---------------------------------------------------------------------------* + * 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 void guS2DInitBg(uObjBg *); +extern void guS2DEmuSetScissor(u32, u32, u32, u32, u8); +extern void guS2DEmuBgRect1Cyc(Gfx **, uObjBg *); + +#ifdef _LANGUAGE_C_PLUS_PLUS +} +#endif +#endif /* _GS2DEX_H_ */ + +/*======== End of gs2dex.h ========*/ diff --git a/include/PR/gt.h b/include/PR/gt.h new file mode 100644 index 0000000..07fa2bc --- /dev/null +++ b/include/PR/gt.h @@ -0,0 +1,363 @@ + +/* + * 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.14 $ + * $Date: 1997/02/11 08:22:47 $ + * $Source: /disk6/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 */ + +/* 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/PR/gu.h b/include/PR/gu.h new file mode 100644 index 0000000..3063e7b --- /dev/null +++ b/include/PR/gu.h @@ -0,0 +1,266 @@ +#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.46 $ + * $Date: 1997/11/26 00:30:53 $ + * $Source: /disk6/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.0f)), 127.0f) & 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); + +/* + * 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/PR/libaudio.h b/include/PR/libaudio.h new file mode 100644 index 0000000..55f22c8 --- /dev/null +++ b/include/PR/libaudio.h @@ -0,0 +1,947 @@ +/*==================================================================== + * 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: /disk6/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 +}; + +/* + * 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 { + 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; + } 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 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/PR/mbi.h b/include/PR/mbi.h new file mode 100644 index 0000000..9956ef2 --- /dev/null +++ b/include/PR/mbi.h @@ -0,0 +1,98 @@ +#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.135 $ + * $Date: 1997/11/26 00:30:54 $ + * $Source: /disk6/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 + +/************************************************************************** + * + * 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/PR/os.h b/include/PR/os.h new file mode 100644 index 0000000..cd0aea1 --- /dev/null +++ b/include/PR/os.h @@ -0,0 +1,1000 @@ + +/*==================================================================== + * 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. + *====================================================================*/ + +/************************************************************************** + * + * $Revision: 1.149 $ + * $Date: 1997/12/15 04:30:52 $ + * $Source: /disk6/Master/cvsmdev2/PR/include/os.h,v $ + * + **************************************************************************/ + + +#ifndef _OS_H_ +#define _OS_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 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 */ + __OSThreadContext context; /* register/interrupt mask */ +} OSThread; + +typedef u32 OSEvent; +typedef u32 OSIntMask; +typedef u32 OSPageMask; +typedef u32 OSHWIntr; + +/* + * 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; + +/* + * 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; + + +/* + * 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; + +/* + * 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; + +/* + * 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; + +/* + * 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; + +/* + * 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 + * + */ + +/* Thread states */ + +#define OS_STATE_STOPPED 1 +#define OS_STATE_RUNNABLE 2 +#define OS_STATE_RUNNING 4 +#define OS_STATE_WAITING 8 + +/* 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 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 + +/* 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 */ + + +/* Flags to turn blocking on/off when sending/receiving message */ + +#define OS_MESG_NOBLOCK 0 +#define OS_MESG_BLOCK 1 + +/* 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 + +/* + * 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 + +/* + * 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 + +/* + * Values for osTvType + */ +#define OS_TV_PAL 0 +#define OS_TV_NTSC 1 +#define OS_TV_MPAL 2 + +/* + * 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 + +/* + * 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 + +/* + * Leo Disk + */ + +/* transfer mode */ + +#define LEO_BLOCK_MODE 1 +#define LEO_TRACK_MODE 2 +#define LEO_SECTOR_MODE 3 + +/* + * 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 + +/* Controller status */ + +#define CONT_CARD_ON 0x01 +#define CONT_CARD_PULL 0x02 +#define CONT_ADDR_CRC_ER 0x04 +#define CONT_EEPROM_BUSY 0x80 + +/* EEPROM TYPE */ + +#define EEPROM_TYPE_4K 0x01 +#define EEPROM_TYPE_16K 0x02 + +/* 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 + +/* 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 */ + +/* 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*/ + +/* definition for EEPROM */ + +#define EEPROM_MAXBLOCKS 64 +#define EEP16K_MAXBLOCKS 256 +#define EEPROM_BLOCK_SIZE 8 + +/* + * PI/EPI + */ +#define PI_DOMAIN1 0 +#define PI_DOMAIN2 1 + +/* + * Profiler constants + */ +#define PROF_MIN_INTERVAL 50 /* microseconds */ + +/* + * Boot addresses + */ +#define BOOT_ADDRESS_ULTRA 0x80000400 +#define BOOT_ADDRESS_COSIM 0x80002000 +#define BOOT_ADDRESS_EMU 0x20010000 +#define BOOT_ADDRESS_INDY 0x88100000 + +/* + * 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 + * + */ + +/* PARTNER-N64 */ +#ifdef PTN64 +#define osReadHost osReadHost_pt +#define osWriteHost osWriteHost_pt +#endif + +/* 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) + +/* + * CPU counter increments at 3/4 of bus clock rate: + * + * Bus Clock Proc Clock Counter (1/2 Proc Clock) + * --------- ---------- ------------------------ + * 62.5 Mhz 93.75 Mhz 46.875 Mhz + */ +extern u64 osClockRate; + +#define OS_CLOCK_RATE 62500000LL +#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4) +#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)) + +/************************************************************************** + * + * 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 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 OSIntMask __OSGlobalIntMask; /* global interrupt mask */ +extern OSPiHandle *__osPiTable; /* The head of OSPiHandle link list */ +extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/ + + + +/************************************************************************** + * + * 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 *); + +/* 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); + +/* Interrupt operations */ + +extern OSIntMask osGetIntMask(void); +extern OSIntMask osSetIntMask(OSIntMask); + +/* RDB port operations */ + +extern void osInitRdb(u8 *sendBuf, u32 sendSize); + +/* Cache operations and macros */ + +extern void osInvalDCache(void *, s32); +extern void osInvalICache(void *, s32); +extern void osWritebackDCache(void *, s32); +extern void osWritebackDCacheAll(void); + +#define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10)) +#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10)) + +/* 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); + +/* Address translation routines and macros */ + +extern u32 osVirtualToPhysical(void *); +extern void * osPhysicalToVirtual(u32); + +#define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000)) +#define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000)) + +#define OS_PHYSICAL_TO_K0(x) (void *)(((u32)(x)+0x80000000)) +#define OS_PHYSICAL_TO_K1(x) (void *)(((u32)(x)+0xa0000000)) + +/* I/O operations */ + +/* Audio interface (Ai) */ +extern u32 osAiGetStatus(void); +extern u32 osAiGetLength(void); +extern s32 osAiSetFrequency(u32); +extern s32 osAiSetNextBuffer(void *, u32); + +/* Display processor interface (Dp) */ +extern u32 osDpGetStatus(void); +extern void osDpSetStatus(u32); +extern void osDpGetCounters(u32 *); +extern s32 osDpSetNextBuffer(void *, u64); + +/* Peripheral interface (Pi) */ +extern u32 osPiGetStatus(void); +extern s32 osPiGetDeviceType(void); +extern s32 osPiRawWriteIo(u32, u32); +extern s32 osPiRawReadIo(u32, u32 *); +extern s32 osPiRawStartDma(s32, u32, void *, u32); +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); + +/* 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 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); + +/* Timer interface */ + +extern OSTime osGetTime(void); +extern void osSetTime(OSTime); +extern int osSetTimer(OSTimer *, OSTime, OSTime, + OSMesgQueue *, OSMesg); +extern int osStopTimer(OSTimer *); + +/* 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 *); + +/* 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 *); + +/* 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); + +/* MOTOR interface */ + +extern s32 osMotorInit(OSMesgQueue *, OSPfs *, int); +extern s32 osMotorStop(OSPfs *); +extern s32 osMotorStart(OSPfs *); + +/* Enhanced PI interface */ + +extern OSPiHandle *osCartRomInit(void); +extern OSPiHandle *osLeoDiskInit(void); +extern OSPiHandle *osDriveRomInit(void); + +extern s32 osEPiDeviceType(OSPiHandle *, OSPiInfo *); +extern s32 osEPiRawWriteIo(OSPiHandle *, u32 , u32); +extern s32 osEPiRawReadIo(OSPiHandle *, u32 , u32 *); +extern s32 osEPiRawStartDma(OSPiHandle *, s32 , u32 , void *, u32 ); +extern s32 osEPiWriteIo(OSPiHandle *, u32 , u32 ); +extern s32 osEPiReadIo(OSPiHandle *, u32 , u32 *); +extern s32 osEPiStartDma(OSPiHandle *, OSIoMesg *, s32); +extern s32 osEPiLinkHandle(OSPiHandle *); + +/* Profiler Interface */ + +extern void osProfileInit(OSProf *, u32 profcnt); +extern void osProfileStart(u32); +extern void osProfileFlush(void); +extern void osProfileStop(void); + +/* 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); + + +/* byte string operations */ + +extern void bcopy(const void *, void *, int); +extern int bcmp(const void *, const void *, int); +extern void bzero(void *, int); + +/* Miscellaneous operations */ + +extern void osInitialize(void); +extern u32 osGetCount(void); +extern void osExit(void); +extern u32 osGetMemSize(void); + +/* Printf */ + +extern int sprintf(char *s, const char *fmt, ...); +extern void osSyncPrintf(const char *fmt, ...); +extern void osAsyncPrintf(const char *fmt, ...); +extern int osSyncGetChars(char *buf); +extern int osAsyncGetChars(char *buf); + +#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ + +#ifdef _LANGUAGE_C_PLUS_PLUS +} +#endif + +#endif /* !_OS_H */ diff --git a/include/PR/os_internal.h b/include/PR/os_internal.h new file mode 100644 index 0000000..544eb32 --- /dev/null +++ b/include/PR/os_internal.h @@ -0,0 +1,118 @@ +/************************************************************************** + * * + * 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.18 $ + * $Date: 1997/02/11 08:26:14 $ + * $Source: /disk6/Master/cvsmdev2/PR/include/os_internal.h,v $ + * + **************************************************************************/ + +#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) + +/* 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); + +/* Routines to get/set floating-point control and status register */ +extern u32 __osSetFpcCsr(u32); +extern u32 __osGetFpcCsr(void); + +/* Routine for HW interrupt "handler" */ +extern void __osSetHWIntrRoutine(OSHWIntr, s32 (*handler)(void)); + +/* Routine for global interrupt mask */ +extern void __osSetGlobalIntMask(OSHWIntr); +extern void __osResetGlobalIntMask(OSHWIntr); + +/* Routine for global interrupt mask */ +extern s32 __osLeoInterrupt(void); + +/* 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); + +/* Serial interface (Si) */ + +extern u32 __osSiGetStatus(void); +extern s32 __osSiRawWriteIo(u32, u32); +extern s32 __osSiRawReadIo(u32, u32 *); +extern s32 __osSiRawStartDma(s32, void *); + +/* 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); + +/* Error handling */ + +extern void __osError(s16, s16, ...); +extern OSThread * __osGetCurrFaultedThread(void); +extern OSThread * __osGetNextFaultedThread(OSThread *); + +/* Development board functions */ + +extern void __osGIOInit(s32); +extern void __osGIOInterrupt(s32); +extern void __osGIORawInterrupt(s32); + +/* For debugger use */ + +extern OSThread * __osGetActiveQueue(void); + +/* Debug port */ +extern void __osSyncPutChars(int, int, const char *); +extern int __osSyncGetChars(char *); +extern void __osAsyncPutChars(int, int, const char *); +extern int __osAsyncGetChars(char *); +extern int __osAtomicInc(unsigned int *p); +extern int __osAtomicDec(unsigned int *p); + +/* 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_H */ diff --git a/include/PR/ramrom.h b/include/PR/ramrom.h new file mode 100644 index 0000000..397b676 --- /dev/null +++ b/include/PR/ramrom.h @@ -0,0 +1,113 @@ +#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: /disk6/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/PR/rcp.h b/include/PR/rcp.h new file mode 100644 index 0000000..3795ff7 --- /dev/null +++ b/include/PR/rcp.h @@ -0,0 +1,882 @@ +#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.20 $ + * $Date: 1997/07/23 08:35:21 $ + * $Source: /disk6/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 */ + +/************************************************************************* + * 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/PR/rdb.h b/include/PR/rdb.h new file mode 100644 index 0000000..c5c3159 --- /dev/null +++ b/include/PR/rdb.h @@ -0,0 +1,93 @@ + +/************************************************************************** + * + * $Revision: 1.6 $ + * $Date: 1997/02/11 08:29:31 $ + * $Source: /disk6/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/PR/region.h b/include/PR/region.h new file mode 100644 index 0000000..9f8bb7f --- /dev/null +++ b/include/PR/region.h @@ -0,0 +1,123 @@ + +/************************************************************************** + * * + * 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: /disk6/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/PR/rmon.h b/include/PR/rmon.h new file mode 100644 index 0000000..ea826d1 --- /dev/null +++ b/include/PR/rmon.h @@ -0,0 +1,39 @@ +/************************************************************************** + * * + * 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: /disk6/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/PR/sched.h b/include/PR/sched.h new file mode 100644 index 0000000..9addae7 --- /dev/null +++ b/include/PR/sched.h @@ -0,0 +1,115 @@ +/*==================================================================== + * 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: /disk6/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/PR/sp.h b/include/PR/sp.h new file mode 100644 index 0000000..24f11a1 --- /dev/null +++ b/include/PR/sp.h @@ -0,0 +1,177 @@ +/************************************************************************** + * * + * 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.15 $ + * $Date: 1997/02/11 08:33:02 $ + * $Source: /disk6/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 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/PR/sptask.h b/include/PR/sptask.h new file mode 100644 index 0000000..8d6ea41 --- /dev/null +++ b/include/PR/sptask.h @@ -0,0 +1,201 @@ +/************************************************************************** + * * + * 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.8 $ + * $Date: 1997/11/10 10:48:35 $ + * $Source: /disk6/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)) +#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/PR/ucode.h b/include/PR/ucode.h new file mode 100644 index 0000000..1025d2f --- /dev/null +++ b/include/PR/ucode.h @@ -0,0 +1,186 @@ +/************************************************************************** + * * + * 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/11/07 04:55:12 $ + * $Source: /disk6/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 only */ +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 gspF3DLX2_fifoTextStart[], gspF3DLX2_fifoTextEnd[]; +extern long long int gspF3DLX2_fifoDataStart[], gspF3DLX2_fifoDataEnd[]; +extern long long int gspF3DLX2_NoN_fifoTextStart[],gspF3DLX2_NoN_fifoTextEnd[]; +extern long long int gspF3DLX2_NoN_fifoDataStart[],gspF3DLX2_NoN_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 gspF3DLP2_Rej_fifoTextStart[],gspF3DLP2_Rej_fifoTextEnd[]; +extern long long int gspF3DLP2_Rej_fifoDataStart[],gspF3DLP2_Rej_fifoDataEnd[]; +extern long long int gspL3DEX2_fifoTextStart[], gspL3DEX2_fifoTextEnd[]; +extern long long int gspL3DEX2_fifoDataStart[], gspL3DEX2_fifoDataEnd[]; + +/************************************************************************** + * + * Function prototypes + * + */ + +#endif /* _LANGUAGE_C */ + +#ifdef _LANGUAGE_C_PLUS_PLUS +} +#endif + +#endif /* !_UCODE_H */ diff --git a/include/PR/ultraerror.h b/include/PR/ultraerror.h new file mode 100644 index 0000000..ef470ba --- /dev/null +++ b/include/PR/ultraerror.h @@ -0,0 +1,165 @@ +/*==================================================================== + * 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.23 $ + * $Date: 1997/02/11 08:38:08 $ + * $Source: /disk6/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 + +#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/PR/ultralog.h b/include/PR/ultralog.h new file mode 100644 index 0000000..9f37359 --- /dev/null +++ b/include/PR/ultralog.h @@ -0,0 +1,74 @@ +/*==================================================================== + * 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: /disk6/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/PR/ultratypes.h b/include/PR/ultratypes.h new file mode 100644 index 0000000..58fef8b --- /dev/null +++ b/include/PR/ultratypes.h @@ -0,0 +1,90 @@ +#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: /disk6/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/PR/uportals.h b/include/PR/uportals.h new file mode 100644 index 0000000..28a1466 --- /dev/null +++ b/include/PR/uportals.h @@ -0,0 +1,134 @@ +/*==================================================================== + * 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: /disk6/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/common.h b/include/common.h new file mode 100644 index 0000000..bea7ce3 --- /dev/null +++ b/include/common.h @@ -0,0 +1,8 @@ +#ifndef _COMMON_H +#define _COMMON_H + +#include "ultra64.h" +#include "functions.h" +#include "variables.h" + +#endif diff --git a/include/functions.h b/include/functions.h new file mode 100644 index 0000000..880fb20 --- /dev/null +++ b/include/functions.h @@ -0,0 +1,6 @@ +#ifndef _FUNCTIONS_H +#define _FUNCTIONS_H + +#include "ultra64.h" + +#endif diff --git a/include/macro.inc b/include/macro.inc new file mode 100644 index 0000000..1adda25 --- /dev/null +++ b/include/macro.inc @@ -0,0 +1,4 @@ +.macro glabel label + .global \label + \label: +.endm diff --git a/include/ultra64.h b/include/ultra64.h new file mode 100644 index 0000000..94e177c --- /dev/null +++ b/include/ultra64.h @@ -0,0 +1,40 @@ + +/************************************************************************** + * * + * 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: /disk6/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/variables.h b/include/variables.h new file mode 100644 index 0000000..a4a9ccc --- /dev/null +++ b/include/variables.h @@ -0,0 +1,6 @@ +#ifndef _VARIABLES_H_ +#define _VARIABLES_H_ + +#include "ultra64.h" + +#endif diff --git a/oldnotes/.gitignore b/oldnotes/.gitignore new file mode 100644 index 0000000..2d621cc --- /dev/null +++ b/oldnotes/.gitignore @@ -0,0 +1,2 @@ +*.n64 +*.exe diff --git a/oldnotes/.gitmodules b/oldnotes/.gitmodules new file mode 100644 index 0000000..1f6ef18 --- /dev/null +++ b/oldnotes/.gitmodules @@ -0,0 +1,24 @@ +[submodule "stadiumgs/0x1e40000"] + path = stadiumgs/0x1e40000 + url = https://github.com/iimarckus/stadiumgs-0x1e40000 +[submodule "stadiumgs/0x1718000"] + path = stadiumgs/0x1718000 + url = https://github.com/iimarckus/stadiumgs-0x1718000 +[submodule "stadiumgs/0x1898000"] + path = stadiumgs/0x1898000 + url = https://github.com/iimarckus/stadiumgs-0x1898000 +[submodule "stadiumgs/0x2000000"] + path = stadiumgs/0x2000000 + url = https://github.com/iimarckus/stadiumgs-0x2000000 +[submodule "stadiumgs/faces"] + path = stadiumgs/faces + url = https://github.com/iimarckus/stadiumgs-faces +[submodule "stadiumgs/0x3fd5000"] + path = stadiumgs/0x3fd5000 + url = https://github.com/iimarckus/stadiumgs-0x3fd5000 +[submodule "stadiumgs/0x3fed000"] + path = stadiumgs/0x3fed000 + url = https://github.com/iimarckus/stadiumgs-0x3fed000 +[submodule "stadiumgs/gameboy"] + path = stadiumgs/gameboy + url = https://github.com/iimarckus/stadiumgs-gameboy diff --git a/stadium1/Makefile b/oldnotes/stadium1/Makefile similarity index 100% rename from stadium1/Makefile rename to oldnotes/stadium1/Makefile diff --git a/stadium1/README.md b/oldnotes/stadium1/README.md similarity index 100% rename from stadium1/README.md rename to oldnotes/stadium1/README.md diff --git a/stadium1/constants/move_constants.s b/oldnotes/stadium1/constants/move_constants.s similarity index 100% rename from stadium1/constants/move_constants.s rename to oldnotes/stadium1/constants/move_constants.s diff --git a/stadium1/constants/pokemon_constants.s b/oldnotes/stadium1/constants/pokemon_constants.s similarity index 100% rename from stadium1/constants/pokemon_constants.s rename to oldnotes/stadium1/constants/pokemon_constants.s diff --git a/stadium1/main.s b/oldnotes/stadium1/main.s similarity index 100% rename from stadium1/main.s rename to oldnotes/stadium1/main.s diff --git a/stadium1/rom_header.s b/oldnotes/stadium1/rom_header.s similarity index 100% rename from stadium1/rom_header.s rename to oldnotes/stadium1/rom_header.s diff --git a/stadium1/text/0x783a50.txt b/oldnotes/stadium1/text/0x783a50.txt similarity index 100% rename from stadium1/text/0x783a50.txt rename to oldnotes/stadium1/text/0x783a50.txt diff --git a/stadium1/text/0x783e50.txt b/oldnotes/stadium1/text/0x783e50.txt similarity index 100% rename from stadium1/text/0x783e50.txt rename to oldnotes/stadium1/text/0x783e50.txt diff --git a/stadium1/text/0x784000.txt b/oldnotes/stadium1/text/0x784000.txt similarity index 100% rename from stadium1/text/0x784000.txt rename to oldnotes/stadium1/text/0x784000.txt diff --git a/stadium1/text/0x784430.txt b/oldnotes/stadium1/text/0x784430.txt similarity index 100% rename from stadium1/text/0x784430.txt rename to oldnotes/stadium1/text/0x784430.txt diff --git a/stadium1/text/0x7846b0.txt b/oldnotes/stadium1/text/0x7846b0.txt similarity index 100% rename from stadium1/text/0x7846b0.txt rename to oldnotes/stadium1/text/0x7846b0.txt diff --git a/stadium1/text/0x7849b0.txt b/oldnotes/stadium1/text/0x7849b0.txt similarity index 100% rename from stadium1/text/0x7849b0.txt rename to oldnotes/stadium1/text/0x7849b0.txt diff --git a/stadium1/text/0x785060.txt b/oldnotes/stadium1/text/0x785060.txt similarity index 100% rename from stadium1/text/0x785060.txt rename to oldnotes/stadium1/text/0x785060.txt diff --git a/stadium1/text/0x7851a0.txt b/oldnotes/stadium1/text/0x7851a0.txt similarity index 100% rename from stadium1/text/0x7851a0.txt rename to oldnotes/stadium1/text/0x7851a0.txt diff --git a/stadium1/text/0x7852f0.txt b/oldnotes/stadium1/text/0x7852f0.txt similarity index 100% rename from stadium1/text/0x7852f0.txt rename to oldnotes/stadium1/text/0x7852f0.txt diff --git a/stadium1/text/0x7853b0.txt b/oldnotes/stadium1/text/0x7853b0.txt similarity index 100% rename from stadium1/text/0x7853b0.txt rename to oldnotes/stadium1/text/0x7853b0.txt diff --git a/stadium1/text/0x78f500.txt b/oldnotes/stadium1/text/0x78f500.txt similarity index 100% rename from stadium1/text/0x78f500.txt rename to oldnotes/stadium1/text/0x78f500.txt diff --git a/stadium1/text/0x78f680.txt b/oldnotes/stadium1/text/0x78f680.txt similarity index 100% rename from stadium1/text/0x78f680.txt rename to oldnotes/stadium1/text/0x78f680.txt diff --git a/stadium1/text/0x78fd40.txt b/oldnotes/stadium1/text/0x78fd40.txt similarity index 100% rename from stadium1/text/0x78fd40.txt rename to oldnotes/stadium1/text/0x78fd40.txt diff --git a/stadium1/text/0x78fe60.txt b/oldnotes/stadium1/text/0x78fe60.txt similarity index 100% rename from stadium1/text/0x78fe60.txt rename to oldnotes/stadium1/text/0x78fe60.txt diff --git a/stadium1/text/0x7901e0.txt b/oldnotes/stadium1/text/0x7901e0.txt similarity index 100% rename from stadium1/text/0x7901e0.txt rename to oldnotes/stadium1/text/0x7901e0.txt diff --git a/stadium1/text/0x790210.txt b/oldnotes/stadium1/text/0x790210.txt similarity index 100% rename from stadium1/text/0x790210.txt rename to oldnotes/stadium1/text/0x790210.txt diff --git a/stadium1/text/0x790380.txt b/oldnotes/stadium1/text/0x790380.txt similarity index 100% rename from stadium1/text/0x790380.txt rename to oldnotes/stadium1/text/0x790380.txt diff --git a/stadium1/text/0x790560.txt b/oldnotes/stadium1/text/0x790560.txt similarity index 100% rename from stadium1/text/0x790560.txt rename to oldnotes/stadium1/text/0x790560.txt diff --git a/stadium1/text/0x790700.txt b/oldnotes/stadium1/text/0x790700.txt similarity index 100% rename from stadium1/text/0x790700.txt rename to oldnotes/stadium1/text/0x790700.txt diff --git a/stadium1/text/0x790a30.txt b/oldnotes/stadium1/text/0x790a30.txt similarity index 100% rename from stadium1/text/0x790a30.txt rename to oldnotes/stadium1/text/0x790a30.txt diff --git a/stadium1/text/0x790c60.txt b/oldnotes/stadium1/text/0x790c60.txt similarity index 100% rename from stadium1/text/0x790c60.txt rename to oldnotes/stadium1/text/0x790c60.txt diff --git a/stadium1/text/0x7912d0.txt b/oldnotes/stadium1/text/0x7912d0.txt similarity index 100% rename from stadium1/text/0x7912d0.txt rename to oldnotes/stadium1/text/0x7912d0.txt diff --git a/stadium1/text/0x792460.txt b/oldnotes/stadium1/text/0x792460.txt similarity index 100% rename from stadium1/text/0x792460.txt rename to oldnotes/stadium1/text/0x792460.txt diff --git a/stadium1/text/0x793470.txt b/oldnotes/stadium1/text/0x793470.txt similarity index 100% rename from stadium1/text/0x793470.txt rename to oldnotes/stadium1/text/0x793470.txt diff --git a/stadium1/text/0x793670.txt b/oldnotes/stadium1/text/0x793670.txt similarity index 100% rename from stadium1/text/0x793670.txt rename to oldnotes/stadium1/text/0x793670.txt diff --git a/stadium1/text/0x797140.txt b/oldnotes/stadium1/text/0x797140.txt similarity index 100% rename from stadium1/text/0x797140.txt rename to oldnotes/stadium1/text/0x797140.txt diff --git a/stadium1/text/0x797150.txt b/oldnotes/stadium1/text/0x797150.txt similarity index 100% rename from stadium1/text/0x797150.txt rename to oldnotes/stadium1/text/0x797150.txt diff --git a/stadium1/text/0x797350.txt b/oldnotes/stadium1/text/0x797350.txt similarity index 100% rename from stadium1/text/0x797350.txt rename to oldnotes/stadium1/text/0x797350.txt diff --git a/stadium1/text/credits.txt b/oldnotes/stadium1/text/credits.txt similarity index 100% rename from stadium1/text/credits.txt rename to oldnotes/stadium1/text/credits.txt diff --git a/stadium1/text/gym.txt b/oldnotes/stadium1/text/gym.txt similarity index 100% rename from stadium1/text/gym.txt rename to oldnotes/stadium1/text/gym.txt diff --git a/stadium1/text/itemdescriptions.txt b/oldnotes/stadium1/text/itemdescriptions.txt similarity index 100% rename from stadium1/text/itemdescriptions.txt rename to oldnotes/stadium1/text/itemdescriptions.txt diff --git a/stadium1/text/items.txt b/oldnotes/stadium1/text/items.txt similarity index 100% rename from stadium1/text/items.txt rename to oldnotes/stadium1/text/items.txt diff --git a/stadium1/text/kidsclub.txt b/oldnotes/stadium1/text/kidsclub.txt similarity index 100% rename from stadium1/text/kidsclub.txt rename to oldnotes/stadium1/text/kidsclub.txt diff --git a/stadium1/text/map.txt b/oldnotes/stadium1/text/map.txt similarity index 100% rename from stadium1/text/map.txt rename to oldnotes/stadium1/text/map.txt diff --git a/stadium1/text/movedescriptions.txt b/oldnotes/stadium1/text/movedescriptions.txt similarity index 100% rename from stadium1/text/movedescriptions.txt rename to oldnotes/stadium1/text/movedescriptions.txt diff --git a/stadium1/text/moves.txt b/oldnotes/stadium1/text/moves.txt similarity index 100% rename from stadium1/text/moves.txt rename to oldnotes/stadium1/text/moves.txt diff --git a/stadium1/text/options.txt b/oldnotes/stadium1/text/options.txt similarity index 100% rename from stadium1/text/options.txt rename to oldnotes/stadium1/text/options.txt diff --git a/stadium1/text/pokedex.txt b/oldnotes/stadium1/text/pokedex.txt similarity index 100% rename from stadium1/text/pokedex.txt rename to oldnotes/stadium1/text/pokedex.txt diff --git a/stadium1/text/pokedex/theblankpokemon.txt b/oldnotes/stadium1/text/pokedex/theblankpokemon.txt similarity index 100% rename from stadium1/text/pokedex/theblankpokemon.txt rename to oldnotes/stadium1/text/pokedex/theblankpokemon.txt diff --git a/stadium1/text/pokemon.txt b/oldnotes/stadium1/text/pokemon.txt similarity index 100% rename from stadium1/text/pokemon.txt rename to oldnotes/stadium1/text/pokemon.txt diff --git a/stadium1/text/statuses.txt b/oldnotes/stadium1/text/statuses.txt similarity index 100% rename from stadium1/text/statuses.txt rename to oldnotes/stadium1/text/statuses.txt diff --git a/stadium1/text/surfpikachu.txt b/oldnotes/stadium1/text/surfpikachu.txt similarity index 100% rename from stadium1/text/surfpikachu.txt rename to oldnotes/stadium1/text/surfpikachu.txt diff --git a/stadium1/text/tradeservice.txt b/oldnotes/stadium1/text/tradeservice.txt similarity index 100% rename from stadium1/text/tradeservice.txt rename to oldnotes/stadium1/text/tradeservice.txt diff --git a/stadium1/text/trainers1.txt b/oldnotes/stadium1/text/trainers1.txt similarity index 100% rename from stadium1/text/trainers1.txt rename to oldnotes/stadium1/text/trainers1.txt diff --git a/stadium1/text/trainers2.txt b/oldnotes/stadium1/text/trainers2.txt similarity index 100% rename from stadium1/text/trainers2.txt rename to oldnotes/stadium1/text/trainers2.txt diff --git a/stadium1/text/types.txt b/oldnotes/stadium1/text/types.txt similarity index 100% rename from stadium1/text/types.txt rename to oldnotes/stadium1/text/types.txt diff --git a/stadiumgs/Makefile b/oldnotes/stadiumgs/Makefile similarity index 100% rename from stadiumgs/Makefile rename to oldnotes/stadiumgs/Makefile diff --git a/stadiumgs/README.md b/oldnotes/stadiumgs/README.md similarity index 100% rename from stadiumgs/README.md rename to oldnotes/stadiumgs/README.md diff --git a/stadiumgs/academygfx/0x22303c0.jpg b/oldnotes/stadiumgs/academygfx/0x22303c0.jpg similarity index 100% rename from stadiumgs/academygfx/0x22303c0.jpg rename to oldnotes/stadiumgs/academygfx/0x22303c0.jpg diff --git a/stadiumgs/academygfx/0x2230c10.jpg b/oldnotes/stadiumgs/academygfx/0x2230c10.jpg similarity index 100% rename from stadiumgs/academygfx/0x2230c10.jpg rename to oldnotes/stadiumgs/academygfx/0x2230c10.jpg diff --git a/stadiumgs/academygfx/0x22314c0.jpg b/oldnotes/stadiumgs/academygfx/0x22314c0.jpg similarity index 100% rename from stadiumgs/academygfx/0x22314c0.jpg rename to oldnotes/stadiumgs/academygfx/0x22314c0.jpg diff --git a/stadiumgs/academygfx/0x2231e60.jpg b/oldnotes/stadiumgs/academygfx/0x2231e60.jpg similarity index 100% rename from stadiumgs/academygfx/0x2231e60.jpg rename to oldnotes/stadiumgs/academygfx/0x2231e60.jpg diff --git a/stadiumgs/academygfx/0x2232990.jpg b/oldnotes/stadiumgs/academygfx/0x2232990.jpg similarity index 100% rename from stadiumgs/academygfx/0x2232990.jpg rename to oldnotes/stadiumgs/academygfx/0x2232990.jpg diff --git a/stadiumgs/academygfx/0x2233520.jpg b/oldnotes/stadiumgs/academygfx/0x2233520.jpg similarity index 100% rename from stadiumgs/academygfx/0x2233520.jpg rename to oldnotes/stadiumgs/academygfx/0x2233520.jpg diff --git a/stadiumgs/academygfx/0x2233eb0.jpg b/oldnotes/stadiumgs/academygfx/0x2233eb0.jpg similarity index 100% rename from stadiumgs/academygfx/0x2233eb0.jpg rename to oldnotes/stadiumgs/academygfx/0x2233eb0.jpg diff --git a/stadiumgs/academygfx/0x22348f0.jpg b/oldnotes/stadiumgs/academygfx/0x22348f0.jpg similarity index 100% rename from stadiumgs/academygfx/0x22348f0.jpg rename to oldnotes/stadiumgs/academygfx/0x22348f0.jpg diff --git a/stadiumgs/academygfx/0x2235310.jpg b/oldnotes/stadiumgs/academygfx/0x2235310.jpg similarity index 100% rename from stadiumgs/academygfx/0x2235310.jpg rename to oldnotes/stadiumgs/academygfx/0x2235310.jpg diff --git a/stadiumgs/academygfx/0x2235c30.jpg b/oldnotes/stadiumgs/academygfx/0x2235c30.jpg similarity index 100% rename from stadiumgs/academygfx/0x2235c30.jpg rename to oldnotes/stadiumgs/academygfx/0x2235c30.jpg diff --git a/stadiumgs/academygfx/0x22363a0.jpg b/oldnotes/stadiumgs/academygfx/0x22363a0.jpg similarity index 100% rename from stadiumgs/academygfx/0x22363a0.jpg rename to oldnotes/stadiumgs/academygfx/0x22363a0.jpg diff --git a/stadiumgs/academygfx/0x22372e0.jpg b/oldnotes/stadiumgs/academygfx/0x22372e0.jpg similarity index 100% rename from stadiumgs/academygfx/0x22372e0.jpg rename to oldnotes/stadiumgs/academygfx/0x22372e0.jpg diff --git a/stadiumgs/academygfx/0x2237eb0.jpg b/oldnotes/stadiumgs/academygfx/0x2237eb0.jpg similarity index 100% rename from stadiumgs/academygfx/0x2237eb0.jpg rename to oldnotes/stadiumgs/academygfx/0x2237eb0.jpg diff --git a/stadiumgs/academygfx/0x2238970.jpg b/oldnotes/stadiumgs/academygfx/0x2238970.jpg similarity index 100% rename from stadiumgs/academygfx/0x2238970.jpg rename to oldnotes/stadiumgs/academygfx/0x2238970.jpg diff --git a/stadiumgs/academygfx/0x22394e0.jpg b/oldnotes/stadiumgs/academygfx/0x22394e0.jpg similarity index 100% rename from stadiumgs/academygfx/0x22394e0.jpg rename to oldnotes/stadiumgs/academygfx/0x22394e0.jpg diff --git a/stadiumgs/academygfx/0x2239fe0.jpg b/oldnotes/stadiumgs/academygfx/0x2239fe0.jpg similarity index 100% rename from stadiumgs/academygfx/0x2239fe0.jpg rename to oldnotes/stadiumgs/academygfx/0x2239fe0.jpg diff --git a/stadiumgs/academygfx/0x223a9b0.jpg b/oldnotes/stadiumgs/academygfx/0x223a9b0.jpg similarity index 100% rename from stadiumgs/academygfx/0x223a9b0.jpg rename to oldnotes/stadiumgs/academygfx/0x223a9b0.jpg diff --git a/stadiumgs/academygfx/0x223b2a0.jpg b/oldnotes/stadiumgs/academygfx/0x223b2a0.jpg similarity index 100% rename from stadiumgs/academygfx/0x223b2a0.jpg rename to oldnotes/stadiumgs/academygfx/0x223b2a0.jpg diff --git a/stadiumgs/academygfx/0x223bc10.jpg b/oldnotes/stadiumgs/academygfx/0x223bc10.jpg similarity index 100% rename from stadiumgs/academygfx/0x223bc10.jpg rename to oldnotes/stadiumgs/academygfx/0x223bc10.jpg diff --git a/stadiumgs/academygfx/0x223c650.jpg b/oldnotes/stadiumgs/academygfx/0x223c650.jpg similarity index 100% rename from stadiumgs/academygfx/0x223c650.jpg rename to oldnotes/stadiumgs/academygfx/0x223c650.jpg diff --git a/stadiumgs/academygfx/0x223ce00.jpg b/oldnotes/stadiumgs/academygfx/0x223ce00.jpg similarity index 100% rename from stadiumgs/academygfx/0x223ce00.jpg rename to oldnotes/stadiumgs/academygfx/0x223ce00.jpg diff --git a/stadiumgs/academygfx/0x223d4c0.jpg b/oldnotes/stadiumgs/academygfx/0x223d4c0.jpg similarity index 100% rename from stadiumgs/academygfx/0x223d4c0.jpg rename to oldnotes/stadiumgs/academygfx/0x223d4c0.jpg diff --git a/stadiumgs/academygfx/0x223dc20.jpg b/oldnotes/stadiumgs/academygfx/0x223dc20.jpg similarity index 100% rename from stadiumgs/academygfx/0x223dc20.jpg rename to oldnotes/stadiumgs/academygfx/0x223dc20.jpg diff --git a/stadiumgs/academygfx/0x223e500.jpg b/oldnotes/stadiumgs/academygfx/0x223e500.jpg similarity index 100% rename from stadiumgs/academygfx/0x223e500.jpg rename to oldnotes/stadiumgs/academygfx/0x223e500.jpg diff --git a/stadiumgs/academygfx/0x223f150.jpg b/oldnotes/stadiumgs/academygfx/0x223f150.jpg similarity index 100% rename from stadiumgs/academygfx/0x223f150.jpg rename to oldnotes/stadiumgs/academygfx/0x223f150.jpg diff --git a/stadiumgs/academygfx/0x223f9a0.jpg b/oldnotes/stadiumgs/academygfx/0x223f9a0.jpg similarity index 100% rename from stadiumgs/academygfx/0x223f9a0.jpg rename to oldnotes/stadiumgs/academygfx/0x223f9a0.jpg diff --git a/stadiumgs/academygfx/0x2240480.jpg b/oldnotes/stadiumgs/academygfx/0x2240480.jpg similarity index 100% rename from stadiumgs/academygfx/0x2240480.jpg rename to oldnotes/stadiumgs/academygfx/0x2240480.jpg diff --git a/stadiumgs/academygfx/0x2241050.jpg b/oldnotes/stadiumgs/academygfx/0x2241050.jpg similarity index 100% rename from stadiumgs/academygfx/0x2241050.jpg rename to oldnotes/stadiumgs/academygfx/0x2241050.jpg diff --git a/stadiumgs/academygfx/0x2241b30.jpg b/oldnotes/stadiumgs/academygfx/0x2241b30.jpg similarity index 100% rename from stadiumgs/academygfx/0x2241b30.jpg rename to oldnotes/stadiumgs/academygfx/0x2241b30.jpg diff --git a/stadiumgs/academygfx/0x2242510.jpg b/oldnotes/stadiumgs/academygfx/0x2242510.jpg similarity index 100% rename from stadiumgs/academygfx/0x2242510.jpg rename to oldnotes/stadiumgs/academygfx/0x2242510.jpg diff --git a/stadiumgs/academygfx/0x2242f80.jpg b/oldnotes/stadiumgs/academygfx/0x2242f80.jpg similarity index 100% rename from stadiumgs/academygfx/0x2242f80.jpg rename to oldnotes/stadiumgs/academygfx/0x2242f80.jpg diff --git a/stadiumgs/academygfx/0x22438e0.jpg b/oldnotes/stadiumgs/academygfx/0x22438e0.jpg similarity index 100% rename from stadiumgs/academygfx/0x22438e0.jpg rename to oldnotes/stadiumgs/academygfx/0x22438e0.jpg diff --git a/stadiumgs/academygfx/0x2243fe0.jpg b/oldnotes/stadiumgs/academygfx/0x2243fe0.jpg similarity index 100% rename from stadiumgs/academygfx/0x2243fe0.jpg rename to oldnotes/stadiumgs/academygfx/0x2243fe0.jpg diff --git a/stadiumgs/academygfx/0x22447b0.jpg b/oldnotes/stadiumgs/academygfx/0x22447b0.jpg similarity index 100% rename from stadiumgs/academygfx/0x22447b0.jpg rename to oldnotes/stadiumgs/academygfx/0x22447b0.jpg diff --git a/stadiumgs/academygfx/0x2244d60.jpg b/oldnotes/stadiumgs/academygfx/0x2244d60.jpg similarity index 100% rename from stadiumgs/academygfx/0x2244d60.jpg rename to oldnotes/stadiumgs/academygfx/0x2244d60.jpg diff --git a/stadiumgs/academygfx/0x22452b0.jpg b/oldnotes/stadiumgs/academygfx/0x22452b0.jpg similarity index 100% rename from stadiumgs/academygfx/0x22452b0.jpg rename to oldnotes/stadiumgs/academygfx/0x22452b0.jpg diff --git a/stadiumgs/academygfx/0x2245a20.jpg b/oldnotes/stadiumgs/academygfx/0x2245a20.jpg similarity index 100% rename from stadiumgs/academygfx/0x2245a20.jpg rename to oldnotes/stadiumgs/academygfx/0x2245a20.jpg diff --git a/stadiumgs/academygfx/0x22460c0.jpg b/oldnotes/stadiumgs/academygfx/0x22460c0.jpg similarity index 100% rename from stadiumgs/academygfx/0x22460c0.jpg rename to oldnotes/stadiumgs/academygfx/0x22460c0.jpg diff --git a/stadiumgs/academygfx/0x2246a50.jpg b/oldnotes/stadiumgs/academygfx/0x2246a50.jpg similarity index 100% rename from stadiumgs/academygfx/0x2246a50.jpg rename to oldnotes/stadiumgs/academygfx/0x2246a50.jpg diff --git a/stadiumgs/academygfx/0x2247350.jpg b/oldnotes/stadiumgs/academygfx/0x2247350.jpg similarity index 100% rename from stadiumgs/academygfx/0x2247350.jpg rename to oldnotes/stadiumgs/academygfx/0x2247350.jpg diff --git a/stadiumgs/academygfx/0x2247c00.jpg b/oldnotes/stadiumgs/academygfx/0x2247c00.jpg similarity index 100% rename from stadiumgs/academygfx/0x2247c00.jpg rename to oldnotes/stadiumgs/academygfx/0x2247c00.jpg diff --git a/stadiumgs/academygfx/0x2248410.jpg b/oldnotes/stadiumgs/academygfx/0x2248410.jpg similarity index 100% rename from stadiumgs/academygfx/0x2248410.jpg rename to oldnotes/stadiumgs/academygfx/0x2248410.jpg diff --git a/stadiumgs/academygfx/0x2248db0.jpg b/oldnotes/stadiumgs/academygfx/0x2248db0.jpg similarity index 100% rename from stadiumgs/academygfx/0x2248db0.jpg rename to oldnotes/stadiumgs/academygfx/0x2248db0.jpg diff --git a/stadiumgs/academygfx/0x2249730.jpg b/oldnotes/stadiumgs/academygfx/0x2249730.jpg similarity index 100% rename from stadiumgs/academygfx/0x2249730.jpg rename to oldnotes/stadiumgs/academygfx/0x2249730.jpg diff --git a/stadiumgs/academygfx/0x224a210.jpg b/oldnotes/stadiumgs/academygfx/0x224a210.jpg similarity index 100% rename from stadiumgs/academygfx/0x224a210.jpg rename to oldnotes/stadiumgs/academygfx/0x224a210.jpg diff --git a/stadiumgs/academygfx/0x224bcc0.jpg b/oldnotes/stadiumgs/academygfx/0x224bcc0.jpg similarity index 100% rename from stadiumgs/academygfx/0x224bcc0.jpg rename to oldnotes/stadiumgs/academygfx/0x224bcc0.jpg diff --git a/stadiumgs/academygfx/0x224d680.jpg b/oldnotes/stadiumgs/academygfx/0x224d680.jpg similarity index 100% rename from stadiumgs/academygfx/0x224d680.jpg rename to oldnotes/stadiumgs/academygfx/0x224d680.jpg diff --git a/stadiumgs/academygfx/0x224ec50.jpg b/oldnotes/stadiumgs/academygfx/0x224ec50.jpg similarity index 100% rename from stadiumgs/academygfx/0x224ec50.jpg rename to oldnotes/stadiumgs/academygfx/0x224ec50.jpg diff --git a/stadiumgs/academygfx/0x224f3f0.jpg b/oldnotes/stadiumgs/academygfx/0x224f3f0.jpg similarity index 100% rename from stadiumgs/academygfx/0x224f3f0.jpg rename to oldnotes/stadiumgs/academygfx/0x224f3f0.jpg diff --git a/stadiumgs/academygfx/0x224f9c0.jpg b/oldnotes/stadiumgs/academygfx/0x224f9c0.jpg similarity index 100% rename from stadiumgs/academygfx/0x224f9c0.jpg rename to oldnotes/stadiumgs/academygfx/0x224f9c0.jpg diff --git a/stadiumgs/academygfx/0x2252960.jpg b/oldnotes/stadiumgs/academygfx/0x2252960.jpg similarity index 100% rename from stadiumgs/academygfx/0x2252960.jpg rename to oldnotes/stadiumgs/academygfx/0x2252960.jpg diff --git a/stadiumgs/academygfx/0x2255980.jpg b/oldnotes/stadiumgs/academygfx/0x2255980.jpg similarity index 100% rename from stadiumgs/academygfx/0x2255980.jpg rename to oldnotes/stadiumgs/academygfx/0x2255980.jpg diff --git a/stadiumgs/academygfx/0x2257c50.jpg b/oldnotes/stadiumgs/academygfx/0x2257c50.jpg similarity index 100% rename from stadiumgs/academygfx/0x2257c50.jpg rename to oldnotes/stadiumgs/academygfx/0x2257c50.jpg diff --git a/stadiumgs/academygfx/0x2258620.jpg b/oldnotes/stadiumgs/academygfx/0x2258620.jpg similarity index 100% rename from stadiumgs/academygfx/0x2258620.jpg rename to oldnotes/stadiumgs/academygfx/0x2258620.jpg diff --git a/stadiumgs/academygfx/0x2258e00.jpg b/oldnotes/stadiumgs/academygfx/0x2258e00.jpg similarity index 100% rename from stadiumgs/academygfx/0x2258e00.jpg rename to oldnotes/stadiumgs/academygfx/0x2258e00.jpg diff --git a/stadiumgs/academygfx/0x225a270.jpg b/oldnotes/stadiumgs/academygfx/0x225a270.jpg similarity index 100% rename from stadiumgs/academygfx/0x225a270.jpg rename to oldnotes/stadiumgs/academygfx/0x225a270.jpg diff --git a/stadiumgs/academygfx/0x225a3d0.jpg b/oldnotes/stadiumgs/academygfx/0x225a3d0.jpg similarity index 100% rename from stadiumgs/academygfx/0x225a3d0.jpg rename to oldnotes/stadiumgs/academygfx/0x225a3d0.jpg diff --git a/stadiumgs/academygfx/0x225a540.jpg b/oldnotes/stadiumgs/academygfx/0x225a540.jpg similarity index 100% rename from stadiumgs/academygfx/0x225a540.jpg rename to oldnotes/stadiumgs/academygfx/0x225a540.jpg diff --git a/stadiumgs/academygfx/0x225a6b0.jpg b/oldnotes/stadiumgs/academygfx/0x225a6b0.jpg similarity index 100% rename from stadiumgs/academygfx/0x225a6b0.jpg rename to oldnotes/stadiumgs/academygfx/0x225a6b0.jpg diff --git a/stadiumgs/backgrounds/castlejohto.jpg b/oldnotes/stadiumgs/backgrounds/castlejohto.jpg similarity index 100% rename from stadiumgs/backgrounds/castlejohto.jpg rename to oldnotes/stadiumgs/backgrounds/castlejohto.jpg diff --git a/stadiumgs/backgrounds/castlekanto.jpg b/oldnotes/stadiumgs/backgrounds/castlekanto.jpg similarity index 100% rename from stadiumgs/backgrounds/castlekanto.jpg rename to oldnotes/stadiumgs/backgrounds/castlekanto.jpg diff --git a/stadiumgs/backgrounds/castleplateau.jpg b/oldnotes/stadiumgs/backgrounds/castleplateau.jpg similarity index 100% rename from stadiumgs/backgrounds/castleplateau.jpg rename to oldnotes/stadiumgs/backgrounds/castleplateau.jpg diff --git a/stadiumgs/backgrounds/classroom1.jpg b/oldnotes/stadiumgs/backgrounds/classroom1.jpg similarity index 100% rename from stadiumgs/backgrounds/classroom1.jpg rename to oldnotes/stadiumgs/backgrounds/classroom1.jpg diff --git a/stadiumgs/backgrounds/classroom2.jpg b/oldnotes/stadiumgs/backgrounds/classroom2.jpg similarity index 100% rename from stadiumgs/backgrounds/classroom2.jpg rename to oldnotes/stadiumgs/backgrounds/classroom2.jpg diff --git a/stadiumgs/backgrounds/credits/blainevspryce.jpg b/oldnotes/stadiumgs/backgrounds/credits/blainevspryce.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/blainevspryce.jpg rename to oldnotes/stadiumgs/backgrounds/credits/blainevspryce.jpg diff --git a/stadiumgs/backgrounds/credits/bugsyvskaren.jpg b/oldnotes/stadiumgs/backgrounds/credits/bugsyvskaren.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/bugsyvskaren.jpg rename to oldnotes/stadiumgs/backgrounds/credits/bugsyvskaren.jpg diff --git a/stadiumgs/backgrounds/credits/chuckvsbruno.jpg b/oldnotes/stadiumgs/backgrounds/credits/chuckvsbruno.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/chuckvsbruno.jpg rename to oldnotes/stadiumgs/backgrounds/credits/chuckvsbruno.jpg diff --git a/stadiumgs/backgrounds/credits/falknervserika.jpg b/oldnotes/stadiumgs/backgrounds/credits/falknervserika.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/falknervserika.jpg rename to oldnotes/stadiumgs/backgrounds/credits/falknervserika.jpg diff --git a/stadiumgs/backgrounds/credits/janinevskoga.jpg b/oldnotes/stadiumgs/backgrounds/credits/janinevskoga.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/janinevskoga.jpg rename to oldnotes/stadiumgs/backgrounds/credits/janinevskoga.jpg diff --git a/stadiumgs/backgrounds/credits/jasminevsbrock.jpg b/oldnotes/stadiumgs/backgrounds/credits/jasminevsbrock.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/jasminevsbrock.jpg rename to oldnotes/stadiumgs/backgrounds/credits/jasminevsbrock.jpg diff --git a/stadiumgs/backgrounds/credits/lancevsclair.jpg b/oldnotes/stadiumgs/backgrounds/credits/lancevsclair.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/lancevsclair.jpg rename to oldnotes/stadiumgs/backgrounds/credits/lancevsclair.jpg diff --git a/stadiumgs/backgrounds/credits/mistyvswhitney.jpg b/oldnotes/stadiumgs/backgrounds/credits/mistyvswhitney.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/mistyvswhitney.jpg rename to oldnotes/stadiumgs/backgrounds/credits/mistyvswhitney.jpg diff --git a/stadiumgs/backgrounds/credits/redvsblue.jpg b/oldnotes/stadiumgs/backgrounds/credits/redvsblue.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/redvsblue.jpg rename to oldnotes/stadiumgs/backgrounds/credits/redvsblue.jpg diff --git a/stadiumgs/backgrounds/credits/rivalvskris.jpg b/oldnotes/stadiumgs/backgrounds/credits/rivalvskris.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/rivalvskris.jpg rename to oldnotes/stadiumgs/backgrounds/credits/rivalvskris.jpg diff --git a/stadiumgs/backgrounds/credits/sabrinavswill.jpg b/oldnotes/stadiumgs/backgrounds/credits/sabrinavswill.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/sabrinavswill.jpg rename to oldnotes/stadiumgs/backgrounds/credits/sabrinavswill.jpg diff --git a/stadiumgs/backgrounds/credits/surgevsmorty.jpg b/oldnotes/stadiumgs/backgrounds/credits/surgevsmorty.jpg similarity index 100% rename from stadiumgs/backgrounds/credits/surgevsmorty.jpg rename to oldnotes/stadiumgs/backgrounds/credits/surgevsmorty.jpg diff --git a/stadiumgs/backgrounds/deptstore.jpg b/oldnotes/stadiumgs/backgrounds/deptstore.jpg similarity index 100% rename from stadiumgs/backgrounds/deptstore.jpg rename to oldnotes/stadiumgs/backgrounds/deptstore.jpg diff --git a/stadiumgs/backgrounds/freebattle.jpg b/oldnotes/stadiumgs/backgrounds/freebattle.jpg similarity index 100% rename from stadiumgs/backgrounds/freebattle.jpg rename to oldnotes/stadiumgs/backgrounds/freebattle.jpg diff --git a/stadiumgs/backgrounds/gamepakcheck.jpg b/oldnotes/stadiumgs/backgrounds/gamepakcheck.jpg similarity index 100% rename from stadiumgs/backgrounds/gamepakcheck.jpg rename to oldnotes/stadiumgs/backgrounds/gamepakcheck.jpg diff --git a/stadiumgs/backgrounds/lab.jpg b/oldnotes/stadiumgs/backgrounds/lab.jpg similarity index 100% rename from stadiumgs/backgrounds/lab.jpg rename to oldnotes/stadiumgs/backgrounds/lab.jpg diff --git a/stadiumgs/backgrounds/labmachine.jpg b/oldnotes/stadiumgs/backgrounds/labmachine.jpg similarity index 100% rename from stadiumgs/backgrounds/labmachine.jpg rename to oldnotes/stadiumgs/backgrounds/labmachine.jpg diff --git a/stadiumgs/backgrounds/library1.jpg b/oldnotes/stadiumgs/backgrounds/library1.jpg similarity index 100% rename from stadiumgs/backgrounds/library1.jpg rename to oldnotes/stadiumgs/backgrounds/library1.jpg diff --git a/stadiumgs/backgrounds/library2.jpg b/oldnotes/stadiumgs/backgrounds/library2.jpg similarity index 100% rename from stadiumgs/backgrounds/library2.jpg rename to oldnotes/stadiumgs/backgrounds/library2.jpg diff --git a/stadiumgs/backgrounds/library3.jpg b/oldnotes/stadiumgs/backgrounds/library3.jpg similarity index 100% rename from stadiumgs/backgrounds/library3.jpg rename to oldnotes/stadiumgs/backgrounds/library3.jpg diff --git a/stadiumgs/backgrounds/minigames.jpg b/oldnotes/stadiumgs/backgrounds/minigames.jpg similarity index 100% rename from stadiumgs/backgrounds/minigames.jpg rename to oldnotes/stadiumgs/backgrounds/minigames.jpg diff --git a/stadiumgs/backgrounds/minigames/clearcut.jpg b/oldnotes/stadiumgs/backgrounds/minigames/clearcut.jpg similarity index 100% rename from stadiumgs/backgrounds/minigames/clearcut.jpg rename to oldnotes/stadiumgs/backgrounds/minigames/clearcut.jpg diff --git a/stadiumgs/backgrounds/minigames/eager.jpg b/oldnotes/stadiumgs/backgrounds/minigames/eager.jpg similarity index 100% rename from stadiumgs/backgrounds/minigames/eager.jpg rename to oldnotes/stadiumgs/backgrounds/minigames/eager.jpg diff --git a/stadiumgs/backgrounds/minigames/emergency.jpg b/oldnotes/stadiumgs/backgrounds/minigames/emergency.jpg similarity index 100% rename from stadiumgs/backgrounds/minigames/emergency.jpg rename to oldnotes/stadiumgs/backgrounds/minigames/emergency.jpg diff --git a/stadiumgs/backgrounds/myroom.jpg b/oldnotes/stadiumgs/backgrounds/myroom.jpg similarity index 100% rename from stadiumgs/backgrounds/myroom.jpg rename to oldnotes/stadiumgs/backgrounds/myroom.jpg diff --git a/stadiumgs/backgrounds/mysterygift1.jpg b/oldnotes/stadiumgs/backgrounds/mysterygift1.jpg similarity index 100% rename from stadiumgs/backgrounds/mysterygift1.jpg rename to oldnotes/stadiumgs/backgrounds/mysterygift1.jpg diff --git a/stadiumgs/backgrounds/mysterygift2.jpg b/oldnotes/stadiumgs/backgrounds/mysterygift2.jpg similarity index 100% rename from stadiumgs/backgrounds/mysterygift2.jpg rename to oldnotes/stadiumgs/backgrounds/mysterygift2.jpg diff --git a/stadiumgs/backgrounds/pleaseselect.jpg b/oldnotes/stadiumgs/backgrounds/pleaseselect.jpg similarity index 100% rename from stadiumgs/backgrounds/pleaseselect.jpg rename to oldnotes/stadiumgs/backgrounds/pleaseselect.jpg diff --git a/stadiumgs/backgrounds/pokedex.jpg b/oldnotes/stadiumgs/backgrounds/pokedex.jpg similarity index 100% rename from stadiumgs/backgrounds/pokedex.jpg rename to oldnotes/stadiumgs/backgrounds/pokedex.jpg diff --git a/stadiumgs/backgrounds/quiz.jpg b/oldnotes/stadiumgs/backgrounds/quiz.jpg similarity index 100% rename from stadiumgs/backgrounds/quiz.jpg rename to oldnotes/stadiumgs/backgrounds/quiz.jpg diff --git a/stadiumgs/backgrounds/rival.jpg b/oldnotes/stadiumgs/backgrounds/rival.jpg similarity index 100% rename from stadiumgs/backgrounds/rival.jpg rename to oldnotes/stadiumgs/backgrounds/rival.jpg diff --git a/stadiumgs/backgrounds/selectpokemon/0x1f449b0.jpg b/oldnotes/stadiumgs/backgrounds/selectpokemon/0x1f449b0.jpg similarity index 100% rename from stadiumgs/backgrounds/selectpokemon/0x1f449b0.jpg rename to oldnotes/stadiumgs/backgrounds/selectpokemon/0x1f449b0.jpg diff --git a/stadiumgs/backgrounds/selectpokemon/battlenow.jpg b/oldnotes/stadiumgs/backgrounds/selectpokemon/battlenow.jpg similarity index 100% rename from stadiumgs/backgrounds/selectpokemon/battlenow.jpg rename to oldnotes/stadiumgs/backgrounds/selectpokemon/battlenow.jpg diff --git a/stadiumgs/backgrounds/selectpokemon/challengecup.jpg b/oldnotes/stadiumgs/backgrounds/selectpokemon/challengecup.jpg similarity index 100% rename from stadiumgs/backgrounds/selectpokemon/challengecup.jpg rename to oldnotes/stadiumgs/backgrounds/selectpokemon/challengecup.jpg diff --git a/stadiumgs/backgrounds/selectpokemon/littlecup.jpg b/oldnotes/stadiumgs/backgrounds/selectpokemon/littlecup.jpg similarity index 100% rename from stadiumgs/backgrounds/selectpokemon/littlecup.jpg rename to oldnotes/stadiumgs/backgrounds/selectpokemon/littlecup.jpg diff --git a/stadiumgs/backgrounds/selectpokemon/pokecup.jpg b/oldnotes/stadiumgs/backgrounds/selectpokemon/pokecup.jpg similarity index 100% rename from stadiumgs/backgrounds/selectpokemon/pokecup.jpg rename to oldnotes/stadiumgs/backgrounds/selectpokemon/pokecup.jpg diff --git a/stadiumgs/backgrounds/selectpokemon/primecup.jpg b/oldnotes/stadiumgs/backgrounds/selectpokemon/primecup.jpg similarity index 100% rename from stadiumgs/backgrounds/selectpokemon/primecup.jpg rename to oldnotes/stadiumgs/backgrounds/selectpokemon/primecup.jpg diff --git a/stadiumgs/backgrounds/stadium.jpg b/oldnotes/stadiumgs/backgrounds/stadium.jpg similarity index 100% rename from stadiumgs/backgrounds/stadium.jpg rename to oldnotes/stadiumgs/backgrounds/stadium.jpg diff --git a/stadiumgs/backgrounds/title1.jpg b/oldnotes/stadiumgs/backgrounds/title1.jpg similarity index 100% rename from stadiumgs/backgrounds/title1.jpg rename to oldnotes/stadiumgs/backgrounds/title1.jpg diff --git a/stadiumgs/backgrounds/title2.jpg b/oldnotes/stadiumgs/backgrounds/title2.jpg similarity index 100% rename from stadiumgs/backgrounds/title2.jpg rename to oldnotes/stadiumgs/backgrounds/title2.jpg diff --git a/stadiumgs/backgrounds/title3.jpg b/oldnotes/stadiumgs/backgrounds/title3.jpg similarity index 100% rename from stadiumgs/backgrounds/title3.jpg rename to oldnotes/stadiumgs/backgrounds/title3.jpg diff --git a/stadiumgs/backgrounds/whitecity1.jpg b/oldnotes/stadiumgs/backgrounds/whitecity1.jpg similarity index 100% rename from stadiumgs/backgrounds/whitecity1.jpg rename to oldnotes/stadiumgs/backgrounds/whitecity1.jpg diff --git a/stadiumgs/backgrounds/whitecity2.jpg b/oldnotes/stadiumgs/backgrounds/whitecity2.jpg similarity index 100% rename from stadiumgs/backgrounds/whitecity2.jpg rename to oldnotes/stadiumgs/backgrounds/whitecity2.jpg diff --git a/stadiumgs/constants/decoration_constants.s b/oldnotes/stadiumgs/constants/decoration_constants.s similarity index 100% rename from stadiumgs/constants/decoration_constants.s rename to oldnotes/stadiumgs/constants/decoration_constants.s diff --git a/stadiumgs/constants/item_constants.s b/oldnotes/stadiumgs/constants/item_constants.s similarity index 100% rename from stadiumgs/constants/item_constants.s rename to oldnotes/stadiumgs/constants/item_constants.s diff --git a/stadiumgs/constants/move_constants.s b/oldnotes/stadiumgs/constants/move_constants.s similarity index 100% rename from stadiumgs/constants/move_constants.s rename to oldnotes/stadiumgs/constants/move_constants.s diff --git a/stadiumgs/constants/pokemon_constants.s b/oldnotes/stadiumgs/constants/pokemon_constants.s similarity index 100% rename from stadiumgs/constants/pokemon_constants.s rename to oldnotes/stadiumgs/constants/pokemon_constants.s diff --git a/stadiumgs/constants/type_constants.s b/oldnotes/stadiumgs/constants/type_constants.s similarity index 100% rename from stadiumgs/constants/type_constants.s rename to oldnotes/stadiumgs/constants/type_constants.s diff --git a/stadiumgs/main.s b/oldnotes/stadiumgs/main.s similarity index 100% rename from stadiumgs/main.s rename to oldnotes/stadiumgs/main.s diff --git a/stadiumgs/rentals/littlecup.json b/oldnotes/stadiumgs/rentals/littlecup.json similarity index 100% rename from stadiumgs/rentals/littlecup.json rename to oldnotes/stadiumgs/rentals/littlecup.json diff --git a/stadiumgs/rentals/pokecup.json b/oldnotes/stadiumgs/rentals/pokecup.json similarity index 100% rename from stadiumgs/rentals/pokecup.json rename to oldnotes/stadiumgs/rentals/pokecup.json diff --git a/stadiumgs/rentals/primecup1.json b/oldnotes/stadiumgs/rentals/primecup1.json similarity index 100% rename from stadiumgs/rentals/primecup1.json rename to oldnotes/stadiumgs/rentals/primecup1.json diff --git a/stadiumgs/rentals/primecup2.json b/oldnotes/stadiumgs/rentals/primecup2.json similarity index 100% rename from stadiumgs/rentals/primecup2.json rename to oldnotes/stadiumgs/rentals/primecup2.json diff --git a/stadiumgs/rom.md5 b/oldnotes/stadiumgs/rom.md5 similarity index 100% rename from stadiumgs/rom.md5 rename to oldnotes/stadiumgs/rom.md5 diff --git a/stadiumgs/rom_header.s b/oldnotes/stadiumgs/rom_header.s similarity index 100% rename from stadiumgs/rom_header.s rename to oldnotes/stadiumgs/rom_header.s diff --git a/stadiumgs/rosters/0x170d240.json b/oldnotes/stadiumgs/rosters/0x170d240.json similarity index 100% rename from stadiumgs/rosters/0x170d240.json rename to oldnotes/stadiumgs/rosters/0x170d240.json diff --git a/stadiumgs/rosters/0x170d5e0.json b/oldnotes/stadiumgs/rosters/0x170d5e0.json similarity index 100% rename from stadiumgs/rosters/0x170d5e0.json rename to oldnotes/stadiumgs/rosters/0x170d5e0.json diff --git a/stadiumgs/rosters/academy/elitefour.json b/oldnotes/stadiumgs/rosters/academy/elitefour.json similarity index 100% rename from stadiumgs/rosters/academy/elitefour.json rename to oldnotes/stadiumgs/rosters/academy/elitefour.json diff --git a/stadiumgs/rosters/academy/gymleader.json b/oldnotes/stadiumgs/rosters/academy/gymleader.json similarity index 100% rename from stadiumgs/rosters/academy/gymleader.json rename to oldnotes/stadiumgs/rosters/academy/gymleader.json diff --git a/stadiumgs/rosters/academy/trainer.json b/oldnotes/stadiumgs/rosters/academy/trainer.json similarity index 100% rename from stadiumgs/rosters/academy/trainer.json rename to oldnotes/stadiumgs/rosters/academy/trainer.json diff --git a/stadiumgs/rosters/challengecup/greatball1.json b/oldnotes/stadiumgs/rosters/challengecup/greatball1.json similarity index 100% rename from stadiumgs/rosters/challengecup/greatball1.json rename to oldnotes/stadiumgs/rosters/challengecup/greatball1.json diff --git a/stadiumgs/rosters/challengecup/greatball2.json b/oldnotes/stadiumgs/rosters/challengecup/greatball2.json similarity index 100% rename from stadiumgs/rosters/challengecup/greatball2.json rename to oldnotes/stadiumgs/rosters/challengecup/greatball2.json diff --git a/stadiumgs/rosters/challengecup/masterball1.json b/oldnotes/stadiumgs/rosters/challengecup/masterball1.json similarity index 100% rename from stadiumgs/rosters/challengecup/masterball1.json rename to oldnotes/stadiumgs/rosters/challengecup/masterball1.json diff --git a/stadiumgs/rosters/challengecup/masterball2.json b/oldnotes/stadiumgs/rosters/challengecup/masterball2.json similarity index 100% rename from stadiumgs/rosters/challengecup/masterball2.json rename to oldnotes/stadiumgs/rosters/challengecup/masterball2.json diff --git a/stadiumgs/rosters/challengecup/pokeball1.json b/oldnotes/stadiumgs/rosters/challengecup/pokeball1.json similarity index 100% rename from stadiumgs/rosters/challengecup/pokeball1.json rename to oldnotes/stadiumgs/rosters/challengecup/pokeball1.json diff --git a/stadiumgs/rosters/challengecup/pokeball2.json b/oldnotes/stadiumgs/rosters/challengecup/pokeball2.json similarity index 100% rename from stadiumgs/rosters/challengecup/pokeball2.json rename to oldnotes/stadiumgs/rosters/challengecup/pokeball2.json diff --git a/stadiumgs/rosters/challengecup/ultraball1.json b/oldnotes/stadiumgs/rosters/challengecup/ultraball1.json similarity index 100% rename from stadiumgs/rosters/challengecup/ultraball1.json rename to oldnotes/stadiumgs/rosters/challengecup/ultraball1.json diff --git a/stadiumgs/rosters/challengecup/ultraball2.json b/oldnotes/stadiumgs/rosters/challengecup/ultraball2.json similarity index 100% rename from stadiumgs/rosters/challengecup/ultraball2.json rename to oldnotes/stadiumgs/rosters/challengecup/ultraball2.json diff --git a/stadiumgs/rosters/gymleadercastle/azalea1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/azalea1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/azalea1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/azalea1.json diff --git a/stadiumgs/rosters/gymleadercastle/azalea2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/azalea2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/azalea2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/azalea2.json diff --git a/stadiumgs/rosters/gymleadercastle/blackthorn1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/blackthorn1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/blackthorn1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/blackthorn1.json diff --git a/stadiumgs/rosters/gymleadercastle/blackthorn2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/blackthorn2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/blackthorn2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/blackthorn2.json diff --git a/stadiumgs/rosters/gymleadercastle/celadon1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/celadon1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/celadon1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/celadon1.json diff --git a/stadiumgs/rosters/gymleadercastle/celadon2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/celadon2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/celadon2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/celadon2.json diff --git a/stadiumgs/rosters/gymleadercastle/cerulean1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/cerulean1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/cerulean1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/cerulean1.json diff --git a/stadiumgs/rosters/gymleadercastle/cerulean2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/cerulean2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/cerulean2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/cerulean2.json diff --git a/stadiumgs/rosters/gymleadercastle/champion1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/champion1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/champion1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/champion1.json diff --git a/stadiumgs/rosters/gymleadercastle/champion2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/champion2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/champion2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/champion2.json diff --git a/stadiumgs/rosters/gymleadercastle/cianwood1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/cianwood1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/cianwood1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/cianwood1.json diff --git a/stadiumgs/rosters/gymleadercastle/cianwood2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/cianwood2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/cianwood2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/cianwood2.json diff --git a/stadiumgs/rosters/gymleadercastle/cinnabar1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/cinnabar1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/cinnabar1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/cinnabar1.json diff --git a/stadiumgs/rosters/gymleadercastle/cinnabar2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/cinnabar2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/cinnabar2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/cinnabar2.json diff --git a/stadiumgs/rosters/gymleadercastle/ecruteak1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/ecruteak1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/ecruteak1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/ecruteak1.json diff --git a/stadiumgs/rosters/gymleadercastle/ecruteak2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/ecruteak2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/ecruteak2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/ecruteak2.json diff --git a/stadiumgs/rosters/gymleadercastle/elitefour1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/elitefour1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/elitefour1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/elitefour1.json diff --git a/stadiumgs/rosters/gymleadercastle/elitefour2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/elitefour2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/elitefour2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/elitefour2.json diff --git a/stadiumgs/rosters/gymleadercastle/fuchsia1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/fuchsia1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/fuchsia1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/fuchsia1.json diff --git a/stadiumgs/rosters/gymleadercastle/fuchsia2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/fuchsia2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/fuchsia2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/fuchsia2.json diff --git a/stadiumgs/rosters/gymleadercastle/goldenrod1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/goldenrod1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/goldenrod1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/goldenrod1.json diff --git a/stadiumgs/rosters/gymleadercastle/goldenrod2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/goldenrod2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/goldenrod2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/goldenrod2.json diff --git a/stadiumgs/rosters/gymleadercastle/mahogany1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/mahogany1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/mahogany1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/mahogany1.json diff --git a/stadiumgs/rosters/gymleadercastle/mahogany2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/mahogany2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/mahogany2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/mahogany2.json diff --git a/stadiumgs/rosters/gymleadercastle/olivine1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/olivine1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/olivine1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/olivine1.json diff --git a/stadiumgs/rosters/gymleadercastle/olivine2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/olivine2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/olivine2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/olivine2.json diff --git a/stadiumgs/rosters/gymleadercastle/pewter1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/pewter1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/pewter1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/pewter1.json diff --git a/stadiumgs/rosters/gymleadercastle/pewter2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/pewter2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/pewter2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/pewter2.json diff --git a/stadiumgs/rosters/gymleadercastle/red1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/red1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/red1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/red1.json diff --git a/stadiumgs/rosters/gymleadercastle/red2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/red2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/red2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/red2.json diff --git a/stadiumgs/rosters/gymleadercastle/rocket1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/rocket1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/rocket1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/rocket1.json diff --git a/stadiumgs/rosters/gymleadercastle/rocket2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/rocket2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/rocket2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/rocket2.json diff --git a/stadiumgs/rosters/gymleadercastle/saffron1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/saffron1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/saffron1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/saffron1.json diff --git a/stadiumgs/rosters/gymleadercastle/saffron2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/saffron2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/saffron2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/saffron2.json diff --git a/stadiumgs/rosters/gymleadercastle/vermilion1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/vermilion1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/vermilion1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/vermilion1.json diff --git a/stadiumgs/rosters/gymleadercastle/vermilion2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/vermilion2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/vermilion2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/vermilion2.json diff --git a/stadiumgs/rosters/gymleadercastle/violet1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/violet1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/violet1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/violet1.json diff --git a/stadiumgs/rosters/gymleadercastle/violet2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/violet2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/violet2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/violet2.json diff --git a/stadiumgs/rosters/gymleadercastle/viridian1.json b/oldnotes/stadiumgs/rosters/gymleadercastle/viridian1.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/viridian1.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/viridian1.json diff --git a/stadiumgs/rosters/gymleadercastle/viridian2.json b/oldnotes/stadiumgs/rosters/gymleadercastle/viridian2.json similarity index 100% rename from stadiumgs/rosters/gymleadercastle/viridian2.json rename to oldnotes/stadiumgs/rosters/gymleadercastle/viridian2.json diff --git a/stadiumgs/rosters/littlecup1.json b/oldnotes/stadiumgs/rosters/littlecup1.json similarity index 100% rename from stadiumgs/rosters/littlecup1.json rename to oldnotes/stadiumgs/rosters/littlecup1.json diff --git a/stadiumgs/rosters/littlecup2.json b/oldnotes/stadiumgs/rosters/littlecup2.json similarity index 100% rename from stadiumgs/rosters/littlecup2.json rename to oldnotes/stadiumgs/rosters/littlecup2.json diff --git a/stadiumgs/rosters/pokecup/greatball1.json b/oldnotes/stadiumgs/rosters/pokecup/greatball1.json similarity index 100% rename from stadiumgs/rosters/pokecup/greatball1.json rename to oldnotes/stadiumgs/rosters/pokecup/greatball1.json diff --git a/stadiumgs/rosters/pokecup/greatball2.json b/oldnotes/stadiumgs/rosters/pokecup/greatball2.json similarity index 100% rename from stadiumgs/rosters/pokecup/greatball2.json rename to oldnotes/stadiumgs/rosters/pokecup/greatball2.json diff --git a/stadiumgs/rosters/pokecup/masterball1.json b/oldnotes/stadiumgs/rosters/pokecup/masterball1.json similarity index 100% rename from stadiumgs/rosters/pokecup/masterball1.json rename to oldnotes/stadiumgs/rosters/pokecup/masterball1.json diff --git a/stadiumgs/rosters/pokecup/masterball2.json b/oldnotes/stadiumgs/rosters/pokecup/masterball2.json similarity index 100% rename from stadiumgs/rosters/pokecup/masterball2.json rename to oldnotes/stadiumgs/rosters/pokecup/masterball2.json diff --git a/stadiumgs/rosters/pokecup/pokeball1.json b/oldnotes/stadiumgs/rosters/pokecup/pokeball1.json similarity index 100% rename from stadiumgs/rosters/pokecup/pokeball1.json rename to oldnotes/stadiumgs/rosters/pokecup/pokeball1.json diff --git a/stadiumgs/rosters/pokecup/pokeball2.json b/oldnotes/stadiumgs/rosters/pokecup/pokeball2.json similarity index 100% rename from stadiumgs/rosters/pokecup/pokeball2.json rename to oldnotes/stadiumgs/rosters/pokecup/pokeball2.json diff --git a/stadiumgs/rosters/pokecup/ultraball1.json b/oldnotes/stadiumgs/rosters/pokecup/ultraball1.json similarity index 100% rename from stadiumgs/rosters/pokecup/ultraball1.json rename to oldnotes/stadiumgs/rosters/pokecup/ultraball1.json diff --git a/stadiumgs/rosters/pokecup/ultraball2.json b/oldnotes/stadiumgs/rosters/pokecup/ultraball2.json similarity index 100% rename from stadiumgs/rosters/pokecup/ultraball2.json rename to oldnotes/stadiumgs/rosters/pokecup/ultraball2.json diff --git a/stadiumgs/rosters/primecup1.json b/oldnotes/stadiumgs/rosters/primecup1.json similarity index 100% rename from stadiumgs/rosters/primecup1.json rename to oldnotes/stadiumgs/rosters/primecup1.json diff --git a/stadiumgs/rosters/primecup2.json b/oldnotes/stadiumgs/rosters/primecup2.json similarity index 100% rename from stadiumgs/rosters/primecup2.json rename to oldnotes/stadiumgs/rosters/primecup2.json diff --git a/stadiumgs/rosters/rival1.json b/oldnotes/stadiumgs/rosters/rival1.json similarity index 100% rename from stadiumgs/rosters/rival1.json rename to oldnotes/stadiumgs/rosters/rival1.json diff --git a/stadiumgs/rosters/rival2.json b/oldnotes/stadiumgs/rosters/rival2.json similarity index 100% rename from stadiumgs/rosters/rival2.json rename to oldnotes/stadiumgs/rosters/rival2.json diff --git a/stadiumgs/text/0x1d8c300.txt b/oldnotes/stadiumgs/text/0x1d8c300.txt similarity index 100% rename from stadiumgs/text/0x1d8c300.txt rename to oldnotes/stadiumgs/text/0x1d8c300.txt diff --git a/stadiumgs/text/0x1d8e4e0.txt b/oldnotes/stadiumgs/text/0x1d8e4e0.txt similarity index 100% rename from stadiumgs/text/0x1d8e4e0.txt rename to oldnotes/stadiumgs/text/0x1d8e4e0.txt diff --git a/stadiumgs/text/0x1d8e8b0.txt b/oldnotes/stadiumgs/text/0x1d8e8b0.txt similarity index 100% rename from stadiumgs/text/0x1d8e8b0.txt rename to oldnotes/stadiumgs/text/0x1d8e8b0.txt diff --git a/stadiumgs/text/0x1d8fad0.txt b/oldnotes/stadiumgs/text/0x1d8fad0.txt similarity index 100% rename from stadiumgs/text/0x1d8fad0.txt rename to oldnotes/stadiumgs/text/0x1d8fad0.txt diff --git a/stadiumgs/text/0x1d904a0.txt b/oldnotes/stadiumgs/text/0x1d904a0.txt similarity index 100% rename from stadiumgs/text/0x1d904a0.txt rename to oldnotes/stadiumgs/text/0x1d904a0.txt diff --git a/stadiumgs/text/0x1d90e00.txt b/oldnotes/stadiumgs/text/0x1d90e00.txt similarity index 100% rename from stadiumgs/text/0x1d90e00.txt rename to oldnotes/stadiumgs/text/0x1d90e00.txt diff --git a/stadiumgs/text/0x1d919a0.txt b/oldnotes/stadiumgs/text/0x1d919a0.txt similarity index 100% rename from stadiumgs/text/0x1d919a0.txt rename to oldnotes/stadiumgs/text/0x1d919a0.txt diff --git a/stadiumgs/text/0x1d91a50.txt b/oldnotes/stadiumgs/text/0x1d91a50.txt similarity index 100% rename from stadiumgs/text/0x1d91a50.txt rename to oldnotes/stadiumgs/text/0x1d91a50.txt diff --git a/stadiumgs/text/0x1d921e0.txt b/oldnotes/stadiumgs/text/0x1d921e0.txt similarity index 100% rename from stadiumgs/text/0x1d921e0.txt rename to oldnotes/stadiumgs/text/0x1d921e0.txt diff --git a/stadiumgs/text/0x1d92650.txt b/oldnotes/stadiumgs/text/0x1d92650.txt similarity index 100% rename from stadiumgs/text/0x1d92650.txt rename to oldnotes/stadiumgs/text/0x1d92650.txt diff --git a/stadiumgs/text/0x1d928a0.txt b/oldnotes/stadiumgs/text/0x1d928a0.txt similarity index 100% rename from stadiumgs/text/0x1d928a0.txt rename to oldnotes/stadiumgs/text/0x1d928a0.txt diff --git a/stadiumgs/text/0x1d92e20.txt b/oldnotes/stadiumgs/text/0x1d92e20.txt similarity index 100% rename from stadiumgs/text/0x1d92e20.txt rename to oldnotes/stadiumgs/text/0x1d92e20.txt diff --git a/stadiumgs/text/0x1d930f0.txt b/oldnotes/stadiumgs/text/0x1d930f0.txt similarity index 100% rename from stadiumgs/text/0x1d930f0.txt rename to oldnotes/stadiumgs/text/0x1d930f0.txt diff --git a/stadiumgs/text/0x1d93480.txt b/oldnotes/stadiumgs/text/0x1d93480.txt similarity index 100% rename from stadiumgs/text/0x1d93480.txt rename to oldnotes/stadiumgs/text/0x1d93480.txt diff --git a/stadiumgs/text/0x1d93510.txt b/oldnotes/stadiumgs/text/0x1d93510.txt similarity index 100% rename from stadiumgs/text/0x1d93510.txt rename to oldnotes/stadiumgs/text/0x1d93510.txt diff --git a/stadiumgs/text/0x1d94340.txt b/oldnotes/stadiumgs/text/0x1d94340.txt similarity index 100% rename from stadiumgs/text/0x1d94340.txt rename to oldnotes/stadiumgs/text/0x1d94340.txt diff --git a/stadiumgs/text/0x1d94c90.txt b/oldnotes/stadiumgs/text/0x1d94c90.txt similarity index 100% rename from stadiumgs/text/0x1d94c90.txt rename to oldnotes/stadiumgs/text/0x1d94c90.txt diff --git a/stadiumgs/text/0x1d94e70.txt b/oldnotes/stadiumgs/text/0x1d94e70.txt similarity index 100% rename from stadiumgs/text/0x1d94e70.txt rename to oldnotes/stadiumgs/text/0x1d94e70.txt diff --git a/stadiumgs/text/0x1d959b0.txt b/oldnotes/stadiumgs/text/0x1d959b0.txt similarity index 100% rename from stadiumgs/text/0x1d959b0.txt rename to oldnotes/stadiumgs/text/0x1d959b0.txt diff --git a/stadiumgs/text/0x1d96770.txt b/oldnotes/stadiumgs/text/0x1d96770.txt similarity index 100% rename from stadiumgs/text/0x1d96770.txt rename to oldnotes/stadiumgs/text/0x1d96770.txt diff --git a/stadiumgs/text/0x1d96b50.txt b/oldnotes/stadiumgs/text/0x1d96b50.txt similarity index 100% rename from stadiumgs/text/0x1d96b50.txt rename to oldnotes/stadiumgs/text/0x1d96b50.txt diff --git a/stadiumgs/text/0x1d96bd0.txt b/oldnotes/stadiumgs/text/0x1d96bd0.txt similarity index 100% rename from stadiumgs/text/0x1d96bd0.txt rename to oldnotes/stadiumgs/text/0x1d96bd0.txt diff --git a/stadiumgs/text/0x1d96e20.txt b/oldnotes/stadiumgs/text/0x1d96e20.txt similarity index 100% rename from stadiumgs/text/0x1d96e20.txt rename to oldnotes/stadiumgs/text/0x1d96e20.txt diff --git a/stadiumgs/text/0x1d96e90.txt b/oldnotes/stadiumgs/text/0x1d96e90.txt similarity index 100% rename from stadiumgs/text/0x1d96e90.txt rename to oldnotes/stadiumgs/text/0x1d96e90.txt diff --git a/stadiumgs/text/0x1d96f40.txt b/oldnotes/stadiumgs/text/0x1d96f40.txt similarity index 100% rename from stadiumgs/text/0x1d96f40.txt rename to oldnotes/stadiumgs/text/0x1d96f40.txt diff --git a/stadiumgs/text/0x1d9bce0.txt b/oldnotes/stadiumgs/text/0x1d9bce0.txt similarity index 100% rename from stadiumgs/text/0x1d9bce0.txt rename to oldnotes/stadiumgs/text/0x1d9bce0.txt diff --git a/stadiumgs/text/0x1d9bd50.txt b/oldnotes/stadiumgs/text/0x1d9bd50.txt similarity index 100% rename from stadiumgs/text/0x1d9bd50.txt rename to oldnotes/stadiumgs/text/0x1d9bd50.txt diff --git a/stadiumgs/text/0x1dc61e0.txt b/oldnotes/stadiumgs/text/0x1dc61e0.txt similarity index 100% rename from stadiumgs/text/0x1dc61e0.txt rename to oldnotes/stadiumgs/text/0x1dc61e0.txt diff --git a/stadiumgs/text/0x1dc64f0.txt b/oldnotes/stadiumgs/text/0x1dc64f0.txt similarity index 100% rename from stadiumgs/text/0x1dc64f0.txt rename to oldnotes/stadiumgs/text/0x1dc64f0.txt diff --git a/stadiumgs/text/0x1dc6dc0.txt b/oldnotes/stadiumgs/text/0x1dc6dc0.txt similarity index 100% rename from stadiumgs/text/0x1dc6dc0.txt rename to oldnotes/stadiumgs/text/0x1dc6dc0.txt diff --git a/stadiumgs/text/0x1dc6fc0.txt b/oldnotes/stadiumgs/text/0x1dc6fc0.txt similarity index 100% rename from stadiumgs/text/0x1dc6fc0.txt rename to oldnotes/stadiumgs/text/0x1dc6fc0.txt diff --git a/stadiumgs/text/0x1dc7610.txt b/oldnotes/stadiumgs/text/0x1dc7610.txt similarity index 100% rename from stadiumgs/text/0x1dc7610.txt rename to oldnotes/stadiumgs/text/0x1dc7610.txt diff --git a/stadiumgs/text/0x1dc79a0.txt b/oldnotes/stadiumgs/text/0x1dc79a0.txt similarity index 100% rename from stadiumgs/text/0x1dc79a0.txt rename to oldnotes/stadiumgs/text/0x1dc79a0.txt diff --git a/stadiumgs/text/0x1dc7cc0.txt b/oldnotes/stadiumgs/text/0x1dc7cc0.txt similarity index 100% rename from stadiumgs/text/0x1dc7cc0.txt rename to oldnotes/stadiumgs/text/0x1dc7cc0.txt diff --git a/stadiumgs/text/0x1dc9720.txt b/oldnotes/stadiumgs/text/0x1dc9720.txt similarity index 100% rename from stadiumgs/text/0x1dc9720.txt rename to oldnotes/stadiumgs/text/0x1dc9720.txt diff --git a/stadiumgs/text/0x1dcab90.txt b/oldnotes/stadiumgs/text/0x1dcab90.txt similarity index 100% rename from stadiumgs/text/0x1dcab90.txt rename to oldnotes/stadiumgs/text/0x1dcab90.txt diff --git a/stadiumgs/text/academy/academy.txt b/oldnotes/stadiumgs/text/academy/academy.txt similarity index 100% rename from stadiumgs/text/academy/academy.txt rename to oldnotes/stadiumgs/text/academy/academy.txt diff --git a/stadiumgs/text/academy/class.txt b/oldnotes/stadiumgs/text/academy/class.txt similarity index 100% rename from stadiumgs/text/academy/class.txt rename to oldnotes/stadiumgs/text/academy/class.txt diff --git a/stadiumgs/text/academy/library.txt b/oldnotes/stadiumgs/text/academy/library.txt similarity index 100% rename from stadiumgs/text/academy/library.txt rename to oldnotes/stadiumgs/text/academy/library.txt diff --git a/stadiumgs/text/academy/multiplayerquiz.txt b/oldnotes/stadiumgs/text/academy/multiplayerquiz.txt similarity index 100% rename from stadiumgs/text/academy/multiplayerquiz.txt rename to oldnotes/stadiumgs/text/academy/multiplayerquiz.txt diff --git a/stadiumgs/text/academy/quiz.txt b/oldnotes/stadiumgs/text/academy/quiz.txt similarity index 100% rename from stadiumgs/text/academy/quiz.txt rename to oldnotes/stadiumgs/text/academy/quiz.txt diff --git a/stadiumgs/text/academy/selectclasspokemon.txt b/oldnotes/stadiumgs/text/academy/selectclasspokemon.txt similarity index 100% rename from stadiumgs/text/academy/selectclasspokemon.txt rename to oldnotes/stadiumgs/text/academy/selectclasspokemon.txt diff --git a/stadiumgs/text/academy/skilltest.txt b/oldnotes/stadiumgs/text/academy/skilltest.txt similarity index 100% rename from stadiumgs/text/academy/skilltest.txt rename to oldnotes/stadiumgs/text/academy/skilltest.txt diff --git a/stadiumgs/text/academy/skilltest/elitefour/becky.txt b/oldnotes/stadiumgs/text/academy/skilltest/elitefour/becky.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/elitefour/becky.txt rename to oldnotes/stadiumgs/text/academy/skilltest/elitefour/becky.txt diff --git a/stadiumgs/text/academy/skilltest/elitefour/connor.txt b/oldnotes/stadiumgs/text/academy/skilltest/elitefour/connor.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/elitefour/connor.txt rename to oldnotes/stadiumgs/text/academy/skilltest/elitefour/connor.txt diff --git a/stadiumgs/text/academy/skilltest/elitefour/ferris.txt b/oldnotes/stadiumgs/text/academy/skilltest/elitefour/ferris.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/elitefour/ferris.txt rename to oldnotes/stadiumgs/text/academy/skilltest/elitefour/ferris.txt diff --git a/stadiumgs/text/academy/skilltest/elitefour/julian.txt b/oldnotes/stadiumgs/text/academy/skilltest/elitefour/julian.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/elitefour/julian.txt rename to oldnotes/stadiumgs/text/academy/skilltest/elitefour/julian.txt diff --git a/stadiumgs/text/academy/skilltest/gymleader/dustin.txt b/oldnotes/stadiumgs/text/academy/skilltest/gymleader/dustin.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/gymleader/dustin.txt rename to oldnotes/stadiumgs/text/academy/skilltest/gymleader/dustin.txt diff --git a/stadiumgs/text/academy/skilltest/gymleader/joseph.txt b/oldnotes/stadiumgs/text/academy/skilltest/gymleader/joseph.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/gymleader/joseph.txt rename to oldnotes/stadiumgs/text/academy/skilltest/gymleader/joseph.txt diff --git a/stadiumgs/text/academy/skilltest/gymleader/naomi.txt b/oldnotes/stadiumgs/text/academy/skilltest/gymleader/naomi.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/gymleader/naomi.txt rename to oldnotes/stadiumgs/text/academy/skilltest/gymleader/naomi.txt diff --git a/stadiumgs/text/academy/skilltest/gymleader/nolan.txt b/oldnotes/stadiumgs/text/academy/skilltest/gymleader/nolan.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/gymleader/nolan.txt rename to oldnotes/stadiumgs/text/academy/skilltest/gymleader/nolan.txt diff --git a/stadiumgs/text/academy/skilltest/gymleader/tammy.txt b/oldnotes/stadiumgs/text/academy/skilltest/gymleader/tammy.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/gymleader/tammy.txt rename to oldnotes/stadiumgs/text/academy/skilltest/gymleader/tammy.txt diff --git a/stadiumgs/text/academy/skilltest/trainer/carson.txt b/oldnotes/stadiumgs/text/academy/skilltest/trainer/carson.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/trainer/carson.txt rename to oldnotes/stadiumgs/text/academy/skilltest/trainer/carson.txt diff --git a/stadiumgs/text/academy/skilltest/trainer/clayton.txt b/oldnotes/stadiumgs/text/academy/skilltest/trainer/clayton.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/trainer/clayton.txt rename to oldnotes/stadiumgs/text/academy/skilltest/trainer/clayton.txt diff --git a/stadiumgs/text/academy/skilltest/trainer/cole.txt b/oldnotes/stadiumgs/text/academy/skilltest/trainer/cole.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/trainer/cole.txt rename to oldnotes/stadiumgs/text/academy/skilltest/trainer/cole.txt diff --git a/stadiumgs/text/academy/skilltest/trainer/cyndy.txt b/oldnotes/stadiumgs/text/academy/skilltest/trainer/cyndy.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/trainer/cyndy.txt rename to oldnotes/stadiumgs/text/academy/skilltest/trainer/cyndy.txt diff --git a/stadiumgs/text/academy/skilltest/trainer/jonathan.txt b/oldnotes/stadiumgs/text/academy/skilltest/trainer/jonathan.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/trainer/jonathan.txt rename to oldnotes/stadiumgs/text/academy/skilltest/trainer/jonathan.txt diff --git a/stadiumgs/text/academy/skilltest/trainer/melvin.txt b/oldnotes/stadiumgs/text/academy/skilltest/trainer/melvin.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/trainer/melvin.txt rename to oldnotes/stadiumgs/text/academy/skilltest/trainer/melvin.txt diff --git a/stadiumgs/text/academy/skilltest/trainer/nancy.txt b/oldnotes/stadiumgs/text/academy/skilltest/trainer/nancy.txt similarity index 100% rename from stadiumgs/text/academy/skilltest/trainer/nancy.txt rename to oldnotes/stadiumgs/text/academy/skilltest/trainer/nancy.txt diff --git a/stadiumgs/text/battleeffects.txt b/oldnotes/stadiumgs/text/battleeffects.txt similarity index 100% rename from stadiumgs/text/battleeffects.txt rename to oldnotes/stadiumgs/text/battleeffects.txt diff --git a/stadiumgs/text/betweenbattles.txt b/oldnotes/stadiumgs/text/betweenbattles.txt similarity index 100% rename from stadiumgs/text/betweenbattles.txt rename to oldnotes/stadiumgs/text/betweenbattles.txt diff --git a/stadiumgs/text/cal.txt b/oldnotes/stadiumgs/text/cal.txt similarity index 100% rename from stadiumgs/text/cal.txt rename to oldnotes/stadiumgs/text/cal.txt diff --git a/stadiumgs/text/challengecup/greatball/curt1.txt b/oldnotes/stadiumgs/text/challengecup/greatball/curt1.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/curt1.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/curt1.txt diff --git a/stadiumgs/text/challengecup/greatball/curt2.txt b/oldnotes/stadiumgs/text/challengecup/greatball/curt2.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/curt2.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/curt2.txt diff --git a/stadiumgs/text/challengecup/greatball/darcy1.txt b/oldnotes/stadiumgs/text/challengecup/greatball/darcy1.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/darcy1.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/darcy1.txt diff --git a/stadiumgs/text/challengecup/greatball/darcy2.txt b/oldnotes/stadiumgs/text/challengecup/greatball/darcy2.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/darcy2.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/darcy2.txt diff --git a/stadiumgs/text/challengecup/greatball/emiko1.txt b/oldnotes/stadiumgs/text/challengecup/greatball/emiko1.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/emiko1.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/emiko1.txt diff --git a/stadiumgs/text/challengecup/greatball/emiko2.txt b/oldnotes/stadiumgs/text/challengecup/greatball/emiko2.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/emiko2.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/emiko2.txt diff --git a/stadiumgs/text/challengecup/greatball/gerald1.txt b/oldnotes/stadiumgs/text/challengecup/greatball/gerald1.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/gerald1.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/gerald1.txt diff --git a/stadiumgs/text/challengecup/greatball/gerald2.txt b/oldnotes/stadiumgs/text/challengecup/greatball/gerald2.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/gerald2.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/gerald2.txt diff --git a/stadiumgs/text/challengecup/greatball/janjane1.txt b/oldnotes/stadiumgs/text/challengecup/greatball/janjane1.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/janjane1.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/janjane1.txt diff --git a/stadiumgs/text/challengecup/greatball/janjane2.txt b/oldnotes/stadiumgs/text/challengecup/greatball/janjane2.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/janjane2.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/janjane2.txt diff --git a/stadiumgs/text/challengecup/greatball/oliver1.txt b/oldnotes/stadiumgs/text/challengecup/greatball/oliver1.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/oliver1.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/oliver1.txt diff --git a/stadiumgs/text/challengecup/greatball/oliver2.txt b/oldnotes/stadiumgs/text/challengecup/greatball/oliver2.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/oliver2.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/oliver2.txt diff --git a/stadiumgs/text/challengecup/greatball/roberto1.txt b/oldnotes/stadiumgs/text/challengecup/greatball/roberto1.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/roberto1.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/roberto1.txt diff --git a/stadiumgs/text/challengecup/greatball/roberto2.txt b/oldnotes/stadiumgs/text/challengecup/greatball/roberto2.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/roberto2.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/roberto2.txt diff --git a/stadiumgs/text/challengecup/greatball/travis1.txt b/oldnotes/stadiumgs/text/challengecup/greatball/travis1.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/travis1.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/travis1.txt diff --git a/stadiumgs/text/challengecup/greatball/travis2.txt b/oldnotes/stadiumgs/text/challengecup/greatball/travis2.txt similarity index 100% rename from stadiumgs/text/challengecup/greatball/travis2.txt rename to oldnotes/stadiumgs/text/challengecup/greatball/travis2.txt diff --git a/stadiumgs/text/challengecup/masterball/curt1.txt b/oldnotes/stadiumgs/text/challengecup/masterball/curt1.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/curt1.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/curt1.txt diff --git a/stadiumgs/text/challengecup/masterball/curt2.txt b/oldnotes/stadiumgs/text/challengecup/masterball/curt2.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/curt2.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/curt2.txt diff --git a/stadiumgs/text/challengecup/masterball/darcy1.txt b/oldnotes/stadiumgs/text/challengecup/masterball/darcy1.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/darcy1.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/darcy1.txt diff --git a/stadiumgs/text/challengecup/masterball/darcy2.txt b/oldnotes/stadiumgs/text/challengecup/masterball/darcy2.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/darcy2.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/darcy2.txt diff --git a/stadiumgs/text/challengecup/masterball/emiko1.txt b/oldnotes/stadiumgs/text/challengecup/masterball/emiko1.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/emiko1.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/emiko1.txt diff --git a/stadiumgs/text/challengecup/masterball/emiko2.txt b/oldnotes/stadiumgs/text/challengecup/masterball/emiko2.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/emiko2.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/emiko2.txt diff --git a/stadiumgs/text/challengecup/masterball/gerald1.txt b/oldnotes/stadiumgs/text/challengecup/masterball/gerald1.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/gerald1.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/gerald1.txt diff --git a/stadiumgs/text/challengecup/masterball/gerald2.txt b/oldnotes/stadiumgs/text/challengecup/masterball/gerald2.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/gerald2.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/gerald2.txt diff --git a/stadiumgs/text/challengecup/masterball/janjane1.txt b/oldnotes/stadiumgs/text/challengecup/masterball/janjane1.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/janjane1.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/janjane1.txt diff --git a/stadiumgs/text/challengecup/masterball/janjane2.txt b/oldnotes/stadiumgs/text/challengecup/masterball/janjane2.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/janjane2.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/janjane2.txt diff --git a/stadiumgs/text/challengecup/masterball/oliver1.txt b/oldnotes/stadiumgs/text/challengecup/masterball/oliver1.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/oliver1.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/oliver1.txt diff --git a/stadiumgs/text/challengecup/masterball/oliver2.txt b/oldnotes/stadiumgs/text/challengecup/masterball/oliver2.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/oliver2.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/oliver2.txt diff --git a/stadiumgs/text/challengecup/masterball/roberto1.txt b/oldnotes/stadiumgs/text/challengecup/masterball/roberto1.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/roberto1.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/roberto1.txt diff --git a/stadiumgs/text/challengecup/masterball/roberto2.txt b/oldnotes/stadiumgs/text/challengecup/masterball/roberto2.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/roberto2.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/roberto2.txt diff --git a/stadiumgs/text/challengecup/masterball/travis1.txt b/oldnotes/stadiumgs/text/challengecup/masterball/travis1.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/travis1.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/travis1.txt diff --git a/stadiumgs/text/challengecup/masterball/travis2.txt b/oldnotes/stadiumgs/text/challengecup/masterball/travis2.txt similarity index 100% rename from stadiumgs/text/challengecup/masterball/travis2.txt rename to oldnotes/stadiumgs/text/challengecup/masterball/travis2.txt diff --git a/stadiumgs/text/challengecup/pokeball/curtis1.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/curtis1.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/curtis1.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/curtis1.txt diff --git a/stadiumgs/text/challengecup/pokeball/curtis2.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/curtis2.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/curtis2.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/curtis2.txt diff --git a/stadiumgs/text/challengecup/pokeball/daren1.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/daren1.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/daren1.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/daren1.txt diff --git a/stadiumgs/text/challengecup/pokeball/daren2.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/daren2.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/daren2.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/daren2.txt diff --git a/stadiumgs/text/challengecup/pokeball/dwight1.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/dwight1.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/dwight1.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/dwight1.txt diff --git a/stadiumgs/text/challengecup/pokeball/dwight2.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/dwight2.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/dwight2.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/dwight2.txt diff --git a/stadiumgs/text/challengecup/pokeball/executivef2.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/executivef2.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/executivef2.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/executivef2.txt diff --git a/stadiumgs/text/challengecup/pokeball/executivem2.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/executivem2.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/executivem2.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/executivem2.txt diff --git a/stadiumgs/text/challengecup/pokeball/gruntf1.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/gruntf1.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/gruntf1.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/gruntf1.txt diff --git a/stadiumgs/text/challengecup/pokeball/gruntm1.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/gruntm1.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/gruntm1.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/gruntm1.txt diff --git a/stadiumgs/text/challengecup/pokeball/marcus1.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/marcus1.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/marcus1.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/marcus1.txt diff --git a/stadiumgs/text/challengecup/pokeball/marcus2.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/marcus2.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/marcus2.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/marcus2.txt diff --git a/stadiumgs/text/challengecup/pokeball/melissa1.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/melissa1.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/melissa1.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/melissa1.txt diff --git a/stadiumgs/text/challengecup/pokeball/melissa2.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/melissa2.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/melissa2.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/melissa2.txt diff --git a/stadiumgs/text/challengecup/pokeball/peggy1.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/peggy1.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/peggy1.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/peggy1.txt diff --git a/stadiumgs/text/challengecup/pokeball/peggy2.txt b/oldnotes/stadiumgs/text/challengecup/pokeball/peggy2.txt similarity index 100% rename from stadiumgs/text/challengecup/pokeball/peggy2.txt rename to oldnotes/stadiumgs/text/challengecup/pokeball/peggy2.txt diff --git a/stadiumgs/text/challengecup/rentals.txt b/oldnotes/stadiumgs/text/challengecup/rentals.txt similarity index 100% rename from stadiumgs/text/challengecup/rentals.txt rename to oldnotes/stadiumgs/text/challengecup/rentals.txt diff --git a/stadiumgs/text/challengecup/rosters.txt b/oldnotes/stadiumgs/text/challengecup/rosters.txt similarity index 100% rename from stadiumgs/text/challengecup/rosters.txt rename to oldnotes/stadiumgs/text/challengecup/rosters.txt diff --git a/stadiumgs/text/challengecup/ultraball/curtis1.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/curtis1.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/curtis1.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/curtis1.txt diff --git a/stadiumgs/text/challengecup/ultraball/curtis2.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/curtis2.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/curtis2.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/curtis2.txt diff --git a/stadiumgs/text/challengecup/ultraball/daren1.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/daren1.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/daren1.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/daren1.txt diff --git a/stadiumgs/text/challengecup/ultraball/daren2.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/daren2.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/daren2.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/daren2.txt diff --git a/stadiumgs/text/challengecup/ultraball/dwight1.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/dwight1.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/dwight1.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/dwight1.txt diff --git a/stadiumgs/text/challengecup/ultraball/dwight2.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/dwight2.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/dwight2.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/dwight2.txt diff --git a/stadiumgs/text/challengecup/ultraball/executivef2.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/executivef2.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/executivef2.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/executivef2.txt diff --git a/stadiumgs/text/challengecup/ultraball/executivem2.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/executivem2.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/executivem2.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/executivem2.txt diff --git a/stadiumgs/text/challengecup/ultraball/gruntf1.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/gruntf1.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/gruntf1.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/gruntf1.txt diff --git a/stadiumgs/text/challengecup/ultraball/gruntm1.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/gruntm1.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/gruntm1.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/gruntm1.txt diff --git a/stadiumgs/text/challengecup/ultraball/marcus1.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/marcus1.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/marcus1.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/marcus1.txt diff --git a/stadiumgs/text/challengecup/ultraball/marcus2.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/marcus2.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/marcus2.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/marcus2.txt diff --git a/stadiumgs/text/challengecup/ultraball/melissa1.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/melissa1.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/melissa1.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/melissa1.txt diff --git a/stadiumgs/text/challengecup/ultraball/melissa2.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/melissa2.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/melissa2.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/melissa2.txt diff --git a/stadiumgs/text/challengecup/ultraball/peggy1.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/peggy1.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/peggy1.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/peggy1.txt diff --git a/stadiumgs/text/challengecup/ultraball/peggy2.txt b/oldnotes/stadiumgs/text/challengecup/ultraball/peggy2.txt similarity index 100% rename from stadiumgs/text/challengecup/ultraball/peggy2.txt rename to oldnotes/stadiumgs/text/challengecup/ultraball/peggy2.txt diff --git a/stadiumgs/text/credits.txt b/oldnotes/stadiumgs/text/credits.txt similarity index 100% rename from stadiumgs/text/credits.txt rename to oldnotes/stadiumgs/text/credits.txt diff --git a/stadiumgs/text/debug.txt b/oldnotes/stadiumgs/text/debug.txt similarity index 100% rename from stadiumgs/text/debug.txt rename to oldnotes/stadiumgs/text/debug.txt diff --git a/stadiumgs/text/decorations.txt b/oldnotes/stadiumgs/text/decorations.txt similarity index 100% rename from stadiumgs/text/decorations.txt rename to oldnotes/stadiumgs/text/decorations.txt diff --git a/stadiumgs/text/gymleadercastle/azalea/bugsy1.txt b/oldnotes/stadiumgs/text/gymleadercastle/azalea/bugsy1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/azalea/bugsy1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/azalea/bugsy1.txt diff --git a/stadiumgs/text/gymleadercastle/azalea/bugsy2.txt b/oldnotes/stadiumgs/text/gymleadercastle/azalea/bugsy2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/azalea/bugsy2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/azalea/bugsy2.txt diff --git a/stadiumgs/text/gymleadercastle/azalea/chaz1.txt b/oldnotes/stadiumgs/text/gymleadercastle/azalea/chaz1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/azalea/chaz1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/azalea/chaz1.txt diff --git a/stadiumgs/text/gymleadercastle/azalea/chaz2.txt b/oldnotes/stadiumgs/text/gymleadercastle/azalea/chaz2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/azalea/chaz2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/azalea/chaz2.txt diff --git a/stadiumgs/text/gymleadercastle/azalea/min b/oldnotes/stadiumgs/text/gymleadercastle/azalea/min similarity index 100% rename from stadiumgs/text/gymleadercastle/azalea/min rename to oldnotes/stadiumgs/text/gymleadercastle/azalea/min diff --git a/stadiumgs/text/gymleadercastle/azalea/minlyn1.txt b/oldnotes/stadiumgs/text/gymleadercastle/azalea/minlyn1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/azalea/minlyn1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/azalea/minlyn1.txt diff --git a/stadiumgs/text/gymleadercastle/azalea/minlyn2.txt b/oldnotes/stadiumgs/text/gymleadercastle/azalea/minlyn2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/azalea/minlyn2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/azalea/minlyn2.txt diff --git a/stadiumgs/text/gymleadercastle/blackthorn/clair1.txt b/oldnotes/stadiumgs/text/gymleadercastle/blackthorn/clair1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/blackthorn/clair1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/blackthorn/clair1.txt diff --git a/stadiumgs/text/gymleadercastle/blackthorn/clair2.txt b/oldnotes/stadiumgs/text/gymleadercastle/blackthorn/clair2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/blackthorn/clair2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/blackthorn/clair2.txt diff --git a/stadiumgs/text/gymleadercastle/blackthorn/gloria1.txt b/oldnotes/stadiumgs/text/gymleadercastle/blackthorn/gloria1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/blackthorn/gloria1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/blackthorn/gloria1.txt diff --git a/stadiumgs/text/gymleadercastle/blackthorn/gloria2.txt b/oldnotes/stadiumgs/text/gymleadercastle/blackthorn/gloria2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/blackthorn/gloria2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/blackthorn/gloria2.txt diff --git a/stadiumgs/text/gymleadercastle/blackthorn/vince1.txt b/oldnotes/stadiumgs/text/gymleadercastle/blackthorn/vince1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/blackthorn/vince1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/blackthorn/vince1.txt diff --git a/stadiumgs/text/gymleadercastle/blackthorn/vince2.txt b/oldnotes/stadiumgs/text/gymleadercastle/blackthorn/vince2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/blackthorn/vince2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/blackthorn/vince2.txt diff --git a/stadiumgs/text/gymleadercastle/cianwood/chuck1.txt b/oldnotes/stadiumgs/text/gymleadercastle/cianwood/chuck1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/cianwood/chuck1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/cianwood/chuck1.txt diff --git a/stadiumgs/text/gymleadercastle/cianwood/chuck2.txt b/oldnotes/stadiumgs/text/gymleadercastle/cianwood/chuck2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/cianwood/chuck2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/cianwood/chuck2.txt diff --git a/stadiumgs/text/gymleadercastle/cianwood/nick1.txt b/oldnotes/stadiumgs/text/gymleadercastle/cianwood/nick1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/cianwood/nick1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/cianwood/nick1.txt diff --git a/stadiumgs/text/gymleadercastle/cianwood/nick2.txt b/oldnotes/stadiumgs/text/gymleadercastle/cianwood/nick2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/cianwood/nick2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/cianwood/nick2.txt diff --git a/stadiumgs/text/gymleadercastle/ecruteak/holly1.txt b/oldnotes/stadiumgs/text/gymleadercastle/ecruteak/holly1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/ecruteak/holly1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/ecruteak/holly1.txt diff --git a/stadiumgs/text/gymleadercastle/ecruteak/holly2.txt b/oldnotes/stadiumgs/text/gymleadercastle/ecruteak/holly2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/ecruteak/holly2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/ecruteak/holly2.txt diff --git a/stadiumgs/text/gymleadercastle/ecruteak/morty1.txt b/oldnotes/stadiumgs/text/gymleadercastle/ecruteak/morty1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/ecruteak/morty1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/ecruteak/morty1.txt diff --git a/stadiumgs/text/gymleadercastle/ecruteak/morty2.txt b/oldnotes/stadiumgs/text/gymleadercastle/ecruteak/morty2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/ecruteak/morty2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/ecruteak/morty2.txt diff --git a/stadiumgs/text/gymleadercastle/ecruteak/ty1.txt b/oldnotes/stadiumgs/text/gymleadercastle/ecruteak/ty1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/ecruteak/ty1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/ecruteak/ty1.txt diff --git a/stadiumgs/text/gymleadercastle/ecruteak/ty2.txt b/oldnotes/stadiumgs/text/gymleadercastle/ecruteak/ty2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/ecruteak/ty2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/ecruteak/ty2.txt diff --git a/stadiumgs/text/gymleadercastle/goldenrod/lois1.txt b/oldnotes/stadiumgs/text/gymleadercastle/goldenrod/lois1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/goldenrod/lois1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/goldenrod/lois1.txt diff --git a/stadiumgs/text/gymleadercastle/goldenrod/lois2.txt b/oldnotes/stadiumgs/text/gymleadercastle/goldenrod/lois2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/goldenrod/lois2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/goldenrod/lois2.txt diff --git a/stadiumgs/text/gymleadercastle/goldenrod/rita1.txt b/oldnotes/stadiumgs/text/gymleadercastle/goldenrod/rita1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/goldenrod/rita1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/goldenrod/rita1.txt diff --git a/stadiumgs/text/gymleadercastle/goldenrod/rita2.txt b/oldnotes/stadiumgs/text/gymleadercastle/goldenrod/rita2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/goldenrod/rita2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/goldenrod/rita2.txt diff --git a/stadiumgs/text/gymleadercastle/goldenrod/whitney1.txt b/oldnotes/stadiumgs/text/gymleadercastle/goldenrod/whitney1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/goldenrod/whitney1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/goldenrod/whitney1.txt diff --git a/stadiumgs/text/gymleadercastle/goldenrod/whitney2.txt b/oldnotes/stadiumgs/text/gymleadercastle/goldenrod/whitney2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/goldenrod/whitney2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/goldenrod/whitney2.txt diff --git a/stadiumgs/text/gymleadercastle/indigo/bruno1.txt b/oldnotes/stadiumgs/text/gymleadercastle/indigo/bruno1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/indigo/bruno1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/indigo/bruno1.txt diff --git a/stadiumgs/text/gymleadercastle/indigo/bruno2.txt b/oldnotes/stadiumgs/text/gymleadercastle/indigo/bruno2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/indigo/bruno2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/indigo/bruno2.txt diff --git a/stadiumgs/text/gymleadercastle/indigo/karen1.txt b/oldnotes/stadiumgs/text/gymleadercastle/indigo/karen1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/indigo/karen1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/indigo/karen1.txt diff --git a/stadiumgs/text/gymleadercastle/indigo/karen2.txt b/oldnotes/stadiumgs/text/gymleadercastle/indigo/karen2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/indigo/karen2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/indigo/karen2.txt diff --git a/stadiumgs/text/gymleadercastle/indigo/koga1.txt b/oldnotes/stadiumgs/text/gymleadercastle/indigo/koga1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/indigo/koga1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/indigo/koga1.txt diff --git a/stadiumgs/text/gymleadercastle/indigo/koga2.txt b/oldnotes/stadiumgs/text/gymleadercastle/indigo/koga2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/indigo/koga2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/indigo/koga2.txt diff --git a/stadiumgs/text/gymleadercastle/indigo/lance1.txt b/oldnotes/stadiumgs/text/gymleadercastle/indigo/lance1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/indigo/lance1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/indigo/lance1.txt diff --git a/stadiumgs/text/gymleadercastle/indigo/lance2.txt b/oldnotes/stadiumgs/text/gymleadercastle/indigo/lance2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/indigo/lance2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/indigo/lance2.txt diff --git a/stadiumgs/text/gymleadercastle/indigo/will1.txt b/oldnotes/stadiumgs/text/gymleadercastle/indigo/will1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/indigo/will1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/indigo/will1.txt diff --git a/stadiumgs/text/gymleadercastle/indigo/will2.txt b/oldnotes/stadiumgs/text/gymleadercastle/indigo/will2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/indigo/will2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/indigo/will2.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/blaine1.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/blaine1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/blaine1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/blaine1.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/blaine2.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/blaine2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/blaine2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/blaine2.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/blue1.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/blue1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/blue1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/blue1.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/blue2.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/blue2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/blue2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/blue2.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/brock1.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/brock1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/brock1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/brock1.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/brock2.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/brock2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/brock2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/brock2.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/erika1.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/erika1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/erika1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/erika1.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/erika2.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/erika2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/erika2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/erika2.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/janine1.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/janine1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/janine1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/janine1.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/janine2.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/janine2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/janine2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/janine2.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/misty1.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/misty1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/misty1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/misty1.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/misty2.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/misty2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/misty2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/misty2.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/red1.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/red1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/red1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/red1.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/red2.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/red2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/red2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/red2.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/sabrina1.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/sabrina1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/sabrina1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/sabrina1.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/sabrina2.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/sabrina2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/sabrina2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/sabrina2.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/surge1.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/surge1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/surge1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/surge1.txt diff --git a/stadiumgs/text/gymleadercastle/kanto/surge2.txt b/oldnotes/stadiumgs/text/gymleadercastle/kanto/surge2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/kanto/surge2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/kanto/surge2.txt diff --git a/stadiumgs/text/gymleadercastle/mahogany/alvin1.txt b/oldnotes/stadiumgs/text/gymleadercastle/mahogany/alvin1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/mahogany/alvin1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/mahogany/alvin1.txt diff --git a/stadiumgs/text/gymleadercastle/mahogany/alvin2.txt b/oldnotes/stadiumgs/text/gymleadercastle/mahogany/alvin2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/mahogany/alvin2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/mahogany/alvin2.txt diff --git a/stadiumgs/text/gymleadercastle/mahogany/carol1.txt b/oldnotes/stadiumgs/text/gymleadercastle/mahogany/carol1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/mahogany/carol1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/mahogany/carol1.txt diff --git a/stadiumgs/text/gymleadercastle/mahogany/carol2.txt b/oldnotes/stadiumgs/text/gymleadercastle/mahogany/carol2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/mahogany/carol2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/mahogany/carol2.txt diff --git a/stadiumgs/text/gymleadercastle/mahogany/pryce1.txt b/oldnotes/stadiumgs/text/gymleadercastle/mahogany/pryce1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/mahogany/pryce1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/mahogany/pryce1.txt diff --git a/stadiumgs/text/gymleadercastle/mahogany/pryce2.txt b/oldnotes/stadiumgs/text/gymleadercastle/mahogany/pryce2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/mahogany/pryce2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/mahogany/pryce2.txt diff --git a/stadiumgs/text/gymleadercastle/olivine/jasmine1.txt b/oldnotes/stadiumgs/text/gymleadercastle/olivine/jasmine1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/olivine/jasmine1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/olivine/jasmine1.txt diff --git a/stadiumgs/text/gymleadercastle/olivine/jasmine2.txt b/oldnotes/stadiumgs/text/gymleadercastle/olivine/jasmine2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/olivine/jasmine2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/olivine/jasmine2.txt diff --git a/stadiumgs/text/gymleadercastle/rocket/executivef1.txt b/oldnotes/stadiumgs/text/gymleadercastle/rocket/executivef1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/rocket/executivef1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/rocket/executivef1.txt diff --git a/stadiumgs/text/gymleadercastle/rocket/executivef2.txt b/oldnotes/stadiumgs/text/gymleadercastle/rocket/executivef2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/rocket/executivef2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/rocket/executivef2.txt diff --git a/stadiumgs/text/gymleadercastle/rocket/executivem1.txt b/oldnotes/stadiumgs/text/gymleadercastle/rocket/executivem1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/rocket/executivem1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/rocket/executivem1.txt diff --git a/stadiumgs/text/gymleadercastle/rocket/executivem2.txt b/oldnotes/stadiumgs/text/gymleadercastle/rocket/executivem2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/rocket/executivem2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/rocket/executivem2.txt diff --git a/stadiumgs/text/gymleadercastle/rocket/gruntf1.txt b/oldnotes/stadiumgs/text/gymleadercastle/rocket/gruntf1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/rocket/gruntf1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/rocket/gruntf1.txt diff --git a/stadiumgs/text/gymleadercastle/rocket/gruntf2.txt b/oldnotes/stadiumgs/text/gymleadercastle/rocket/gruntf2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/rocket/gruntf2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/rocket/gruntf2.txt diff --git a/stadiumgs/text/gymleadercastle/rocket/gruntm1.txt b/oldnotes/stadiumgs/text/gymleadercastle/rocket/gruntm1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/rocket/gruntm1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/rocket/gruntm1.txt diff --git a/stadiumgs/text/gymleadercastle/rocket/gruntm2.txt b/oldnotes/stadiumgs/text/gymleadercastle/rocket/gruntm2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/rocket/gruntm2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/rocket/gruntm2.txt diff --git a/stadiumgs/text/gymleadercastle/violet/falkner1.txt b/oldnotes/stadiumgs/text/gymleadercastle/violet/falkner1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/violet/falkner1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/violet/falkner1.txt diff --git a/stadiumgs/text/gymleadercastle/violet/falkner2.txt b/oldnotes/stadiumgs/text/gymleadercastle/violet/falkner2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/violet/falkner2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/violet/falkner2.txt diff --git a/stadiumgs/text/gymleadercastle/violet/matt1.txt b/oldnotes/stadiumgs/text/gymleadercastle/violet/matt1.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/violet/matt1.txt rename to oldnotes/stadiumgs/text/gymleadercastle/violet/matt1.txt diff --git a/stadiumgs/text/gymleadercastle/violet/matt2.txt b/oldnotes/stadiumgs/text/gymleadercastle/violet/matt2.txt similarity index 100% rename from stadiumgs/text/gymleadercastle/violet/matt2.txt rename to oldnotes/stadiumgs/text/gymleadercastle/violet/matt2.txt diff --git a/stadiumgs/text/itemdescriptionsgs.txt b/oldnotes/stadiumgs/text/itemdescriptionsgs.txt similarity index 100% rename from stadiumgs/text/itemdescriptionsgs.txt rename to oldnotes/stadiumgs/text/itemdescriptionsgs.txt diff --git a/stadiumgs/text/itemdescriptionsrby.txt b/oldnotes/stadiumgs/text/itemdescriptionsrby.txt similarity index 100% rename from stadiumgs/text/itemdescriptionsrby.txt rename to oldnotes/stadiumgs/text/itemdescriptionsrby.txt diff --git a/stadiumgs/text/itemsgs.txt b/oldnotes/stadiumgs/text/itemsgs.txt similarity index 100% rename from stadiumgs/text/itemsgs.txt rename to oldnotes/stadiumgs/text/itemsgs.txt diff --git a/stadiumgs/text/itemsrby.txt b/oldnotes/stadiumgs/text/itemsrby.txt similarity index 100% rename from stadiumgs/text/itemsrby.txt rename to oldnotes/stadiumgs/text/itemsrby.txt diff --git a/stadiumgs/text/littlecup/bernie1.txt b/oldnotes/stadiumgs/text/littlecup/bernie1.txt similarity index 100% rename from stadiumgs/text/littlecup/bernie1.txt rename to oldnotes/stadiumgs/text/littlecup/bernie1.txt diff --git a/stadiumgs/text/littlecup/bernie2.txt b/oldnotes/stadiumgs/text/littlecup/bernie2.txt similarity index 100% rename from stadiumgs/text/littlecup/bernie2.txt rename to oldnotes/stadiumgs/text/littlecup/bernie2.txt diff --git a/stadiumgs/text/littlecup/clark1.txt b/oldnotes/stadiumgs/text/littlecup/clark1.txt similarity index 100% rename from stadiumgs/text/littlecup/clark1.txt rename to oldnotes/stadiumgs/text/littlecup/clark1.txt diff --git a/stadiumgs/text/littlecup/clark2.txt b/oldnotes/stadiumgs/text/littlecup/clark2.txt similarity index 100% rename from stadiumgs/text/littlecup/clark2.txt rename to oldnotes/stadiumgs/text/littlecup/clark2.txt diff --git a/stadiumgs/text/littlecup/cora1.txt b/oldnotes/stadiumgs/text/littlecup/cora1.txt similarity index 100% rename from stadiumgs/text/littlecup/cora1.txt rename to oldnotes/stadiumgs/text/littlecup/cora1.txt diff --git a/stadiumgs/text/littlecup/cora2.txt b/oldnotes/stadiumgs/text/littlecup/cora2.txt similarity index 100% rename from stadiumgs/text/littlecup/cora2.txt rename to oldnotes/stadiumgs/text/littlecup/cora2.txt diff --git a/stadiumgs/text/littlecup/grant1.txt b/oldnotes/stadiumgs/text/littlecup/grant1.txt similarity index 100% rename from stadiumgs/text/littlecup/grant1.txt rename to oldnotes/stadiumgs/text/littlecup/grant1.txt diff --git a/stadiumgs/text/littlecup/grant2.txt b/oldnotes/stadiumgs/text/littlecup/grant2.txt similarity index 100% rename from stadiumgs/text/littlecup/grant2.txt rename to oldnotes/stadiumgs/text/littlecup/grant2.txt diff --git a/stadiumgs/text/littlecup/janet1.txt b/oldnotes/stadiumgs/text/littlecup/janet1.txt similarity index 100% rename from stadiumgs/text/littlecup/janet1.txt rename to oldnotes/stadiumgs/text/littlecup/janet1.txt diff --git a/stadiumgs/text/littlecup/janet2.txt b/oldnotes/stadiumgs/text/littlecup/janet2.txt similarity index 100% rename from stadiumgs/text/littlecup/janet2.txt rename to oldnotes/stadiumgs/text/littlecup/janet2.txt diff --git a/stadiumgs/text/littlecup/rex1.txt b/oldnotes/stadiumgs/text/littlecup/rex1.txt similarity index 100% rename from stadiumgs/text/littlecup/rex1.txt rename to oldnotes/stadiumgs/text/littlecup/rex1.txt diff --git a/stadiumgs/text/littlecup/rex2.txt b/oldnotes/stadiumgs/text/littlecup/rex2.txt similarity index 100% rename from stadiumgs/text/littlecup/rex2.txt rename to oldnotes/stadiumgs/text/littlecup/rex2.txt diff --git a/stadiumgs/text/littlecup/stacy1.txt b/oldnotes/stadiumgs/text/littlecup/stacy1.txt similarity index 100% rename from stadiumgs/text/littlecup/stacy1.txt rename to oldnotes/stadiumgs/text/littlecup/stacy1.txt diff --git a/stadiumgs/text/littlecup/stacy2.txt b/oldnotes/stadiumgs/text/littlecup/stacy2.txt similarity index 100% rename from stadiumgs/text/littlecup/stacy2.txt rename to oldnotes/stadiumgs/text/littlecup/stacy2.txt diff --git a/stadiumgs/text/littlecup/tina1.txt b/oldnotes/stadiumgs/text/littlecup/tina1.txt similarity index 100% rename from stadiumgs/text/littlecup/tina1.txt rename to oldnotes/stadiumgs/text/littlecup/tina1.txt diff --git a/stadiumgs/text/littlecup/tina2.txt b/oldnotes/stadiumgs/text/littlecup/tina2.txt similarity index 100% rename from stadiumgs/text/littlecup/tina2.txt rename to oldnotes/stadiumgs/text/littlecup/tina2.txt diff --git a/stadiumgs/text/messagedebug.txt b/oldnotes/stadiumgs/text/messagedebug.txt similarity index 100% rename from stadiumgs/text/messagedebug.txt rename to oldnotes/stadiumgs/text/messagedebug.txt diff --git a/stadiumgs/text/minigames.txt b/oldnotes/stadiumgs/text/minigames.txt similarity index 100% rename from stadiumgs/text/minigames.txt rename to oldnotes/stadiumgs/text/minigames.txt diff --git a/stadiumgs/text/movedescriptions.txt b/oldnotes/stadiumgs/text/movedescriptions.txt similarity index 100% rename from stadiumgs/text/movedescriptions.txt rename to oldnotes/stadiumgs/text/movedescriptions.txt diff --git a/stadiumgs/text/moves.txt b/oldnotes/stadiumgs/text/moves.txt similarity index 100% rename from stadiumgs/text/moves.txt rename to oldnotes/stadiumgs/text/moves.txt diff --git a/stadiumgs/text/mysterygift.txt b/oldnotes/stadiumgs/text/mysterygift.txt similarity index 100% rename from stadiumgs/text/mysterygift.txt rename to oldnotes/stadiumgs/text/mysterygift.txt diff --git a/stadiumgs/text/options.txt b/oldnotes/stadiumgs/text/options.txt similarity index 100% rename from stadiumgs/text/options.txt rename to oldnotes/stadiumgs/text/options.txt diff --git a/stadiumgs/text/pokecup/greatball/baxter1.txt b/oldnotes/stadiumgs/text/pokecup/greatball/baxter1.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/baxter1.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/baxter1.txt diff --git a/stadiumgs/text/pokecup/greatball/baxter2.txt b/oldnotes/stadiumgs/text/pokecup/greatball/baxter2.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/baxter2.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/baxter2.txt diff --git a/stadiumgs/text/pokecup/greatball/carmen1.txt b/oldnotes/stadiumgs/text/pokecup/greatball/carmen1.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/carmen1.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/carmen1.txt diff --git a/stadiumgs/text/pokecup/greatball/carmen2.txt b/oldnotes/stadiumgs/text/pokecup/greatball/carmen2.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/carmen2.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/carmen2.txt diff --git a/stadiumgs/text/pokecup/greatball/chen1.txt b/oldnotes/stadiumgs/text/pokecup/greatball/chen1.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/chen1.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/chen1.txt diff --git a/stadiumgs/text/pokecup/greatball/chen2.txt b/oldnotes/stadiumgs/text/pokecup/greatball/chen2.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/chen2.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/chen2.txt diff --git a/stadiumgs/text/pokecup/greatball/cliff1.txt b/oldnotes/stadiumgs/text/pokecup/greatball/cliff1.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/cliff1.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/cliff1.txt diff --git a/stadiumgs/text/pokecup/greatball/cliff2.txt b/oldnotes/stadiumgs/text/pokecup/greatball/cliff2.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/cliff2.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/cliff2.txt diff --git a/stadiumgs/text/pokecup/greatball/dillon1.txt b/oldnotes/stadiumgs/text/pokecup/greatball/dillon1.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/dillon1.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/dillon1.txt diff --git a/stadiumgs/text/pokecup/greatball/dillon2.txt b/oldnotes/stadiumgs/text/pokecup/greatball/dillon2.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/dillon2.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/dillon2.txt diff --git a/stadiumgs/text/pokecup/greatball/molly1.txt b/oldnotes/stadiumgs/text/pokecup/greatball/molly1.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/molly1.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/molly1.txt diff --git a/stadiumgs/text/pokecup/greatball/molly2.txt b/oldnotes/stadiumgs/text/pokecup/greatball/molly2.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/molly2.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/molly2.txt diff --git a/stadiumgs/text/pokecup/greatball/pedro1.txt b/oldnotes/stadiumgs/text/pokecup/greatball/pedro1.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/pedro1.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/pedro1.txt diff --git a/stadiumgs/text/pokecup/greatball/pedro2.txt b/oldnotes/stadiumgs/text/pokecup/greatball/pedro2.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/pedro2.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/pedro2.txt diff --git a/stadiumgs/text/pokecup/greatball/wyatt1.txt b/oldnotes/stadiumgs/text/pokecup/greatball/wyatt1.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/wyatt1.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/wyatt1.txt diff --git a/stadiumgs/text/pokecup/greatball/wyatt2.txt b/oldnotes/stadiumgs/text/pokecup/greatball/wyatt2.txt similarity index 100% rename from stadiumgs/text/pokecup/greatball/wyatt2.txt rename to oldnotes/stadiumgs/text/pokecup/greatball/wyatt2.txt diff --git a/stadiumgs/text/pokecup/masterball/baxter1.txt b/oldnotes/stadiumgs/text/pokecup/masterball/baxter1.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/baxter1.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/baxter1.txt diff --git a/stadiumgs/text/pokecup/masterball/baxter2.txt b/oldnotes/stadiumgs/text/pokecup/masterball/baxter2.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/baxter2.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/baxter2.txt diff --git a/stadiumgs/text/pokecup/masterball/carmen1.txt b/oldnotes/stadiumgs/text/pokecup/masterball/carmen1.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/carmen1.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/carmen1.txt diff --git a/stadiumgs/text/pokecup/masterball/carmen2.txt b/oldnotes/stadiumgs/text/pokecup/masterball/carmen2.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/carmen2.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/carmen2.txt diff --git a/stadiumgs/text/pokecup/masterball/chen1.txt b/oldnotes/stadiumgs/text/pokecup/masterball/chen1.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/chen1.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/chen1.txt diff --git a/stadiumgs/text/pokecup/masterball/chen2.txt b/oldnotes/stadiumgs/text/pokecup/masterball/chen2.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/chen2.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/chen2.txt diff --git a/stadiumgs/text/pokecup/masterball/cliff1.txt b/oldnotes/stadiumgs/text/pokecup/masterball/cliff1.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/cliff1.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/cliff1.txt diff --git a/stadiumgs/text/pokecup/masterball/cliff2.txt b/oldnotes/stadiumgs/text/pokecup/masterball/cliff2.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/cliff2.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/cliff2.txt diff --git a/stadiumgs/text/pokecup/masterball/dillon1.txt b/oldnotes/stadiumgs/text/pokecup/masterball/dillon1.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/dillon1.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/dillon1.txt diff --git a/stadiumgs/text/pokecup/masterball/dillon2.txt b/oldnotes/stadiumgs/text/pokecup/masterball/dillon2.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/dillon2.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/dillon2.txt diff --git a/stadiumgs/text/pokecup/masterball/molly1.txt b/oldnotes/stadiumgs/text/pokecup/masterball/molly1.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/molly1.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/molly1.txt diff --git a/stadiumgs/text/pokecup/masterball/molly2.txt b/oldnotes/stadiumgs/text/pokecup/masterball/molly2.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/molly2.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/molly2.txt diff --git a/stadiumgs/text/pokecup/masterball/pedro1.txt b/oldnotes/stadiumgs/text/pokecup/masterball/pedro1.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/pedro1.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/pedro1.txt diff --git a/stadiumgs/text/pokecup/masterball/pedro2.txt b/oldnotes/stadiumgs/text/pokecup/masterball/pedro2.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/pedro2.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/pedro2.txt diff --git a/stadiumgs/text/pokecup/masterball/wyatt1.txt b/oldnotes/stadiumgs/text/pokecup/masterball/wyatt1.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/wyatt1.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/wyatt1.txt diff --git a/stadiumgs/text/pokecup/masterball/wyatt2.txt b/oldnotes/stadiumgs/text/pokecup/masterball/wyatt2.txt similarity index 100% rename from stadiumgs/text/pokecup/masterball/wyatt2.txt rename to oldnotes/stadiumgs/text/pokecup/masterball/wyatt2.txt diff --git a/stadiumgs/text/pokecup/pokeball/alissa1.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/alissa1.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/alissa1.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/alissa1.txt diff --git a/stadiumgs/text/pokecup/pokeball/alissa2.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/alissa2.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/alissa2.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/alissa2.txt diff --git a/stadiumgs/text/pokecup/pokeball/bruce1.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/bruce1.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/bruce1.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/bruce1.txt diff --git a/stadiumgs/text/pokecup/pokeball/bruce2.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/bruce2.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/bruce2.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/bruce2.txt diff --git a/stadiumgs/text/pokecup/pokeball/chester1.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/chester1.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/chester1.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/chester1.txt diff --git a/stadiumgs/text/pokecup/pokeball/chester2.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/chester2.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/chester2.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/chester2.txt diff --git a/stadiumgs/text/pokecup/pokeball/claude1.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/claude1.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/claude1.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/claude1.txt diff --git a/stadiumgs/text/pokecup/pokeball/claude2.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/claude2.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/claude2.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/claude2.txt diff --git a/stadiumgs/text/pokecup/pokeball/clifford1.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/clifford1.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/clifford1.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/clifford1.txt diff --git a/stadiumgs/text/pokecup/pokeball/clifford2.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/clifford2.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/clifford2.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/clifford2.txt diff --git a/stadiumgs/text/pokecup/pokeball/jensen1.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/jensen1.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/jensen1.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/jensen1.txt diff --git a/stadiumgs/text/pokecup/pokeball/jensen2.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/jensen2.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/jensen2.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/jensen2.txt diff --git a/stadiumgs/text/pokecup/pokeball/mason1.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/mason1.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/mason1.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/mason1.txt diff --git a/stadiumgs/text/pokecup/pokeball/mason2.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/mason2.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/mason2.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/mason2.txt diff --git a/stadiumgs/text/pokecup/pokeball/nelson1.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/nelson1.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/nelson1.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/nelson1.txt diff --git a/stadiumgs/text/pokecup/pokeball/nelson2.txt b/oldnotes/stadiumgs/text/pokecup/pokeball/nelson2.txt similarity index 100% rename from stadiumgs/text/pokecup/pokeball/nelson2.txt rename to oldnotes/stadiumgs/text/pokecup/pokeball/nelson2.txt diff --git a/stadiumgs/text/pokecup/ultraball/alissa1.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/alissa1.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/alissa1.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/alissa1.txt diff --git a/stadiumgs/text/pokecup/ultraball/alissa2.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/alissa2.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/alissa2.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/alissa2.txt diff --git a/stadiumgs/text/pokecup/ultraball/bruce1.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/bruce1.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/bruce1.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/bruce1.txt diff --git a/stadiumgs/text/pokecup/ultraball/bruce2.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/bruce2.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/bruce2.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/bruce2.txt diff --git a/stadiumgs/text/pokecup/ultraball/chester1.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/chester1.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/chester1.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/chester1.txt diff --git a/stadiumgs/text/pokecup/ultraball/chester2.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/chester2.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/chester2.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/chester2.txt diff --git a/stadiumgs/text/pokecup/ultraball/claude1.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/claude1.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/claude1.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/claude1.txt diff --git a/stadiumgs/text/pokecup/ultraball/claude2.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/claude2.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/claude2.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/claude2.txt diff --git a/stadiumgs/text/pokecup/ultraball/clifford1.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/clifford1.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/clifford1.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/clifford1.txt diff --git a/stadiumgs/text/pokecup/ultraball/clifford2.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/clifford2.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/clifford2.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/clifford2.txt diff --git a/stadiumgs/text/pokecup/ultraball/jensen1.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/jensen1.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/jensen1.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/jensen1.txt diff --git a/stadiumgs/text/pokecup/ultraball/jensen2.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/jensen2.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/jensen2.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/jensen2.txt diff --git a/stadiumgs/text/pokecup/ultraball/mason1.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/mason1.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/mason1.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/mason1.txt diff --git a/stadiumgs/text/pokecup/ultraball/mason2.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/mason2.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/mason2.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/mason2.txt diff --git a/stadiumgs/text/pokecup/ultraball/nelson1.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/nelson1.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/nelson1.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/nelson1.txt diff --git a/stadiumgs/text/pokecup/ultraball/nelson2.txt b/oldnotes/stadiumgs/text/pokecup/ultraball/nelson2.txt similarity index 100% rename from stadiumgs/text/pokecup/ultraball/nelson2.txt rename to oldnotes/stadiumgs/text/pokecup/ultraball/nelson2.txt diff --git a/stadiumgs/text/pokedex/gold.txt b/oldnotes/stadiumgs/text/pokedex/gold.txt similarity index 100% rename from stadiumgs/text/pokedex/gold.txt rename to oldnotes/stadiumgs/text/pokedex/gold.txt diff --git a/stadiumgs/text/pokedex/heights.txt b/oldnotes/stadiumgs/text/pokedex/heights.txt similarity index 100% rename from stadiumgs/text/pokedex/heights.txt rename to oldnotes/stadiumgs/text/pokedex/heights.txt diff --git a/stadiumgs/text/pokedex/silver.txt b/oldnotes/stadiumgs/text/pokedex/silver.txt similarity index 100% rename from stadiumgs/text/pokedex/silver.txt rename to oldnotes/stadiumgs/text/pokedex/silver.txt diff --git a/stadiumgs/text/pokedex/theblankpokemon.txt b/oldnotes/stadiumgs/text/pokedex/theblankpokemon.txt similarity index 100% rename from stadiumgs/text/pokedex/theblankpokemon.txt rename to oldnotes/stadiumgs/text/pokedex/theblankpokemon.txt diff --git a/stadiumgs/text/pokedex/weights.txt b/oldnotes/stadiumgs/text/pokedex/weights.txt similarity index 100% rename from stadiumgs/text/pokedex/weights.txt rename to oldnotes/stadiumgs/text/pokedex/weights.txt diff --git a/stadiumgs/text/pokemon.txt b/oldnotes/stadiumgs/text/pokemon.txt similarity index 100% rename from stadiumgs/text/pokemon.txt rename to oldnotes/stadiumgs/text/pokemon.txt diff --git a/stadiumgs/text/primecup/adam1.txt b/oldnotes/stadiumgs/text/primecup/adam1.txt similarity index 100% rename from stadiumgs/text/primecup/adam1.txt rename to oldnotes/stadiumgs/text/primecup/adam1.txt diff --git a/stadiumgs/text/primecup/adam2.txt b/oldnotes/stadiumgs/text/primecup/adam2.txt similarity index 100% rename from stadiumgs/text/primecup/adam2.txt rename to oldnotes/stadiumgs/text/primecup/adam2.txt diff --git a/stadiumgs/text/primecup/chase1.txt b/oldnotes/stadiumgs/text/primecup/chase1.txt similarity index 100% rename from stadiumgs/text/primecup/chase1.txt rename to oldnotes/stadiumgs/text/primecup/chase1.txt diff --git a/stadiumgs/text/primecup/chase2.txt b/oldnotes/stadiumgs/text/primecup/chase2.txt similarity index 100% rename from stadiumgs/text/primecup/chase2.txt rename to oldnotes/stadiumgs/text/primecup/chase2.txt diff --git a/stadiumgs/text/primecup/craig1.txt b/oldnotes/stadiumgs/text/primecup/craig1.txt similarity index 100% rename from stadiumgs/text/primecup/craig1.txt rename to oldnotes/stadiumgs/text/primecup/craig1.txt diff --git a/stadiumgs/text/primecup/craig2.txt b/oldnotes/stadiumgs/text/primecup/craig2.txt similarity index 100% rename from stadiumgs/text/primecup/craig2.txt rename to oldnotes/stadiumgs/text/primecup/craig2.txt diff --git a/stadiumgs/text/primecup/floria1.txt b/oldnotes/stadiumgs/text/primecup/floria1.txt similarity index 100% rename from stadiumgs/text/primecup/floria1.txt rename to oldnotes/stadiumgs/text/primecup/floria1.txt diff --git a/stadiumgs/text/primecup/floria2.txt b/oldnotes/stadiumgs/text/primecup/floria2.txt similarity index 100% rename from stadiumgs/text/primecup/floria2.txt rename to oldnotes/stadiumgs/text/primecup/floria2.txt diff --git a/stadiumgs/text/primecup/kathy1.txt b/oldnotes/stadiumgs/text/primecup/kathy1.txt similarity index 100% rename from stadiumgs/text/primecup/kathy1.txt rename to oldnotes/stadiumgs/text/primecup/kathy1.txt diff --git a/stadiumgs/text/primecup/kathy2.txt b/oldnotes/stadiumgs/text/primecup/kathy2.txt similarity index 100% rename from stadiumgs/text/primecup/kathy2.txt rename to oldnotes/stadiumgs/text/primecup/kathy2.txt diff --git a/stadiumgs/text/primecup/marty1.txt b/oldnotes/stadiumgs/text/primecup/marty1.txt similarity index 100% rename from stadiumgs/text/primecup/marty1.txt rename to oldnotes/stadiumgs/text/primecup/marty1.txt diff --git a/stadiumgs/text/primecup/marty2.txt b/oldnotes/stadiumgs/text/primecup/marty2.txt similarity index 100% rename from stadiumgs/text/primecup/marty2.txt rename to oldnotes/stadiumgs/text/primecup/marty2.txt diff --git a/stadiumgs/text/primecup/terry1.txt b/oldnotes/stadiumgs/text/primecup/terry1.txt similarity index 100% rename from stadiumgs/text/primecup/terry1.txt rename to oldnotes/stadiumgs/text/primecup/terry1.txt diff --git a/stadiumgs/text/primecup/terry2.txt b/oldnotes/stadiumgs/text/primecup/terry2.txt similarity index 100% rename from stadiumgs/text/primecup/terry2.txt rename to oldnotes/stadiumgs/text/primecup/terry2.txt diff --git a/stadiumgs/text/primecup/yang1.txt b/oldnotes/stadiumgs/text/primecup/yang1.txt similarity index 100% rename from stadiumgs/text/primecup/yang1.txt rename to oldnotes/stadiumgs/text/primecup/yang1.txt diff --git a/stadiumgs/text/primecup/yang2.txt b/oldnotes/stadiumgs/text/primecup/yang2.txt similarity index 100% rename from stadiumgs/text/primecup/yang2.txt rename to oldnotes/stadiumgs/text/primecup/yang2.txt diff --git a/stadiumgs/text/prizes.txt b/oldnotes/stadiumgs/text/prizes.txt similarity index 100% rename from stadiumgs/text/prizes.txt rename to oldnotes/stadiumgs/text/prizes.txt diff --git a/stadiumgs/text/relearn.txt b/oldnotes/stadiumgs/text/relearn.txt similarity index 100% rename from stadiumgs/text/relearn.txt rename to oldnotes/stadiumgs/text/relearn.txt diff --git a/stadiumgs/text/rival1.txt b/oldnotes/stadiumgs/text/rival1.txt similarity index 100% rename from stadiumgs/text/rival1.txt rename to oldnotes/stadiumgs/text/rival1.txt diff --git a/stadiumgs/text/rival2.txt b/oldnotes/stadiumgs/text/rival2.txt similarity index 100% rename from stadiumgs/text/rival2.txt rename to oldnotes/stadiumgs/text/rival2.txt diff --git a/stadiumgs/text/selectgamepak.txt b/oldnotes/stadiumgs/text/selectgamepak.txt similarity index 100% rename from stadiumgs/text/selectgamepak.txt rename to oldnotes/stadiumgs/text/selectgamepak.txt diff --git a/stadiumgs/text/selectscreen.txt b/oldnotes/stadiumgs/text/selectscreen.txt similarity index 100% rename from stadiumgs/text/selectscreen.txt rename to oldnotes/stadiumgs/text/selectscreen.txt diff --git a/stadiumgs/text/stats.txt b/oldnotes/stadiumgs/text/stats.txt similarity index 100% rename from stadiumgs/text/stats.txt rename to oldnotes/stadiumgs/text/stats.txt diff --git a/stadiumgs/text/statuses.txt b/oldnotes/stadiumgs/text/statuses.txt similarity index 100% rename from stadiumgs/text/statuses.txt rename to oldnotes/stadiumgs/text/statuses.txt diff --git a/stadiumgs/text/trainergroups.txt b/oldnotes/stadiumgs/text/trainergroups.txt similarity index 100% rename from stadiumgs/text/trainergroups.txt rename to oldnotes/stadiumgs/text/trainergroups.txt diff --git a/stadiumgs/text/trainers.txt b/oldnotes/stadiumgs/text/trainers.txt similarity index 100% rename from stadiumgs/text/trainers.txt rename to oldnotes/stadiumgs/text/trainers.txt diff --git a/stadiumgs/text/types.txt b/oldnotes/stadiumgs/text/types.txt similarity index 100% rename from stadiumgs/text/types.txt rename to oldnotes/stadiumgs/text/types.txt diff --git a/stadiumgs/text/whitecity.txt b/oldnotes/stadiumgs/text/whitecity.txt similarity index 100% rename from stadiumgs/text/whitecity.txt rename to oldnotes/stadiumgs/text/whitecity.txt diff --git a/utils/Makefile b/oldnotes/utils/Makefile similarity index 100% rename from utils/Makefile rename to oldnotes/utils/Makefile diff --git a/utils/cattbl.c b/oldnotes/utils/cattbl.c similarity index 100% rename from utils/cattbl.c rename to oldnotes/utils/cattbl.c diff --git a/utils/constants.h b/oldnotes/utils/constants.h similarity index 100% rename from utils/constants.h rename to oldnotes/utils/constants.h diff --git a/utils/extractbin.c b/oldnotes/utils/extractbin.c similarity index 100% rename from utils/extractbin.c rename to oldnotes/utils/extractbin.c diff --git a/utils/extractrostertbltbl.c b/oldnotes/utils/extractrostertbltbl.c similarity index 100% rename from utils/extractrostertbltbl.c rename to oldnotes/utils/extractrostertbltbl.c diff --git a/utils/extractstrtbltbl.c b/oldnotes/utils/extractstrtbltbl.c similarity index 100% rename from utils/extractstrtbltbl.c rename to oldnotes/utils/extractstrtbltbl.c diff --git a/utils/face2png.c b/oldnotes/utils/face2png.c similarity index 100% rename from utils/face2png.c rename to oldnotes/utils/face2png.c diff --git a/utils/json2rostertbl.c b/oldnotes/utils/json2rostertbl.c similarity index 100% rename from utils/json2rostertbl.c rename to oldnotes/utils/json2rostertbl.c diff --git a/utils/padff.c b/oldnotes/utils/padff.c similarity index 100% rename from utils/padff.c rename to oldnotes/utils/padff.c diff --git a/utils/txt2strtbl.c b/oldnotes/utils/txt2strtbl.c similarity index 100% rename from utils/txt2strtbl.c rename to oldnotes/utils/txt2strtbl.c diff --git a/splat.yaml b/splat.yaml new file mode 100644 index 0000000..d071757 --- /dev/null +++ b/splat.yaml @@ -0,0 +1,227 @@ +name: Pokemon Stadium (North America) +basename: pokemonstadium +options: + find-file-boundaries: True + compiler: IDO + symbol_addrs_path: tools/symbol_addrs.txt +segments: + - name: header + type: header + start: 0x00 + vram: 0 + subsegments: + - [0x0000, header, header] + - name: boot + type: code + start: 0x0040 + vram: 0xA4000040 + subsegments: + - [0x0040, asm, boot] + - [0x0B70, bin, bootcode_font] + - name: code + type: code + start: 0x1000 + vram: 0x80000400 + subsegments: + - [0x1000, asm] # bootloader + - [0x1060, asm] # rsp graphics + - [0x11C0, asm] # rsp audio + - [0x1A80, asm] # DMA transfer + - [0x1F80, asm] # dp intro code + - [0x28E0, asm] # dp code + - [0x2EC0, asm] # intro loader + - [0x3A80, asm] # transition loader + - [0x3FB0, asm] # PRES-JPEG decoder + - [0x60A0, asm] # + - [0x6430, asm] # controller code + - [0x6BC0, asm] # + - [0x75F0, asm] # stage loader + - [0x8EC0, asm] # crash handler + - [0xAF00, asm] # camera code + - [0xB130, asm] # dp code for text + - [0xC030, asm] # extra sprites loader + - [0xC3F0, asm] # yay0 decoder + - [0xC4B0, bin] # + - [0xCE80, asm] # + - [0xDDC0, asm] # + - [0xE1C0, asm] # + - [0xE570, asm] # + - [0xE890, asm] # + - [0x11BA0, asm] # + - [0x12D80, asm] # + - [0x18140, asm] # dp model animations + - [0x18480, asm] # dp model animations + - [0x19840, asm] # alternative pkm textures + - [0x1AB70, asm] # vs screen code + - [0x1CF30, asm] # dp list code + - [0x20330, asm] # some cache cleaner + - [0x20470, asm] # dp list for UI and icons + - [0x22630, asm] # registered pkm stats + - [0x26820, asm] # save data code + - [0x29BA0, asm] # scenary code + - [0x2C1C0, asm] # scenary cache cleaner + - [0x2D340, asm] # pkm lab pc code + - [0x2E110, asm] # stack cleaner + - [0x2E460, asm] # pkm lab pokedex code + - [0x2FEA0, asm] # minigames code + - [0x30640, asm] # gallery code + - [0x32D10, asm] + - [0x33E30, asm] + - [0x33FE0, asm] + - [0x37370, asm] + - [0x373A0, asm] # battle code + - [0x3D140, asm] # music code + - [0x43520, c] # + - [0x435B0, c] # + - [0x435D0, asm] # pkm lab cries code + - [0x45720, asm] # music code + - [0x46680, asm] # speech code + - [0x47B60, asm] # sound code + - [0x485C0, asm] # moves code + - [0x48C60, asm] # move effects code + - [0x490A0, asm] # audio functions to 0x50C00 + - [0x49190, bin] + - [0x49790, asm] + - [0x49BA0, asm] + - [0x49DC0, asm] + - [0x4A360, asm] + - [0x4A3E0, asm] + - [0x4B940, asm] + - [0x4BA90, asm] + - [0x4BDC0, asm] + - [0x4F410, asm] + - [0x4F7F0, asm] + - [0x4F870, asm] + - [0x4FDB0, asm] + - [0x4FE60, asm] + - [0x4FF50, bin] + - [0x50000, asm] + - [0x50120, asm] + - [0x50860, asm] + - [0x50990, asm] + - [0x50A00, asm] + - [0x50C20, asm] + - [0x50CC0, asm] + - [0x517A0, asm] # yay0 audio decoder + - [0x518A0, asm] + - [0x51BC0, asm] + - [0x51C50, asm] + - [0x520C0, asm] + - [0x52AC0, asm] + - [0x53150, asm] + - [0x535C0, asm] + - [0x53710, asm] + - [0x54310, asm] + - [0x558C0, asm] + - [0x55960, asm] + - [0x55BB0, asm] + - [0x55ED0, asm] + - [0x56170, asm] + - [0x56680, asm] + - [0x567B0, asm] + - [0x569F0, asm] + - [0x57190, asm] + - [0x57230, asm] + - [0x572D0, asm] + - [0x574C0, c, os/O1/osSendMesg] + - [0x57610, c, os/O1/osStopThread] + - [0x576D0, c, os/O1/osRecvMesg] + - [0x57810, asm] + - [0x57990, asm] + - [0x57F00, asm] + - [0x58010, asm] + - [0x58C70, asm] + - [0x58EC0, asm] + - [0x59350, asm] + - [0x597A0, asm] + - [0x598C0, asm] + - [0x59A10, asm] + - [0x59BF0, asm] + - [0x59C00, asm] + - [0x59C90, asm] + - [0x59D10, asm] + - [0x59DA0, asm] + - [0x5A0F0, asm] + - [0x5A100, asm] + - [0x5B1C0, asm] + - [0x5B450, asm] + - [0x5B4E0, asm] + - [0x5B590, asm] + - [0x5B5E0, asm] + - [0x5B6A0, asm] + - [0x5BB50, asm] + - [0x5BE30, asm] + - [0x5C2A0, asm] + - [0x5C420, asm] + - [0x5C900, hasm, os/osGetCount] # RNG + - [0x5C910, asm] + - [0x5CD50, asm] + - [0x5CE70, asm] + - [0x5D9F0, asm] + - [0x5DAB0, asm] + - [0x5DAC0, asm] + - [0x5DCF0, asm] + - [0x5DDB0, asm] + - [0x5EAA0, asm] + - [0x5ECA0, asm] + - [0x5ECF0, asm] + - [0x5EDD0, asm] + - [0x5EE10, asm] + - [0x5EE50, asm] + - [0x5EEF0, asm] + - [0x5EFA0, asm] + - [0x5F050, asm] + - [0x5F140, asm] + - [0x5F240, asm] + - [0x5F490, asm] + - [0x5FA40, asm] + - [0x5FD50, asm] + - [0x5FDE0, asm] + - [0x61010, asm] + - [0x61270, asm] + - [0x61EF0, asm] + - [0x621F0, asm] + - [0x62E70, asm] + - [0x62FC0, asm] + - [0x63010, asm] + - [0x630B0, asm] + - [0x630C0, asm] + - [0x63160, asm] + - [0x634D0, asm] + - [0x63690, asm] + - [0x63720, asm] + - [0x63860, asm] + - [0x63B60, c, os/O1/code_63B60] + - [0x63B90, asm] + - [0x63D00, asm] + - [0x63D50, asm] + - [0x63EB0, asm] + - [0x63EE0, asm] + - [0x63F50, asm] + - [0x64110, asm] + - [0x64270, asm] + - [0x642F0, asm] + - [0x64360, asm] + - [0x643C0, asm] + - [0x64410, asm] + - [0x64890, asm] + - [0x64A00, hasm, os/__osGetCause] + - [0x64A10, asm] + - [0x64B70, asm] + - [0x64C50, asm] + - [0x658A0, asm] + - [0x65B40, asm] + - [0x65B90, asm] + - [0x65BC0, asm] + - [0x65F10, asm] + - [0x65F70, asm] + - [0x661F0, asm] + - [0x66250, asm] + - [0x66460, asm] + - [0x66500, asm] + - [0x66510, asm] + - [0x66850, asm] + - [0x66B50, asm] + #- [0x66BC0, asm] + - [0x66BC0, bin] + - [0x2000000] diff --git a/src/43520.c b/src/43520.c new file mode 100644 index 0000000..73996d3 --- /dev/null +++ b/src/43520.c @@ -0,0 +1,25 @@ +#include "common.h" + +void func_800491C0(s32 arg0); +void func_8004FD90(void); + +extern s32 D_80078580; +extern s32 D_80078584; + +void func_80042920(s32 arg0, s32 arg1) { + if (D_80078580 == 0) { + D_80078580 = arg0; + if (D_80078584 == 0) { + D_80078584 = arg0; + func_800491C0(arg1); + } + } +} + +void func_8004296C(void) { + if (D_80078580 != 0) { + func_8004FD90(); + D_80078580 = 0; + D_80078584 = 0; + } +} diff --git a/src/435B0.c b/src/435B0.c new file mode 100644 index 0000000..59b9779 --- /dev/null +++ b/src/435B0.c @@ -0,0 +1,10 @@ +#include "common.h" + +typedef struct { + /* 0x00 */ char unk_00[0x16]; + /* 0x16 */ s16 unk_16; +} struct_800429B0; + +void func_800429B0(struct_800429B0* arg0, s16 arg1) { + arg0->unk_16 = arg1; +} diff --git a/src/os/O1/code_63B60.c b/src/os/O1/code_63B60.c new file mode 100644 index 0000000..061339c --- /dev/null +++ b/src/os/O1/code_63B60.c @@ -0,0 +1,11 @@ +#include "common.h" + +extern s32 D_8007A860; +extern s32 D_8007A868; + +s32 func_80062F60(void) { + if (D_8007A860 == 0) { + return 0; + } + return D_8007A868; +} diff --git a/src/os/O1/osRecvMesg.c b/src/os/O1/osRecvMesg.c new file mode 100644 index 0000000..7895630 --- /dev/null +++ b/src/os/O1/osRecvMesg.c @@ -0,0 +1,31 @@ +#include "common.h" + +extern OSThread* __osRunningThread; // todo remove eventually + +s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag) { + register s32 s0 = __osDisableInt(); + + while (mq->validCount == 0) { + if (flag == OS_MESG_NOBLOCK) { + __osRestoreInt(s0); + return -1; + } + __osRunningThread->state = 8; + __osEnqueueAndYield(mq); + } + + 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(s0); + + return 0; +} diff --git a/src/os/O1/osSendMesg.c b/src/os/O1/osSendMesg.c new file mode 100644 index 0000000..3047197 --- /dev/null +++ b/src/os/O1/osSendMesg.c @@ -0,0 +1,30 @@ +#include "common.h" + +extern OSThread* __osRunningThread; // todo remove eventually + +s32 osSendMesg(OSMesgQueue* mq, OSMesg mesg, s32 flag) { + register u32 s0 = __osDisableInt(); + register u32 index; + + while (mq->validCount >= mq->msgCount) { + if (flag == OS_MESG_BLOCK) { + __osRunningThread->state = 8; + __osEnqueueAndYield(&mq->fullqueue); + } else { + __osRestoreInt(s0); + return -1; + } + } + + index = (mq->first + mq->validCount) % mq->msgCount; + mq->msg[index] = mesg; + mq->validCount++; + + if (mq->mtqueue->next != NULL) { + osStartThread(__osPopThread(&mq->mtqueue)); + } + + __osRestoreInt(s0); + + return 0; +} diff --git a/src/os/O1/osStopThread.c b/src/os/O1/osStopThread.c new file mode 100644 index 0000000..4962f5a --- /dev/null +++ b/src/os/O1/osStopThread.c @@ -0,0 +1,28 @@ +#include "common.h" + +extern OSThread* __osRunningThread; // todo remove eventually + +void osStopThread(OSThread* thread) { + register u32 s0 = __osDisableInt(); + register u32 state; + + if (thread == NULL) { + state = 4; + } else { + state = thread->state; + } + + switch (state) { + case 4: + __osRunningThread->state = 1; + __osEnqueueAndYield(NULL); + break; + case 2: + case 8: + thread->state = 1; + __osDequeueThread(thread->queue, thread); + break; + } + + __osRestoreInt(s0); +} diff --git a/stadiumgs/0x1718000 b/stadiumgs/0x1718000 deleted file mode 160000 index 9b18f11..0000000 --- a/stadiumgs/0x1718000 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9b18f11796067c1c9c74866ae6b74e65376c584f diff --git a/stadiumgs/0x1898000 b/stadiumgs/0x1898000 deleted file mode 160000 index 0be7b31..0000000 --- a/stadiumgs/0x1898000 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0be7b316a8e579e07e38ef5ef734cbdb2bff3615 diff --git a/stadiumgs/0x1e40000 b/stadiumgs/0x1e40000 deleted file mode 160000 index 31f874e..0000000 --- a/stadiumgs/0x1e40000 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 31f874effb6247957d8b9763e01c492723ab9552 diff --git a/stadiumgs/0x2000000 b/stadiumgs/0x2000000 deleted file mode 160000 index 7f4b535..0000000 --- a/stadiumgs/0x2000000 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7f4b535eeeb5f221b5c41993719c820f1fb85b78 diff --git a/stadiumgs/0x3fd5000 b/stadiumgs/0x3fd5000 deleted file mode 160000 index 8179108..0000000 --- a/stadiumgs/0x3fd5000 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8179108adf0359d4b82b55ae2a5ee93e5a2eda9c diff --git a/stadiumgs/0x3fed000 b/stadiumgs/0x3fed000 deleted file mode 160000 index c47509f..0000000 --- a/stadiumgs/0x3fed000 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c47509f4f6d729c23d3b1c52a485358ec6d1b5d6 diff --git a/stadiumgs/faces b/stadiumgs/faces deleted file mode 160000 index 465b64e..0000000 --- a/stadiumgs/faces +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 465b64eb323a091ed25b1148335f53b59019cb1b diff --git a/stadiumgs/gameboy b/stadiumgs/gameboy deleted file mode 160000 index 6c99ffe..0000000 --- a/stadiumgs/gameboy +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6c99ffe45a56c76acdf7fd76db5e87e8ce7e4d5f diff --git a/tools/ido_recomp/linux/5.3/as1 b/tools/ido_recomp/linux/5.3/as1 new file mode 100644 index 0000000..17ff2aa Binary files /dev/null and b/tools/ido_recomp/linux/5.3/as1 differ diff --git a/tools/ido_recomp/linux/5.3/cc b/tools/ido_recomp/linux/5.3/cc new file mode 100644 index 0000000..6dbb85e Binary files /dev/null and b/tools/ido_recomp/linux/5.3/cc differ diff --git a/tools/ido_recomp/linux/5.3/cfe b/tools/ido_recomp/linux/5.3/cfe new file mode 100644 index 0000000..d742f7b Binary files /dev/null and b/tools/ido_recomp/linux/5.3/cfe differ diff --git a/tools/ido_recomp/linux/5.3/err.english.cc b/tools/ido_recomp/linux/5.3/err.english.cc new file mode 100644 index 0000000..6976e38 --- /dev/null +++ b/tools/ido_recomp/linux/5.3/err.english.cc @@ -0,0 +1,1260 @@ +@ + 358 358 358 + 6464 6482 6553 + 6553 6593 6728 + 6728 6746 6803 + 6803 6808 6808 + 6808 6818 6818 + 6818 6826 6826 + 6826 6847 6847 + 6847 6875 6922 + 6922 6930 6930 + 6930 6939 6939 + 6939 6948 6948 + 6948 6974 7120 + 7120 7149 7204 + 7210 7248 7311 + 7317 7350 7442 + 7450 7497 7627 + 7635 7709 7930 + 7938 7975 8063 + 8071 8113 8253 + 8261 8289 8289 + 8298 8338 8445 + 8460 8502 8635 + 8650 8690 8819 + 8834 8857 8965 + 8965 9008 9113 + 9119 9142 9227 + 9235 9282 9451 + 9451 9462 9462 + 9462 9477 9477 + 9477 9497 9497 + 9497 9545 9545 + 9545 9584 9584 + 9584 9604 9662 + 9662 9682 9720 + 9720 9749 9749 + 9749 9788 9788 + 9788 9802 9802 + 9802 9829 9829 + 9829 9861 9861 + 9861 9904 9904 + 9904 9920 9920 + 9920 9962 9962 + 9962 9988 9988 + 9988 10014 10014 +10014 10035 10035 +10035 10054 10097 +10097 10115 10115 +10115 10147 10147 +10147 10183 10183 +10183 10208 10208 +10208 10236 10236 +10236 10269 10269 +10269 10304 10304 +10304 10328 10328 +10328 10351 10351 +10351 10371 10371 +10371 10402 10402 +10402 10447 10447 +10447 10497 10497 +10497 10533 10533 +10533 10598 10598 +10606 10630 10630 +10640 10671 10671 +10690 10719 10719 +10728 10752 10795 +10795 10837 10837 +10837 10876 10876 +10876 10900 10900 +10900 10948 10948 +10960 11021 11103 +11103 11128 11128 +11128 11153 11153 +11153 11216 11216 +11216 11239 11239 +11239 11303 11303 +11303 11347 11347 +11357 11393 11393 +11393 11432 11432 +11442 11494 11494 +11494 11536 11536 +11536 11595 11595 +11595 11622 11622 +11622 11684 11684 +11684 11726 11726 +11738 11778 11778 +11782 11813 11813 +11813 11850 11850 +11850 11900 12087 +12111 12120 12120 +12120 12129 12129 +12129 12158 12158 +12158 12192 12192 +12192 12237 12237 +12237 12273 12273 +12273 12326 12326 +12330 12366 12366 +12366 12423 12423 +12427 12482 12482 +12486 12560 12560 +12568 12631 12631 +12637 12691 12691 +12691 12743 12743 +12743 12785 12785 +12785 12826 12826 +12826 12865 12865 +12865 12883 12883 +12883 12946 12946 +12956 12995 12995 +13005 13066 13066 +13077 13163 13163 +13163 13211 13211 +13211 13270 13270 +13270 13318 13318 +13318 13350 13350 +13350 13387 13387 +13387 13428 13428 +13428 13464 13533 +13533 13580 13737 +13737 13776 13854 +13854 13913 13913 +13913 13950 13950 +13950 14118 14118 +14118 14150 14150 +14150 14163 14194 +14194 14224 14255 +14255 14275 14319 +14319 14353 14458 +14466 14484 14530 +14534 14567 14567 +14567 14635 14682 +14690 14742 14742 +14742 14789 14789 +14801 14875 14875 +14886 14947 14947 +14947 14992 14992 +14992 15035 15085 +15085 15134 15205 +15214 15267 15448 +15454 15496 16810 +16822 16875 16960 +16972 17053 17179 +17191 17236 17332 +17344 17491 17841 +17853 17939 18304 +18316 18471 18774 +18786 18952 19323 +19335 19364 19496 +19500 19527 19598 +19598 19613 19776 +19797 19808 19837 +19837 19862 19862 +19868 19927 20026 +20034 20075 20179 +20187 20223 20223 +20223 20290 20382 +20392 20441 20589 +20601 20656 20656 +20656 20699 20818 +20826 20860 21038 +21046 21094 21191 +21203 21236 21314 +21326 21395 21457 +21469 21502 21502 +21502 21587 21731 +21756 21789 21864 +21875 21901 21976 +22013 22059 22220 +22257 22397 22561 +22561 22595 22595 +22603 22623 22623 +22631 22667 22828 +22865 22919 22994 +23031 23059 23120 +23132 23201 23201 +23212 23274 23274 +23285 23345 23345 +23356 23393 23393 +23399 23431 23532 +23542 23587 23646 +23656 23697 23745 +23755 23796 23844 +23854 23876 23928 +23942 23971 24153 +24160 24243 24243 +24247 24273 24743 +24755 24784 24984 +24996 25034 25034 +25034 25075 25273 +25281 25332 25410 +25420 25467 25544 +25554 25583 25744 +25754 25783 26061 +26071 26111 26185 +26194 26239 26525 +26535 26568 26914 +26924 26951 26998 +27008 27035 27082 +27093 27120 27167 +27178 27206 27251 +27261 27289 27334 +27345 27391 27931 +27938 27959 28007 +28019 28037 28037 +28043 28069 28069 +28077 28147 28199 +28207 28266 28266 +28274 28306 28306 +28314 28339 28339 +28347 28404 28510 +28518 28567 28682 +28690 28728 28728 +28736 28782 29023 +29033 29085 29234 +29246 29303 29383 +29395 29432 29570 +29592 29631 29644 +29644 29693 29758 +29767 29810 29875 +29875 29911 29976 +29984 30014 30014 +30027 30086 30151 +30157 30223 30293 +30301 30369 30445 +30457 30511 30568 +30580 30630 30743 +30755 30812 30874 +30886 30959 31035 +31043 31076 31175 +31183 31243 31243 +31251 31323 31323 +31331 31433 31433 +31445 31544 31686 +31698 31740 31740 +31740 31783 31783 +31783 31824 31824 +31824 31873 31996 +32008 32056 32164 +32176 32210 32210 +32229 32271 32271 +32279 32323 32569 +32581 32642 32718 +32739 32779 32916 +32926 32953 33047 +33057 33116 33315 +33325 33373 33373 +33373 33407 33469 +33494 33527 33527 +33536 33573 33573 +33584 33650 33697 +33705 33763 33763 +33763 33797 33797 +33797 33829 33906 +33915 33976 33976 +33985 34016 34098 +34098 34133 34198 +34198 34261 34261 +34269 34312 34312 +34324 34363 34438 +34444 34530 34530 +34538 34596 34626 +34636 34675 34754 +34764 34821 34821 +34821 34867 34950 +34959 35016 35135 +35145 35198 35198 +35208 35266 35344 +35355 35382 35537 +35547 35576 35629 +35637 35705 35705 +35713 35764 35764 +35764 35784 35876 +35888 35932 35950 +35950 36013 36138 +36150 36191 36280 +36286 36314 36419 +36431 36516 36516 +36516 36554 36642 +36642 36689 36808 +36818 36881 37105 +37113 37183 37204 +37204 37225 37225 +37225 37255 37348 +37348 37388 37388 +37388 37454 37454 +37454 37518 37518 +37518 37584 37584 +37584 37717 37717 +37717 37752 37752 +37752 37783 37889 +37901 37928 38034 +38046 38115 38115 +38115 38140 38187 +38195 38219 38339 +38351 38422 38422 +38422 38486 38486 +38486 38555 38555 +38555 38619 38619 +38619 38641 38641 +38641 38758 38758 +38758 38929 38929 +38929 38975 39043 +39055 39084 39133 +39133 39175 39265 +39275 39310 39494 +39504 39547 39576 +39587 39614 39668 +39674 39697 39797 +39797 39845 40094 +40094 40158 40264 +40264 40369 40523 +40523 40593 40593 +40593 40629 40876 +40876 40911 40971 +40977 41026 41026 +41038 41077 41077 +41077 41116 41116 +41116 41156 41156 +41156 41195 41195 +41195 41237 41237 +41237 41285 41285 +41285 41304 41304 +41304 41371 41371 +41371 41429 41429 +41429 41491 41491 +41491 41519 41519 +41519 41572 41572 +41572 41642 41642 +41642 41676 41676 +41676 41713 41713 +41713 41751 41751 +41751 41792 41792 +41792 41856 41856 +41856 41881 41881 +41881 41936 41936 +41936 41977 41977 +41977 42018 42018 +42018 42090 42090 +42090 42162 42162 +42162 42205 42205 +42205 42267 42267 +42267 42294 42294 +42294 42309 42309 +42309 42338 42386 +42393 42425 42522 +42530 42577 42577 +42577 42623 42623 +42623 42643 42725 +42725 42748 42748 +42748 42829 42897 +42901 42952 42952 +42952 42978 43025 +43025 43116 43116 +43116 43171 43171 +43171 43204 43376 +43386 43453 43471 +43471 43547 43780 +43798 43921 44116 +44120 44120 44120 +Out of memory: %s +There is no more memory left in the system for compiling this program. +Internal Error Unknown Error Message %s +1) An internal error, while attempting to print an unavailable message +2) The error message file is inaccessible or has other problems +Unknown Signal %s +1) An unknown signal has been caught +2) 2 Nested signals +line +Warning: +Fatal: +Source not available +Too many errors... goodbye. +There is a limit of 30 errors before aborting. +Error: +reserved +reserved +Unknown Control Statement +1) The line begins with a '#' and is not of the form: + # "" +2) Please compile this program with the preprocessor enabled. +Unknown character %s ignored +The character is not part of the source character set. +2.2.1 +Unknown control character \%s ignored +The control character is not part of the source character set. +2.2.1 +Illegal character %s in exponent +1) Digits or sign expected after 'e' or 'E'. +2) Digits are expected after sign in exponent. +3.1.3.1 +Constant is out of range and may be truncated. +The constant is too large to be accurately represented and may be +truncated. The limits are in the system include file limits.h. +2.2.4.2 +Constant is out of range for a 32-bit data type, but accepted as written. +The constant is too large to fit in a 32-bit data type, but will be +accurately represented in a wider data type. The value may be truncated, +depending on its context. The limits are in the system include file +limits.h. +2.2.4.2 +Character constant size out of range +1) No characters in a character constant. +2) More than 4 bytes in a character constant. +3.1.3.4 +Wide character constant size out of range +1) No characters in the multibyte sequence (0 assumed). +2) More than 1 byte in the multi-byte sequence (only the first byte was converted). +3.1.3.4 +Invalid multibyte character +4.10.7.2 +Newline in string or character constant +1) Terminate your string or character constant with closing quotes. +2) Put a backslash before the newline. +3.1.3.4, 3.1.4 +Octal character escape too large: %s > %s +1) Terminate end of octal sequence with a non-octal character. +2) Select a character value within the limits. +Value may be truncated +3.1.3.4, 3.1.4 +Hex character escape too large: %s > %s +1) Terminate end of hex sequence with a non-hex character. +2) Select a character value within the limits. +Value may be truncated +3.1.3.4, 3.1.4 +Unexpected End-of-file +1) Unterminated string or character constant +2) Missing closing comment marker (*/) +3) File system problems +Unrecognized escape sequence in string \%s +Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. +Character will be treated as un-escaped. +3.9.2 +Illegal octal digit %s +Octal constants, beginning with 0, must only have digits between 0 and 7, +inclusive. +3.1.3.2 +Unable to open temporary file for compiling %s +1) TMPDIR environment variable is set to a directory that you have no + permissions for. +2) The file system is full. +3) System errors beyond the scope of the compiler. +%s: Hangup +%s: Interrupt +%s: Quit (ASCII FS) +%s: Illegal instruction (not reset when caught) +%s: Trace trap (not reset when caught) +%s: IOT instruction +Also SIGABRT, used by abort, replace SIGIOT in the future +%s: EMT instruction +Also SIGXCPU, Exceeded CPU time limit +%s: Floating point exception +%s: Kill (cannot be caught or ignored) +%s: Bus error +%s: Segmentation violation +%s: Bad argument to system call +%s: Write on a pipe with no one to read it +%s: Alarm clock +%s: Software termination signal from kill +%s: User defined signal 1 +%s: User defined signal 2 +%s: Death of a child +Power-fail restart +%s: Also SIGXFSZ, exceeded file size limit +%s: Window change +%s: Handset, line status change +%s: Sendablestop signalnot from tty +%s: Stop signal from tty +%s: Pollable event occurred +%s: Input/Output possible signal +%s: Urgent condition on IO channel +%s: Window size changes +%s: Virtual time alarm +%s: Profiling alarm +%s: Continue a stopped process +%s: To readers pgrp upon background tty read +%s: Like TTIN for output if (tp->t_local<OSTOP) +%s: Resource lost (eg, record-lock) +'auto' and 'register' are not allowed in an external declaration +3.7(10) +must have function type +3.7.1(30) +Functions cannot return arrays +3.7.1(33), 3.3.2.2 +Declaration list not allowed +3.7.1(5) +Too many input files %s +The command line may contain only one file +cpp internal error: input stack underflow +cpp internal error: if stack underflow +Cannot open the file %s +No new-line character at the end of the file %s +2.1.1.2(30) +Fatal: Exceeded the limit of nesting level for #include file +Fatal: Exceeded the limit of nesting level for #include file. This limit +is 200. +Fail to read the file %s +Cannot write the file %s +%s: %s: An if directive is not terminated properly in the file +%s: %s: nested comment +%s:%s: Illegal macro name %s; macro name shall be an identifier +%s:%s: Illegal preprocessing token sequence +3.8.3(35) +%s:%s: Illegal macro parameter name +%s:%s: Non-unique macro parameter name +3.8.3(18) +%s:%s: Missing ')' in parameter list for #define %s +%s:%s: Missing ')' in macro instantiation +%s:%s: Bad punctuator in the parameter list for #define %s +%s:%s: Macro %s redefined. +%s:%s: # operator should be followed by a macro argument name +%s:%s: Badly formed constant expression%s +3.4(9), 3.8 +%s:%s: Division by zero in #if or #elif +3.8 +unknown command line option %s +extraneous input/output file name %s +%s: %s: Unterminated string or character constant +A preprocessing string or character constant token was not +terminated. Note that preprocessing directives are processed +after the source file has been divided into preprocessing tokens. +2.1.1.2(30) 3.1(18) 3.8 +%s: %s: +%s: %s: +%s: %s: Unterminated comment +%s: %s: Unknown directive type %s +%s: %s: #elif or #else after #else directive +%s: %s: Bad identifier after the %s +%s: %s: #%s accepts only one identifier as parameter +3.8 +%s: %s: Bad identifier after the %s +%s: %s: text following #%s violates the ANSI C standard. +3.8 +%s: %s: Bad character %s occurs after the # directive. +3.8 +%s: %s: the ## operator shall not be the %s token in the replacement list +3.8.3.3 +%s: %s: the defined operator takes identifier as operand only. +3.8.1 +%s: %s: Not in a conditional directive while using %s +%s: %s: Illegal filename specification for #include +%s: %s: Invalid file name %s for #include +%s: %s: Cannot open file %s for #include +%s: %s: Bad argument for #line command +%s: %s: #error %s +%s: %s: Tried to redefine predefined macro %s, attempt ignored +3.8.7(22) +%s: %s: Undefining predefined macro %s +3.8.7(22) +%s: %s: Undefined the ANSI standard library defined macro %s +4.1.2.1(9) +%s: %s: The number of arguments in the macro invocation does not match the definition +%s: %s: Illegal character %s in preprocessor if +%s: %s: Illegal character %s for number in preprocessor if +%s: %s: No string is allowed in preprocessor if +%s: %s: Not supported pragma %s +%s: %s: Not supported #pragma format +%s: %s: ANSI C does not allow #ident; %s +%s: %s: Not supported #ident format +This cpp extension accepts the following format: +#ident "any string" +%s: %s: Not supported #assert/#unassert format +This cpp extension accepts the following format: +#assert identifier +#assert identifier ( pp-tokens ) +#unassert identifier +#unassert identifier ( pp-tokens ) +%s: %s: Bad assertion predicate format +The correct syntax for this cpp extension is: +#assert identifier ( pp-token ) +%s: %s: directive is an upward-compatible ANSI C extension +%s: This option requires an argument +%s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. +A status return from cpp to cfe +Syntax Error +The token read was unexpected. +Syntax Error -- cannot backup +The token read was unexpected. +Yacc stack overflow +The expression is too complicated to parse. +Trailing comma in enumerator list +The use of a trailing comma in an enumerator list is not standard C. There +may be portability problems. +3.5.2.2 +Empty declaration +Empty declarations are invalid in standard C. +3.5 +%s declared, but not referenced. +redeclaration of '%s'; previous declaration at line %s in file '%s' +Identifier redeclared in the same scope/block. +3.1.2.3 +'%s' undefined; reoccurrences will not be reported. +Non-function name referenced in function call. +3.3.2.2(18) +The number of arguments doesn't agree with the number in the declaration. +3.3.2.2(5) +'%s' section name longer than 8 characters. Name truncated. +'%s' is already placed by pragma alloc_text. +Cannot write ucode file while compiling %s +1) The file system is full +2) Permissions problem +Must have corresponding formal argument for '%s' +Parameter found in the declaration part, but not in the argument list. +3.7.1(7) +Non-prototype declaration is an obsolescent feature. +The use of function definitions with separate parameter identifier +and declaration lists (not prototype-format parameter type and +identifier declarators) is an obsolescent feature. +3.9.5 +Incompatible function declarations for %s +For two function types to be compatible, both shall specify compatible +return types. Moreover, the parameter type lists, if both are present, +shall agree in the number of parameters and in use of the ellipsis +terminator; corresponding parameters shall have compatible types. If +one type has a parameter type list and the other type is specified by +a function declarator that is not part of a function definition and +contains an empty identifier list, the parameter list shall not have +an ellipsis terminator and the type of each parameter shall be +compatible with they type that results from application of the default +argument promotions. If one type has a parameter type list and the +other is specified by a function definition that contains a (possibly +empty) identifier list, both shall agree in the number of parameters, +and the type of each prototype parameter shall be compatible with the +type that results from application of the default argument promotions +to the type of the corresponding identifier. (For each parameter +declared with function or array type, its type for these comparisons +is the one that results from conversion to a pointer type. For each +parameter declared with qualified type, its type for these comparisons +is the unqualified version of its declared type.) There you have it! +3.5.4.3(15) +Incompatible function return type for this function. +For two function types to be compatible, both shall specify compatible +return types. +3.5.4.3(15) +The number of parameters for function is different from the previous declaration +The parameter type lists, if both are present, shall agree in the +number of parameters and in use of the ellipsis terminator. +3.5.4.3(15) +Incompatible type for the function parameter +If both parameter type lists are present, corresponding +parameters shall have compatible types. +3.5.4.3(15) +Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. +The redeclaration could cause arguments at a call site to be passed +inconsistently with what the function implementation expects, and +parameters would therefore be accessed erroneously when executing the +function body. Note that a float argument is promoted to a double +when passed (potentially through fp registers) to an unprototyped +function. +3.5.4.3(15) +prototype and non-prototype declaration found for %s, ellipsis terminator not allowed +If one type has a parameter type list and the other type is specified +by a function declarator that is not part of a function definition and +contains an empty identifier list, the parameter list shall not have +an ellipsis terminator and the type of each parameter shall be +compatible with they type that results from application of the default +argument promotions. +3.5.4.3(15) +prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion +If one type has a parameter type list and the other type is specified +by a function declarator that is not part of a function definition and +contains an empty identifier list, the type of each parameter shall be +compatible with the type that results from application of the default +argument promotions. +3.5.4.3(15) +prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion +If one type has a parameter type list and the other is specified by a +function definition that contains a (possibly empty) identifier list, +both shall agree in the number of parameters, and the type of each +prototype parameter shall be compatible with the type that results +from application of the default argument promotions to the type of the +corresponding identifier. +3.5.4.3(15) +Empty declaration specifiers +Standard C requires at least a storage class specifier, type specifier, +or a type qualifier in declarations. 'extern int' assumed. +3.5 +Can't write to the file %s +1) The output file cannot be opened for writing. +2) Out of file space. +Duplicate '%s' +typedef, extern, static, auto, register, const, volatile may not +appear more than once in the same specifier list or qualifier list. +Duplicate occurrence ignored. +3.5.1(10) , 3.5.3(5) +Null input +There is nothing to compile. +Illegal type combination +3.5.2 +Missing ';' at end of structure / union member declaration +In standard C, each member declaration must be terminated by a ';'. A +terminating ';' is assumed. +3.5.2.1 +Missing member name in structure / union +In standard C, each member declaration have a member name. The missing +member is assumed to not exist. +3.5.2.1 +This variable is initialized twice. +Neither 'const' or 'volatile' have any effect on function results. +Qualifiers only apply to expressions designating an object that +can be altered or examined. +3.5.3(10) +An integer constant expression is required here. +The expression that defines the value of an enumeration constant +shall be an integral constant expression that has a value +representable as an int. +3.5.2.2(28) +(previous declaration of '%s' at line %s in file '%s') +Must be an integer type greater than zero. +The array size must be either a char, signed or unsigned integer or +an enumerated type with a value greater than zero. +3.5.4.2 +Array size cannot be a long long. +Arrays with more than 2^32 elements are not yet supported. +The array size must be either a char, signed or unsigned integer or +an enumerated type with a value greater than zero. +3.5.4.2 +bit-field '%s' width is not an integer constant +The expression that specifies the width of a bit-field shall be an +integral constant expression. +3.5.2.1(15) +bit-field '%s' width is negative +The expression that specifies the width of a bit-field shall be +non-negative. +3.5.2.1(15) +bit-field '%s' type required to be int, unsigned int, or signed int. +A bit-field shall have type int, unsigned int, or signed int. +3.5.2.1(30) +bit-field %s's type not integer. +Non-scalar type or pointer type to a non-object for increment or decrement operator. +The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. +3.3.2.4(37), 3.3.3.1(25) +Assign value to a function type. +An assignment operator shall have a modifiable lvalue as its left operand. +3.2.2.1(5) +Assign value to an array. +An assignment operator shall have a modifiable lvalue as its left operand. +3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) +Change value for variable of incomplete type. +The operand of increment and decrement operator shall be a modifiable +scalar lvalue. An assignment operator shall have a modifiable lvalue +as its left operand. +3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) +The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. +This is a restriction in our implementation, which can be worked +around by always accessing long long bit-fields indirectly (i.e. +by means of the '->' operator). +This expression is not an lvalue. +3.2.2.1 +Modified an rvalue. +3.2.2.1 +Change value for constant variable. +The operand of increment and decrement operators shall be modifiable +scalar lvalues. An assignment operator shall have a modifiable lvalue +as its left operand. +3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) +Change value for constant field of a struct or union. +An assignment operator shall have a modifiable lvalue as its left operand. +3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) +Dereferenced a non-pointer. +The operand of the unary * operator shall have pointer type. +3.3.3.2(39) +The operand of the unary + or - operator shall have arithmetic type. +3.3.3.3(6) +The operand of the unary ~ operator shall have integral type. +3.3.3.3(6) +The operand of the unary ! operator shall have scalar type. +3.3.3.3(6) +Constants must have arithmetic type. +3.1.3 +Bad type name for cast operator +The type name for the cast operator should either be void or a +qualified or unqualified scalar type. +3.3.4(22) +Improper cast of non-scalar type expression. +The operand for the cast operator shall be of scalar type. +3.3.4(23) +Cast a pointer into a non-integral type. +A pointer may be converted to an integral type. +3.3.4(31) +Cast a non-integral type into a pointer. +An integral type may be converted to a pointer. +3.3.4(31) +Duplicate member '%s' +Two members of a struct may not have the same name. +3.1.2.2(7,25) +Invalid constant expression. +Constant expressions shall not contain assignment, increment, decrement, +function-call, or comma operators, except when they are contained within +the operand of the sizeof operator. +3.4(9) +Constant expressions must be derived from a constant value or a constant +variable. +3.4 +Dangerous operand of '&'. +The operand of the unary & operator shall be either a function +designator or an lvalue that designates an object that is not a +bit-field and is not declared with the register storage-class +specifier. This operand is NOT an lvalue, but we let it pass. +Note that a segmentation error with possible core dump will result +when the resulting address does not denote a valid (declared) +storage location. This feature will be discontinued in future +releases of the compiler! +3.3.3.2(36) +Unacceptable operand of '&'. +The operand of the unary & operator shall be either a function +designator or an lvalue that designates an object that is not a +bit-field and is not declared with the register storage-class +specifier. +3.3.3.2(36) +'&' before array or function; ignored +Unacceptable operand of sizeof operator. +The sizeof operator shall not be applied to an expression that has +function type or an incomplete type, to the parenthesized name of such +a type, or to an lvalue that designates a bit-field object. +3.3.3.4 +Unacceptable operand of a multiplicative operator. +Each of the operands of a multiplicative operator shall have arithmetic type. +3.3.5(18) +Unacceptable operand of the remainder operator +Each of the operands of the remainder (%) operator shall have integral type. +3.3.5(18) +Unacceptable operand of '+'. +For the + operator, either both operands shall have arithmetic type, or +one operand shall be a pointer to an object type and the other shall +have integral type. +3.3.6(39) +Unacceptable operand of '-'. +For the subtraction operator, one of the following shall hold: both operands +have arithmetic type; operands are pointers to qualified or unqualified +versions of compatible object types; or the left operand is a pointer +to an object type and the right operand has integral type. +3.3.6(39) +Unacceptable operand of shift operator. +Each of the operands of bitwise shift operators shall have integral type. +3.3.7(9) +Unacceptable operand of relational operator. +For relational operators, one of the following shall hold: both +operands have arithmetic type; both operands are pointers to qualified +or unqualified versions of compatible object types; or both operands +are pointers to qualified or unqualified versions of compatible +incomplete types. +3.3.8(32) +Unacceptable operand of == or != +For the == or != operator, one of the following shall hold: both operands +are pointers to qualified or unqualified versions of compatible types; one +operand is a pointer to an object or incomplete type and the other is a +pointer to a qualified or unqualified version of void; or one operand is +a pointer and the other is a null pointer constant. +3.3.9(21) +Unacceptable operand of &. +Each of the operands shall have integral type. +3.3.10(7) +Unacceptable operand of ^. +Each of the operands shall have integral type. +3.3.11(18) +Unacceptable operand of |. +Each of the operands shall have integral type. +3.3.12(30) +Unacceptable operand of &&. +Each of the operands shall have scalar type. +3.3.13(7) +Unacceptable operand of ||. +Each of the operands shall have scalar type. +3.3.14(20) +Unacceptable operand of conditional operator. +The first operand of conditional operator shall have scalar type. One +of the following shall hold for the second and third operands: +both operands have arithmetic type; both operands have compatible +structure or union types; both operands have void type; both operands +are pointers to qualified or unqualified versions of compatible types; +one operand is a pointer and the other is a null pointer constant; or +one operand is pointer to an object or incomplete type and the other +is a pointer to a qualified or unqualified version of void. +3.3.15 +Duplicate label '%s' +A label name can only occur once in a function. +3.1.2.1(25) +Division by zero. +3.3.5 +Subscripting a non-array. +3.3.2.1 +Subscripting an array of incomplete type which is not an object type. +The element of the array shall have an object type. +3.3.2.1 +Should only subscript an array with an integral expression +3.3.2.1 +Subscripting an unbounded array +3.3.2.1 +Array index out of range +3.3.2.1 +Selector requires struct/union pointer as left hand side +In K&R mode the expression is implicitly converted to the '.' selector +for a struct/union left-hand side. +3.3.2.3 +Selector requires struct/union as left hand side +In K&R mode the expression is implicitly converted to the '->' selector +for a struct/union pointer left-hand side. +3.3.2.3 +member of structure or union required +3.3.2.3 +types have different qualifier specifications +For two qualified types to be compatible, both shall have the +identically qualified version of a compatible type; qualified +and unqualified versions of a type are distinct types. For two +types to be compatible their types must be the same. +3.5.3(26) +Incompatible array type due to different array size +For two array types to be compatible, both shall have compatible element +types; if both size specifiers are present, they shall have the +same value. +3.5.4.2(11) +Incompatible array type due to incompatible element type +For two array types to be compatible, both shall have compatible element +types. +3.5.4.2(11) +Incompatible pointer type assignment +The type pointed to by the left-hand side of simple assignment +statement is incompatible with the type pointed to by the right-hand side. +3.3.16.1, 3.5.4.1(21) +Incompatible base type of pointer type +K&R feature. +Type %s of %s is incompatible with type %s of %s +Incompatible types can be resolved by casting or by other means. +3.3.16.1 +illegal combination of pointer and integer +Assigning an integral expression to a pointer is a bad practice. +Type for %s is incompatible with %s +Incompatible types can be resolved by casting or by other means. +3.1.2.6 +Bad operand type for += or -= +3.3.16.2(26) +A case or default label appears outside a switch statement +A case or default label shall appear only in a switch statement. +3.6.1 +The controlling expression of the if statement is not scalar type +The controlling expression of an if statement shall have scalar type. +3.6.4.1 +The controlling expression of switch statement is not integral type +The controlling expression of an switch statement shall have integral type. +3.6.4.2(20) +The case label is not an integral constant expression +The case label shall be an integral constant expression. +3.6.4.2(22) +Duplicate case label in the same switch statement +No two of the case constant expressions in the same switch statement +shall have the same value after conversion. +3.6.4.2(22) +More than one default label in the same switch statement +There may be at most one default label in a switch statement. +3.6.4.2(23) +The controlling expression of the iteration statement is not scalar +type +The controlling expression of a iteration statement shall have scalar +type. +3.6.5.1 +label '%s' used, but not defined +The identifier in a goto statement shall name a label located +somewhere in the enclosing function. +3.6.6.1 +A continue statement shall appear only in or as a loop body +3.6.6.2 +A break statement shall appear only in or as a switch body or loop body +3.6.6.3 +A return statement with an expression should not appear +in a function '%s', whose return type is void +3.6.6.4(24) +A return statement without an expression appears in a +function '%s', whose return type is not void +If a return statement without an expression is executed, and the value +of the function call is used by the caller, the behavior is undefined. +3.6.6.4(33) +Internal Error: statement stack underflow +Long double not supported; double assumed. +Long float not standard; double assumed. +Only 'register' allowed in parameter declaration +The only storage-class specifier that shall occur in a parameter +declaration is 'register'; illegal storage class ignored. +3.5.4.3(25) +Name(s) without types in a function declaration +An old-style function declaration is not allowed to have names +in the parameter list; useless names ignored +3.5.4.3(26) +Functions cannot return functions +3.7.1(33), 3.3.2.2 +Functions cannot return a non-object type +3.3.2.2 +enum declaration must contain enum literals +Although structs or unions may delay the declaration of their members, +a similar construction with enum does not exist and is not necessary, +as there can be no mutual dependencies between the declaration of an +enumerated type and any other type. +3.5.2.3(27) +Register qualification has no effect for this type of object +Register declarations for array, struct, and function types have +no effect. +3.5.1(16), 3.5.1(19) +Functions cannot be declared 'register' +The declaration of an identifier for a function that has block +scope shall have no explicit storage-class specifier other than +'extern'. +3.5.1(19) +'%s' cannot be initialized +The type of the entity to be initialized shall be an object type +or an array of unknown size. +3.5.7(32) +Cannot initialize 'extern' variable '%s' within a function +If the declaration of an identifier has block scope, and the +identifier has 'extern' or 'static' linkage, the declaration +shall have no initializer for the identifier; initialization +allowed anyway. +3.5.7(35) +initializing an 'extern' is an ANSI C extension +conflicting declarations for '%s' +'static' and 'extern' declarations conflict. Which is meant? +3.1.2.2(15), 3.1.2.2(27) +Too many initial values for '%s' +3.5.7(1) +incompatible types in initialization +3.3.16(35) +redefinition of '%s'; previous definition at line %s in file '%s' +Identifier redeclared in the same scope/block. +3.1.2.3 +bit-fields as members of a union are an ANSI C invention. +storage size for '%s' isn't known +type mismatch in initialization +Missing braces in a union initialization or illegally formed +initialization. +3.5.7(5) +union '%s' only allowed one initializer for the first member +3.5.7(5) +width of '%s' exceeds its type +the specified bitfield width is too large to be contained within a +bitfield type. +structure has no member named '%s' +This is allowed for compatibility with AT&T pcc-based compilers. +Reference of an expression of void type or an incomplete type. +3.2.2.1 +element size of an array shall not be zero +3.2.2.5(25) +invalid combination of type specifiers +Although order is unimportant, not all type specifiers can occur together. +3.5.2 +declaration must at least declare an identifier, tag, or the member of an enumeration +3.5(16) +at most one storage class may be given in the declaration +Duplicate occurrence ignored. +3.5.1(10) +size of function's return type is zero +The return type of a function must be void or an object type other than array. +3.7.1(33) +Expecting an integral return type from the main function +identifier missing from parameter declaration +Prototypes for function definitions require identifiers in parameter +declarations. +3.7.1(4) +only 'register' allowed for storage class for parameters +The declarations in the declaration list shall contain no storage class +other than 'register', and no initializations. +3.7.1(10) +parameters declarations can not have initializations +3.7.1(10) +only one instance of 'void' allowed in the parameter list +'void' must occur by itself (specifying that the function has no parameters). +3.5.4.3(1) +%s must have function type +1) An argument list must be explicitly present in the declarator; it cannot + be inherited from a typedef (3.5.4.3). +2) The declarator is not a function. +3.7.1(30) +Illegal hexadecimal constant +You have no digits after the 0x or 0X. 0x0 assumed. +3.1.3.2 +value overflows its type in this context. Value is set to be '%s'! +3.2.1.4 +value is outside range representable for type '%s' +missing member name +K&R mode permits a missing member name; otherwise, only bitfields can omit +the member name. +3.5.2.1(10) +useless keyword or type name in declaration +Type was ignored. +'%s' declared within and is limited to this function prototype +Possible program error, since parameter type checking will always fail +unless the type declaration is visible to the caller. +3.1.2.1(35) +Extra spaces within operator, %s assumed +In ANSI C, the compound assignment operator cannot have embedded +white space characters. +3.1.5 +missing size for array '%s' +Incomplete types permitted for identifiers with internal or +external linkage, but not automatic linkage. +3.1.2.5(10) +can't jump into (from outside of) the body of a 'try' or into either type of handler +'%s' missing, please #include excpt.h +excpt.h required to declare exception statements, intrinsics or compiler +runtime names. +local function declarations cannot be 'static' +A function declaration can only contain the storage-class 'static' +if it is at file scope. Declaration made 'extern'. +3.5.1(19) +static function '%s' declared and referenced, but not defined. +If an identifier declared with internal linkage is used in an +expression (other than as a part of the operand of a sizeof +operator), there shall be exactly one external definition for +the identifier in the translation unit. +3.7(12) +pragma argument '%s' must be declared prior to being used in a pragma +Pragma name ignored. +Pragma not supported +'%s' not enabled as intrinsic +It may have already appeared in a function pragma, or never occurred in +an intrinsic pragma. +'%s' is already enabled as an intrinsic +weak definition for '%s' is later redefined; pragma weak ignored. +definition of primary name '%s' not found; pragma weak ignored. +definition of secondary name '%s' not found; pragma weak ignored. +primary name '%s' is declared as a common or external, and is not defined +with initial value within this file; pragma weak ignored. +useless '%s' storage class ignored +array of functions not allowed +The element type must be an object type representing a region +of data storage which can represent values. +3.1.2.5(23) +array of voids not allowed +The element type must be an object type representing a region +of data storage which can represent values. +3.1.2.5(23) +argument for pragma pack must be an integer constant; pragma ignored +'%s' has wrong tag type. +Identifier redeclared in the same scope/block. +3.1.2.3 +missing dimension bound +For multidimensional arrays, the constant bounds of the array may be +omitted only for the first member of the sequence. +3.1.2.5(23) +Internal error in parameters to function substr; loc: '%s'; len: '%s'. +Internal error in parameters to function insertstr; indx: '%s'. +Internal error in function get_tag_name; input is a non-tagged type. +Internal error in function gen_type_str -- not a type tree '%s' +Cannot open file '%s' +Prototype should be moved after tag or a typedef declaration. +Please look for comments in the extracted header file. +The extracted header file includes prototypes for static functions, +which should be removed, if you wish to include the header in a source file +other than the originator. +ANSI C requires formal parameter before "..." +This extension is meant to be used for compatibility with varargs.h +3.5.4.3(35) +syntax error: "&..." invalid +extension used to access "..." formal arguments. +function '%s' initialized like a variable +The type of entity to be initialized shall be an object type or an +array of unknown size. +3.5.7(31) +initializer not an array aggregate +The initializer for an object that has aggregate type shall be a +brace-enclosed list of initializers for the members of the aggregate, +written in increasing subscript or member order. +3.5.7(20) +'%s' type is incomplete; cannot initialize +Was the struct ever defined? +3.5.7.(31) +'%s' is not standard ANSI. +This keyword/type is not defined in strict ANSI mode. +3.1.1 +not a legal asm string +The first operand of an asm string should be, after argument substitution, +a legal assembly string. +The -float option will be ignored in ANSI mode. +The -float option is ignored, since otherwise program semantics would +violate the ANSI standard. In particular, fp constants are always +'double' with ANSI-C, while with -float the type of fp constants will +depend on the context and may be 'float'. +ANSI C support unavailable with C compiler bundled with RISC/os +The C compiler bundled with RISC/os does not support ANSI C. ANSI +C support requires a separate license. +Ignored invalid warning number(s) in -woff option, %s%s ! +Warning numbers must be in the range %s to %s. +The set of warning numbers in cfe is disjoint from the set of warning numbers +in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. +'%s' not handled as an intrinsic due to incompatible argument types . +'__unalign' only qualifies pointers +'__unalign' indicates the object pointed at by pointer is unaligned (e.g., +int * __unalign p). This is an extension to ANSI C and like 'volatile' +and 'const' can follow the '*' in pointer declarations, but unlike both +cannot qualify a base type. +index expression is an anachronism +ANSI C++ doesn't support array index expressions in delete. +5.3.4 +member cannot be of function or incomplete type. +3.5.2.1(12) +Illegal lint option, '%s', is ignored. +cannot open header message buffer file +cannot write header message buffer file +cannot read header message buffer file +cannot seek in header message buffer file +struct/union/enum '%s' is used, but not defined +static '%s' unused +nonportable character comparison (chars may be signed or unsigned) +redundant comparison of unsigned with constant expression +redundant statement, control flow cannot reach this statement +'%s' may be used before set +function parameter '%s' is not used in function '%s' +'%s' can be const qualified, since it is not set within its lifetime. +'%s' is not used in function '%s' +'%s' set but unused in function '%s' +control may fall through %s statement +function '%s' has return(e); and return; +function '%s' may return random value to place of invocation %s +label without goto: '%s' +width of %s constant is smaller than size of type (%s) +explicit conversion from '%s' to '%s' %s +implicit conversion from '%s' to '%s' %s +'%s' may be indistinguishable from '%s' due to internal name truncation +Promoted formal parameter and promoted argument have incompatible types +No prototype for the definition of '%s' %s +References to '%s' are substituted by its literal initializer + (as included in %s) +============== +unsupported language linkage +string-literal specifies an unsupported linkage +7.4(1) +No prototype for the call to %s +To achieve better type-checking, there should be a full prototype for +the function being called. +3.5.4.3 +'inline' only applies to function declarations +leave statment can occur only within try body +Microsoft extension +Use of a Microsoft extension detected without usage of the +compiler option -msft. +No parameter mentioned +A file with no declarations or definitions is accepted as an extension to ANSI C +The translation unit must contain at least one external definition. +3.7 +Incompatible signed and unsigned version of a type +Yacc initialization error +Internal error: yacc cannot initialize itself. +The cfe option %s may not be in future releases. We suggest that you not use this option! +Incompatible char and unsigned char versions of a type +Lshift with undefined behaviour. +Lshift with a negative right operand, or a right operand that is greater +than or equal to the width in bits of the promoted left operand, results +in undefined behaviour. +3.3.7(11) +useless type name in declaration, possibly a semicolon is missing. +Type was ignored. +constant initializer expression is invalid (refers to automatic variables). +All the expressions in an initializer for an object that has static storage +duration or in the initializer list for an object that has aggregate or +union type shall be constant expressions. Otherwise, unexpected results +may occur. +3.5.7(32) and 3.4 +invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. +An address constant in a constant initializing expression can neither +initialize a bit-field nor be directly or indirectly converted to an +integral type of size different from an address type. +6.4 diff --git a/tools/ido_recomp/linux/5.3/ugen b/tools/ido_recomp/linux/5.3/ugen new file mode 100644 index 0000000..692086f Binary files /dev/null and b/tools/ido_recomp/linux/5.3/ugen differ diff --git a/tools/ido_recomp/linux/5.3/uopt b/tools/ido_recomp/linux/5.3/uopt new file mode 100644 index 0000000..49558be Binary files /dev/null and b/tools/ido_recomp/linux/5.3/uopt differ diff --git a/tools/ido_recomp/linux/7.1/as1 b/tools/ido_recomp/linux/7.1/as1 new file mode 100644 index 0000000..a7bb3ad Binary files /dev/null and b/tools/ido_recomp/linux/7.1/as1 differ diff --git a/tools/ido_recomp/linux/7.1/cc b/tools/ido_recomp/linux/7.1/cc new file mode 100644 index 0000000..e926b54 Binary files /dev/null and b/tools/ido_recomp/linux/7.1/cc differ diff --git a/tools/ido_recomp/linux/7.1/cfe b/tools/ido_recomp/linux/7.1/cfe new file mode 100644 index 0000000..3a3e983 Binary files /dev/null and b/tools/ido_recomp/linux/7.1/cfe differ diff --git a/tools/ido_recomp/linux/7.1/err.english.cc b/tools/ido_recomp/linux/7.1/err.english.cc new file mode 100644 index 0000000..b5d5be3 --- /dev/null +++ b/tools/ido_recomp/linux/7.1/err.english.cc @@ -0,0 +1,1260 @@ +@ + 358 358 358 + 6464 6482 6553 + 6553 6593 6728 + 6728 6746 6803 + 6803 6808 6808 + 6808 6818 6818 + 6818 6826 6826 + 6826 6847 6847 + 6847 6875 6922 + 6922 6930 6930 + 6930 6939 6939 + 6939 6948 6948 + 6948 6974 7120 + 7120 7149 7204 + 7210 7248 7311 + 7317 7350 7442 + 7450 7497 7627 + 7635 7709 7930 + 7938 7975 8063 + 8071 8113 8253 + 8261 8289 8289 + 8298 8338 8445 + 8460 8502 8635 + 8650 8690 8819 + 8834 8857 8965 + 8965 9008 9113 + 9119 9142 9227 + 9235 9282 9451 + 9451 9462 9462 + 9462 9477 9477 + 9477 9497 9497 + 9497 9545 9545 + 9545 9584 9584 + 9584 9604 9662 + 9662 9682 9720 + 9720 9749 9749 + 9749 9788 9788 + 9788 9802 9802 + 9802 9829 9829 + 9829 9861 9861 + 9861 9904 9904 + 9904 9920 9920 + 9920 9962 9962 + 9962 9988 9988 + 9988 10014 10014 +10014 10035 10035 +10035 10054 10097 +10097 10115 10115 +10115 10147 10147 +10147 10183 10183 +10183 10208 10208 +10208 10236 10236 +10236 10269 10269 +10269 10304 10304 +10304 10328 10328 +10328 10351 10351 +10351 10371 10371 +10371 10402 10402 +10402 10447 10447 +10447 10497 10497 +10497 10533 10533 +10533 10598 10598 +10606 10630 10630 +10640 10671 10671 +10690 10719 10719 +10728 10752 10795 +10795 10837 10837 +10837 10876 10876 +10876 10900 10900 +10900 10948 10948 +10960 11021 11103 +11103 11128 11128 +11128 11153 11153 +11153 11216 11216 +11216 11239 11239 +11239 11303 11303 +11303 11347 11347 +11357 11393 11393 +11393 11432 11432 +11442 11494 11494 +11494 11536 11536 +11536 11595 11595 +11595 11622 11622 +11622 11684 11684 +11684 11726 11726 +11738 11778 11778 +11782 11813 11813 +11813 11850 11850 +11850 11900 12087 +12111 12120 12120 +12120 12129 12129 +12129 12158 12158 +12158 12192 12192 +12192 12237 12237 +12237 12273 12273 +12273 12326 12326 +12330 12366 12366 +12366 12423 12423 +12427 12482 12482 +12486 12560 12560 +12568 12631 12631 +12637 12691 12691 +12691 12743 12743 +12743 12785 12785 +12785 12826 12826 +12826 12865 12865 +12865 12883 12883 +12883 12946 12946 +12956 12995 12995 +13005 13066 13066 +13077 13163 13163 +13163 13211 13211 +13211 13270 13270 +13270 13318 13318 +13318 13350 13350 +13350 13387 13387 +13387 13428 13428 +13428 13464 13533 +13533 13580 13737 +13737 13776 13854 +13854 13913 13913 +13913 13950 13950 +13950 14118 14118 +14118 14150 14150 +14150 14163 14194 +14194 14224 14255 +14255 14275 14319 +14319 14353 14458 +14466 14484 14530 +14534 14567 14567 +14567 14635 14682 +14690 14742 14742 +14742 14789 14789 +14801 14875 14875 +14886 14947 14947 +14947 14992 14992 +14992 15035 15085 +15085 15134 15205 +15214 15267 15448 +15454 15496 16810 +16822 16875 16960 +16972 17053 17179 +17191 17236 17332 +17344 17491 17841 +17853 17939 18304 +18316 18471 18774 +18786 18952 19323 +19335 19364 19496 +19500 19527 19598 +19598 19613 19776 +19797 19808 19837 +19837 19862 19862 +19868 19927 20026 +20034 20075 20179 +20187 20223 20223 +20223 20290 20382 +20392 20441 20589 +20601 20656 20656 +20656 20699 20818 +20826 20860 21038 +21046 21094 21191 +21203 21236 21314 +21326 21395 21457 +21469 21502 21502 +21502 21587 21731 +21756 21789 21864 +21875 21901 21976 +22013 22059 22220 +22257 22397 22561 +22561 22595 22595 +22603 22623 22623 +22631 22667 22828 +22865 22919 22994 +23031 23059 23120 +23132 23201 23201 +23212 23274 23274 +23285 23345 23345 +23356 23393 23393 +23399 23431 23532 +23542 23587 23646 +23656 23697 23745 +23755 23796 23844 +23854 23876 23928 +23942 23971 24153 +24160 24243 24243 +24247 24273 24743 +24755 24784 24984 +24996 25034 25034 +25034 25075 25273 +25281 25332 25410 +25420 25467 25544 +25554 25583 25744 +25754 25783 26061 +26071 26111 26185 +26194 26239 26525 +26535 26568 26914 +26924 26951 26998 +27008 27035 27082 +27093 27120 27167 +27178 27206 27251 +27261 27289 27334 +27345 27391 27931 +27938 27959 28007 +28019 28037 28037 +28043 28069 28069 +28077 28147 28199 +28207 28266 28266 +28274 28306 28306 +28314 28339 28339 +28347 28404 28510 +28518 28567 28682 +28690 28728 28728 +28736 28782 29023 +29033 29085 29234 +29246 29303 29383 +29395 29432 29570 +29592 29631 29644 +29644 29693 29758 +29767 29810 29875 +29875 29911 29976 +29984 30014 30014 +30027 30086 30151 +30157 30223 30293 +30301 30369 30445 +30457 30511 30568 +30580 30630 30743 +30755 30812 30874 +30886 30959 31035 +31043 31076 31175 +31183 31243 31243 +31251 31323 31323 +31331 31433 31433 +31445 31544 31686 +31698 31740 31740 +31740 31783 31783 +31783 31824 31824 +31824 31873 31996 +32008 32056 32164 +32176 32210 32210 +32229 32271 32271 +32279 32323 32569 +32581 32642 32718 +32739 32779 32916 +32926 32953 33047 +33057 33116 33315 +33325 33373 33373 +33373 33407 33469 +33494 33527 33527 +33536 33573 33573 +33584 33650 33697 +33705 33763 33763 +33763 33797 33797 +33797 33829 33906 +33915 33976 33976 +33985 34016 34098 +34098 34133 34198 +34198 34261 34261 +34269 34312 34312 +34324 34363 34438 +34444 34530 34530 +34538 34596 34626 +34636 34675 34754 +34764 34821 34821 +34821 34867 34950 +34959 35016 35135 +35145 35198 35198 +35208 35266 35344 +35355 35382 35537 +35547 35576 35629 +35637 35705 35705 +35713 35764 35764 +35764 35784 35876 +35888 35932 35950 +35950 36013 36138 +36150 36191 36280 +36286 36314 36419 +36431 36516 36516 +36516 36554 36642 +36642 36689 36808 +36818 36881 37105 +37113 37183 37204 +37204 37225 37225 +37225 37255 37348 +37348 37388 37388 +37388 37454 37454 +37454 37518 37518 +37518 37584 37584 +37584 37717 37717 +37717 37752 37752 +37752 37783 37889 +37901 37928 38034 +38046 38115 38115 +38115 38140 38187 +38195 38219 38339 +38351 38422 38422 +38422 38486 38486 +38486 38555 38555 +38555 38619 38619 +38619 38641 38641 +38641 38758 38758 +38758 38929 38929 +38929 38975 39043 +39055 39084 39133 +39133 39175 39265 +39275 39310 39494 +39504 39547 39576 +39587 39614 39668 +39674 39697 39797 +39797 39845 40094 +40094 40158 40264 +40264 40369 40523 +40523 40593 40593 +40593 40629 40876 +40876 40911 40971 +40977 41026 41026 +41038 41077 41077 +41077 41116 41116 +41116 41156 41156 +41156 41195 41195 +41195 41237 41237 +41237 41285 41285 +41285 41304 41304 +41304 41371 41371 +41371 41429 41429 +41429 41491 41491 +41491 41519 41519 +41519 41572 41572 +41572 41642 41642 +41642 41676 41676 +41676 41713 41713 +41713 41751 41751 +41751 41792 41792 +41792 41856 41856 +41856 41881 41881 +41881 41944 41944 +41944 41985 41985 +41985 42026 42026 +42026 42098 42098 +42098 42170 42170 +42170 42213 42213 +42213 42275 42275 +42275 42302 42302 +42302 42317 42317 +42317 42346 42394 +42401 42433 42530 +42538 42585 42585 +42585 42631 42631 +42631 42651 42733 +42733 42756 42756 +42756 42837 42905 +42909 42960 42960 +42960 42986 43033 +43033 43124 43124 +43124 43179 43179 +43179 43212 43384 +43394 43461 43479 +43479 43555 43788 +43806 43929 44124 +44128 44128 44128 +Out of memory: %s +There is no more memory left in the system for compiling this program. +Internal Error Unknown Error Message %s +1) An internal error, while attempting to print an unavailable message +2) The error message file is inaccessible or has other problems +Unknown Signal %s +1) An unknown signal has been caught +2) 2 Nested signals +line +Warning: +Fatal: +Source not available +Too many errors... goodbye. +There is a limit of 30 errors before aborting. +Error: +reserved +reserved +Unknown Control Statement +1) The line begins with a '#' and is not of the form: + # "" +2) Please compile this program with the preprocessor enabled. +Unknown character %s ignored +The character is not part of the source character set. +2.2.1 +Unknown control character \%s ignored +The control character is not part of the source character set. +2.2.1 +Illegal character %s in exponent +1) Digits or sign expected after 'e' or 'E'. +2) Digits are expected after sign in exponent. +3.1.3.1 +Constant is out of range and may be truncated. +The constant is too large to be accurately represented and may be +truncated. The limits are in the system include file limits.h. +2.2.4.2 +Constant is out of range for a 32-bit data type, but accepted as written. +The constant is too large to fit in a 32-bit data type, but will be +accurately represented in a wider data type. The value may be truncated, +depending on its context. The limits are in the system include file +limits.h. +2.2.4.2 +Character constant size out of range +1) No characters in a character constant. +2) More than 4 bytes in a character constant. +3.1.3.4 +Wide character constant size out of range +1) No characters in the multibyte sequence (0 assumed). +2) More than 1 byte in the multi-byte sequence (only the first byte was converted). +3.1.3.4 +Invalid multibyte character +4.10.7.2 +Newline in string or character constant +1) Terminate your string or character constant with closing quotes. +2) Put a backslash before the newline. +3.1.3.4, 3.1.4 +Octal character escape too large: %s > %s +1) Terminate end of octal sequence with a non-octal character. +2) Select a character value within the limits. +Value may be truncated +3.1.3.4, 3.1.4 +Hex character escape too large: %s > %s +1) Terminate end of hex sequence with a non-hex character. +2) Select a character value within the limits. +Value may be truncated +3.1.3.4, 3.1.4 +Unexpected End-of-file +1) Unterminated string or character constant +2) Missing closing comment marker (*/) +3) File system problems +Unrecognized escape sequence in string \%s +Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. +Character will be treated as un-escaped. +3.9.2 +Illegal octal digit %s +Octal constants, beginning with 0, must only have digits between 0 and 7, +inclusive. +3.1.3.2 +Unable to open temporary file for compiling %s +1) TMPDIR environment variable is set to a directory that you have no + permissions for. +2) The file system is full. +3) System errors beyond the scope of the compiler. +%s: Hangup +%s: Interrupt +%s: Quit (ASCII FS) +%s: Illegal instruction (not reset when caught) +%s: Trace trap (not reset when caught) +%s: IOT instruction +Also SIGABRT, used by abort, replace SIGIOT in the future +%s: EMT instruction +Also SIGXCPU, Exceeded CPU time limit +%s: Floating point exception +%s: Kill (cannot be caught or ignored) +%s: Bus error +%s: Segmentation violation +%s: Bad argument to system call +%s: Write on a pipe with no one to read it +%s: Alarm clock +%s: Software termination signal from kill +%s: User defined signal 1 +%s: User defined signal 2 +%s: Death of a child +Power-fail restart +%s: Also SIGXFSZ, exceeded file size limit +%s: Window change +%s: Handset, line status change +%s: Sendablestop signalnot from tty +%s: Stop signal from tty +%s: Pollable event occurred +%s: Input/Output possible signal +%s: Urgent condition on IO channel +%s: Window size changes +%s: Virtual time alarm +%s: Profiling alarm +%s: Continue a stopped process +%s: To readers pgrp upon background tty read +%s: Like TTIN for output if (tp->t_local<OSTOP) +%s: Resource lost (eg, record-lock) +'auto' and 'register' are not allowed in an external declaration +3.7(10) +must have function type +3.7.1(30) +Functions cannot return arrays +3.7.1(33), 3.3.2.2 +Declaration list not allowed +3.7.1(5) +Too many input files %s +The command line may contain only one file +cpp internal error: input stack underflow +cpp internal error: if stack underflow +Cannot open the file %s +No new-line character at the end of the file %s +2.1.1.2(30) +Fatal: Exceeded the limit of nesting level for #include file +Fatal: Exceeded the limit of nesting level for #include file. This limit +is 200. +Fail to read the file %s +Cannot write the file %s +%s: %s: An if directive is not terminated properly in the file +%s: %s: nested comment +%s:%s: Illegal macro name %s; macro name shall be an identifier +%s:%s: Illegal preprocessing token sequence +3.8.3(35) +%s:%s: Illegal macro parameter name +%s:%s: Non-unique macro parameter name +3.8.3(18) +%s:%s: Missing ')' in parameter list for #define %s +%s:%s: Missing ')' in macro instantiation +%s:%s: Bad punctuator in the parameter list for #define %s +%s:%s: Macro %s redefined. +%s:%s: # operator should be followed by a macro argument name +%s:%s: Badly formed constant expression%s +3.4(9), 3.8 +%s:%s: Division by zero in #if or #elif +3.8 +unknown command line option %s +extraneous input/output file name %s +%s: %s: Unterminated string or character constant +A preprocessing string or character constant token was not +terminated. Note that preprocessing directives are processed +after the source file has been divided into preprocessing tokens. +2.1.1.2(30) 3.1(18) 3.8 +%s: %s: +%s: %s: +%s: %s: Unterminated comment +%s: %s: Unknown directive type %s +%s: %s: #elif or #else after #else directive +%s: %s: Bad identifier after the %s +%s: %s: #%s accepts only one identifier as parameter +3.8 +%s: %s: Bad identifier after the %s +%s: %s: text following #%s violates the ANSI C standard. +3.8 +%s: %s: Bad character %s occurs after the # directive. +3.8 +%s: %s: the ## operator shall not be the %s token in the replacement list +3.8.3.3 +%s: %s: the defined operator takes identifier as operand only. +3.8.1 +%s: %s: Not in a conditional directive while using %s +%s: %s: Illegal filename specification for #include +%s: %s: Invalid file name %s for #include +%s: %s: Cannot open file %s for #include +%s: %s: Bad argument for #line command +%s: %s: #error %s +%s: %s: Tried to redefine predefined macro %s, attempt ignored +3.8.7(22) +%s: %s: Undefining predefined macro %s +3.8.7(22) +%s: %s: Undefined the ANSI standard library defined macro %s +4.1.2.1(9) +%s: %s: The number of arguments in the macro invocation does not match the definition +%s: %s: Illegal character %s in preprocessor if +%s: %s: Illegal character %s for number in preprocessor if +%s: %s: No string is allowed in preprocessor if +%s: %s: Not supported pragma %s +%s: %s: Not supported #pragma format +%s: %s: ANSI C does not allow #ident; %s +%s: %s: Not supported #ident format +This cpp extension accepts the following format: +#ident "any string" +%s: %s: Not supported #assert/#unassert format +This cpp extension accepts the following format: +#assert identifier +#assert identifier ( pp-tokens ) +#unassert identifier +#unassert identifier ( pp-tokens ) +%s: %s: Bad assertion predicate format +The correct syntax for this cpp extension is: +#assert identifier ( pp-token ) +%s: %s: directive is an upward-compatible ANSI C extension +%s: This option requires an argument +%s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. +A status return from cpp to cfe +Syntax Error +The token read was unexpected. +Syntax Error -- cannot backup +The token read was unexpected. +Yacc stack overflow +The expression is too complicated to parse. +Trailing comma in enumerator list +The use of a trailing comma in an enumerator list is not standard C. There +may be portability problems. +3.5.2.2 +Empty declaration +Empty declarations are invalid in standard C. +3.5 +%s declared, but not referenced. +redeclaration of '%s'; previous declaration at line %s in file '%s' +Identifier redeclared in the same scope/block. +3.1.2.3 +'%s' undefined; reoccurrences will not be reported. +Non-function name referenced in function call. +3.3.2.2(18) +The number of arguments doesn't agree with the number in the declaration. +3.3.2.2(5) +'%s' section name longer than 8 characters. Name truncated. +'%s' is already placed by pragma alloc_text. +Cannot write ucode file while compiling %s +1) The file system is full +2) Permissions problem +Must have corresponding formal argument for '%s' +Parameter found in the declaration part, but not in the argument list. +3.7.1(7) +Non-prototype declaration is an obsolescent feature. +The use of function definitions with separate parameter identifier +and declaration lists (not prototype-format parameter type and +identifier declarators) is an obsolescent feature. +3.9.5 +Incompatible function declarations for %s +For two function types to be compatible, both shall specify compatible +return types. Moreover, the parameter type lists, if both are present, +shall agree in the number of parameters and in use of the ellipsis +terminator; corresponding parameters shall have compatible types. If +one type has a parameter type list and the other type is specified by +a function declarator that is not part of a function definition and +contains an empty identifier list, the parameter list shall not have +an ellipsis terminator and the type of each parameter shall be +compatible with they type that results from application of the default +argument promotions. If one type has a parameter type list and the +other is specified by a function definition that contains a (possibly +empty) identifier list, both shall agree in the number of parameters, +and the type of each prototype parameter shall be compatible with the +type that results from application of the default argument promotions +to the type of the corresponding identifier. (For each parameter +declared with function or array type, its type for these comparisons +is the one that results from conversion to a pointer type. For each +parameter declared with qualified type, its type for these comparisons +is the unqualified version of its declared type.) There you have it! +3.5.4.3(15) +Incompatible function return type for this function. +For two function types to be compatible, both shall specify compatible +return types. +3.5.4.3(15) +The number of parameters for function is different from the previous declaration +The parameter type lists, if both are present, shall agree in the +number of parameters and in use of the ellipsis terminator. +3.5.4.3(15) +Incompatible type for the function parameter +If both parameter type lists are present, corresponding +parameters shall have compatible types. +3.5.4.3(15) +Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. +The redeclaration could cause arguments at a call site to be passed +inconsistently with what the function implementation expects, and +parameters would therefore be accessed erroneously when executing the +function body. Note that a float argument is promoted to a double +when passed (potentially through fp registers) to an unprototyped +function. +3.5.4.3(15) +prototype and non-prototype declaration found for %s, ellipsis terminator not allowed +If one type has a parameter type list and the other type is specified +by a function declarator that is not part of a function definition and +contains an empty identifier list, the parameter list shall not have +an ellipsis terminator and the type of each parameter shall be +compatible with they type that results from application of the default +argument promotions. +3.5.4.3(15) +prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion +If one type has a parameter type list and the other type is specified +by a function declarator that is not part of a function definition and +contains an empty identifier list, the type of each parameter shall be +compatible with the type that results from application of the default +argument promotions. +3.5.4.3(15) +prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion +If one type has a parameter type list and the other is specified by a +function definition that contains a (possibly empty) identifier list, +both shall agree in the number of parameters, and the type of each +prototype parameter shall be compatible with the type that results +from application of the default argument promotions to the type of the +corresponding identifier. +3.5.4.3(15) +Empty declaration specifiers +Standard C requires at least a storage class specifier, type specifier, +or a type qualifier in declarations. 'extern int' assumed. +3.5 +Can't write to the file %s +1) The output file cannot be opened for writing. +2) Out of file space. +Duplicate '%s' +typedef, extern, static, auto, register, const, volatile may not +appear more than once in the same specifier list or qualifier list. +Duplicate occurrence ignored. +3.5.1(10) , 3.5.3(5) +Null input +There is nothing to compile. +Illegal type combination +3.5.2 +Missing ';' at end of structure / union member declaration +In standard C, each member declaration must be terminated by a ';'. A +terminating ';' is assumed. +3.5.2.1 +Missing member name in structure / union +In standard C, each member declaration have a member name. The missing +member is assumed to not exist. +3.5.2.1 +This variable is initialized twice. +Neither 'const' or 'volatile' have any effect on function results. +Qualifiers only apply to expressions designating an object that +can be altered or examined. +3.5.3(10) +An integer constant expression is required here. +The expression that defines the value of an enumeration constant +shall be an integral constant expression that has a value +representable as an int. +3.5.2.2(28) +(previous declaration of '%s' at line %s in file '%s') +Must be an integer type greater than zero. +The array size must be either a char, signed or unsigned integer or +an enumerated type with a value greater than zero. +3.5.4.2 +Array size cannot be a long long. +Arrays with more than 2^32 elements are not yet supported. +The array size must be either a char, signed or unsigned integer or +an enumerated type with a value greater than zero. +3.5.4.2 +bit-field '%s' width is not an integer constant +The expression that specifies the width of a bit-field shall be an +integral constant expression. +3.5.2.1(15) +bit-field '%s' width is negative +The expression that specifies the width of a bit-field shall be +non-negative. +3.5.2.1(15) +bit-field '%s' type required to be int, unsigned int, or signed int. +A bit-field shall have type int, unsigned int, or signed int. +3.5.2.1(30) +bit-field %s's type not integer. +Non-scalar type or pointer type to a non-object for increment or decrement operator. +The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. +3.3.2.4(37), 3.3.3.1(25) +Assign value to a function type. +An assignment operator shall have a modifiable lvalue as its left operand. +3.2.2.1(5) +Assign value to an array. +An assignment operator shall have a modifiable lvalue as its left operand. +3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) +Change value for variable of incomplete type. +The operand of increment and decrement operator shall be a modifiable +scalar lvalue. An assignment operator shall have a modifiable lvalue +as its left operand. +3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) +The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. +This is a restriction in our implementation, which can be worked +around by always accessing long long bit-fields indirectly (i.e. +by means of the '->' operator). +This expression is not an lvalue. +3.2.2.1 +Modified an rvalue. +3.2.2.1 +Change value for constant variable. +The operand of increment and decrement operators shall be modifiable +scalar lvalues. An assignment operator shall have a modifiable lvalue +as its left operand. +3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) +Change value for constant field of a struct or union. +An assignment operator shall have a modifiable lvalue as its left operand. +3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) +Dereferenced a non-pointer. +The operand of the unary * operator shall have pointer type. +3.3.3.2(39) +The operand of the unary + or - operator shall have arithmetic type. +3.3.3.3(6) +The operand of the unary ~ operator shall have integral type. +3.3.3.3(6) +The operand of the unary ! operator shall have scalar type. +3.3.3.3(6) +Constants must have arithmetic type. +3.1.3 +Bad type name for cast operator +The type name for the cast operator should either be void or a +qualified or unqualified scalar type. +3.3.4(22) +Improper cast of non-scalar type expression. +The operand for the cast operator shall be of scalar type. +3.3.4(23) +Cast a pointer into a non-integral type. +A pointer may be converted to an integral type. +3.3.4(31) +Cast a non-integral type into a pointer. +An integral type may be converted to a pointer. +3.3.4(31) +Duplicate member '%s' +Two members of a struct may not have the same name. +3.1.2.2(7,25) +Invalid constant expression. +Constant expressions shall not contain assignment, increment, decrement, +function-call, or comma operators, except when they are contained within +the operand of the sizeof operator. +3.4(9) +Constant expressions must be derived from a constant value or a constant +variable. +3.4 +Dangerous operand of '&'. +The operand of the unary & operator shall be either a function +designator or an lvalue that designates an object that is not a +bit-field and is not declared with the register storage-class +specifier. This operand is NOT an lvalue, but we let it pass. +Note that a segmentation error with possible core dump will result +when the resulting address does not denote a valid (declared) +storage location. This feature will be discontinued in future +releases of the compiler! +3.3.3.2(36) +Unacceptable operand of '&'. +The operand of the unary & operator shall be either a function +designator or an lvalue that designates an object that is not a +bit-field and is not declared with the register storage-class +specifier. +3.3.3.2(36) +'&' before array or function; ignored +Unacceptable operand of sizeof operator. +The sizeof operator shall not be applied to an expression that has +function type or an incomplete type, to the parenthesized name of such +a type, or to an lvalue that designates a bit-field object. +3.3.3.4 +Unacceptable operand of a multiplicative operator. +Each of the operands of a multiplicative operator shall have arithmetic type. +3.3.5(18) +Unacceptable operand of the remainder operator +Each of the operands of the remainder (%) operator shall have integral type. +3.3.5(18) +Unacceptable operand of '+'. +For the + operator, either both operands shall have arithmetic type, or +one operand shall be a pointer to an object type and the other shall +have integral type. +3.3.6(39) +Unacceptable operand of '-'. +For the subtraction operator, one of the following shall hold: both operands +have arithmetic type; operands are pointers to qualified or unqualified +versions of compatible object types; or the left operand is a pointer +to an object type and the right operand has integral type. +3.3.6(39) +Unacceptable operand of shift operator. +Each of the operands of bitwise shift operators shall have integral type. +3.3.7(9) +Unacceptable operand of relational operator. +For relational operators, one of the following shall hold: both +operands have arithmetic type; both operands are pointers to qualified +or unqualified versions of compatible object types; or both operands +are pointers to qualified or unqualified versions of compatible +incomplete types. +3.3.8(32) +Unacceptable operand of == or != +For the == or != operator, one of the following shall hold: both operands +are pointers to qualified or unqualified versions of compatible types; one +operand is a pointer to an object or incomplete type and the other is a +pointer to a qualified or unqualified version of void; or one operand is +a pointer and the other is a null pointer constant. +3.3.9(21) +Unacceptable operand of &. +Each of the operands shall have integral type. +3.3.10(7) +Unacceptable operand of ^. +Each of the operands shall have integral type. +3.3.11(18) +Unacceptable operand of |. +Each of the operands shall have integral type. +3.3.12(30) +Unacceptable operand of &&. +Each of the operands shall have scalar type. +3.3.13(7) +Unacceptable operand of ||. +Each of the operands shall have scalar type. +3.3.14(20) +Unacceptable operand of conditional operator. +The first operand of conditional operator shall have scalar type. One +of the following shall hold for the second and third operands: +both operands have arithmetic type; both operands have compatible +structure or union types; both operands have void type; both operands +are pointers to qualified or unqualified versions of compatible types; +one operand is a pointer and the other is a null pointer constant; or +one operand is pointer to an object or incomplete type and the other +is a pointer to a qualified or unqualified version of void. +3.3.15 +Duplicate label '%s' +A label name can only occur once in a function. +3.1.2.1(25) +Division by zero. +3.3.5 +Subscripting a non-array. +3.3.2.1 +Subscripting an array of incomplete type which is not an object type. +The element of the array shall have an object type. +3.3.2.1 +Should only subscript an array with an integral expression +3.3.2.1 +Subscripting an unbounded array +3.3.2.1 +Array index out of range +3.3.2.1 +Selector requires struct/union pointer as left hand side +In K&R mode the expression is implicitly converted to the '.' selector +for a struct/union left-hand side. +3.3.2.3 +Selector requires struct/union as left hand side +In K&R mode the expression is implicitly converted to the '->' selector +for a struct/union pointer left-hand side. +3.3.2.3 +member of structure or union required +3.3.2.3 +types have different qualifier specifications +For two qualified types to be compatible, both shall have the +identically qualified version of a compatible type; qualified +and unqualified versions of a type are distinct types. For two +types to be compatible their types must be the same. +3.5.3(26) +Incompatible array type due to different array size +For two array types to be compatible, both shall have compatible element +types; if both size specifiers are present, they shall have the +same value. +3.5.4.2(11) +Incompatible array type due to incompatible element type +For two array types to be compatible, both shall have compatible element +types. +3.5.4.2(11) +Incompatible pointer type assignment +The type pointed to by the left-hand side of simple assignment +statement is incompatible with the type pointed to by the right-hand side. +3.3.16.1, 3.5.4.1(21) +Incompatible base type of pointer type +K&R feature. +Type %s of %s is incompatible with type %s of %s +Incompatible types can be resolved by casting or by other means. +3.3.16.1 +illegal combination of pointer and integer +Assigning an integral expression to a pointer is a bad practice. +Type for %s is incompatible with %s +Incompatible types can be resolved by casting or by other means. +3.1.2.6 +Bad operand type for += or -= +3.3.16.2(26) +A case or default label appears outside a switch statement +A case or default label shall appear only in a switch statement. +3.6.1 +The controlling expression of the if statement is not scalar type +The controlling expression of an if statement shall have scalar type. +3.6.4.1 +The controlling expression of switch statement is not integral type +The controlling expression of an switch statement shall have integral type. +3.6.4.2(20) +The case label is not an integral constant expression +The case label shall be an integral constant expression. +3.6.4.2(22) +Duplicate case label in the same switch statement +No two of the case constant expressions in the same switch statement +shall have the same value after conversion. +3.6.4.2(22) +More than one default label in the same switch statement +There may be at most one default label in a switch statement. +3.6.4.2(23) +The controlling expression of the iteration statement is not scalar +type +The controlling expression of a iteration statement shall have scalar +type. +3.6.5.1 +label '%s' used, but not defined +The identifier in a goto statement shall name a label located +somewhere in the enclosing function. +3.6.6.1 +A continue statement shall appear only in or as a loop body +3.6.6.2 +A break statement shall appear only in or as a switch body or loop body +3.6.6.3 +A return statement with an expression should not appear +in a function '%s', whose return type is void +3.6.6.4(24) +A return statement without an expression appears in a +function '%s', whose return type is not void +If a return statement without an expression is executed, and the value +of the function call is used by the caller, the behavior is undefined. +3.6.6.4(33) +Internal Error: statement stack underflow +Long double not supported; double assumed. +Long float not standard; double assumed. +Only 'register' allowed in parameter declaration +The only storage-class specifier that shall occur in a parameter +declaration is 'register'; illegal storage class ignored. +3.5.4.3(25) +Name(s) without types in a function declaration +An old-style function declaration is not allowed to have names +in the parameter list; useless names ignored +3.5.4.3(26) +Functions cannot return functions +3.7.1(33), 3.3.2.2 +Functions cannot return a non-object type +3.3.2.2 +enum declaration must contain enum literals +Although structs or unions may delay the declaration of their members, +a similar construction with enum does not exist and is not necessary, +as there can be no mutual dependencies between the declaration of an +enumerated type and any other type. +3.5.2.3(27) +Register qualification has no effect for this type of object +Register declarations for array, struct, and function types have +no effect. +3.5.1(16), 3.5.1(19) +Functions cannot be declared 'register' +The declaration of an identifier for a function that has block +scope shall have no explicit storage-class specifier other than +'extern'. +3.5.1(19) +'%s' cannot be initialized +The type of the entity to be initialized shall be an object type +or an array of unknown size. +3.5.7(32) +Cannot initialize 'extern' variable '%s' within a function +If the declaration of an identifier has block scope, and the +identifier has 'extern' or 'static' linkage, the declaration +shall have no initializer for the identifier; initialization +allowed anyway. +3.5.7(35) +initializing an 'extern' is an ANSI C extension +conflicting declarations for '%s' +'static' and 'extern' declarations conflict. Which is meant? +3.1.2.2(15), 3.1.2.2(27) +Too many initial values for '%s' +3.5.7(1) +incompatible types in initialization +3.3.16(35) +redefinition of '%s'; previous definition at line %s in file '%s' +Identifier redeclared in the same scope/block. +3.1.2.3 +bit-fields as members of a union are an ANSI C invention. +storage size for '%s' isn't known +type mismatch in initialization +Missing braces in a union initialization or illegally formed +initialization. +3.5.7(5) +union '%s' only allowed one initializer for the first member +3.5.7(5) +width of '%s' exceeds its type +the specified bitfield width is too large to be contained within a +bitfield type. +structure has no member named '%s' +This is allowed for compatibility with AT&T pcc-based compilers. +Reference of an expression of void type or an incomplete type. +3.2.2.1 +element size of an array shall not be zero +3.2.2.5(25) +invalid combination of type specifiers +Although order is unimportant, not all type specifiers can occur together. +3.5.2 +declaration must at least declare an identifier, tag, or the member of an enumeration +3.5(16) +at most one storage class may be given in the declaration +Duplicate occurrence ignored. +3.5.1(10) +size of function's return type is zero +The return type of a function must be void or an object type other than array. +3.7.1(33) +Expecting an integral return type from the main function +identifier missing from parameter declaration +Prototypes for function definitions require identifiers in parameter +declarations. +3.7.1(4) +only 'register' allowed for storage class for parameters +The declarations in the declaration list shall contain no storage class +other than 'register', and no initializations. +3.7.1(10) +parameters declarations can not have initializations +3.7.1(10) +only one instance of 'void' allowed in the parameter list +'void' must occur by itself (specifying that the function has no parameters). +3.5.4.3(1) +%s must have function type +1) An argument list must be explicitly present in the declarator; it cannot + be inherited from a typedef (3.5.4.3). +2) The declarator is not a function. +3.7.1(30) +Illegal hexadecimal constant +You have no digits after the 0x or 0X. 0x0 assumed. +3.1.3.2 +value overflows its type in this context. Value is set to be '%s'! +3.2.1.4 +value is outside range representable for type '%s' +missing member name +K&R mode permits a missing member name; otherwise, only bitfields can omit +the member name. +3.5.2.1(10) +useless keyword or type name in declaration +Type was ignored. +'%s' declared within and is limited to this function prototype +Possible program error, since parameter type checking will always fail +unless the type declaration is visible to the caller. +3.1.2.1(35) +Extra spaces within operator, %s assumed +In ANSI C, the compound assignment operator cannot have embedded +white space characters. +3.1.5 +missing size for array '%s' +Incomplete types permitted for identifiers with internal or +external linkage, but not automatic linkage. +3.1.2.5(10) +can't jump into (from outside of) the body of a 'try' or into either type of handler +'%s' missing, please #include excpt.h +excpt.h required to declare exception statements, intrinsics or compiler +runtime names. +local function declarations cannot be 'static' +A function declaration can only contain the storage-class 'static' +if it is at file scope. Declaration made 'extern'. +3.5.1(19) +static function '%s' declared and referenced, but not defined. +If an identifier declared with internal linkage is used in an +expression (other than as a part of the operand of a sizeof +operator), there shall be exactly one external definition for +the identifier in the translation unit. +3.7(12) +pragma argument '%s' must be declared prior to being used in a pragma +Pragma name ignored. +Pragma not supported +'%s' not enabled as intrinsic +It may have already appeared in a function pragma, or never occurred in +an intrinsic pragma. +'%s' is already enabled as an intrinsic +weak definition for '%s' is later redefined; pragma weak ignored. +definition of primary name '%s' not found; pragma weak ignored. +definition of secondary name '%s' not found; pragma weak ignored. +primary name '%s' is declared as a common or external, and is not defined +with initial value within this file; pragma weak ignored. +useless '%s' storage class ignored +array of functions not allowed +The element type must be an object type representing a region +of data storage which can represent values. +3.1.2.5(23) +array of voids not allowed +The element type must be an object type representing a region +of data storage which can represent values. +3.1.2.5(23) +argument for pragma pack must be an integer constant; pragma ignored +'%s' has wrong tag type. +Identifier redeclared in the same scope/block. +3.1.2.3 +missing dimension bound +For multidimensional arrays, the constant bounds of the array may be +omitted only for the first member of the sequence. +3.1.2.5(23) +Internal error in parameters to function substr; loc: '%s'; len: '%s'. +Internal error in parameters to function insertstr; indx: '%s'. +Internal error in function get_tag_name; input is a non-tagged type. +Internal error in function gen_type_str -- not a type tree '%s' +Cannot open file '%s' +Prototype should be moved after tag or a typedef declaration. +Please look for comments in the extracted header file. +The extracted header file includes prototypes for static functions, +which should be removed, if you wish to include the header in a source file +other than the originator. +ANSI C requires formal parameter before "..." +This extension is meant to be used for compatibility with varargs.h +3.5.4.3(35) +syntax error: "&..." invalid +extension used to access "..." formal arguments. +function '%s' initialized like a variable +The type of entity to be initialized shall be an object type or an +array of unknown size. +3.5.7(31) +initializer not an array aggregate +The initializer for an object that has aggregate type shall be a +brace-enclosed list of initializers for the members of the aggregate, +written in increasing subscript or member order. +3.5.7(20) +'%s' type is incomplete; cannot initialize +Was the struct ever defined? +3.5.7.(31) +'%s' is not standard ANSI. +This keyword/type is not defined in strict ANSI mode. +3.1.1 +not a legal asm string +The first operand of an asm string should be, after argument substitution, +a legal assembly string. +The -float option will be ignored in ANSI mode. +The -float option is ignored, since otherwise program semantics would +violate the ANSI standard. In particular, fp constants are always +'double' with ANSI-C, while with -float the type of fp constants will +depend on the context and may be 'float'. +ANSI C support unavailable with C compiler bundled with RISC/os +The C compiler bundled with RISC/os does not support ANSI C. ANSI +C support requires a separate license. +Ignored invalid warning number(s) in -woff option, %s%s ! +Warning numbers must be in the range %s to %s. +The set of warning numbers in cfe is disjoint from the set of warning numbers +in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. +'%s' not handled as an intrinsic due to incompatible argument types . +'__unalign' only qualifies pointers +'__unalign' indicates the object pointed at by pointer is unaligned (e.g., +int * __unalign p). This is an extension to ANSI C and like 'volatile' +and 'const' can follow the '*' in pointer declarations, but unlike both +cannot qualify a base type. +index expression is an anachronism +ANSI C++ doesn't support array index expressions in delete. +5.3.4 +member cannot be of function or incomplete type. +3.5.2.1(12) +Illegal lint option, '%s', is ignored. +cannot open header message buffer file +cannot write header message buffer file +cannot read header message buffer file +cannot seek in header message buffer file +struct/union/enum '%s' is used, but not defined +static '%s' unused +nonportable character comparison (chars may be signed or unsigned) +redundant comparison of unsigned with constant expression +redundant statement, control flow cannot reach this statement +'%s' may be used before set +function parameter '%s' is not used in function '%s' +'%s' can be const qualified, since it is not set within its lifetime. +'%s' is not used in function '%s' +'%s' set but unused in function '%s' +control may fall through %s statement +function '%s' has return(e); and return; +function '%s' may return random value to place of invocation %s +label without goto: '%s' +only %s bits of '%s' constant (type '%s') are explicitly given +explicit conversion from '%s' to '%s' %s +implicit conversion from '%s' to '%s' %s +'%s' may be indistinguishable from '%s' due to internal name truncation +Promoted formal parameter and promoted argument have incompatible types +No prototype for the definition of '%s' %s +References to '%s' are substituted by its literal initializer + (as included in %s) +============== +unsupported language linkage +string-literal specifies an unsupported linkage +7.4(1) +No prototype for the call to %s +To achieve better type-checking, there should be a full prototype for +the function being called. +3.5.4.3 +'inline' only applies to function declarations +leave statment can occur only within try body +Microsoft extension +Use of a Microsoft extension detected without usage of the +compiler option -msft. +No parameter mentioned +A file with no declarations or definitions is accepted as an extension to ANSI C +The translation unit must contain at least one external definition. +3.7 +Incompatible signed and unsigned version of a type +Yacc initialization error +Internal error: yacc cannot initialize itself. +The cfe option %s may not be in future releases. We suggest that you not use this option! +Incompatible char and unsigned char versions of a type +Lshift with undefined behaviour. +Lshift with a negative right operand, or a right operand that is greater +than or equal to the width in bits of the promoted left operand, results +in undefined behaviour. +3.3.7(11) +useless type name in declaration, possibly a semicolon is missing. +Type was ignored. +constant initializer expression is invalid (refers to automatic variables). +All the expressions in an initializer for an object that has static storage +duration or in the initializer list for an object that has aggregate or +union type shall be constant expressions. Otherwise, unexpected results +may occur. +3.5.7(32) and 3.4 +invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. +An address constant in a constant initializing expression can neither +initialize a bit-field nor be directly or indirectly converted to an +integral type of size different from an address type. +6.4 diff --git a/tools/ido_recomp/linux/7.1/ugen b/tools/ido_recomp/linux/7.1/ugen new file mode 100644 index 0000000..e8e8756 Binary files /dev/null and b/tools/ido_recomp/linux/7.1/ugen differ diff --git a/tools/ido_recomp/linux/7.1/uopt b/tools/ido_recomp/linux/7.1/uopt new file mode 100644 index 0000000..fd93d2d Binary files /dev/null and b/tools/ido_recomp/linux/7.1/uopt differ diff --git a/tools/n64splat b/tools/n64splat new file mode 160000 index 0000000..b9ddd5e --- /dev/null +++ b/tools/n64splat @@ -0,0 +1 @@ +Subproject commit b9ddd5e6051bc38c7768364c9d153f08db81836a diff --git a/tools/symbol_addrs.txt b/tools/symbol_addrs.txt new file mode 100644 index 0000000..2d2d205 --- /dev/null +++ b/tools/symbol_addrs.txt @@ -0,0 +1,12 @@ +__osDisableInt = 0x80062A90; +__osRestoreInt = 0x80062B00; +__osRunningThread = 0x80079630; +__osEnqueueAndYield = 0x80057CEC; // ! +osStartThread = 0x80065370; +__osPopThread = 0x80057E34; // ! +osSendMesg = 0x800568C0; +__osDispatchThread = 0x80057E44; // ! +osStopThread = 0x80056A10; +__osDequeueThread = 0x80056CB0; +osRecvMesg = 0x80056AD0; +osSetIntMask = 0x80056C10; \ No newline at end of file diff --git a/undefined_funcs_auto.txt b/undefined_funcs_auto.txt new file mode 100644 index 0000000..d654646 --- /dev/null +++ b/undefined_funcs_auto.txt @@ -0,0 +1,7 @@ +func_8000B8B0 = 0x8000B8B0; +func_8000BD70 = 0x8000BD70; +func_8000C02C = 0x8000C02C; +func_80048590 = 0x80048590; +func_80048684 = 0x80048684; +func_80048904 = 0x80048904; +func_8004F350 = 0x8004F350; diff --git a/undefined_syms.txt b/undefined_syms.txt new file mode 100644 index 0000000..9e3b7ec --- /dev/null +++ b/undefined_syms.txt @@ -0,0 +1,5 @@ +D_80078580 = 0x80078580; +D_80078584 = 0x80078584; +D_8007A860 = 0x8007A860; +D_8007A868 = 0x8007A868; +__osRunningThread = 0x80079630; \ No newline at end of file diff --git a/undefined_syms_auto.txt b/undefined_syms_auto.txt new file mode 100644 index 0000000..9e18eb8 --- /dev/null +++ b/undefined_syms_auto.txt @@ -0,0 +1,1665 @@ +D_7F980 = 0x7F980; +D_ADC80 = 0xADC80; +D_FFFFF = 0xFFFFF; +D_100003 = 0x100003; +D_107FA0 = 0x107FA0; +D_118990 = 0x118990; +D_11F560 = 0x11F560; +D_120920 = 0x120920; +D_120A10 = 0x120A10; +D_124570 = 0x124570; +D_1278D0 = 0x1278D0; +D_12DF40 = 0x12DF40; +D_1329E0 = 0x1329E0; +D_134680 = 0x134680; +D_138F20 = 0x138F20; +D_142B10 = 0x142B10; +D_143700 = 0x143700; +D_1442E0 = 0x1442E0; +D_14CA50 = 0x14CA50; +D_1589E0 = 0x1589E0; +D_15F990 = 0x15F990; +D_1708B0 = 0x1708B0; +D_17FB40 = 0x17FB40; +D_1802B0 = 0x1802B0; +D_185A10 = 0x185A10; +D_191660 = 0x191660; +D_1A8570 = 0x1A8570; +D_2552C0 = 0x2552C0; +D_25A740 = 0x25A740; +D_25B0D0 = 0x25B0D0; +D_25F440 = 0x25F440; +D_261F70 = 0x261F70; +D_271260 = 0x271260; +D_2717E0 = 0x2717E0; +D_272830 = 0x272830; +D_275CE0 = 0x275CE0; +D_27BCA0 = 0x27BCA0; +D_285DC0 = 0x285DC0; +D_287EB0 = 0x287EB0; +D_29DD30 = 0x29DD30; +D_2A1B30 = 0x2A1B30; +D_2A4DF0 = 0x2A4DF0; +D_2A9790 = 0x2A9790; +D_2AD270 = 0x2AD270; +D_2AD8F0 = 0x2AD8F0; +D_2B3F70 = 0x2B3F70; +D_2B46F0 = 0x2B46F0; +D_2B5350 = 0x2B5350; +D_2BD0A0 = 0x2BD0A0; +D_2BD6E0 = 0x2BD6E0; +D_2BDAC0 = 0x2BDAC0; +D_2BED20 = 0x2BED20; +D_2C3220 = 0x2C3220; +D_2C49D0 = 0x2C49D0; +D_2CF350 = 0x2CF350; +D_2D24C0 = 0x2D24C0; +D_2D5CB0 = 0x2D5CB0; +D_2D7890 = 0x2D7890; +D_2EA8C0 = 0x2EA8C0; +D_394100 = 0x394100; +D_3AEE50 = 0x3AEE50; +D_3B2AE0 = 0x3B2AE0; +D_3B6130 = 0x3B6130; +D_3B8530 = 0x3B8530; +D_3B8570 = 0x3B8570; +D_3B8960 = 0x3B8960; +D_3B9590 = 0x3B9590; +D_3BA190 = 0x3BA190; +D_3CB130 = 0x3CB130; +D_675FA0 = 0x675FA0; +D_696350 = 0x696350; +D_783760 = 0x783760; +D_1000800 = 0x1000800; +D_1001800 = 0x1001800; +D_1002480 = 0x1002480; +D_1002508 = 0x1002508; +D_1002590 = 0x1002590; +D_10025D0 = 0x10025D0; +D_1002650 = 0x1002650; +D_10026D0 = 0x10026D0; +D_1002750 = 0x1002750; +D_10027D0 = 0x10027D0; +D_1002850 = 0x1002850; +D_10028D0 = 0x10028D0; +D_1002950 = 0x1002950; +D_10029D0 = 0x10029D0; +D_1002A50 = 0x1002A50; +D_1002AD0 = 0x1002AD0; +D_1002B50 = 0x1002B50; +D_1002BD0 = 0x1002BD0; +D_1002C50 = 0x1002C50; +D_1002CD0 = 0x1002CD0; +D_1002D50 = 0x1002D50; +D_1002DD0 = 0x1002DD0; +D_1002E50 = 0x1002E50; +D_1002ED0 = 0x1002ED0; +D_1002F50 = 0x1002F50; +D_1002FD0 = 0x1002FD0; +D_1003050 = 0x1003050; +D_10030D0 = 0x10030D0; +D_1003150 = 0x1003150; +D_10031D0 = 0x10031D0; +D_1003750 = 0x1003750; +D_1003890 = 0x1003890; +D_1003930 = 0x1003930; +D_10039F0 = 0x10039F0; +D_1003AB0 = 0x1003AB0; +D_1003B70 = 0x1003B70; +D_1003C30 = 0x1003C30; +D_1003CF0 = 0x1003CF0; +D_1003DB0 = 0x1003DB0; +D_1003E50 = 0x1003E50; +D_1003E78 = 0x1003E78; +D_1003EA0 = 0x1003EA0; +D_1003EC8 = 0x1003EC8; +D_1003EF0 = 0x1003EF0; +D_1010101 = 0x1010101; +D_15C0000 = 0x15C0000; +D_2004000 = 0x2004000; +D_2004320 = 0x2004320; +D_3000000 = 0x3000000; +D_5001950 = 0x5001950; +D_5003AE8 = 0x5003AE8; +D_7FFFFFFF = 0x7FFFFFFF; +D_80000000 = 0x80000000; +D_80000004 = 0x80000004; +D_80000008 = 0x80000008; +D_8000000C = 0x8000000C; +D_800001A0 = 0x800001A0; +D_80000300 = 0x80000300; +D_80000308 = 0x80000308; +D_8000030C = 0x8000030C; +D_80000318 = 0x80000318; +D_8000031C = 0x8000031C; +D_800576E0 = 0x800576E0; +D_80057FC0 = 0x80057FC0; +D_80065FC0 = 0x80065FC0; +D_80066090 = 0x80066090; +D_80067420 = 0x80067420; +D_80068080 = 0x80068080; +D_80068B70 = 0x80068B70; +D_80068B74 = 0x80068B74; +D_80068B90 = 0x80068B90; +D_80068BA0 = 0x80068BA0; +D_80068BB0 = 0x80068BB0; +D_80068BC0 = 0x80068BC0; +D_80068BC4 = 0x80068BC4; +D_80068BC8 = 0x80068BC8; +D_80068C08 = 0x80068C08; +D_80068C18 = 0x80068C18; +D_80068C68 = 0x80068C68; +D_80068CA0 = 0x80068CA0; +D_80068CA4 = 0x80068CA4; +D_80068CA8 = 0x80068CA8; +D_80068CB0 = 0x80068CB0; +D_800695B0 = 0x800695B0; +D_80069630 = 0x80069630; +D_80069730 = 0x80069730; +D_80069778 = 0x80069778; +D_80069790 = 0x80069790; +D_800697B0 = 0x800697B0; +D_800697B4 = 0x800697B4; +D_800697B8 = 0x800697B8; +D_800697BC = 0x800697BC; +D_800697C0 = 0x800697C0; +D_800697C4 = 0x800697C4; +D_800697D0 = 0x800697D0; +D_800697E0 = 0x800697E0; +D_800697F0 = 0x800697F0; +D_8006A7F0 = 0x8006A7F0; +D_8006E7F0 = 0x8006E7F0; +D_8006F000 = 0x8006F000; +D_8006F004 = 0x8006F004; +D_8006F010 = 0x8006F010; +D_8006F050 = 0x8006F050; +D_8006F05C = 0x8006F05C; +D_8006F064 = 0x8006F064; +D_8006F080 = 0x8006F080; +D_8006F084 = 0x8006F084; +D_8006F088 = 0x8006F088; +D_8006F08C = 0x8006F08C; +D_8006F090 = 0x8006F090; +D_8006F094 = 0x8006F094; +D_8006F098 = 0x8006F098; +D_8006F09C = 0x8006F09C; +D_8006F0A0 = 0x8006F0A0; +D_8006F0A4 = 0x8006F0A4; +D_8006F120 = 0x8006F120; +D_8006F124 = 0x8006F124; +D_8006F1B4 = 0x8006F1B4; +D_8006F2A4 = 0x8006F2A4; +D_8006F2B0 = 0x8006F2B0; +D_8006F350 = 0x8006F350; +D_8006F3E0 = 0x8006F3E0; +D_8006F498 = 0x8006F498; +D_8006F4C0 = 0x8006F4C0; +D_8006F4E0 = 0x8006F4E0; +D_8006F518 = 0x8006F518; +D_8006F5A0 = 0x8006F5A0; +D_8006F610 = 0x8006F610; +D_8006F630 = 0x8006F630; +D_8006F710 = 0x8006F710; +D_8006F750 = 0x8006F750; +D_8006F768 = 0x8006F768; +D_8006F798 = 0x8006F798; +D_8006F7D0 = 0x8006F7D0; +D_8006FEE8 = 0x8006FEE8; +D_8006FF00 = 0x8006FF00; +D_80070F8A = 0x80070F8A; +D_80070F8B = 0x80070F8B; +D_80070F8C = 0x80070F8C; +D_80070F8D = 0x80070F8D; +D_80070F8E = 0x80070F8E; +D_80070F97 = 0x80070F97; +D_80070FA0 = 0x80070FA0; +D_80070FA6 = 0x80070FA6; +D_80072338 = 0x80072338; +D_80072B00 = 0x80072B00; +D_80072EDC = 0x80072EDC; +D_80072EF8 = 0x80072EF8; +D_80073030 = 0x80073030; +D_80073130 = 0x80073130; +D_80073230 = 0x80073230; +D_80073267 = 0x80073267; +D_800732FF = 0x800732FF; +D_800733BF = 0x800733BF; +D_80073457 = 0x80073457; +D_800734EF = 0x800734EF; +D_80073597 = 0x80073597; +D_80073640 = 0x80073640; +D_8007364C = 0x8007364C; +D_80073650 = 0x80073650; +D_80073660 = 0x80073660; +D_80075668 = 0x80075668; +D_8007566C = 0x8007566C; +D_80075674 = 0x80075674; +D_80075678 = 0x80075678; +D_8007567C = 0x8007567C; +D_80075684 = 0x80075684; +D_80075690 = 0x80075690; +D_80075890 = 0x80075890; +D_80075896 = 0x80075896; +D_800758A8 = 0x800758A8; +D_80075910 = 0x80075910; +D_80075940 = 0x80075940; +D_80075941 = 0x80075941; +D_80075942 = 0x80075942; +D_80075950 = 0x80075950; +D_80075951 = 0x80075951; +D_80075952 = 0x80075952; +D_8007596A = 0x8007596A; +D_80075F80 = 0x80075F80; +D_80075F84 = 0x80075F84; +D_80075F88 = 0x80075F88; +D_80075F90 = 0x80075F90; +D_80075F94 = 0x80075F94; +D_80075F98 = 0x80075F98; +D_80075F9C = 0x80075F9C; +D_80075FA0 = 0x80075FA0; +D_8007616C = 0x8007616C; +D_800761B0 = 0x800761B0; +D_8007625A = 0x8007625A; +D_8007626A = 0x8007626A; +D_80076270 = 0x80076270; +D_800762B0 = 0x800762B0; +D_800762C8 = 0x800762C8; +D_80076330 = 0x80076330; +D_800763B0 = 0x800763B0; +D_800765B4 = 0x800765B4; +D_800767B8 = 0x800767B8; +D_800769BC = 0x800769BC; +D_80076BC0 = 0x80076BC0; +D_80076DC4 = 0x80076DC4; +D_80076FC8 = 0x80076FC8; +D_800771CC = 0x800771CC; +D_800773D0 = 0x800773D0; +D_800775D4 = 0x800775D4; +D_800777A8 = 0x800777A8; +D_80077950 = 0x80077950; +D_80077970 = 0x80077970; +D_80077C64 = 0x80077C64; +D_80077C68 = 0x80077C68; +D_80077C6C = 0x80077C6C; +D_80077C70 = 0x80077C70; +D_80077C74 = 0x80077C74; +D_80077C78 = 0x80077C78; +D_80077C7C = 0x80077C7C; +D_80077C90 = 0x80077C90; +D_80077C94 = 0x80077C94; +D_80077C98 = 0x80077C98; +D_80077D5C = 0x80077D5C; +D_80077D90 = 0x80077D90; +D_80077D94 = 0x80077D94; +D_80077D98 = 0x80077D98; +D_80077D9C = 0x80077D9C; +D_80077DA0 = 0x80077DA0; +D_80077DA4 = 0x80077DA4; +D_80077DA8 = 0x80077DA8; +D_80077DAC = 0x80077DAC; +D_80077DB0 = 0x80077DB0; +D_80077DB4 = 0x80077DB4; +D_80077DB8 = 0x80077DB8; +D_80077DBC = 0x80077DBC; +D_80077DC0 = 0x80077DC0; +D_80077DC4 = 0x80077DC4; +D_80077DC8 = 0x80077DC8; +D_80077DCC = 0x80077DCC; +D_80077DD0 = 0x80077DD0; +D_80077DD4 = 0x80077DD4; +D_80077DD8 = 0x80077DD8; +D_80077DDC = 0x80077DDC; +D_80077DE0 = 0x80077DE0; +D_80077DE4 = 0x80077DE4; +D_80077DF0 = 0x80077DF0; +D_80077E00 = 0x80077E00; +D_80077E10 = 0x80077E10; +D_80077E18 = 0x80077E18; +D_80077E20 = 0x80077E20; +D_80077E28 = 0x80077E28; +D_80077E30 = 0x80077E30; +D_80077E38 = 0x80077E38; +D_80077E40 = 0x80077E40; +D_80077E48 = 0x80077E48; +D_80077E50 = 0x80077E50; +D_80077E58 = 0x80077E58; +D_80077E60 = 0x80077E60; +D_80077E68 = 0x80077E68; +D_80077E70 = 0x80077E70; +D_80077E78 = 0x80077E78; +D_80077E88 = 0x80077E88; +D_80077E90 = 0x80077E90; +D_80077E98 = 0x80077E98; +D_80077EA4 = 0x80077EA4; +D_80077EB4 = 0x80077EB4; +D_80077EC0 = 0x80077EC0; +D_80077ECC = 0x80077ECC; +D_80077ED8 = 0x80077ED8; +D_80077EE4 = 0x80077EE4; +D_80077EF0 = 0x80077EF0; +D_80077EF8 = 0x80077EF8; +D_80077F04 = 0x80077F04; +D_80077F0C = 0x80077F0C; +D_80077F14 = 0x80077F14; +D_80077F1C = 0x80077F1C; +D_80077F24 = 0x80077F24; +D_80077F2C = 0x80077F2C; +D_80077F34 = 0x80077F34; +D_80077F3C = 0x80077F3C; +D_80077F44 = 0x80077F44; +D_80077F50 = 0x80077F50; +D_80077F58 = 0x80077F58; +D_80077F60 = 0x80077F60; +D_80077F6C = 0x80077F6C; +D_80077F74 = 0x80077F74; +D_80077F7C = 0x80077F7C; +D_80077F88 = 0x80077F88; +D_80077F90 = 0x80077F90; +D_80077F98 = 0x80077F98; +D_80077FA4 = 0x80077FA4; +D_80077FAC = 0x80077FAC; +D_80077FB4 = 0x80077FB4; +D_80077FC0 = 0x80077FC0; +D_80077FC8 = 0x80077FC8; +D_80077FD0 = 0x80077FD0; +D_80077FD8 = 0x80077FD8; +D_80077FE4 = 0x80077FE4; +D_80077FEC = 0x80077FEC; +D_80077FF4 = 0x80077FF4; +D_80077FFC = 0x80077FFC; +D_80078004 = 0x80078004; +D_8007800C = 0x8007800C; +D_80078014 = 0x80078014; +D_8007801C = 0x8007801C; +D_80078024 = 0x80078024; +D_80078030 = 0x80078030; +D_80078038 = 0x80078038; +D_80078040 = 0x80078040; +D_80078048 = 0x80078048; +D_80078050 = 0x80078050; +D_80078058 = 0x80078058; +D_80078060 = 0x80078060; +D_80078068 = 0x80078068; +D_80078070 = 0x80078070; +D_80078078 = 0x80078078; +D_80078080 = 0x80078080; +D_80078088 = 0x80078088; +D_80078090 = 0x80078090; +D_80078098 = 0x80078098; +D_800780A0 = 0x800780A0; +D_800780A8 = 0x800780A8; +D_800780B3 = 0x800780B3; +D_800780B4 = 0x800780B4; +D_80078180 = 0x80078180; +D_800781E0 = 0x800781E0; +D_800782A4 = 0x800782A4; +D_80078388 = 0x80078388; +D_8007838C = 0x8007838C; +D_80078390 = 0x80078390; +D_80078394 = 0x80078394; +D_80078398 = 0x80078398; +D_8007839C = 0x8007839C; +D_800783A0 = 0x800783A0; +D_800783A4 = 0x800783A4; +D_800783B4 = 0x800783B4; +D_800783B8 = 0x800783B8; +D_800783BC = 0x800783BC; +D_800783C0 = 0x800783C0; +D_800783C4 = 0x800783C4; +D_800783C8 = 0x800783C8; +D_800783CC = 0x800783CC; +D_800783D0 = 0x800783D0; +D_800783D4 = 0x800783D4; +D_800783D8 = 0x800783D8; +D_800783DC = 0x800783DC; +D_800783E0 = 0x800783E0; +D_800783E4 = 0x800783E4; +D_800783E8 = 0x800783E8; +D_800783EC = 0x800783EC; +D_800783F0 = 0x800783F0; +D_800783F4 = 0x800783F4; +D_800783F8 = 0x800783F8; +D_800783FC = 0x800783FC; +D_80078400 = 0x80078400; +D_80078404 = 0x80078404; +D_80078408 = 0x80078408; +D_8007840C = 0x8007840C; +D_80078410 = 0x80078410; +D_80078446 = 0x80078446; +D_800784EA = 0x800784EA; +D_80078544 = 0x80078544; +D_80078548 = 0x80078548; +D_80078552 = 0x80078552; +D_80078554 = 0x80078554; +D_80078565 = 0x80078565; +D_80078568 = 0x80078568; +D_80078571 = 0x80078571; +D_80078580 = 0x80078580; +D_80078584 = 0x80078584; +D_80078590 = 0x80078590; +D_80078598 = 0x80078598; +D_800785A0 = 0x800785A0; +D_800785A4 = 0x800785A4; +D_800785A8 = 0x800785A8; +D_800785AC = 0x800785AC; +D_800785B0 = 0x800785B0; +D_800785B4 = 0x800785B4; +D_800785B8 = 0x800785B8; +D_800785BC = 0x800785BC; +D_800785CC = 0x800785CC; +D_800785F0 = 0x800785F0; +D_80078600 = 0x80078600; +D_800786FD = 0x800786FD; +D_800786FE = 0x800786FE; +D_80078700 = 0x80078700; +D_800789F4 = 0x800789F4; +D_800789F8 = 0x800789F8; +D_800789FC = 0x800789FC; +D_80078A00 = 0x80078A00; +D_80078A10 = 0x80078A10; +D_80078A14 = 0x80078A14; +D_80078A18 = 0x80078A18; +D_80078A1C = 0x80078A1C; +D_80078A20 = 0x80078A20; +D_80078A30 = 0x80078A30; +D_80078A34 = 0x80078A34; +D_80078A38 = 0x80078A38; +D_80078A3C = 0x80078A3C; +D_80078A40 = 0x80078A40; +D_80078A44 = 0x80078A44; +D_80078A48 = 0x80078A48; +D_80078A4C = 0x80078A4C; +D_80078A50 = 0x80078A50; +D_80078A60 = 0x80078A60; +D_80078E60 = 0x80078E60; +D_80078E64 = 0x80078E64; +D_80078E68 = 0x80078E68; +D_80078E70 = 0x80078E70; +D_80078E74 = 0x80078E74; +D_80078E78 = 0x80078E78; +D_80078E7C = 0x80078E7C; +D_80078E80 = 0x80078E80; +D_80078E83 = 0x80078E83; +D_80078E8B = 0x80078E8B; +D_80078E93 = 0x80078E93; +D_80078E9B = 0x80078E9B; +D_80078EA3 = 0x80078EA3; +D_80078EAB = 0x80078EAB; +D_80078EB3 = 0x80078EB3; +D_80078EBC = 0x80078EBC; +D_80078EBF = 0x80078EBF; +D_80078EC8 = 0x80078EC8; +D_80078ECC = 0x80078ECC; +D_80078ED0 = 0x80078ED0; +D_80078ED4 = 0x80078ED4; +D_80078ED8 = 0x80078ED8; +D_80078EDC = 0x80078EDC; +D_80078EE0 = 0x80078EE0; +D_80078EF0 = 0x80078EF0; +D_80078F00 = 0x80078F00; +D_80078F04 = 0x80078F04; +D_80078F08 = 0x80078F08; +D_80078F0C = 0x80078F0C; +D_80078F20 = 0x80078F20; +D_80078F24 = 0x80078F24; +D_80078F34 = 0x80078F34; +D_80078F44 = 0x80078F44; +D_80078F48 = 0x80078F48; +D_80078F4C = 0x80078F4C; +D_80078F50 = 0x80078F50; +D_80078F54 = 0x80078F54; +D_80078F64 = 0x80078F64; +D_80078F74 = 0x80078F74; +D_80078F84 = 0x80078F84; +D_80078F88 = 0x80078F88; +D_80078F8C = 0x80078F8C; +D_80078F9C = 0x80078F9C; +D_80078FA0 = 0x80078FA0; +D_80078FA4 = 0x80078FA4; +D_80078FA8 = 0x80078FA8; +D_80078FAC = 0x80078FAC; +D_80078FB0 = 0x80078FB0; +D_80078FC0 = 0x80078FC0; +D_80078FCC = 0x80078FCC; +D_80078FD8 = 0x80078FD8; +D_80078FE8 = 0x80078FE8; +D_80078FF8 = 0x80078FF8; +D_80079008 = 0x80079008; +D_8007900C = 0x8007900C; +D_80079010 = 0x80079010; +D_80079014 = 0x80079014; +D_80079018 = 0x80079018; +D_8007901C = 0x8007901C; +D_80079020 = 0x80079020; +D_80079024 = 0x80079024; +D_80079028 = 0x80079028; +D_8007902B = 0x8007902B; +D_80079033 = 0x80079033; +D_80079040 = 0x80079040; +D_80079043 = 0x80079043; +D_8007904C = 0x8007904C; +D_80079050 = 0x80079050; +D_80079054 = 0x80079054; +D_80079058 = 0x80079058; +D_8007905C = 0x8007905C; +D_80079060 = 0x80079060; +D_80079064 = 0x80079064; +D_8007906E = 0x8007906E; +D_8007906F = 0x8007906F; +D_80079364 = 0x80079364; +D_80079370 = 0x80079370; +D_800793D8 = 0x800793D8; +D_80079460 = 0x80079460; +D_80079488 = 0x80079488; +D_800794B0 = 0x800794B0; +D_800794D8 = 0x800794D8; +D_80079510 = 0x80079510; +D_80079514 = 0x80079514; +D_80079520 = 0x80079520; +D_80079560 = 0x80079560; +D_80079580 = 0x80079580; +D_80079590 = 0x80079590; +D_800795B0 = 0x800795B0; +D_80079610 = 0x80079610; +D_80079620 = 0x80079620; +D_80079628 = 0x80079628; +D_8007962C = 0x8007962C; +__osRunningThread = 0x80079630; +D_80079634 = 0x80079634; +D_80079640 = 0x80079640; +D_80079650 = 0x80079650; +D_80079654 = 0x80079654; +D_80079680 = 0x80079680; +D_80079690 = 0x80079690; +D_800796A0 = 0x800796A0; +D_800796A4 = 0x800796A4; +D_800796A8 = 0x800796A8; +D_800796AC = 0x800796AC; +D_800796B0 = 0x800796B0; +D_800796E0 = 0x800796E0; +D_8007A860 = 0x8007A860; +D_8007A868 = 0x8007A868; +D_8007A87C = 0x8007A87C; +D_8007A880 = 0x8007A880; +D_8007A930 = 0x8007A930; +D_8007A934 = 0x8007A934; +D_8007A940 = 0x8007A940; +D_8007A950 = 0x8007A950; +D_8007A960 = 0x8007A960; +D_8007A984 = 0x8007A984; +D_8007A9B0 = 0x8007A9B0; +D_8007A9C0 = 0x8007A9C0; +D_8007AA28 = 0x8007AA28; +D_8007AAB0 = 0x8007AAB0; +D_8007AAD8 = 0x8007AAD8; +D_8007AB00 = 0x8007AB00; +D_8007AB28 = 0x8007AB28; +D_8007AB50 = 0x8007AB50; +D_8007AC4E = 0x8007AC4E; +D_8007AC50 = 0x8007AC50; +D_8007AC90 = 0x8007AC90; +D_8007ACF0 = 0x8007ACF0; +D_8007ACF4 = 0x8007ACF4; +D_8007AD00 = 0x8007AD00; +D_8007AD50 = 0x8007AD50; +D_8007ADA0 = 0x8007ADA0; +D_8007ADF0 = 0x8007ADF0; +D_8007AE20 = 0x8007AE20; +D_8007AE40 = 0x8007AE40; +D_8007AE50 = 0x8007AE50; +D_8007AE60 = 0x8007AE60; +D_8007AE74 = 0x8007AE74; +D_8007AE90 = 0x8007AE90; +D_8007AEAC = 0x8007AEAC; +D_8007AEB0 = 0x8007AEB0; +jtbl_8007AEC0_code = 0x8007AEC0; +jtbl_8007AEDC_code = 0x8007AEDC; +D_8007AF10 = 0x8007AF10; +D_8007AF20 = 0x8007AF20; +D_8007AF34 = 0x8007AF34; +jtbl_8007AF50_code = 0x8007AF50; +jtbl_8007AFC0_code = 0x8007AFC0; +D_8007B1E4 = 0x8007B1E4; +D_8007B1F0 = 0x8007B1F0; +D_8007B200 = 0x8007B200; +D_8007B20C = 0x8007B20C; +D_8007B214 = 0x8007B214; +D_8007B224 = 0x8007B224; +D_8007B244 = 0x8007B244; +D_8007B264 = 0x8007B264; +D_8007B284 = 0x8007B284; +D_8007B2A4 = 0x8007B2A4; +D_8007B2C4 = 0x8007B2C4; +D_8007B2E4 = 0x8007B2E4; +D_8007B304 = 0x8007B304; +D_8007B324 = 0x8007B324; +D_8007B344 = 0x8007B344; +D_8007B364 = 0x8007B364; +D_8007B378 = 0x8007B378; +D_8007B384 = 0x8007B384; +D_8007B390 = 0x8007B390; +D_8007B3A0 = 0x8007B3A0; +D_8007B3AC = 0x8007B3AC; +D_8007B3B8 = 0x8007B3B8; +D_8007B3BC = 0x8007B3BC; +D_8007B3C0 = 0x8007B3C0; +D_8007B3CC = 0x8007B3CC; +D_8007B3DC = 0x8007B3DC; +D_8007B3EC = 0x8007B3EC; +jtbl_8007B400_code = 0x8007B400; +jtbl_8007B4C8_code = 0x8007B4C8; +jtbl_8007B508_code = 0x8007B508; +jtbl_8007B548_code = 0x8007B548; +D_8007B580 = 0x8007B580; +D_8007B584 = 0x8007B584; +D_8007B590 = 0x8007B590; +D_8007B5A0 = 0x8007B5A0; +D_8007B5B0 = 0x8007B5B0; +D_8007C0A0 = 0x8007C0A0; +D_8007C0B4 = 0x8007C0B4; +jtbl_8007C0C4_code = 0x8007C0C4; +jtbl_8007C0D8_code = 0x8007C0D8; +jtbl_8007C0EC_code = 0x8007C0EC; +D_8007C110 = 0x8007C110; +D_8007C118 = 0x8007C118; +D_8007C11C = 0x8007C11C; +D_8007C124 = 0x8007C124; +D_8007C12C = 0x8007C12C; +jtbl_8007C140_code = 0x8007C140; +jtbl_8007C160_code = 0x8007C160; +jtbl_8007C180_code = 0x8007C180; +jtbl_8007C1A0_code = 0x8007C1A0; +jtbl_8007C1C0_code = 0x8007C1C0; +jtbl_8007C1E0_code = 0x8007C1E0; +jtbl_8007C200_code = 0x8007C200; +jtbl_8007C220_code = 0x8007C220; +jtbl_8007C240_code = 0x8007C240; +jtbl_8007C260_code = 0x8007C260; +jtbl_8007C280_code = 0x8007C280; +jtbl_8007C2A0_code = 0x8007C2A0; +D_8007C2C0 = 0x8007C2C0; +D_8007C2C4 = 0x8007C2C4; +D_8007C2C8 = 0x8007C2C8; +D_8007C2CC = 0x8007C2CC; +jtbl_8007C2D0_code = 0x8007C2D0; +D_8007C3D0 = 0x8007C3D0; +D_8007C3D4 = 0x8007C3D4; +D_8007C3D8 = 0x8007C3D8; +D_8007C3DC = 0x8007C3DC; +D_8007C3E0 = 0x8007C3E0; +jtbl_8007C3E4_code = 0x8007C3E4; +jtbl_8007C404_code = 0x8007C404; +D_8007C430 = 0x8007C430; +jtbl_8007C440_code = 0x8007C440; +jtbl_8007C490_code = 0x8007C490; +jtbl_8007C4D0_code = 0x8007C4D0; +jtbl_8007C4F0_code = 0x8007C4F0; +D_8007C538 = 0x8007C538; +D_8007C540 = 0x8007C540; +D_8007C548 = 0x8007C548; +D_8007C550 = 0x8007C550; +D_8007C558 = 0x8007C558; +D_8007C560 = 0x8007C560; +D_8007C568 = 0x8007C568; +D_8007C570 = 0x8007C570; +D_8007C5B0 = 0x8007C5B0; +D_8007C5B4 = 0x8007C5B4; +D_8007C5B8 = 0x8007C5B8; +jtbl_8007C5BC_code = 0x8007C5BC; +D_8007C5D0 = 0x8007C5D0; +D_8007C5D4 = 0x8007C5D4; +D_8007C5D8 = 0x8007C5D8; +D_8007C5DC = 0x8007C5DC; +D_8007C5E0 = 0x8007C5E0; +D_8007C5E4 = 0x8007C5E4; +D_8007C5E8 = 0x8007C5E8; +D_8007C5EC = 0x8007C5EC; +D_8007C5F0 = 0x8007C5F0; +D_8007C5F4 = 0x8007C5F4; +jtbl_8007C5F8_code = 0x8007C5F8; +jtbl_8007C630_code = 0x8007C630; +D_8007C730 = 0x8007C730; +D_8007C740 = 0x8007C740; +D_8007C748 = 0x8007C748; +D_8007C750 = 0x8007C750; +D_8007C758 = 0x8007C758; +D_8007C760 = 0x8007C760; +D_8007C768 = 0x8007C768; +D_8007C770 = 0x8007C770; +D_8007C778 = 0x8007C778; +D_8007C780 = 0x8007C780; +D_8007C788 = 0x8007C788; +D_8007C790 = 0x8007C790; +D_8007C798 = 0x8007C798; +D_8007C7A0 = 0x8007C7A0; +D_8007C7A8 = 0x8007C7A8; +D_8007C7B0 = 0x8007C7B0; +D_8007C7B8 = 0x8007C7B8; +D_8007C7BC = 0x8007C7BC; +D_8007C7C0 = 0x8007C7C0; +jtbl_8007C7C4_code = 0x8007C7C4; +D_8007C7E0 = 0x8007C7E0; +D_8007C7E8 = 0x8007C7E8; +D_8007C7F0 = 0x8007C7F0; +D_8007C7F8 = 0x8007C7F8; +D_8007C800 = 0x8007C800; +D_8007C804 = 0x8007C804; +D_8007C808 = 0x8007C808; +jtbl_8007C810_code = 0x8007C810; +jtbl_8007C974_code = 0x8007C974; +jtbl_8007CA28_code = 0x8007CA28; +jtbl_8007CA40_code = 0x8007CA40; +D_8007CB80 = 0x8007CB80; +D_8007CB84 = 0x8007CB84; +D_8007CB88 = 0x8007CB88; +D_8007CB8C = 0x8007CB8C; +D_8007CB90 = 0x8007CB90; +jtbl_8007CB94_code = 0x8007CB94; +jtbl_8007CC00_code = 0x8007CC00; +jtbl_8007CC60_code = 0x8007CC60; +jtbl_8007CC80_code = 0x8007CC80; +D_8007CCC8 = 0x8007CCC8; +jtbl_8007CCD0_code = 0x8007CCD0; +jtbl_8007CCE8_code = 0x8007CCE8; +jtbl_8007CF40_code = 0x8007CF40; +jtbl_8007D1D0_code = 0x8007D1D0; +jtbl_8007D380_code = 0x8007D380; +jtbl_8007D3D0_code = 0x8007D3D0; +jtbl_8007D49C_code = 0x8007D49C; +D_8007D4C0 = 0x8007D4C0; +D_8007D4D0 = 0x8007D4D0; +D_8007D4D4 = 0x8007D4D4; +jtbl_8007D4E0_code = 0x8007D4E0; +jtbl_8007D4F8_code = 0x8007D4F8; +jtbl_8007D510_code = 0x8007D510; +jtbl_8007D680_code = 0x8007D680; +jtbl_8007D6C0_code = 0x8007D6C0; +jtbl_8007D6D4_code = 0x8007D6D4; +jtbl_8007D6F0_code = 0x8007D6F0; +D_8007D708 = 0x8007D708; +jtbl_8007D710_code = 0x8007D710; +jtbl_8007D72C_code = 0x8007D72C; +jtbl_8007D75C_code = 0x8007D75C; +jtbl_8007D788_code = 0x8007D788; +jtbl_8007D7AC_code = 0x8007D7AC; +jtbl_8007D7CC_code = 0x8007D7CC; +D_8007D7E8 = 0x8007D7E8; +D_8007D7F0 = 0x8007D7F0; +D_8007D7F8 = 0x8007D7F8; +jtbl_8007D800_code = 0x8007D800; +jtbl_8007D844_code = 0x8007D844; +jtbl_8007D858_code = 0x8007D858; +D_8007D8A8 = 0x8007D8A8; +D_8007D8B0 = 0x8007D8B0; +D_8007D8B8 = 0x8007D8B8; +jtbl_8007D8C0_code = 0x8007D8C0; +jtbl_8007D91C_code = 0x8007D91C; +jtbl_8007D960_code = 0x8007D960; +jtbl_8007D98C_code = 0x8007D98C; +jtbl_8007D9D0_code = 0x8007D9D0; +D_8007D9E8 = 0x8007D9E8; +jtbl_8007DA00_code = 0x8007DA00; +D_8007DA20 = 0x8007DA20; +D_8007DA30 = 0x8007DA30; +D_8007DA40 = 0x8007DA40; +jtbl_8007DA48_code = 0x8007DA48; +jtbl_8007DA80_code = 0x8007DA80; +jtbl_8007DAB8_code = 0x8007DAB8; +D_8007DAF0 = 0x8007DAF0; +D_8007DAF2 = 0x8007DAF2; +jtbl_8007DB00_code = 0x8007DB00; +jtbl_8007DB34_code = 0x8007DB34; +D_8007DB78 = 0x8007DB78; +D_8007DB84 = 0x8007DB84; +D_8007DB96 = 0x8007DB96; +D_8007DB98 = 0x8007DB98; +D_8007DC78 = 0x8007DC78; +D_8007DC98 = 0x8007DC98; +D_8007DD06 = 0x8007DD06; +D_8007DD18 = 0x8007DD18; +D_8007DD28 = 0x8007DD28; +D_8007DD50 = 0x8007DD50; +D_8007DE4F = 0x8007DE4F; +D_8007DF50 = 0x8007DF50; +jtbl_8007E150_code = 0x8007E150; +D_8007E170 = 0x8007E170; +D_8007E1B0 = 0x8007E1B0; +D_8007E1F0 = 0x8007E1F0; +D_8007E1F8 = 0x8007E1F8; +D_8007E210 = 0x8007E210; +D_8007E290 = 0x8007E290; +D_8007E2B8 = 0x8007E2B8; +D_8007E2C0 = 0x8007E2C0; +D_8007E2C8 = 0x8007E2C8; +D_8007E2D0 = 0x8007E2D0; +D_8007E2E0 = 0x8007E2E0; +jtbl_8007E300_code = 0x8007E300; +jtbl_8007E330_code = 0x8007E330; +D_8007E350 = 0x8007E350; +D_8007E360 = 0x8007E360; +jtbl_8007E370_code = 0x8007E370; +D_8007E390 = 0x8007E390; +D_8007E394 = 0x8007E394; +D_8007E39C = 0x8007E39C; +jtbl_8007E3B4_code = 0x8007E3B4; +D_8007E490 = 0x8007E490; +D_8007E4A0 = 0x8007E4A0; +D_8007E4B0 = 0x8007E4B0; +jtbl_8007E4C0_code = 0x8007E4C0; +D_8007E4D8 = 0x8007E4D8; +jtbl_8007E4E0_code = 0x8007E4E0; +D_8007E528 = 0x8007E528; +D_8007E530 = 0x8007E530; +jtbl_8007E540_code = 0x8007E540; +D_8007E568 = 0x8007E568; +D_8007E570 = 0x8007E570; +D_8007E580 = 0x8007E580; +D_8007E5A8 = 0x8007E5A8; +D_8007E5B0 = 0x8007E5B0; +D_8007E5B8 = 0x8007E5B8; +D_8007E5C0 = 0x8007E5C0; +D_8007E5D0 = 0x8007E5D0; +D_8007E5E0 = 0x8007E5E0; +D_8007E628 = 0x8007E628; +D_8007E62C = 0x8007E62C; +D_8007E630 = 0x8007E630; +D_8007E638 = 0x8007E638; +D_8007E640 = 0x8007E640; +D_8007E648 = 0x8007E648; +D_8007E650 = 0x8007E650; +D_8007EA70 = 0x8007EA70; +D_8007ED20 = 0x8007ED20; +D_8007ED80 = 0x8007ED80; +D_8007F180 = 0x8007F180; +D_8007F730 = 0x8007F730; +D_80080001 = 0x80080001; +D_800818E0 = 0x800818E0; +D_800818F8 = 0x800818F8; +D_80081900 = 0x80081900; +D_80083AB0 = 0x80083AB0; +D_80083ACC = 0x80083ACC; +D_80083B4C = 0x80083B4C; +D_80083B8C = 0x80083B8C; +D_80083BCC = 0x80083BCC; +D_80083BD0 = 0x80083BD0; +D_80083BD4 = 0x80083BD4; +D_80083BEC = 0x80083BEC; +D_80083C04 = 0x80083C04; +D_80083C1C = 0x80083C1C; +D_80083C20 = 0x80083C20; +D_80083C24 = 0x80083C24; +D_80083C25 = 0x80083C25; +D_80083C26 = 0x80083C26; +D_80083C27 = 0x80083C27; +D_80083C28 = 0x80083C28; +D_80083C29 = 0x80083C29; +D_80083C2C = 0x80083C2C; +D_80083C30 = 0x80083C30; +D_80083C34 = 0x80083C34; +D_80083CA0 = 0x80083CA0; +D_80084680 = 0x80084680; +D_80084684 = 0x80084684; +D_80084688 = 0x80084688; +D_8008468C = 0x8008468C; +D_800846A4 = 0x800846A4; +D_800846C0 = 0x800846C0; +D_8008472C = 0x8008472C; +D_8008473C = 0x8008473C; +D_8008474C = 0x8008474C; +D_80084758 = 0x80084758; +D_80084760 = 0x80084760; +D_80084860 = 0x80084860; +D_80084C68 = 0x80084C68; +D_80085870 = 0x80085870; +D_800A5870 = 0x800A5870; +D_800A58F0 = 0x800A58F0; +D_800A6070 = 0x800A6070; +D_800A6074 = 0x800A6074; +D_800A608C = 0x800A608C; +D_800A60A0 = 0x800A60A0; +D_800A60B0 = 0x800A60B0; +D_800A60C0 = 0x800A60C0; +D_800A62C0 = 0x800A62C0; +D_800A62D8 = 0x800A62D8; +D_800A62E0 = 0x800A62E0; +D_800A6C90 = 0x800A6C90; +D_800A6CD0 = 0x800A6CD0; +D_800A6CE8 = 0x800A6CE8; +D_800A6CEC = 0x800A6CEC; +D_800A6CF0 = 0x800A6CF0; +D_800A6CF4 = 0x800A6CF4; +D_800A6D18 = 0x800A6D18; +D_800A6D20 = 0x800A6D20; +D_800A7300 = 0x800A7300; +D_800A7308 = 0x800A7308; +D_800A730C = 0x800A730C; +D_800A7310 = 0x800A7310; +D_800A7320 = 0x800A7320; +D_800A733C = 0x800A733C; +D_800A7340 = 0x800A7340; +D_800A7344 = 0x800A7344; +D_800A7360 = 0x800A7360; +D_800A7364 = 0x800A7364; +D_800A7368 = 0x800A7368; +D_800A7384 = 0x800A7384; +D_800A7388 = 0x800A7388; +D_800A738C = 0x800A738C; +D_800A73A8 = 0x800A73A8; +D_800A73AC = 0x800A73AC; +D_800A73B0 = 0x800A73B0; +D_800A73C8 = 0x800A73C8; +D_800A73C9 = 0x800A73C9; +D_800A73D0 = 0x800A73D0; +D_800A73D4 = 0x800A73D4; +D_800A73D8 = 0x800A73D8; +D_800A73DC = 0x800A73DC; +D_800A73E0 = 0x800A73E0; +D_800A73E6 = 0x800A73E6; +D_800A73EC = 0x800A73EC; +D_800A73F2 = 0x800A73F2; +D_800A73F8 = 0x800A73F8; +D_800A73FC = 0x800A73FC; +D_800A7400 = 0x800A7400; +D_800A7420 = 0x800A7420; +D_800A7428 = 0x800A7428; +D_800A742C = 0x800A742C; +D_800A7430 = 0x800A7430; +D_800A7440 = 0x800A7440; +D_800A7450 = 0x800A7450; +D_800A7454 = 0x800A7454; +D_800A7458 = 0x800A7458; +D_800A7464 = 0x800A7464; +D_800A7468 = 0x800A7468; +D_800A74B0 = 0x800A74B0; +D_800A74C0 = 0x800A74C0; +D_800A7E70 = 0x800A7E70; +D_800A7E88 = 0x800A7E88; +D_800A7E8C = 0x800A7E8C; +D_800A7E90 = 0x800A7E90; +D_800A7EA0 = 0x800A7EA0; +D_800A8100 = 0x800A8100; +D_800A82A0 = 0x800A82A0; +D_800A82A4 = 0x800A82A4; +D_800A82A5 = 0x800A82A5; +D_800A82A6 = 0x800A82A6; +D_800A82A7 = 0x800A82A7; +D_800A82A8 = 0x800A82A8; +D_800A82AC = 0x800A82AC; +D_800A82B0 = 0x800A82B0; +D_800A82CF = 0x800A82CF; +D_800A82D0 = 0x800A82D0; +D_800A82D4 = 0x800A82D4; +D_800A82D8 = 0x800A82D8; +D_800A82D9 = 0x800A82D9; +D_800A82DC = 0x800A82DC; +D_800A82E0 = 0x800A82E0; +D_800A82F0 = 0x800A82F0; +D_800A82F2 = 0x800A82F2; +D_800A82F4 = 0x800A82F4; +D_800A82F8 = 0x800A82F8; +D_800A82FC = 0x800A82FC; +D_800A8300 = 0x800A8300; +D_800A8308 = 0x800A8308; +D_800A8320 = 0x800A8320; +D_800A8324 = 0x800A8324; +D_800A8325 = 0x800A8325; +D_800A8326 = 0x800A8326; +D_800A8327 = 0x800A8327; +D_800A8328 = 0x800A8328; +D_800A8329 = 0x800A8329; +D_800A832C = 0x800A832C; +D_800A8330 = 0x800A8330; +D_800A8394 = 0x800A8394; +D_800A8398 = 0x800A8398; +D_800A83A0 = 0x800A83A0; +D_800A83A8 = 0x800A83A8; +D_800A83AC = 0x800A83AC; +D_800A8410 = 0x800A8410; +D_800A8414 = 0x800A8414; +D_800A8478 = 0x800A8478; +D_800A847C = 0x800A847C; +D_800A8480 = 0x800A8480; +D_800AA660 = 0x800AA660; +D_800AA664 = 0x800AA664; +D_800AA668 = 0x800AA668; +D_800AA670 = 0x800AA670; +D_800AA680 = 0x800AA680; +D_800AA688 = 0x800AA688; +D_800AA690 = 0x800AA690; +D_800AA694 = 0x800AA694; +D_800AA698 = 0x800AA698; +D_800AA6B0 = 0x800AA6B0; +D_800AA6C0 = 0x800AA6C0; +D_800AA6C8 = 0x800AA6C8; +D_800AA8C8 = 0x800AA8C8; +D_800AB968 = 0x800AB968; +D_800AB970 = 0x800AB970; +D_800ABAF0 = 0x800ABAF0; +D_800ABB00 = 0x800ABB00; +D_800ABB04 = 0x800ABB04; +D_800ABB08 = 0x800ABB08; +D_800ABB10 = 0x800ABB10; +D_800ABB11 = 0x800ABB11; +D_800ABB28 = 0x800ABB28; +D_800ABB2C = 0x800ABB2C; +D_800ABB30 = 0x800ABB30; +D_800ABB34 = 0x800ABB34; +D_800ABB38 = 0x800ABB38; +D_800ABB3C = 0x800ABB3C; +D_800ABB40 = 0x800ABB40; +D_800ABB44 = 0x800ABB44; +D_800ABB48 = 0x800ABB48; +D_800ABB4C = 0x800ABB4C; +D_800ABB4D = 0x800ABB4D; +D_800ABB4E = 0x800ABB4E; +D_800ABB4F = 0x800ABB4F; +D_800ABB50 = 0x800ABB50; +D_800ABCB8 = 0x800ABCB8; +D_800ABCBC = 0x800ABCBC; +D_800ABCC0 = 0x800ABCC0; +D_800ABCF0 = 0x800ABCF0; +D_800ABD00 = 0x800ABD00; +D_800ABD20 = 0x800ABD20; +D_800ABD30 = 0x800ABD30; +D_800ABD34 = 0x800ABD34; +D_800ABD38 = 0x800ABD38; +D_800ABD78 = 0x800ABD78; +D_800ABDF8 = 0x800ABDF8; +D_800ABDFA = 0x800ABDFA; +D_800ABDFE = 0x800ABDFE; +D_800ABE00 = 0x800ABE00; +D_800ABE10 = 0x800ABE10; +D_800AC7C0 = 0x800AC7C0; +D_800AC7E0 = 0x800AC7E0; +D_800AC7F8 = 0x800AC7F8; +D_800AC7FC = 0x800AC7FC; +D_800AC814 = 0x800AC814; +D_800AC818 = 0x800AC818; +D_800AC81C = 0x800AC81C; +D_800AC820 = 0x800AC820; +D_800AC824 = 0x800AC824; +D_800AC830 = 0x800AC830; +D_800AC834 = 0x800AC834; +D_800AC840 = 0x800AC840; +D_800AC858 = 0x800AC858; +D_800AC870 = 0x800AC870; +D_800AC888 = 0x800AC888; +D_800AC88C = 0x800AC88C; +D_800AC890 = 0x800AC890; +D_800AC8B0 = 0x800AC8B0; +D_800AC8D0 = 0x800AC8D0; +D_800AC8F0 = 0x800AC8F0; +D_800AC910 = 0x800AC910; +D_800AC912 = 0x800AC912; +D_800AC913 = 0x800AC913; +D_800AC914 = 0x800AC914; +D_800AC915 = 0x800AC915; +D_800AC960 = 0x800AC960; +D_800AC964 = 0x800AC964; +D_800ACA70 = 0x800ACA70; +D_800ACA74 = 0x800ACA74; +D_800ACA75 = 0x800ACA75; +D_800ACA78 = 0x800ACA78; +D_800ACA90 = 0x800ACA90; +D_800ADA1B = 0x800ADA1B; +D_800AE4E0 = 0x800AE4E0; +D_800AE4E8 = 0x800AE4E8; +D_800AE4EC = 0x800AE4EC; +D_800AE504 = 0x800AE504; +D_800AE510 = 0x800AE510; +D_800AE520 = 0x800AE520; +D_800AE540 = 0x800AE540; +D_800AE542 = 0x800AE542; +D_800AE543 = 0x800AE543; +D_800AE544 = 0x800AE544; +D_800AE548 = 0x800AE548; +D_800AEDB0 = 0x800AEDB0; +D_800AF6D4 = 0x800AF6D4; +D_800AF6DC = 0x800AF6DC; +D_800AF6FC = 0x800AF6FC; +D_800AF724 = 0x800AF724; +D_800AF732 = 0x800AF732; +D_800AF735 = 0x800AF735; +D_800AF736 = 0x800AF736; +D_800AF738 = 0x800AF738; +D_800AF740 = 0x800AF740; +D_800AF744 = 0x800AF744; +D_800AF750 = 0x800AF750; +D_800AF768 = 0x800AF768; +D_800AF778 = 0x800AF778; +D_800AF780 = 0x800AF780; +D_800AF788 = 0x800AF788; +D_800AF790 = 0x800AF790; +D_800AF798 = 0x800AF798; +D_800AF7A0 = 0x800AF7A0; +D_800AF7A8 = 0x800AF7A8; +D_800AF7AC = 0x800AF7AC; +D_800AF7AE = 0x800AF7AE; +D_800AF7B0 = 0x800AF7B0; +D_800AF7B4 = 0x800AF7B4; +D_800AF7C0 = 0x800AF7C0; +D_800AF7C8 = 0x800AF7C8; +D_800AFFC8 = 0x800AFFC8; +D_800B2EA8 = 0x800B2EA8; +D_800B2F50 = 0x800B2F50; +D_800B2F58 = 0x800B2F58; +D_800B3258 = 0x800B3258; +D_800B32A0 = 0x800B32A0; +D_800FC680 = 0x800FC680; +D_800FC684 = 0x800FC684; +D_800FC688 = 0x800FC688; +D_800FC68C = 0x800FC68C; +D_800FC690 = 0x800FC690; +D_800FC698 = 0x800FC698; +D_800FC6A4 = 0x800FC6A4; +D_800FC6A8 = 0x800FC6A8; +D_800FC6AC = 0x800FC6AC; +D_800FC6B0 = 0x800FC6B0; +D_800FC6C0 = 0x800FC6C0; +D_800FC6CC = 0x800FC6CC; +D_800FC6D0 = 0x800FC6D0; +D_800FC6D4 = 0x800FC6D4; +D_800FC6D8 = 0x800FC6D8; +D_800FC6DC = 0x800FC6DC; +D_800FC6E0 = 0x800FC6E0; +D_800FC6E4 = 0x800FC6E4; +D_800FC6E8 = 0x800FC6E8; +D_800FC6EC = 0x800FC6EC; +D_800FC6F0 = 0x800FC6F0; +D_800FC6F4 = 0x800FC6F4; +D_800FC6F8 = 0x800FC6F8; +D_800FC6FC = 0x800FC6FC; +D_800FC700 = 0x800FC700; +D_800FC704 = 0x800FC704; +D_800FC708 = 0x800FC708; +D_800FC714 = 0x800FC714; +D_800FC798 = 0x800FC798; +D_800FC7A0 = 0x800FC7A0; +D_800FC7B8 = 0x800FC7B8; +D_800FC7CC = 0x800FC7CC; +D_800FC7D0 = 0x800FC7D0; +D_800FC7D4 = 0x800FC7D4; +D_800FC7D8 = 0x800FC7D8; +D_800FC7DC = 0x800FC7DC; +D_800FC7DE = 0x800FC7DE; +D_800FC7E0 = 0x800FC7E0; +D_800FC7E4 = 0x800FC7E4; +D_800FC7E8 = 0x800FC7E8; +D_800FC7EC = 0x800FC7EC; +D_800FC7F0 = 0x800FC7F0; +D_800FC7F4 = 0x800FC7F4; +D_800FC7F8 = 0x800FC7F8; +D_800FC7FC = 0x800FC7FC; +D_800FC800 = 0x800FC800; +D_800FC804 = 0x800FC804; +D_800FC808 = 0x800FC808; +D_800FC80C = 0x800FC80C; +D_800FC810 = 0x800FC810; +D_800FC814 = 0x800FC814; +D_800FC818 = 0x800FC818; +D_800FC81C = 0x800FC81C; +D_800FC820 = 0x800FC820; +D_800FC824 = 0x800FC824; +D_800FC825 = 0x800FC825; +D_800FC828 = 0x800FC828; +D_800FC830 = 0x800FC830; +D_800FC838 = 0x800FC838; +D_800FC83C = 0x800FC83C; +D_800FCA68 = 0x800FCA68; +D_800FCAB8 = 0x800FCAB8; +D_800FCAC4 = 0x800FCAC4; +D_800FCAC8 = 0x800FCAC8; +D_800FCACC = 0x800FCACC; +D_800FCAD0 = 0x800FCAD0; +D_800FCAD4 = 0x800FCAD4; +D_800FCAD8 = 0x800FCAD8; +D_800FCAE0 = 0x800FCAE0; +D_800FCAF8 = 0x800FCAF8; +D_800FCAFC = 0x800FCAFC; +D_800FCB00 = 0x800FCB00; +D_800FCB04 = 0x800FCB04; +D_800FCB08 = 0x800FCB08; +D_800FCB18 = 0x800FCB18; +D_800FCB1C = 0x800FCB1C; +D_800FCB28 = 0x800FCB28; +D_800FCB2C = 0x800FCB2C; +D_800FCB30 = 0x800FCB30; +D_800FCB38 = 0x800FCB38; +D_800FCB48 = 0x800FCB48; +D_800FCBC0 = 0x800FCBC0; +D_800FCC50 = 0x800FCC50; +D_800FCCA0 = 0x800FCCA0; +D_800FCCA1 = 0x800FCCA1; +D_800FCCA2 = 0x800FCCA2; +D_800FCCA4 = 0x800FCCA4; +D_800FCCA8 = 0x800FCCA8; +D_800FCCAC = 0x800FCCAC; +D_800FCCAD = 0x800FCCAD; +D_800FCCAE = 0x800FCCAE; +D_800FCCAF = 0x800FCCAF; +D_800FCCB0 = 0x800FCCB0; +D_800FCCB1 = 0x800FCCB1; +D_800FCCB2 = 0x800FCCB2; +D_800FCCB3 = 0x800FCCB3; +D_800FCCB4 = 0x800FCCB4; +D_800FCCB5 = 0x800FCCB5; +D_800FCCB6 = 0x800FCCB6; +D_800FCCB7 = 0x800FCCB7; +D_800FCCB8 = 0x800FCCB8; +D_800FCCBA = 0x800FCCBA; +D_800FCCBC = 0x800FCCBC; +D_800FCCBE = 0x800FCCBE; +D_800FCCC0 = 0x800FCCC0; +D_800FCCC2 = 0x800FCCC2; +D_800FCCC4 = 0x800FCCC4; +D_800FCCC6 = 0x800FCCC6; +D_800FCCC8 = 0x800FCCC8; +D_800FCCCA = 0x800FCCCA; +D_800FCCCC = 0x800FCCCC; +D_800FCCCE = 0x800FCCCE; +D_800FCCD0 = 0x800FCCD0; +D_800FCCD2 = 0x800FCCD2; +D_800FCCD4 = 0x800FCCD4; +D_800FCCD6 = 0x800FCCD6; +D_800FCCD8 = 0x800FCCD8; +D_800FCCED = 0x800FCCED; +D_800FCCF0 = 0x800FCCF0; +D_800FCD18 = 0x800FCD18; +D_800FCD48 = 0x800FCD48; +D_800FCD49 = 0x800FCD49; +D_800FCD4A = 0x800FCD4A; +D_800FCD4B = 0x800FCD4B; +D_800FCD4C = 0x800FCD4C; +D_800FCD4D = 0x800FCD4D; +D_800FCD4E = 0x800FCD4E; +D_800FCD4F = 0x800FCD4F; +D_800FCD50 = 0x800FCD50; +D_800FCD51 = 0x800FCD51; +D_800FCD52 = 0x800FCD52; +D_800FCD53 = 0x800FCD53; +D_800FCD58 = 0x800FCD58; +D_800FCD59 = 0x800FCD59; +D_800FCD5A = 0x800FCD5A; +D_800FCD5B = 0x800FCD5B; +D_800FCD60 = 0x800FCD60; +D_800FCD61 = 0x800FCD61; +D_800FCD62 = 0x800FCD62; +D_800FCD63 = 0x800FCD63; +D_800FCD68 = 0x800FCD68; +D_800FCD70 = 0x800FCD70; +D_800FCD71 = 0x800FCD71; +D_800FCD72 = 0x800FCD72; +D_800FCD73 = 0x800FCD73; +D_800FCD74 = 0x800FCD74; +D_800FCD75 = 0x800FCD75; +D_800FCD76 = 0x800FCD76; +D_800FCD77 = 0x800FCD77; +D_800FCD78 = 0x800FCD78; +D_800FCD79 = 0x800FCD79; +D_800FCD7A = 0x800FCD7A; +D_800FCD7B = 0x800FCD7B; +D_800FCD7C = 0x800FCD7C; +D_800FCD7D = 0x800FCD7D; +D_800FCD7E = 0x800FCD7E; +D_800FCD7F = 0x800FCD7F; +D_800FCD80 = 0x800FCD80; +D_800FCD81 = 0x800FCD81; +D_800FCD82 = 0x800FCD82; +D_800FCD83 = 0x800FCD83; +D_800FCD98 = 0x800FCD98; +D_800FCD9C = 0x800FCD9C; +D_800FCDA0 = 0x800FCDA0; +D_800FCDA4 = 0x800FCDA4; +D_800FCDA8 = 0x800FCDA8; +D_800FCDAC = 0x800FCDAC; +D_800FCDB0 = 0x800FCDB0; +D_800FCDB4 = 0x800FCDB4; +D_800FCDB8 = 0x800FCDB8; +D_800FCDBC = 0x800FCDBC; +D_800FCDC0 = 0x800FCDC0; +D_800FCDC4 = 0x800FCDC4; +D_800FCDC8 = 0x800FCDC8; +D_800FCDCC = 0x800FCDCC; +D_800FCDD0 = 0x800FCDD0; +D_800FCDD4 = 0x800FCDD4; +D_800FCE18 = 0x800FCE18; +D_800FCE19 = 0x800FCE19; +D_800FCE1A = 0x800FCE1A; +D_800FCE1B = 0x800FCE1B; +D_800FCE20 = 0x800FCE20; +D_800FCE21 = 0x800FCE21; +D_800FCE22 = 0x800FCE22; +D_800FCE23 = 0x800FCE23; +D_800FCE28 = 0x800FCE28; +D_800FCE30 = 0x800FCE30; +D_800FCE31 = 0x800FCE31; +D_800FCE32 = 0x800FCE32; +D_800FCE33 = 0x800FCE33; +D_800FCE38 = 0x800FCE38; +D_800FCE40 = 0x800FCE40; +D_800FCE41 = 0x800FCE41; +D_800FCE48 = 0x800FCE48; +D_800FCE68 = 0x800FCE68; +D_800FCE88 = 0x800FCE88; +D_800FCEA8 = 0x800FCEA8; +D_800FCEA9 = 0x800FCEA9; +D_800FCEAA = 0x800FCEAA; +D_800FCEAB = 0x800FCEAB; +D_800FCEB0 = 0x800FCEB0; +D_800FCEB2 = 0x800FCEB2; +D_800FCEB4 = 0x800FCEB4; +D_800FCEB6 = 0x800FCEB6; +D_800FCEB7 = 0x800FCEB7; +D_800FCEB8 = 0x800FCEB8; +D_800FCEC0 = 0x800FCEC0; +D_800FCEC8 = 0x800FCEC8; +D_800FCECC = 0x800FCECC; +D_800FCECD = 0x800FCECD; +D_800FCED0 = 0x800FCED0; +D_800FCED8 = 0x800FCED8; +D_800FCEE0 = 0x800FCEE0; +D_800FCEE8 = 0x800FCEE8; +D_800FCEEC = 0x800FCEEC; +D_800FCEF0 = 0x800FCEF0; +D_800FCEF8 = 0x800FCEF8; +D_800FCF00 = 0x800FCF00; +D_800FCF08 = 0x800FCF08; +D_800FCF10 = 0x800FCF10; +D_800FCF1C = 0x800FCF1C; +D_800FCF20 = 0x800FCF20; +D_800FCF24 = 0x800FCF24; +D_800FCF28 = 0x800FCF28; +D_800FCF30 = 0x800FCF30; +D_800FCF38 = 0x800FCF38; +D_800FCF40 = 0x800FCF40; +D_800FCF58 = 0x800FCF58; +D_800FCF60 = 0x800FCF60; +D_800FCF90 = 0x800FCF90; +D_800FCFB8 = 0x800FCFB8; +D_800FCFD8 = 0x800FCFD8; +D_800FD004 = 0x800FD004; +D_800FD008 = 0x800FD008; +D_800FD009 = 0x800FD009; +D_800FD00A = 0x800FD00A; +D_800FD00C = 0x800FD00C; +D_800FD015 = 0x800FD015; +D_800FD016 = 0x800FD016; +D_800FD017 = 0x800FD017; +D_800FD019 = 0x800FD019; +D_800FD01B = 0x800FD01B; +D_800FD028 = 0x800FD028; +D_800FD02A = 0x800FD02A; +D_800FD030 = 0x800FD030; +D_800FD048 = 0x800FD048; +D_800FD068 = 0x800FD068; +D_800FD06E = 0x800FD06E; +D_800FD6A0 = 0x800FD6A0; +D_800FD6A8 = 0x800FD6A8; +D_800FD6AC = 0x800FD6AC; +D_800FD6E0 = 0x800FD6E0; +D_800FD6E1 = 0x800FD6E1; +D_800FD6E4 = 0x800FD6E4; +D_800FD6E8 = 0x800FD6E8; +D_800FD6F0 = 0x800FD6F0; +D_800FD6F4 = 0x800FD6F4; +D_800FD6F8 = 0x800FD6F8; +D_800FF978 = 0x800FF978; +D_800FF97C = 0x800FF97C; +D_800FF980 = 0x800FF980; +D_800FF990 = 0x800FF990; +D_800FF9A8 = 0x800FF9A8; +D_800FF9AC = 0x800FF9AC; +D_800FF9B0 = 0x800FF9B0; +D_800FF9B4 = 0x800FF9B4; +D_800FF9C0 = 0x800FF9C0; +D_800FF9D0 = 0x800FF9D0; +D_800FF9E8 = 0x800FF9E8; +D_800FF9F0 = 0x800FF9F0; +D_800FF9F5 = 0x800FF9F5; +D_800FFAD8 = 0x800FFAD8; +D_800FFC88 = 0x800FFC88; +D_800FFFFF = 0x800FFFFF; +D_80100238 = 0x80100238; +D_80100638 = 0x80100638; +D_80100650 = 0x80100650; +D_80100668 = 0x80100668; +D_80100680 = 0x80100680; +D_80100698 = 0x80100698; +D_801006B0 = 0x801006B0; +D_801006B4 = 0x801006B4; +D_801006B8 = 0x801006B8; +D_801006C0 = 0x801006C0; +D_801006C4 = 0x801006C4; +D_801006C8 = 0x801006C8; +D_801006CC = 0x801006CC; +D_801006D0 = 0x801006D0; +D_801006D4 = 0x801006D4; +D_801006D5 = 0x801006D5; +D_801006D6 = 0x801006D6; +D_801006D8 = 0x801006D8; +D_801006E0 = 0x801006E0; +D_801006E2 = 0x801006E2; +D_801006E6 = 0x801006E6; +D_801006EC = 0x801006EC; +D_801006F0 = 0x801006F0; +D_801006F8 = 0x801006F8; +D_80100710 = 0x80100710; +D_80100718 = 0x80100718; +D_80100730 = 0x80100730; +D_80100740 = 0x80100740; +D_80100754 = 0x80100754; +D_801007C0 = 0x801007C0; +D_801007D4 = 0x801007D4; +D_80100834 = 0x80100834; +D_80100840 = 0x80100840; +D_80100844 = 0x80100844; +D_80100850 = 0x80100850; +D_80100870 = 0x80100870; +D_80100938 = 0x80100938; +D_80100940 = 0x80100940; +D_80100CE0 = 0x80100CE0; +D_80101080 = 0x80101080; +D_80101084 = 0x80101084; +D_80101088 = 0x80101088; +D_80101089 = 0x80101089; +D_8010108C = 0x8010108C; +D_80101090 = 0x80101090; +D_801010D0 = 0x801010D0; +D_801020D0 = 0x801020D0; +D_801020E0 = 0x801020E0; +D_801020E8 = 0x801020E8; +D_80102100 = 0x80102100; +D_80102140 = 0x80102140; +D_8010217C = 0x8010217C; +D_80102180 = 0x80102180; +D_80102181 = 0x80102181; +D_80102188 = 0x80102188; +D_801021A8 = 0x801021A8; +D_801021C0 = 0x801021C0; +D_801021D0 = 0x801021D0; +D_801021D8 = 0x801021D8; +D_801021F0 = 0x801021F0; +D_80102200 = 0x80102200; +D_80102220 = 0x80102220; +D_80102238 = 0x80102238; +D_80102240 = 0x80102240; +D_801023F0 = 0x801023F0; +D_8010242C = 0x8010242C; +D_80102434 = 0x80102434; +D_80102435 = 0x80102435; +D_80102436 = 0x80102436; +D_80102437 = 0x80102437; +D_80102438 = 0x80102438; +D_801024AC = 0x801024AC; +D_801024AD = 0x801024AD; +D_801024AE = 0x801024AE; +D_801024AF = 0x801024AF; +D_801024B0 = 0x801024B0; +D_80102520 = 0x80102520; +D_801036D0 = 0x801036D0; +D_801036E8 = 0x801036E8; +D_801036F0 = 0x801036F0; +D_801037F0 = 0x801037F0; +D_80103830 = 0x80103830; +D_80103834 = 0x80103834; +D_80103870 = 0x80103870; +D_80103880 = 0x80103880; +D_801038B0 = 0x801038B0; +D_801038B4 = 0x801038B4; +D_801038B8 = 0x801038B8; +D_801038BC = 0x801038BC; +D_801038C0 = 0x801038C0; +D_801038D0 = 0x801038D0; +D_801038E4 = 0x801038E4; +D_80103950 = 0x80103950; +D_80104B00 = 0x80104B00; +D_80104B18 = 0x80104B18; +D_80104B30 = 0x80104B30; +D_80104B48 = 0x80104B48; +D_80104B60 = 0x80104B60; +D_80104B70 = 0x80104B70; +D_80104B71 = 0x80104B71; +D_80104B74 = 0x80104B74; +D_80104BB0 = 0x80104BB0; +D_81000000 = 0x81000000; +D_810007A8 = 0x810007A8; +D_810007F8 = 0x810007F8; +D_81002260 = 0x81002260; +D_81100000 = 0x81100000; +D_81200000 = 0x81200000; +D_81206D9C = 0x81206D9C; +D_81206E64 = 0x81206E64; +D_81206F38 = 0x81206F38; +D_81300000 = 0x81300000; +D_81400000 = 0x81400000; +D_8140C734 = 0x8140C734; +D_8140E6B8 = 0x8140E6B8; +D_82000000 = 0x82000000; +D_82100000 = 0x82100000; +D_82200000 = 0x82200000; +D_82300000 = 0x82300000; +D_82500000 = 0x82500000; +D_82600000 = 0x82600000; +D_82A00000 = 0x82A00000; +D_82B00000 = 0x82B00000; +D_82C00000 = 0x82C00000; +D_82D00000 = 0x82D00000; +D_82E00000 = 0x82E00000; +D_82F00000 = 0x82F00000; +D_83100000 = 0x83100000; +D_83200000 = 0x83200000; +D_83300000 = 0x83300000; +D_83400000 = 0x83400000; +D_8340051C = 0x8340051C; +D_83407B30 = 0x83407B30; +D_83500000 = 0x83500000; +D_83600000 = 0x83600000; +D_83700000 = 0x83700000; +D_83800000 = 0x83800000; +D_83A00000 = 0x83A00000; +D_84000000 = 0x84000000; +D_84100000 = 0x84100000; +D_84200000 = 0x84200000; +D_84300000 = 0x84300000; +D_84800000 = 0x84800000; +D_84A00000 = 0x84A00000; +D_84B00000 = 0x84B00000; +D_86000000 = 0x86000000; +D_86100000 = 0x86100000; +D_86200000 = 0x86200000; +D_86300000 = 0x86300000; +D_86400000 = 0x86400000; +D_86500000 = 0x86500000; +D_86600000 = 0x86600000; +D_86700000 = 0x86700000; +D_86800000 = 0x86800000; +D_86900000 = 0x86900000; +D_86A00000 = 0x86A00000; +D_86B00000 = 0x86B00000; +D_86C00000 = 0x86C00000; +D_86D00000 = 0x86D00000; +D_86E00000 = 0x86E00000; +D_86F00000 = 0x86F00000; +D_87800000 = 0x87800000; +D_87900000 = 0x87900000; +D_87A00000 = 0x87A00000; +D_87B00000 = 0x87B00000; +D_88000000 = 0x88000000; +D_8F000000 = 0x8F000000; +D_8FA00000 = 0x8FA00000; +D_A0000000 = 0xA0000000; +D_A0000010 = 0xA0000010; +D_A0000090 = 0xA0000090; +D_A0000110 = 0xA0000110; +D_A0000190 = 0xA0000190; +D_A00FFFFC = 0xA00FFFFC; +D_A3F0000C = 0xA3F0000C; +D_A3F80004 = 0xA3F80004; +D_A3F80008 = 0xA3F80008; +D_A3F80014 = 0xA3F80014; +D_A4000000 = 0xA4000000; +D_A40004C0 = 0xA40004C0; +D_A4000768 = 0xA4000768; +D_A4001000 = 0xA4001000; +D_A4040000 = 0xA4040000; +D_A4040004 = 0xA4040004; +D_A4040008 = 0xA4040008; +D_A404000C = 0xA404000C; +D_A4040010 = 0xA4040010; +D_A4080000 = 0xA4080000; +D_A410000C = 0xA410000C; +D_A4100010 = 0xA4100010; +D_A4100014 = 0xA4100014; +D_A4100018 = 0xA4100018; +D_A410001C = 0xA410001C; +D_A4300000 = 0xA4300000; +D_A4300004 = 0xA4300004; +D_A4300008 = 0xA4300008; +D_A430000C = 0xA430000C; +D_A4400000 = 0xA4400000; +D_A4400004 = 0xA4400004; +D_A4400008 = 0xA4400008; +D_A440000C = 0xA440000C; +D_A4400010 = 0xA4400010; +D_A4400014 = 0xA4400014; +D_A4400018 = 0xA4400018; +D_A440001C = 0xA440001C; +D_A4400020 = 0xA4400020; +D_A4400024 = 0xA4400024; +D_A4400028 = 0xA4400028; +D_A440002C = 0xA440002C; +D_A4400030 = 0xA4400030; +D_A4400034 = 0xA4400034; +D_A4500000 = 0xA4500000; +D_A4500004 = 0xA4500004; +D_A4500008 = 0xA4500008; +D_A450000C = 0xA450000C; +D_A4500010 = 0xA4500010; +D_A4500014 = 0xA4500014; +D_A4600000 = 0xA4600000; +D_A4600004 = 0xA4600004; +D_A4600008 = 0xA4600008; +D_A460000C = 0xA460000C; +D_A4600010 = 0xA4600010; +D_A4600014 = 0xA4600014; +D_A4600018 = 0xA4600018; +D_A460001C = 0xA460001C; +D_A4600020 = 0xA4600020; +D_A4600024 = 0xA4600024; +D_A4600028 = 0xA4600028; +D_A460002C = 0xA460002C; +D_A4600030 = 0xA4600030; +D_A4700000 = 0xA4700000; +D_A4700010 = 0xA4700010; +D_A4800000 = 0xA4800000; +D_A4800004 = 0xA4800004; +D_A4800010 = 0xA4800010; +D_A4800018 = 0xA4800018; +D_A5000510 = 0xA5000510; +D_A6000000 = 0xA6000000; +D_A6001010 = 0xA6001010; +D_B0000000 = 0xB0000000; +D_B0000008 = 0xB0000008; +D_B0000010 = 0xB0000010; +D_B0000014 = 0xB0000014; +D_B0000E38 = 0xB0000E38;