diff options
| author | John Wilbert M. Villamor <lameguy64@gmail.com> | 2021-01-05 10:58:04 +0800 |
|---|---|---|
| committer | John Wilbert M. Villamor <lameguy64@gmail.com> | 2021-01-05 10:58:04 +0800 |
| commit | 974b17fad06cef4b304645b8a9dd92ac91ebb749 (patch) | |
| tree | 1db281d9cac9bb4e80ae17dc731f1a3241c787f6 | |
| parent | f048f87b445942f961d225348e2af1113e544d23 (diff) | |
| download | psn00bsdk-974b17fad06cef4b304645b8a9dd92ac91ebb749.tar.gz | |
Added updated library reference, added struct names in psxgpu.h, defined GTE squareroot functions and added C++ demo example.
| -rw-r--r-- | README.md | 101 | ||||
| -rw-r--r-- | changelog.txt | 24 | ||||
| -rw-r--r-- | doc/LibPSn00b Reference.odt | bin | 141962 -> 141928 bytes | |||
| -rw-r--r-- | examples/beginner/cppdemo/main.cpp | 152 | ||||
| -rw-r--r-- | examples/beginner/cppdemo/makefile | 54 | ||||
| -rw-r--r-- | libpsn00b/include/inline_c.h | 5 | ||||
| -rw-r--r-- | libpsn00b/include/psxgpu.h | 70 | ||||
| -rw-r--r-- | libpsn00b/include/psxgte.h | 3 | ||||
| -rw-r--r-- | libpsn00b/psxgte/vectornormals.s | 5 |
9 files changed, 319 insertions, 95 deletions
@@ -10,55 +10,58 @@ provide a basic framework for developing software for the PlayStation hardware, the compiler is separate (GCC) and should be acquired from GNU. The library API is intentionally written to resemble the library API of the official libraries as closely as possible. This design decision is not only -for familiarity reasons and so that existing sample code and tutorials would -still apply, but to also make porting existing homebrew originally made with -official SDKs to PSn00bSDK easier with few modifications. +for familiarity reasons to experienced programmers, but also so that existing +sample code and tutorials would still apply to this SDK, as well as making +the process of porting over existing homebrew originally made with official +SDKs easier with minimal modification, provided it doesn't use libgs. PSn00bSDK is currently a work in progress and cannot really be considered production ready, but what is currently implemented should be enough to -produce some interesting homebrew with the SDK, especially with extensive +produce some interesting homebrew with the SDK, especially with its extensive support for the GPU and GTE hardware. There's no reason not to fully support -the hardware features of the target platform when they have been fully -documented for years (nocash's PSX specs document in this case). +hardware features of a target platform when said hardware features have been +fully documented for years (nocash's PSX specs document in this case). -Most of libpsn00b is written mostly in MIPS assembly, more so functions that -interface with hardware. Many of the standard C functions are implemented in -custom MIPS assembly instead of equivalents found in the BIOS ROM for -performance reasons. +Most of libpsn00b is written mostly in MIPS assembly, moreso functions that +interface with the hardware. Many of the standard C functions are implemented +in custom MIPS assembly instead of equivalents found in the BIOS ROM, for both +stability (the BIOS libc implementation of the PlayStation is actually buggy) +and performance reasons. ## Notable features -As of September 19, 2020 +As of January 5, 2021 -* Extensive GPU support with polygon primitives, high-speed DMA VRAM - transfers and DMA ordering table processing. All video modes for both NTSC - and PAL standards also supported with fully adjustable display area and - automatic video standard detection based on last GPU mode. No BIOS ROM - string checks used. +* Extensive GPU support with polygon, line and sprite primitives, high-speed + DMA transfers for VRAM data and ordering tables. All video modes for both + NTSC and PAL standards also supported with fully adjustable display area + and automatic video standard detection based on last GPU mode. No BIOS + ROM checks used. * Extensive GTE support with rotate, translate, perspective correction and - lighting through assembly macros (for both C and ASM) and high performance + lighting fully supported via C and assembly GTE macros, with high speed matrix and vector functions. All calculations performed in fixed point integer math. -* Stable interrupt service routine with easy to use callback system for +* Flexible interrupt service routine with easy to use callback mechanism for simplified handling and hooking of hardware and DMA interrupts, no crude - event handler hooks or kernel hacks used and should be compatible with - HLE BIOS implementations. Should also play well with writing loader + event handler hooks or kernel hacks providing great compatibility with + HLE BIOS implementations. Should work without issue in loader/menu type programs. -* Complete Serial I/O support with SIOCONS driver for tty console access - through serial interface. Handshake and flow control also supported. +* Complete Serial I/O support with SIOCONS driver for tty stdin/stdout + console access. Hardware handshake for flow control also supported. * BIOS controller functions for polling controller input work as intended - thanks to proper interrupt handling. No crude manual polling of controllers - in your main loop. + thanks to proper handling of hardware interrupts. No crude manual polling + of controllers in a main loop. BIOS memory card functions may also work, + but not yet tested extensively. -* Full CD-ROM support with data reading, CD audio and XA audio playback. +* Full CD-ROM support with data read, CD audio and XA audio playback support. Features built-in ISO9660 file system parser for locating files and supports directories containing more than 30 files (classic ISO9660 only, - no Rock Ridge or Joliet extensions support). Also supports multi-session - discs. + no Rock Ridge or Joliet extensions). Also supports reading new disc + sessions in a multi-session disc. * Uses Sony SDK library syntax for familiarity to experienced programmers and to make porting existing homebrew projects to PSn00bSDK easier. @@ -70,34 +73,30 @@ As of September 19, 2020 Because PSn00bSDK is updated semi-regularly due to this project being in a work-in-progress state, it is better to obtain this SDK from source and -building it yourself in the long run. Prepared packages containing -precompiled libpsn00b libraries, the toolchain and additional utilities -not included in this repository for Windows users are planned, though some -arrangements would need to be made first. Perhaps once PSn00bSDK is -considered halfway production ready. +building it yourself in the long run. Pre-compiled packages for Debian and +Msys2 are being planned however. A precompiled copy of the GCC 7.4.0 toolchain for Windows is available in the PSn00bSDK page of Lameguy64's website ( http://lameguy64.net/?page=psn00bsdk ). This should make building PSn00bSDK -under Windows a bit easier as building the toolchain is the hardest part -of building PSn00bSDK, as its more difficult to get it to compile correctly -under Windows than on Linux and BSDs. +under Windows a bit easier, as the GCC toolchain is quite difficult to +compile correctly under Windows than it is on Linux and BSDs. ## Building the SDK You may set one of the following variables either with set/export or on the -make command line to specify various parameters in building PSn00bSDK and -projects made with it. +make command line, to specify various parameters in building PSn00bSDK and +projects made with it as you see fit. -* ``GCC_VERSION`` specifies the GCC version number. This is only really - required for building the libc library. If not defined, the default value - of `7.4.0` is used. +* ``GCC_VERSION`` specifies the GCC version number. This is only required for + building the libc library. If not defined, the default value of `7.4.0` is + used. * ``PSN00BSDK_TC`` specifies the base directory of the GCC toolchain to - build PSn00bSDK with, otherwise the makefile assumes you have the - toolchain binaries in one of your PATH directories. + build PSn00bSDK with, otherwise the makefile assumes you have the path to + the toolchain binaries in one of your PATH directories. * ``PSN00BSDK_LIBS`` specifies the target directory you wish to install - the compiled libpsn00b libraries to. If not specified, compiled + the compiled libpsn00b libraries to. If not defined, compiled libraries are consolidated to the libpsn00b directory. @@ -128,7 +127,9 @@ projects made with it. directory. Add this directory to your PATH variable by adding `export=$PATH:<path to SDK>/tools/bin` in your .bash_profile file. You'll need to reload the MSys2 shell after making the changes. -8. Enter libpsn00b directory and run `make` to build all libpsn00b libraries. +8. Enter libpsn00b directory and run `make` to build all libpsn00b libraries, + then `make install` to consolidate the libraries to the parent directory + or the directory specified by ``PSN00BSDK_LIBS``. 6. Compile the example programs to test if the SDK is set up correctly. Update directory paths in `sdk-common.mk` when necessary. @@ -154,8 +155,10 @@ programs with PSn00bSDK within the Command Prompt. the tools to a bin directory. Add this directory to your PATH variable and make sure `elf2x` and `lzpack` (required for n00bDEMO) is accessible from any directory. -5. Enter the libpsn00b directory and run `make`. -6. Compile the example programs to test if the SDK is set up correctly. +5. Enter the libpsn00b directory and run `make`. Then, run `make install` to + consolidate the libraries to the libpsn00b parent directory or the + directory specified by ``PSN00BSDK_LIBS``. +6. Compile example programs to test if the SDK is set up correctly. ## Examples @@ -167,12 +170,6 @@ and contributed example programs are welcome. ## To-do List -* psxgpu: VRAM move function, few more primitives and macros yet to be - implemented. - -* psxgte: Higher level GTE rotate translate and perspective functions, - and many matrix transformation functions yet to be implemented. - * psxspu: Plenty of work to be done. Hardware timer driven sound/music system may need to be implemented (an equivalent to the Ss* series of functions in libspu basically). diff --git a/changelog.txt b/changelog.txt index 1f6177b..0e7b514 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,18 +2,30 @@ PSn00bSDK changelog Items that are lower in the log are more recently implemented. +01-05-2021 by Lameguy64: + +* psxgpu: Added struct names to many primitives. + +* psxgte: Defined SquareRoot0() and SquareRoot12(). + +* psxgte: Added gte_lddp() C macro. + +* examples: Added C++ demo. + +* Updated readme a bit. + + 11-29-2020 by Lameguy64: -* Defined MDEC hardware and related DMA registers in hwregs_a.h file. +* libpsn00b: Defined MDEC hardware and related DMA registers in hwregs_a.h file. -* Fixed entry typo in table of squareroot.s (pointed out by SoapyMan). +* psxgte: Fixed entry typo in table of squareroot.s (pointed out by SoapyMan). -* memmove updated to account for forward-looped memory move (by ckosmic). +* libc: memmove updated to account for forward-looped memory move (by ckosmic). -* Removed redundant toolchain executable definitions in the makefiles of - examples. +* examples: Removed redundant toolchain executable definitions in the makefiles. -* Included HDTV example for Github repo. +* examples: Included HDTV example for Github repo. 09-19-2020 by Lameguy64: diff --git a/doc/LibPSn00b Reference.odt b/doc/LibPSn00b Reference.odt Binary files differindex e17e81b..1110a1e 100644 --- a/doc/LibPSn00b Reference.odt +++ b/doc/LibPSn00b Reference.odt diff --git a/examples/beginner/cppdemo/main.cpp b/examples/beginner/cppdemo/main.cpp new file mode 100644 index 0000000..1a98cac --- /dev/null +++ b/examples/beginner/cppdemo/main.cpp @@ -0,0 +1,152 @@ +/* Work in progress example, need to add comments. + * + * Basically a quick little example that showcases C++ classes are + * functioning in PSn00bSDK. - Lameguy64 + * + * Written in December 18, 2020. + */ + +#include <sys/types.h> +#include <stdio.h> +#include <malloc.h> +#include <psxgte.h> +#include <psxgpu.h> + +class GraphClass +{ + u_int *_ot[2]; + u_char *_pri[2]; + u_char *_nextpri; + + int _ot_count; + int _db; + + DISPENV _disp[2]; + DRAWENV _draw[2]; + +public: + + GraphClass( int ot_len = 8, int pri_len = 8192 ) + { + _ot[0] = (u_int*)malloc( sizeof(u_int)*ot_len ); + _ot[1] = (u_int*)malloc( sizeof(u_int)*ot_len ); + + _db = 0; + _ot_count = ot_len; + ClearOTagR( _ot[0], _ot_count ); + ClearOTagR( _ot[1], _ot_count ); + + _pri[0] = (u_char*)malloc( pri_len ); + _pri[1] = (u_char*)malloc( pri_len ); + + _nextpri = _pri[0]; + + printf( "GraphClass::GraphClass: Buffers allocated.\n" ); + + } /* GraphClass */ + + virtual ~GraphClass() + { + /* free the OTs and primitive buffers */ + free( _ot[0] ); + free( _ot[1] ); + + free( _pri[0] ); + free( _pri[1] ); + + printf( "GraphClass::GraphClass: Buffers freed.\n" ); + + } /* ~GraphClass */ + + void SetRes( int w, int h ) + { + SetDefDispEnv( &_disp[0], 0, h, w, h ); + SetDefDispEnv( &_disp[1], 0, 0, w, h ); + + SetDefDrawEnv( &_draw[0], 0, 0, w, h ); + SetDefDrawEnv( &_draw[1], 0, h, w, h ); + + setRGB0( &_draw[0], 63, 0, 127 ); + _draw[0].isbg = 1; + _draw[0].dtd = 1; + setRGB0( &_draw[1], 63, 0, 127 ); + _draw[1].isbg = 1; + _draw[1].dtd = 1; + + PutDispEnv( &_disp[0] ); + PutDrawEnv( &_draw[0] ); + + } /* SetRes */ + + void IncPri( int bytes ) + { + _nextpri += bytes; + + } /* IncPri */ + + void SetPri( u_char *ptr ) + { + _nextpri = ptr; + + } /* SetPri */ + + u_char *GetNextPri( void ) + { + return( _nextpri ); + + } /* GetNextPri */ + + u_int *GetOt( void ) + { + return( _ot[_db] ); + + } /* GetOt */ + + void Display( void ) + { + VSync( 0 ); + DrawSync( 0 ); + SetDispMask( 1 ); + + _db = !_db; + + PutDispEnv( &_disp[_db] ); + PutDrawEnv( &_draw[_db] ); + + DrawOTag( _ot[!_db]+(_ot_count-1) ); + + ClearOTagR( _ot[_db], _ot_count ); + _nextpri = _pri[_db]; + + } /* Display */ + +}; /* GraphClass */ + +GraphClass *otable; + +int main( int argc, const char *argv[] ) +{ + TILE *tile; + + ResetGraph( 0 ); + + otable = new GraphClass(); + + otable->SetRes( 320, 240 ); + + while( 1 ) + { + tile = (TILE*)otable->GetNextPri(); + setTile( tile ); + setXY0( tile, 32, 32 ); + setWH( tile, 128, 128 ); + setRGB0( tile, 255, 255, 0 ); + addPrim( otable->GetOt(), tile ); + otable->IncPri( sizeof(TILE) ); + + otable->Display(); + } + + return( 0 ); + +} /* main */
\ No newline at end of file diff --git a/examples/beginner/cppdemo/makefile b/examples/beginner/cppdemo/makefile new file mode 100644 index 0000000..6a29033 --- /dev/null +++ b/examples/beginner/cppdemo/makefile @@ -0,0 +1,54 @@ +include ../../examples-setup.mk + +# Project target name +TARGET = cppdemo.elf + +# Searches for C, C++ and S (assembler) files in local directory +CFILES = $(notdir $(wildcard *.c)) +CPPFILES = $(notdir $(wildcard *.cpp)) +AFILES = $(notdir $(wildcard *.s)) + +# Determine object files +OFILES = $(addprefix build/,$(CFILES:.c=.o)) \ + $(addprefix build/,$(CPPFILES:.cpp=.o)) \ + $(addprefix build/,$(AFILES:.s=.o)) + +# Project specific include and library directories +# (use -I for include dirs, -L for library dirs) +INCLUDE += +LIBDIRS += + +# Libraries to link +LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc + +# C compiler flags +CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections + +# C++ compiler flags +CPPFLAGS = $(CFLAGS) -fno-builtin -fno-rtti -fno-exceptions + +# Assembler flags +AFLAGS = -g -msoft-float + +# Linker flags +LDFLAGS = -g -Ttext=0x80010000 -gc-sections \ + -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x + +all: $(OFILES) + $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET) + elf2x -q $(TARGET) + +build/%.o: %.c + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + +build/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CPPFLAGS) $(INCLUDE) -c $< -o $@ + +build/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@ + +clean: + rm -rf build $(TARGET) $(TARGET:.elf=.exe) diff --git a/libpsn00b/include/inline_c.h b/libpsn00b/include/inline_c.h index aa2c197..3775fdd 100644 --- a/libpsn00b/include/inline_c.h +++ b/libpsn00b/include/inline_c.h @@ -72,6 +72,11 @@ "lwc2 $10, 4( %0 );" \ : \ : "r"( r0 ) ) + +#define gte_lddp( r0 ) __asm__ volatile ( \ + "mtc2 %0, $8;" \ + : \ + : "r"( r0 ) ) /* Sets the GTE offset */ diff --git a/libpsn00b/include/psxgpu.h b/libpsn00b/include/psxgpu.h index bcd1835..89fa338 100644 --- a/libpsn00b/include/psxgpu.h +++ b/libpsn00b/include/psxgpu.h @@ -206,7 +206,7 @@ /* * Primitive definitions */ -typedef struct { +typedef struct _P_TAG { unsigned int addr:24; unsigned int len:8; unsigned char r,g,b; @@ -216,7 +216,7 @@ typedef struct { /* * Polygon primitive definitions */ -typedef struct { +typedef struct _POLY_F3 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -224,7 +224,7 @@ typedef struct { short x2,y2; } POLY_F3; -typedef struct { +typedef struct _POLY_F4 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -233,7 +233,7 @@ typedef struct { short x3,y3; } POLY_F4; -typedef struct { +typedef struct _POLY_FT3 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -247,7 +247,7 @@ typedef struct { unsigned short pad; } POLY_FT3; -typedef struct { +typedef struct _POLY_FT4 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -264,7 +264,7 @@ typedef struct { unsigned short pad1; } POLY_FT4; -typedef struct { +typedef struct _POLY_G3 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -274,7 +274,7 @@ typedef struct { short x2,y2; } POLY_G3; -typedef struct { +typedef struct _POLY_G4 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -286,7 +286,7 @@ typedef struct { short x3,y3; } POLY_G4; -typedef struct { +typedef struct _POLY_GT3 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -302,7 +302,7 @@ typedef struct { unsigned short pad2; } POLY_GT3; -typedef struct { +typedef struct _POLY_GT4 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -325,14 +325,14 @@ typedef struct { /* * Line primitive definitions */ -typedef struct { +typedef struct _LINE_F2 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; short x1,y1; } LINE_F2; -typedef struct { +typedef struct _LINE_G2 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -340,7 +340,7 @@ typedef struct { short x1,y1; } LINE_G2; -typedef struct { +typedef struct _LINE_F3 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -349,7 +349,7 @@ typedef struct { unsigned int pad; } LINE_F3; -typedef struct { +typedef struct _LINE_G3 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -360,7 +360,7 @@ typedef struct { unsigned int pad; } LINE_G3; -typedef struct { +typedef struct _LINE_F4 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -370,7 +370,7 @@ typedef struct { unsigned int pad; } LINE_F4; -typedef struct { +typedef struct _LINE_G4 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -386,26 +386,26 @@ typedef struct { /* * Tile and sprite primitive definitions */ -typedef struct { +typedef struct _TILE { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; short w,h; } TILE; -typedef struct { +typedef struct _TILE_1 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; } TILE_1; -typedef struct { +typedef struct _TILE_8 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; } TILE_8; -typedef struct { +typedef struct _TILE_16 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -414,7 +414,7 @@ typedef struct { /* * Sprite primitive definitions */ -typedef struct { +typedef struct _SPRT { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -423,7 +423,7 @@ typedef struct { unsigned short w,h; } SPRT; -typedef struct { +typedef struct _SPRT_8 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -431,7 +431,7 @@ typedef struct { unsigned short clut; } SPRT_8; -typedef struct { +typedef struct _SPRT_16 { unsigned int tag; unsigned char r0,g0,b0,code; short x0,y0; @@ -443,44 +443,44 @@ typedef struct { * VRAM fill and transfer primitive definitions */ -typedef struct DR_ENV { +typedef struct _DR_ENV { unsigned int tag; unsigned int code[15]; } DR_ENV; -typedef struct DR_AREA { +typedef struct _DR_AREA { unsigned int tag; unsigned int code[2]; } DR_AREA; -typedef struct DR_OFFSET { +typedef struct _DR_OFFSET { unsigned int tag; unsigned int code[1]; } DR_OFFSET; -typedef struct DR_TWIN { +typedef struct _DR_TWIN { unsigned int tag; unsigned int code[2]; } DR_TWIN; -typedef struct DR_TPAGE { +typedef struct _DR_TPAGE { unsigned int tag; unsigned int code[1]; } DR_TPAGE; -typedef struct DR_MASK { /* ORIGINAL */ +typedef struct _DR_MASK { /* ORIGINAL */ unsigned int tag; unsigned int code[1]; } DR_MASK; -typedef struct FILL { /* ORIGINAL */ +typedef struct _FILL { /* ORIGINAL */ unsigned int tag; unsigned char r0,g0,b0,code; unsigned short x0,y0; // Note: coordinates must be in 16 pixel steps unsigned short w,h; } FILL; -typedef struct VRAM2VRAM { /* ORIGINAL */ +typedef struct _VRAM2VRAM { /* ORIGINAL */ unsigned int tag; unsigned char p0,p1,p2,code; unsigned short x0,y0; @@ -491,18 +491,18 @@ typedef struct VRAM2VRAM { /* ORIGINAL */ // General structs -typedef struct RECT { +typedef struct _RECT { short x,y; short w,h; } RECT; -typedef struct DISPENV_RAW { +typedef struct _DISPENV_RAW { unsigned int vid_mode; // Video mode short vid_xpos,vid_ypos; // Video position (not framebuffer) short fb_x,fb_y; // Framebuffer display position } DISPENV_RAW; -typedef struct DISPENV { +typedef struct _DISPENV { RECT disp; RECT screen; char isinter; @@ -511,7 +511,7 @@ typedef struct DISPENV { char pad; } DISPENV; -typedef struct DRAWENV { +typedef struct _DRAWENV { RECT clip; // Drawing area short ofs[2]; // GPU draw offset (relative to draw area) RECT tw; // Texture window (doesn't do anything atm) @@ -523,7 +523,7 @@ typedef struct DRAWENV { DR_ENV dr_env; // Draw mode packet area (used by PutDrawEnv) } DRAWENV; -typedef struct TIM_IMAGE { +typedef struct _TIM_IMAGE { unsigned int mode; RECT *crect; unsigned int *caddr; diff --git a/libpsn00b/include/psxgte.h b/libpsn00b/include/psxgte.h index da9aff6..7c10533 100644 --- a/libpsn00b/include/psxgte.h +++ b/libpsn00b/include/psxgte.h @@ -70,6 +70,9 @@ void VectorNormalS(VECTOR *v0, SVECTOR *v1); void Square0(VECTOR *v0, VECTOR *v1); +int SquareRoot12( int v ); +int SquareRoot0( int v ); + #ifdef __cplusplus } #endif diff --git a/libpsn00b/psxgte/vectornormals.s b/libpsn00b/psxgte/vectornormals.s index 49d949d..939c4d1 100644 --- a/libpsn00b/psxgte/vectornormals.s +++ b/libpsn00b/psxgte/vectornormals.s @@ -56,12 +56,11 @@ VectorNormalS: la $t5, _norm_table addu $t5, $t4 lh $t5, 0($t5) - nop - mtc2 $t5, C2_IR0 mtc2 $t0, C2_IR1 mtc2 $t1, C2_IR2 mtc2 $t2, C2_IR3 + mtc2 $t5, C2_IR0 nGPF(0) @@ -81,6 +80,8 @@ VectorNormalS: .section .data +.global _norm_table +.type _norm_table, @object _norm_table: .hword 0x1000, 0x0FE0, 0x0FC1, 0x0FA3, 0x0F85, 0x0F68, 0x0F4C, 0x0F30 .hword 0x0F15, 0x0EFB, 0x0EE1, 0x0EC7, 0x0EAE, 0x0E96, 0x0E7E, 0x0E66 |
