diff --git a/configure.py b/configure.py index 9a23ac3473..55ca69a90a 100755 --- a/configure.py +++ b/configure.py @@ -259,6 +259,14 @@ async def main(): depfile="$out.d", deps="gcc") n.newline() + # KMC gcc crashes if the argument string is too long, so preprocess input separately to minimize arguments + # KMC gcc doesn't support input on stdin, so a temp file has to be made for the preprocessor output + n.rule("cc_kmc", + command=f"bash -o pipefail -c '{cpp} -Iver/$version/build/include -Iinclude -Iinclude/PR -Isrc -D _LANGUAGE_C -D _FINALROM -D VERSION=$version -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=32 {args.cflags} -MD -MF $out.d $in -o $out.i && export WINEPATH=tools/kmc/BIN && wine exew32 gcc -O3 -c -G0 -mgp32 -mfp32 -mips3 $out.i -o $out' && {cross}strip $out -N $in", + description="dsl $in", + depfile="$out.d", + deps="gcc") + n.newline() with open("tools/permuter_settings.toml", "w") as f: version = versions[0] @@ -287,7 +295,7 @@ async def main(): n.newline() n.rule("as", - command="${cross}as -EB -march=vr4300 -mtune=vr4300 -Iinclude $in -o $out", + command="${cross}as -EB -O0 -G0 -mtune=vr4300 -march=vr4300 -mabi=32 -Iinclude $in -o $out", description="assemble $in") n.newline() @@ -561,9 +569,10 @@ async def main(): for version in versions: s_glob = "ver/" + version + "/" + re.sub("src/", "asm/nonmatchings/", c_file)[:-2] + "/*.s" + rule = "cc_kmc" if c_file.startswith("src/ultra/") else ("cc_dsl" if status == 0 else "cc") n.build( obj(c_file), - "cc_dsl" if status == 0 else "cc", + rule, c_file, implicit = None if not args.depend_on_s else glob(s_glob), order_only="generated_headers_" + version, diff --git a/src/os/code_47ae0_len_e0.c b/src/os/code_47ae0_len_e0.c index 9480e91498..a716c3e998 100644 --- a/src/os/code_47ae0_len_e0.c +++ b/src/os/code_47ae0_len_e0.c @@ -2,7 +2,7 @@ INCLUDE_ASM(s32, "os/code_47ae0_len_e0", osSpGetStatus); -INCLUDE_ASM(s32, "os/code_47ae0_len_e0", osSpSetStatus); +INCLUDE_ASM(s32, "os/code_47ae0_len_e0", __osSpSetStatus); INCLUDE_ASM(s32, "os/code_47ae0_len_e0", osSpSetPc); diff --git a/src/os/osEPiReadIo.c b/src/os/osEPiReadIo.c deleted file mode 100644 index 851813a1d9..0000000000 --- a/src/os/osEPiReadIo.c +++ /dev/null @@ -1,12 +0,0 @@ -#define MOVE_ADDU - -#include "common.h" - -s32 osEPiReadIo(OSPiHandle* pihandle, u32 devAddr, u32* data) { - s32 ret; - - __osPiGetAccess(); - ret = osEPiRawReadIo(pihandle, devAddr, data); - __osPiRelAccess(); - return ret; -} diff --git a/src/os/osSpTaskYield.c b/src/os/osSpTaskYield.c deleted file mode 100644 index fb5f39de37..0000000000 --- a/src/os/osSpTaskYield.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(void, "os/osSpTaskYield", osSpTaskYield); diff --git a/src/ultra/epiread.c b/src/ultra/epiread.c new file mode 100644 index 0000000000..07b9652b84 --- /dev/null +++ b/src/ultra/epiread.c @@ -0,0 +1,10 @@ +#include +#include "piint.h" + +s32 osEPiReadIo(OSPiHandle *pihandle, u32 devAddr, u32 *data) { + register s32 ret; + __osPiGetAccess(); + ret = osEPiRawReadIo(pihandle, devAddr, data); + __osPiRelAccess(); + return ret; +} diff --git a/src/ultra/piint.h b/src/ultra/piint.h new file mode 100644 index 0000000000..b618cd3a85 --- /dev/null +++ b/src/ultra/piint.h @@ -0,0 +1,145 @@ +#ifndef _PIINT_H +#define _PIINT_H +#include +#include + +//https://github.com/LuigiBlood/64dd/wiki/Memory-Map + +#define LEO_BASE_REG 0x05000000 + +#define LEO_CMD (LEO_BASE_REG + 0x508) +#define LEO_STATUS (LEO_BASE_REG + 0x508) + +#define LEO_BM_CTL (LEO_BASE_REG + 0x510) +#define LEO_BM_STATUS (LEO_BASE_REG + 0x510) + +#define LEO_SEQ_CTL (LEO_BASE_REG + 0x518) +#define LEO_SEQ_STATUS (LEO_BASE_REG + 0x518) + +#define LEO_C2_BUFF (LEO_BASE_REG + 0x000) //C2 Sector Buffer +#define LEO_SECTOR_BUFF (LEO_BASE_REG + 0x400) //Data Sector Buffer +#define LEO_DATA (LEO_BASE_REG + 0x500) //Data +#define LEO_MISC_REG (LEO_BASE_REG + 0x504) //Misc Register +#define LEO_CUR_TK (LEO_BASE_REG + 0x50C) //Current Track +#define LEO_ERR_SECTOR (LEO_BASE_REG + 0x514) //Sector Error Status +#define LEO_CUR_SECTOR (LEO_BASE_REG + 0x51C) //Current Sector +#define LEO_HARD_RESET (LEO_BASE_REG + 0x520) //Hard Reset +#define LEO_C1_S0 (LEO_BASE_REG + 0x524) //C1 +#define LEO_HOST_SECBYTE (LEO_BASE_REG + 0x528) //Sector Size (in bytes) +#define LEO_C1_S2 (LEO_BASE_REG + 0x52C) //C1 +#define LEO_SEC_BYTE (LEO_BASE_REG + 0x530) //Sectors per Block, Full Size +#define LEO_C1_S4 (LEO_BASE_REG + 0x534) //C1 +#define LEO_C1_S6 (LEO_BASE_REG + 0x538) //C1 +#define LEO_CUR_ADDR (LEO_BASE_REG + 0x53C) //Current Address? +#define LEO_ID_REG (LEO_BASE_REG + 0x540) //ID +#define LEO_TEST_REG (LEO_BASE_REG + 0x544) //Test Read +#define LEO_TEST_PIN_SEL (LEO_BASE_REG + 0x548) //Test Write +#define LEO_RAM_ADDR (LEO_BASE_REG + 0x580) //Microsequencer RAM + +#define LEO_STATUS_PRESENCE_MASK 0xFFFF + +#define LEO_STATUS_DATA_REQUEST 0x40000000 +#define LEO_STATUS_C2_TRANSFER 0x10000000 +#define LEO_STATUS_BUFFER_MANAGER_ERROR 0x08000000 +#define LEO_STATUS_BUFFER_MANAGER_INTERRUPT 0x04000000 +#define LEO_STATUS_MECHANIC_INTERRUPT 0x02000000 +#define LEO_STATUS_DISK_PRESENT 0x01000000 +#define LEO_STATUS_BUSY_STATE 0x00800000 +#define LEO_STATUS_RESET_STATE 0x00400000 +#define LEO_STATUS_MOTOR_NOT_SPINNING 0x00100000 +#define LEO_STATUS_HEAD_RETRACTED 0x00080000 +#define LEO_STATUS_WRITE_PROTECT_ERROR 0x00040000 +#define LEO_STATUS_MECHANIC_ERROR 0x00020000 +#define LEO_STATUS_DISK_CHANGE 0x00010000 + +#define LEO_STATUS_MODE_MASK (LEO_STATUS_MOTOR_NOT_SPINNING | LEO_STATUS_HEAD_RETRACTED) +#define LEO_STATUS_MODE_SLEEP (LEO_STATUS_MOTOR_NOT_SPINNING | LEO_STATUS_HEAD_RETRACTED) +#define LEO_STATUS_MODE_STANDBY (LEO_STATUS_HEAD_RETRACTED) +#define LEO_STATUS_MODE_ACTIVE 0 + +#define LEO_CUR_TK_INDEX_LOCK 0x60000000 + +#define LEO_BM_STATUS_RUNNING 0x80000000 //Running +#define LEO_BM_STATUS_ERROR 0x04000000 //Error +#define LEO_BM_STATUS_MICRO 0x02000000 //Micro Status? +#define LEO_BM_STATUS_BLOCK 0x01000000 //Block Transfer +#define LEO_BM_STATUS_C1CORRECTION 0x00800000 //C1 Correction +#define LEO_BM_STATUS_C1DOUBLE 0x00400000 //C1 Double +#define LEO_BM_STATUS_C1SINGLE 0x00200000 //C1 Single +#define LEO_BM_STATUS_C1ERROR 0x00010000 //C1 Error + +#define LEO_BM_CTL_START 0x80000000 //Start Buffer Manager +#define LEO_BM_CTL_MODE 0x40000000 //Buffer Manager Mode +#define LEO_BM_CTL_IMASK 0x20000000 //BM Interrupt Mask +#define LEO_BM_CTL_RESET 0x10000000 //Buffer Manager Reset +#define LEO_BM_CTL_DISABLE_OR 0x08000000 //Disable OR Check? +#define LEO_BM_CTL_DISABLE_C1 0x04000000 //Disable C1 Correction +#define LEO_BM_CTL_BLOCK 0x02000000 //Block Transfer +#define LEO_BM_CTL_CLR_MECHANIC_INTR 0x01000000 //Mechanic Interrupt Reset + +#define LEO_BM_CTL_CONTROL_MASK 0xFF000000 +#define LEO_BM_CTL_SECTOR_MASK 0x00FF0000 +#define LEO_BM_CTL_SECTOR_SHIFT 16 + +#define LEO_CMD_TYPE_0 0 //TODO: name +#define LEO_CMD_TYPE_1 1 //TODO: name +#define LEO_CMD_TYPE_2 2 //TODO: name + +#define LEO_ERROR_GOOD 0 +#define LEO_ERROR_4 4 //maybe busy? +#define LEO_ERROR_22 22 // +#define LEO_ERROR_23 23 //unrecovered read error? +#define LEO_ERROR_24 24 //no reference position found? +#define LEO_ERROR_29 29 // + +extern OSDevMgr __osPiDevMgr; +extern OSPiHandle *__osCurrentHandle[2]; +extern OSPiHandle CartRomHandle; +extern OSPiHandle LeoDiskHandle; +extern OSMesgQueue __osPiAccessQueue; +extern u32 __osPiAccessQueueEnabled; + +int __osPiDeviceBusy(void); +void __osDevMgrMain(void *); +void __osPiCreateAccessQueue(void); +void __osPiRelAccess(void); +void __osPiGetAccess(void); +OSMesgQueue *osPiGetCmdQueue(void); + +#define OS_RAMROM_STACKSIZE 1024 + +#define WAIT_ON_IOBUSY(stat) \ + stat = IO_READ(PI_STATUS_REG); \ + while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \ + stat = IO_READ(PI_STATUS_REG); + +#define UPDATE_REG(reg, var) \ + if (cHandle->var != pihandle->var) \ + IO_WRITE(reg, pihandle->var); + +#define EPI_SYNC(pihandle, stat, domain) \ + \ + WAIT_ON_IOBUSY(stat) \ + \ + domain = pihandle->domain; \ + if (__osCurrentHandle[domain] != pihandle) \ + { \ + OSPiHandle *cHandle = __osCurrentHandle[domain]; \ + if (domain == PI_DOMAIN1) \ + { \ + UPDATE_REG(PI_BSD_DOM1_LAT_REG, latency); \ + UPDATE_REG(PI_BSD_DOM1_PGS_REG, pageSize); \ + UPDATE_REG(PI_BSD_DOM1_RLS_REG, relDuration); \ + UPDATE_REG(PI_BSD_DOM1_PWD_REG, pulse); \ + } \ + else \ + { \ + UPDATE_REG(PI_BSD_DOM2_LAT_REG, latency); \ + UPDATE_REG(PI_BSD_DOM2_PGS_REG, pageSize); \ + UPDATE_REG(PI_BSD_DOM2_RLS_REG, relDuration); \ + UPDATE_REG(PI_BSD_DOM2_PWD_REG, pulse); \ + } \ + __osCurrentHandle[domain] = pihandle; \ + } + +#endif diff --git a/src/ultra/sptaskyield.c b/src/ultra/sptaskyield.c new file mode 100644 index 0000000000..667d81cbd4 --- /dev/null +++ b/src/ultra/sptaskyield.c @@ -0,0 +1,6 @@ +#include +#include + +void osSpTaskYield(void) { + __osSpSetStatus(SP_SET_YIELD); +} diff --git a/tools/kmc/BIN/AR.EXE b/tools/kmc/BIN/AR.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/AR.EXE differ diff --git a/tools/kmc/BIN/AR.OUT b/tools/kmc/BIN/AR.OUT new file mode 100755 index 0000000000..61a06f896a Binary files /dev/null and b/tools/kmc/BIN/AR.OUT differ diff --git a/tools/kmc/BIN/AS.EXE b/tools/kmc/BIN/AS.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/AS.EXE differ diff --git a/tools/kmc/BIN/AS.OUT b/tools/kmc/BIN/AS.OUT new file mode 100755 index 0000000000..57b0c2cdd9 Binary files /dev/null and b/tools/kmc/BIN/AS.OUT differ diff --git a/tools/kmc/BIN/CC1.EXE b/tools/kmc/BIN/CC1.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/CC1.EXE differ diff --git a/tools/kmc/BIN/CC1.OUT b/tools/kmc/BIN/CC1.OUT new file mode 100755 index 0000000000..5d655e7f29 Binary files /dev/null and b/tools/kmc/BIN/CC1.OUT differ diff --git a/tools/kmc/BIN/CELF.EXE b/tools/kmc/BIN/CELF.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/CELF.EXE differ diff --git a/tools/kmc/BIN/CELF.OUT b/tools/kmc/BIN/CELF.OUT new file mode 100755 index 0000000000..ce5fe11493 Binary files /dev/null and b/tools/kmc/BIN/CELF.OUT differ diff --git a/tools/kmc/BIN/CPP.EXE b/tools/kmc/BIN/CPP.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/CPP.EXE differ diff --git a/tools/kmc/BIN/CPP.OUT b/tools/kmc/BIN/CPP.OUT new file mode 100755 index 0000000000..7d387d2895 Binary files /dev/null and b/tools/kmc/BIN/CPP.OUT differ diff --git a/tools/kmc/BIN/ELFTBL.EXE b/tools/kmc/BIN/ELFTBL.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/ELFTBL.EXE differ diff --git a/tools/kmc/BIN/ELFTBL.OUT b/tools/kmc/BIN/ELFTBL.OUT new file mode 100755 index 0000000000..8cf924429d Binary files /dev/null and b/tools/kmc/BIN/ELFTBL.OUT differ diff --git a/tools/kmc/BIN/EXEW32.EXE b/tools/kmc/BIN/EXEW32.EXE new file mode 100755 index 0000000000..1beb0c0501 Binary files /dev/null and b/tools/kmc/BIN/EXEW32.EXE differ diff --git a/tools/kmc/BIN/GCC.EXE b/tools/kmc/BIN/GCC.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/GCC.EXE differ diff --git a/tools/kmc/BIN/GCC.OUT b/tools/kmc/BIN/GCC.OUT new file mode 100755 index 0000000000..156b78f67d Binary files /dev/null and b/tools/kmc/BIN/GCC.OUT differ diff --git a/tools/kmc/BIN/LD.EXE b/tools/kmc/BIN/LD.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/LD.EXE differ diff --git a/tools/kmc/BIN/LD.OUT b/tools/kmc/BIN/LD.OUT new file mode 100755 index 0000000000..91e598368e Binary files /dev/null and b/tools/kmc/BIN/LD.OUT differ diff --git a/tools/kmc/BIN/MAKE.EXE b/tools/kmc/BIN/MAKE.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/MAKE.EXE differ diff --git a/tools/kmc/BIN/MAKE.OUT b/tools/kmc/BIN/MAKE.OUT new file mode 100755 index 0000000000..e68a6b4519 Binary files /dev/null and b/tools/kmc/BIN/MAKE.OUT differ diff --git a/tools/kmc/BIN/MAKEMASK.EXE b/tools/kmc/BIN/MAKEMASK.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/MAKEMASK.EXE differ diff --git a/tools/kmc/BIN/MAKEMASK.OUT b/tools/kmc/BIN/MAKEMASK.OUT new file mode 100755 index 0000000000..ba0a648f40 Binary files /dev/null and b/tools/kmc/BIN/MAKEMASK.OUT differ diff --git a/tools/kmc/BIN/MILD.EXE b/tools/kmc/BIN/MILD.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/MILD.EXE differ diff --git a/tools/kmc/BIN/MILD.OUT b/tools/kmc/BIN/MILD.OUT new file mode 100755 index 0000000000..5457474d6f Binary files /dev/null and b/tools/kmc/BIN/MILD.OUT differ diff --git a/tools/kmc/BIN/NM.EXE b/tools/kmc/BIN/NM.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/NM.EXE differ diff --git a/tools/kmc/BIN/NM.OUT b/tools/kmc/BIN/NM.OUT new file mode 100755 index 0000000000..2708e8b0ec Binary files /dev/null and b/tools/kmc/BIN/NM.OUT differ diff --git a/tools/kmc/BIN/OBJDUMP.EXE b/tools/kmc/BIN/OBJDUMP.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/OBJDUMP.EXE differ diff --git a/tools/kmc/BIN/OBJDUMP.OUT b/tools/kmc/BIN/OBJDUMP.OUT new file mode 100755 index 0000000000..ea4214c0ac Binary files /dev/null and b/tools/kmc/BIN/OBJDUMP.OUT differ diff --git a/tools/kmc/BIN/RANLIB.EXE b/tools/kmc/BIN/RANLIB.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/RANLIB.EXE differ diff --git a/tools/kmc/BIN/RANLIB.OUT b/tools/kmc/BIN/RANLIB.OUT new file mode 100755 index 0000000000..386a77f20d Binary files /dev/null and b/tools/kmc/BIN/RANLIB.OUT differ diff --git a/tools/kmc/BIN/SGI2GAS.EXE b/tools/kmc/BIN/SGI2GAS.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/SGI2GAS.EXE differ diff --git a/tools/kmc/BIN/SGI2GAS.OUT b/tools/kmc/BIN/SGI2GAS.OUT new file mode 100755 index 0000000000..a2c274a019 Binary files /dev/null and b/tools/kmc/BIN/SGI2GAS.OUT differ diff --git a/tools/kmc/BIN/SIZE.EXE b/tools/kmc/BIN/SIZE.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/SIZE.EXE differ diff --git a/tools/kmc/BIN/SIZE.OUT b/tools/kmc/BIN/SIZE.OUT new file mode 100755 index 0000000000..deb577daa5 Binary files /dev/null and b/tools/kmc/BIN/SIZE.OUT differ diff --git a/tools/kmc/BIN/STRIP.EXE b/tools/kmc/BIN/STRIP.EXE new file mode 100755 index 0000000000..69f457fe99 Binary files /dev/null and b/tools/kmc/BIN/STRIP.EXE differ diff --git a/tools/kmc/BIN/STRIP.OUT b/tools/kmc/BIN/STRIP.OUT new file mode 100755 index 0000000000..0dd12278bb Binary files /dev/null and b/tools/kmc/BIN/STRIP.OUT differ diff --git a/tools/kmc/GPL.TXT b/tools/kmc/GPL.TXT new file mode 100755 index 0000000000..9285110205 --- /dev/null +++ b/tools/kmc/GPL.TXT @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/tools/kmc/README.TXT b/tools/kmc/README.TXT new file mode 100755 index 0000000000..dd040f1173 --- /dev/null +++ b/tools/kmc/README.TXT @@ -0,0 +1,78 @@ +Some additional functions not shown in a manual are explained here. + +Additional option for 'mild' + + -E If an undefined symbol is found when 'mild' calls a linker (ld) and linking is being + processed, 'mild' continues the processing by default. However, if -E option is + specified, the processing stops when the undefined symbol is found. + +Shrinking function for debugging information + + If an environmental parameter GCC_CELF is set ON (set GCC_CELF=ON), it will + delete unnecessary debugging information (such as unused structure information in a file) + and reduce the size of the debugging information. Moreover, by describing a header file + etc a user uses in __elfcom.c file, debugging information which is same as one defined + in the file will not be output to each file, and peculiar portion of each file alone will be + output as debugging information. By using this function, an object size of each module + will be reduced and therefore, time needed for compiling/linking will be considerably + reduced. And, since a memory used for linking is reduced a memory size needed for a + host computer does not have to be large. + + In ultra/gcc/mipse/debug directory, a sample for using debugging function for + N64 sample ultra/usr/pr/src/simple, is stored. Please copy all the files in + ultra/gcc/mipse/debug to ultra/usr/pr/src/simple, and enter, + + c:>envset + c:>make + + and confirm the file shrinking function. + + In the event that to describe the common debugging information in __elfcom.c file is + not necessary as it is optional, there is no need to describe it. However, specifying of + 'set GCC_CELF=ON' allows to reduce the size of debugging information considerably just + by re-compiling and without changing the present environment, so be sure to specify it. + +How to use file shrinking function for debugging information + +1. Please specify an environmental parameter as 'set GCC_CELF=ON'. Usually, please add, + + set GCC_CELF=ON + + to ultra/setup.bat. + +2. Please have all the objects depend upon __elfcom.tbl and __elfcom.elf just like the + last portion of 'makefile' in a game program directory. As an example, for N64 + sample ultra/usr/pr/src/simple, please add the following at the end of 'makefile': + + $(CODEOBJECTS) $(DATAOBJECTS) : __elfcom.tbl __elfcom.elf + + __elfcom.tbl __elfcom.elf : __elfcom.o + elftbl + +3. Please include or describe directly a header file which describes a structure etc in __elfcom.c file. + Debugging information like a structure information described in this + __elfcom.c will be a common information for all the files to be compiled in the same + environment. Debugging information which is same as the one defined in + __elfcom.c will not be output to each file, and peculiar portion of each file alone will + be output as debugging information. For N64 sample ultra/usr/pr/src/simple, + please describe, + + #include + + in __elfcom.c. + +4. It is not necessary for N64 sample ultra/usr/pr/src/simple, however, in case that + a source code or an object code is stored in other place than a current directory, it + is necessary to specify a directory which has a common information table + (__elfcom.tbl) file using an environmental parameter GCC_ELF_TBL, if the file is to + be compiled. + +set GCC_ELF_TBL=%ROOT%/usr/src/PR/simple + +5. The above concludes setting of an environmental parameter. Please delete every + object file (.o) once, and redo the compiling. And confirm that compiling ended + normally, and the created file '.out file' has shrunk. + + Note: When a file shrinking function is used, Partner Ver 1.07 or newer ones should be + used. Any older versions than this cannot read a file shrunk debugging + information correctly. diff --git a/tools/kmc/VERSION.TXT b/tools/kmc/VERSION.TXT new file mode 100755 index 0000000000..648a04251a --- /dev/null +++ b/tools/kmc/VERSION.TXT @@ -0,0 +1,27 @@ +1997.9.26 1.2 (PC) +A new function, a shrinking function for debugging information, was added. By using this function, the size of the present debugging information can be reduced to one-tenth approximately. However, PARTNER-N64/WIN Version 1.07 is necessary to utilize this function. + +'lba' command was added for 'mild'. + +1997. 7.5 1.1 (PC) + An operating environment of exeGCC(N64) has been changed so that it can be operated +on WIN32 (a native environment for Windows 95, Windows NT). So, it is possible to secure a memory of the system up to maximum virtual memory area. Furthermore, it is now possible to create an environment to compile a program of N64 on Windows NT. + +The size of debugging information was reduced to two-thirds approximately. So, the time for linking can be reduced. + +A shortage of a stack and a general protection error due to a complicated function or a large function, in case of '-02' or '-03' option being specified and optimization being done when compiling, are evaded. + + 'romalign' specification for delta transfer for 'mild' is now available. Delta transfer + function is now available if used with PARTNER-N64/Win Version 1.06. + +'-w option' was added for 'mild'. By this option specification, it is possible to control a + warning display of 'overlapping' for 'mild'. + +'-E option' was added for 'mild'. By this option specification, if an undefined symbol is found when 'mild' calls a linker (ld) and linking is being processed, the processing stops +at that moment. + +A directory specification by DOS environment drives or '\' for 'make' is available. +(It is now possible to describe c: \prog,x: \nintendo\kmc etc.) + +1997. 1.1 1.0 (PC) + Final version for shipment diff --git a/ver/us/asm/nonmatchings/os/code_40E10/osSpTaskLoad.s b/ver/us/asm/nonmatchings/os/code_40E10/osSpTaskLoad.s index ef02ce804e..5759a6434d 100644 --- a/ver/us/asm/nonmatchings/os/code_40E10/osSpTaskLoad.s +++ b/ver/us/asm/nonmatchings/os/code_40E10/osSpTaskLoad.s @@ -107,7 +107,7 @@ glabel osSpTaskLoad .L80065B8C: /* 40F8C 80065B8C 0C018614 */ jal osWritebackDCache /* 40F90 80065B90 24050040 */ addiu $a1, $zero, 0x40 -/* 40F94 80065B94 0C01B1BC */ jal osSpSetStatus +/* 40F94 80065B94 0C01B1BC */ jal __osSpSetStatus /* 40F98 80065B98 24042B00 */ addiu $a0, $zero, 0x2b00 /* 40F9C 80065B9C 2410FFFF */ addiu $s0, $zero, -1 /* 40FA0 80065BA0 3C040400 */ lui $a0, 0x400 diff --git a/ver/us/asm/nonmatchings/os/code_40E10/osSpTaskStartGo.s b/ver/us/asm/nonmatchings/os/code_40E10/osSpTaskStartGo.s index 5c63f5a265..207924b330 100644 --- a/ver/us/asm/nonmatchings/os/code_40E10/osSpTaskStartGo.s +++ b/ver/us/asm/nonmatchings/os/code_40E10/osSpTaskStartGo.s @@ -9,7 +9,7 @@ glabel osSpTaskStartGo /* 41028 80065C28 00000000 */ nop /* 4102C 80065C2C 1440FFFD */ bnez $v0, .L80065C24 /* 41030 80065C30 00000000 */ nop -/* 41034 80065C34 0C01B1BC */ jal osSpSetStatus +/* 41034 80065C34 0C01B1BC */ jal __osSpSetStatus /* 41038 80065C38 24040125 */ addiu $a0, $zero, 0x125 /* 4103C 80065C3C 8FBF0010 */ lw $ra, 0x10($sp) /* 41040 80065C40 03E00008 */ jr $ra diff --git a/ver/us/asm/nonmatchings/os/code_41050_len_120/osSpTaskYield.s b/ver/us/asm/nonmatchings/os/code_41050_len_120/osSpTaskYield.s index f2df926325..1d4415764b 100644 --- a/ver/us/asm/nonmatchings/os/code_41050_len_120/osSpTaskYield.s +++ b/ver/us/asm/nonmatchings/os/code_41050_len_120/osSpTaskYield.s @@ -4,7 +4,7 @@ glabel osSpTaskYield /* 41050 80065C50 27BDFFE8 */ addiu $sp, $sp, -0x18 /* 41054 80065C54 AFBF0010 */ sw $ra, 0x10($sp) -/* 41058 80065C58 0C01B1BC */ jal osSpSetStatus +/* 41058 80065C58 0C01B1BC */ jal __osSpSetStatus /* 4105C 80065C5C 24040400 */ addiu $a0, $zero, 0x400 /* 41060 80065C60 8FBF0010 */ lw $ra, 0x10($sp) /* 41064 80065C64 03E00008 */ jr $ra diff --git a/ver/us/asm/nonmatchings/os/code_47ae0_len_e0/osSpSetStatus.s b/ver/us/asm/nonmatchings/os/code_47ae0_len_e0/__osSpSetStatus.s similarity index 92% rename from ver/us/asm/nonmatchings/os/code_47ae0_len_e0/osSpSetStatus.s rename to ver/us/asm/nonmatchings/os/code_47ae0_len_e0/__osSpSetStatus.s index ad5757e16e..2aed5341bd 100644 --- a/ver/us/asm/nonmatchings/os/code_47ae0_len_e0/osSpSetStatus.s +++ b/ver/us/asm/nonmatchings/os/code_47ae0_len_e0/__osSpSetStatus.s @@ -1,7 +1,7 @@ .set noat # allow manual use of $at .set noreorder # don't insert nops after branches -glabel osSpSetStatus +glabel __osSpSetStatus /* 47AF0 8006C6F0 3C02A404 */ lui $v0, 0xa404 /* 47AF4 8006C6F4 34420010 */ ori $v0, $v0, 0x10 /* 47AF8 8006C6F8 03E00008 */ jr $ra diff --git a/ver/us/asm/nonmatchings/os/osSpTaskYield/osSpTaskYield.s b/ver/us/asm/nonmatchings/os/osSpTaskYield/osSpTaskYield.s index f2df926325..1d4415764b 100644 --- a/ver/us/asm/nonmatchings/os/osSpTaskYield/osSpTaskYield.s +++ b/ver/us/asm/nonmatchings/os/osSpTaskYield/osSpTaskYield.s @@ -4,7 +4,7 @@ glabel osSpTaskYield /* 41050 80065C50 27BDFFE8 */ addiu $sp, $sp, -0x18 /* 41054 80065C54 AFBF0010 */ sw $ra, 0x10($sp) -/* 41058 80065C58 0C01B1BC */ jal osSpSetStatus +/* 41058 80065C58 0C01B1BC */ jal __osSpSetStatus /* 4105C 80065C5C 24040400 */ addiu $a0, $zero, 0x400 /* 41060 80065C60 8FBF0010 */ lw $ra, 0x10($sp) /* 41064 80065C64 03E00008 */ jr $ra diff --git a/ver/us/splat.yaml b/ver/us/splat.yaml index 3b82a82723..a97c67223e 100644 --- a/ver/us/splat.yaml +++ b/ver/us/splat.yaml @@ -107,7 +107,7 @@ segments: - [0x3BD40, hasm, os/osSetIntMask] - [0x3bde0, c, os/osCreatePiManager] - [0x3C160, c, os/osEPiWriteIo] # MOVE_ADDU - - [0x3c1c0, c, os/osEPiReadIo] # MOVE_ADDU + - [0x3c1c0, c, ultra/epiread] - [0x3c220, c, os/osEPiStartDma] # MOVE_ADDU - [0x3c2c0, c, os/osEPiLinkHandle] - [0x3c310, c, os/osCartRomInit] @@ -141,7 +141,7 @@ segments: - [0x40c20, c, os/code_40c20_len_1f0] - [0x40E00, hasm, os/osGetCount] - [0x40E10, c, os/code_40E10] - - [0x41050, c, os/osSpTaskYield] + - [0x41050, c, ultra/sptaskyield] - [0x41070, c, os/osSpTaskYielded] - [0x410C0, c, os/osSiRawStartDma] - [0x41170, c, os/code_41170_len_f0] diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index 267d9d5d90..d43af5d561 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -1094,7 +1094,7 @@ osSetSR = 0x8006C6A0; // type:func rom:0x47AA0 osSetWatchLo = 0x8006C6B0; // type:func rom:0x47AB0 osSpDeviceBusy = 0x8006C6C0; // type:func rom:0x47AC0 osSpGetStatus = 0x8006C6E0; // type:func rom:0x47AE0 -osSpSetStatus = 0x8006C6F0; // type:func rom:0x47AF0 +__osSpSetStatus = 0x8006C6F0; // type:func rom:0x47AF0 osSpSetPc = 0x8006C700; // type:func rom:0x47B00 osSpRawStartDma = 0x8006C730; // type:func rom:0x47B30 osSiRawReadIo = 0x8006C7C0; // type:func rom:0x47BC0