Updating dependencies docs and prepping for more advanced script usage of toolchain for Psy-Q

This commit is contained in:
2025-08-05 21:22:49 -04:00
parent cc487a0e42
commit 5da7c2e3b0
94 changed files with 12730 additions and 26 deletions
View File
View File
+34 -5
View File
@@ -6,19 +6,48 @@ A rest from the usual.
## Dependencies
I will be programming from a Windows 11 machine:
![system_info](./docs/assets/system_info.png)
```ps1
scoop bucket add extras
scoop install armips
# not really used yet for scripts (may never)
scoop install lua
powershell -c "& { iwr -UseBasicParsing https://bit.ly/mips-ps1 | iex }"
mips install 14.2.0
```
[armips](https://github.com/Kingcom/armips)
* Supports doing bare-metal assembly for the ps1
* `scoop install armips`
[pscx-redux](https://github.com/grumpycoders/pcsx-redux/): A collection of tools, research, hardware design, and libraries aiming at development and reverse engineering on the PlayStation 1.
* Used as the runtime sandbox emulated the ps1
* Has hookups to behaving as a gdb server which can be utilized with the gdb client in vscode.
* Supports symbolic info emitted by armips
* pysq library has been sucessfully adjusted for modern compiler usage (see: src/)
[MIPS Toolchain (from pscx-redux)](https://static.grumpycoder.net/pixel/mips/)
* Used for building ps1 programs for the C runtime provided by the psyq/o SDK
[nugget](https://github.com/pcsx-redux/nugget)
* Readonly mirror of pcsx-redux's `src/mips` directory.
* Not necessary if the pcsx-redux repo is cloned
[PSX Psy-Q SDK (supplied by `psx.arthus.net`)](https://psx.arthus.net/sdk/Psy-Q/)
* Original official SDK
* Modernized using obj parser to extract info for GNU toolchain usage.
* Can be utilized effectively with the includes below
* Can either grab from arthus [psyq-4.7-converted-full.7z](https://psx.arthus.net/sdk/Psy-Q/psyq-4.7-converted-full.7z) or [psyq-4_7-converted-light.zip](psyq-4_7-converted-light.zip)
* The light version omits the link modules (object files), just keeps the static archives.
[psyq_include_what_you_use](https://github.com/johnbaumann/psyq_include_what_you_use/)
* Fixes psyq headers to include what they use, so changing the include order in your project doesn't break compiling.
* Needed if you want to link and utilize the psyq C SDK
## Gallery
![clear!](./docs/assets/pcsx-redux.main_2025-08-03_18-02-08.png)
-19
View File
@@ -1,19 +0,0 @@
$path_root = split-path -Path $PSScriptRoot -Parent
$path_build = join-path $path_root 'build'
$path_code = join-path $path_root 'code'
$path_scripts = join-path $path_root 'scripts'
$path_toolchain = join-path $path_root 'toolchain'
if ((test-path $path_build) -eq $false) {
new-item -itemtype directory -path $path_build
}
$armips = join-path $path_toolchain 'armips/build/Debug/armips.exe'
$bin2exe_lua = join-path $path_scripts 'bin2exe.lua'
$bin2exe_py = join-path $path_scripts 'bin2exe.py'
# TODO(Ed): General way to build C runtime sandboxed projects.
# The goal here is to lift w/e is going on in SpinningCube to just utilize the toolchain dir's content
# We also want to strip down the C to just calling the ASM's entry point, from there we'll try to use
# the PS1 SDK from asm and just setup macros for the ABI calling convention
+234
View File
@@ -0,0 +1,234 @@
$path_root = split-path -Path $PSScriptRoot -Parent
$path_build = join-path $path_root 'build'
$path_code = join-path $path_root 'code'
$path_scripts = join-path $path_root 'scripts'
$path_toolchain = join-path $path_root 'toolchain'
if ((test-path $path_build) -eq $false) {
new-item -itemtype directory -path $path_build
}
# TODO(Ed): General way to build C runtime sandboxed projects.
# The goal here is to lift w/e is going on in SpinningCube to just utilize the toolchain dir's content
# We also want to strip down the C to just calling the ASM's entry point, from there we'll try to use
# the PS1 SDK from asm and just setup macros for the ABI calling convention
# --- Toolchain Definition ---
# Assumes 'mipsel-none-elf' toolchain is in your system's PATH.
$Prefix = "mipsel-none-elf"
$Compiler = "$($Prefix)-gcc"
$Objcopy = "$($Prefix)-objcopy"
# --- Abstracted GCC/MIPS Flags ---
# General Compiler Flags
$f_compile = "-c"
$f_debug = "-g"
$f_define = "-D"
$f_include = "-I"
$f_output = "-o"
$f_std_c11 = "-std=c11"
# Warning Flags
$f_wall = "-Wall"
$f_wno_attributes = "-Wno-attributes"
# Optimization Flags
$f_optimize_none = "-O0" # For Debug builds
$f_optimize_size = "-Os" # For Release builds
$f_omit_frame_ptr = "-fomit-frame-pointer"
# Environment & Standard Library Flags
$f_no_stdlib = "-nostdlib"
$f_freestanding = "-ffreestanding"
$f_no_builtin = "-fno-builtin"
# MIPS Architecture Specific Flags
$f_arch_mips1 = "-march=mips1"
$f_arch_abi32 = "-mabi=32"
$f_arch_little_endian = "-EL"
$f_arch_fp32 = "-mfp32"
$f_arch_no_pic = "-fno-pic"
$f_arch_no_shared = "-mno-shared"
$f_arch_no_abicalls = "-mno-abicalls"
$f_arch_no_llsc = "-mno-llsc"
$f_arch_no_gpopt = "-mno-gpopt"
$f_arch_no_stack_prot = "-fno-stack-protector"
# Linker-related Flags (for Compiler)
$f_code_sections = "-ffunction-sections"
$f_data_sections = "-fdata-sections"
$f_no_strict_alias = "-fno-strict-aliasing"
# Linker Flags (passed via -Wl,)
$f_link_pass_through_prefix = "-Wl,"
$f_link_mapfile = "-Map=" # Usage: $flag_link_pass_through_prefix + $flag_link_mapfile + path
$f_link_gc_sections = "--gc-sections"
$f_link_format = "--oformat="
$f_link_start_group = "--start-group"
$f_link_end_group = "--end-group"
$f_link_static = "-static"
$f_link_script = "-T"
$f_link_lib_path = "-L"
$f_link_lib = "-l"
# Objcopy Flags
$f_objcopy_format = "-O"
$path_nugget = join-path $path_third_party 'nugget'
$path_psyq = join-path $path_third_party 'psyq'
$path_psyq_imyu = join-path $path_third_party 'psyq-iwyu'
$path_nugget_common = join-path $path_nugget 'common'
function assemble-unit { param(
[string]$
)
$compile_args_asm += $f_debug
$compile_args_asm += @(
$f_arch_mips1,
$f_arch_abi32,
$f_arch_fp32,
$f_arch_little_endian,
$f_arch_no_abicalls,
$f_arch_no_pic,
$f_arch_no_llsc,
$f_arch_no_shared,
$f_arch_no_stack_prot
)
$compile_args_asm += $f_no_stdlib
$compile_args_asm += $f_freestanding
$compile_args_asm += ($f_include + $path_nugget)
}
function compile-unit { param(
[string]$module,
[string]$unit
)
write-host "--- Compiling Source Files ---" -ForegroundColor Cyan
$compile_args_c = @()
$compile_args_c += $f_debug
$compile_args_c += $f_optimize_none
# $compile_args_c += $f_optimize_size
$compile_args_c += $f_code_sections
$compile_args_c += $f_data_sections
$compile_args_c += $f_wno_attributes
$compile_args_c += $f_freestanding
$compile_args_c += $f_omit_frame_ptr
$compile_args_c += $f_no_builtin
$compile_args_c += $f_no_stdlib
$compile_args_c += $f_no_strict_alias
$compile_args_c += @(
$f_arch_mips1,
$f_arch_abi32,
$f_arch_fp32,
$f_arch_little_endian,
$f_arch_no_abicalls,
$f_arch_no_gpopt,
$f_arch_no_pic,
$f_arch_no_llsc,
$f_arch_no_shared,
$f_arch_no_stack_prot
)
$path_psyq_imyu_inc = join-path $path_psyq_imyu 'include'
$compile_args_c += ($f_include + $path_psyq_imyu_inc)
$compile_args_c += ($f_include + $path_nugget)
}
function link-modules { param(
)
write-host "`n--- Linking Modules ---" -ForegroundColor Cyan
$link_args = @()
$link_args += $f_debug
# $link_args += $f_optimize_size
$link_args += $f_no_stdlib
$link_args += $f_link_static
$link_args += $f_arch_mips1
$link_args += $f_arch_abi32
$link_args += $f_arch_little_endian
$link_args += ($f_link_pass_through_prefix + $f_link_gc_sections)
$link_args += ($f_link_pass_through_prefix + $f_link_format + "elf32-littlemips")
$linkscript_nugget = join-path $path_nugget 'nooverlay.ld'
$linkscript_ps_exe = join-path $path_nugget "ps-exe.ld"
$link_args += ($f_link_script + $linkscript_nugget)
$link_args += ($f_link_script + $linkscript_ps_exe)
$path_psyq_lib = join-path $path_psyq 'lib'
$link_args += ($f_link_lib_path + $path_psyq_lib)
$link_args += $link_modules
$map = join-path $path_build 'SpinningCube.map'
$link_args += ($f_link_pass_through_prefix + $f_link_mapfile + $map)
$link_args += ($f_link_pass_through_prefix + $f_link_start_group)
$libraries = @(
"api",
"c",
"c2",
"card",
"cd",
"comb",
"ds",
"etc",
"gpu",
"gs",
"gte",
"gun",
"hmd",
"math",
"mcrd",
"mcx",
"pad",
"press",
"sio",
"snd",
"spu",
"tap"
)
foreach ($lib in $libraries) {
$link_args += ($f_link_lib + $lib)
}
$elf = Join-Path $path_build "SpinningCube.elf"
$final_link_args = @($link_args) + ($f_output + $elf)
write-host "Linking modules into 'SpinningCube.elf'"
$final_link_args += ($f_link_pass_through_prefix + $f_link_end_group)
$final_link_args | foreach-object { write-host $_ }
& $Compiler $final_link_args
if ($LASTEXITCODE -ne 0) { write-error "Linking failed. Aborting."; exit 1 }
}
function make-binary { param(
)
Write-Host "`n--- Creating Final Binary ---" -ForegroundColor Cyan
$exe = join-path $path_build "SpinningCube.ps-exe"
write-host "Converting ELF to PS-EXE -> 'SpinningCube.ps-exe'"
$objcopy_args = ($f_objcopy_format + "binary"), $elf, $exe
& $Objcopy $objcopy_args
if ($LASTEXITCODE -ne 0) { Write-Error "Objcopy failed. Aborting."; exit 1 }
}
function build-hello_psyqo {
}
build-hello_psyqo
+6 -1
View File
@@ -18,7 +18,7 @@ $url_armips = 'https://github.com/Kingcom/armips.git'
$url_pcsx_redux = 'https://github.com/grumpycoders/pcsx-redux.git'
$path_armips = join-path $path_toolchain 'armips'
$path_pcsx_redux = join-path $path_toolchain 'pcsx_redux'
$path_pcsx_redux = join-path $path_toolchain 'pcsx-redux'
clone-gitrepo $path_armips $url_armips
clone-gitrepo $path_pcsx_redux $url_pcsx_redux
@@ -29,3 +29,8 @@ push-location $path_armips_build
& cmake ..
& cmake --build . --config Debug
pop-location
$path_pcsx_redux_vsprojects = join-path $path_pcsx_redux 'vscprojects'
$path_pcsx_redux_binaries = join-path $path_pcsx_redux_vsprojects 'x64/Release'
$psyq_obj_parser = join-path $path_pcsx_redux_binaries 'psyq-obj-parser.exe'
Submodule toolchain/pcsx-redux added at a2a6d77cba
+24
View File
@@ -0,0 +1,24 @@
/*
* File:abs.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _ABS_H
#define _ABS_H
#ifndef ABS
#define ABS(x) (((x)>=0)?(x):(-(x)))
#endif /* abs */
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int abs(int);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _ABS_H */
+156
View File
@@ -0,0 +1,156 @@
/*
* File:asm.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _ASM_H
#define _ASM_H
#define R0 $0
#define R1 $1
#define R2 $2
#define R3 $3
#define R4 $4
#define R5 $5
#define R6 $6
#define R7 $7
#define R8 $8
#define R9 $9
#define R10 $10
#define R11 $11
#define R12 $12
#define R13 $13
#define R14 $14
#define R15 $15
#define R16 $16
#define R17 $17
#define R18 $18
#define R19 $19
#define R20 $20
#define R21 $21
#define R22 $22
#define R23 $23
#define R24 $24
#define R25 $25
#define R26 $26
#define R27 $27
#define R28 $28
#define R29 $29
#define R30 $30
#define R31 $31
#if defined(_LANGUAGE_C)||defined(LANGUAGE_C)||defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
#else
#define zero $0 /* wired zero */
#define AT $1 /* assembler temp */
#define v0 $2 /* return value */
#define v1 $3
#define a0 $4 /* argument registers */
#define a1 $5
#define a2 $6
#define a3 $7
#define t0 $8 /* caller saved */
#define t1 $9
#define t2 $10
#define t3 $11
#define t4 $12
#define t5 $13
#define t6 $14
#define t7 $15
#define s0 $16 /* callee saved */
#define s1 $17
#define s2 $18
#define s3 $19
#define s4 $20
#define s5 $21
#define s6 $22
#define s7 $23
#define t8 $24 /* code generator */
#define t9 $25
#define k0 $26 /* kernel temporary */
#define k1 $27
#define gp $28 /* global pointer */
#define sp $29 /* stack pointer */
#define fp $30 /* frame pointer */
#define ra $31 /* return address */
#endif
/* register offset */
#define R_R0 0
#define R_R1 1
#define R_R2 2
#define R_R3 3
#define R_R4 4
#define R_R5 5
#define R_R6 6
#define R_R7 7
#define R_R8 8
#define R_R9 9
#define R_R10 10
#define R_R11 11
#define R_R12 12
#define R_R13 13
#define R_R14 14
#define R_R15 15
#define R_R16 16
#define R_R17 17
#define R_R18 18
#define R_R19 19
#define R_R20 20
#define R_R21 21
#define R_R22 22
#define R_R23 23
#define R_R24 24
#define R_R25 25
#define R_R26 26
#define R_R27 27
#define R_R28 28
#define R_R29 29
#define R_R30 30
#define R_R31 31
#define R_EPC 32
#define R_MDHI 33
#define R_MDLO 34
#define R_SR 35
#define R_CAUSE 36
#define NREGS 40
/*
* compiler defined bindings
*/
#define R_ZERO R_R0
#define R_AT R_R1
#define R_V0 R_R2
#define R_V1 R_R3
#define R_A0 R_R4
#define R_A1 R_R5
#define R_A2 R_R6
#define R_A3 R_R7
#define R_T0 R_R8
#define R_T1 R_R9
#define R_T2 R_R10
#define R_T3 R_R11
#define R_T4 R_R12
#define R_T5 R_R13
#define R_T6 R_R14
#define R_T7 R_R15
#define R_S0 R_R16
#define R_S1 R_R17
#define R_S2 R_R18
#define R_S3 R_R19
#define R_S4 R_R20
#define R_S5 R_R21
#define R_S6 R_R22
#define R_S7 R_R23
#define R_T8 R_R24
#define R_T9 R_R25
#define R_K0 R_R26
#define R_K1 R_R27
#define R_GP R_R28
#define R_SP R_R29
#define R_FP R_R30
#define R_RA R_R31
#endif
+23
View File
@@ -0,0 +1,23 @@
/*
* $PSLibId: Run-time Library Release 4.7$
*/
/*
* File:assert.h
*/
#ifndef _ASSERT_H
#define _ASSERT_H
# ifdef NDEBUG
# define _assert(x)
# define assert(x)
# else
# define _assert(x) {if (!(x)){printf("Assertion failed: file \"%s\", line %d\n", __FILE__, __LINE__);exit(1);}}
# define assert(x) _assert(x)
# endif
#endif /* _ASSERT_H */
+23
View File
@@ -0,0 +1,23 @@
/*
* File:convert.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _CONVERT_H
#define _CONVERT_H
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int atoi(const char *);
extern long atol(const char *);
extern long strtol(const char *,char**, int);
extern unsigned long strtoul(const char *, char **, int);
extern long labs(long);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif
+49
View File
@@ -0,0 +1,49 @@
/*
* File:ctype.h
* character handling macro definitions
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _CTYPE_H
#define _CTYPE_H
#define _U 0x01 /* upper case letter */
#define _L 0x02 /* lower case letter */
#define _N 0x04 /* digit */
#define _S 0x08 /* space, tab, newline, vertical tab, formfeed, or
carriage return */
#define _P 0x10 /* punctuation character */
#define _C 0x20 /* control character or delete */
#define _X 0x40 /* hexadecimal digit [0-9a-fA-F]*/
#define _B 0x80 /* blank (space) */
extern char _ctype_[];
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern char toupper(char);
extern char tolower(char);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#define isalpha(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L))
#define isupper(c) ((_ctype_+1)[(unsigned char)(c)]&_U)
#define islower(c) ((_ctype_+1)[(unsigned char)(c)]&_L)
#define isdigit(c) ((_ctype_+1)[(unsigned char)(c)]&_N)
#define isxdigit(c) ((_ctype_+1)[(unsigned char)(c)]&(_X|_N))
#define isspace(c) ((_ctype_+1)[(unsigned char)(c)]&_S)
#define ispunct(c) ((_ctype_+1)[(unsigned char)(c)]&_P)
#define isalnum(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L|_N))
#define isprint(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N|_B))
#define isgraph(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N))
#define iscntrl(c) ((_ctype_+1)[(unsigned char)(c)]&_C)
#define isascii(c) ((unsigned)(c)<=0x7f)
#define toascii(c) ((unsigned char)(c)&0x7f)
#define _toupper(c) ((unsigned char)(c)-'a'+'A')
#define _tolower(c) ((unsigned char)(c)-'A'+'a')
#endif /* _CTYPE_H */
+59
View File
@@ -0,0 +1,59 @@
/*
* Error codes
* $RCSfile: errno.h,v $
* $Id: errno.h,v 1.3 1995/02/28 10:02:53 yoshi Exp $
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _ERRNO_H
#define _ERRNO_H
/* Error codes */
#define EPERM 1 /* Not owner */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No children */
#define EAGAIN 11 /* No more processes */
#define ENOMEM 12 /* Not enough core */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Mount device busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory*/
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* File table overflow */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Not a typewriter */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only file system */
#define EFORMAT 31 /* Bad file format */
#define EPIPE 32 /* Broken pipe */
/* math software */
#define EDOM 33 /* Argument too large */
#define ERANGE 34 /* Result too large */
/* non-blocking and interrupt i/o */
#define EWOULDBLOCK 35 /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */
#define EALREADY 37 /* Operation already in progress */
extern int errno;
#endif /* _ERRNO_H */
+25
View File
@@ -0,0 +1,25 @@
/*
* File:fcntl.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _SYS_FCNTL_H
#define _SYS_FCNTL_H
/* flags */
#define FREAD 0x0001 /* readable */
#define FWRITE 0x0002 /* writable */
#define FNBLOCK 0x0004 /* non-blocking reads */
#define FRLOCK 0x0010 /* read locked (non-shared) */
#define FWLOCK 0x0020 /* write locked (non-shared) */
#define FAPPEND 0x0100 /* append on each write */
#define FCREAT 0x0200 /* create if nonexistant */
#define FTRUNC 0x0400 /* truncate to zero length */
#define FSCAN 0x1000 /* scan type */
#define FRCOM 0x2000 /* remote command entry */
#define FNBUF 0x4000 /* no ring buf. and console interrupt */
#define FASYNC 0x8000 /* asyncronous i/o */
#endif /* _SYS_FCNTL_H */
+33
View File
@@ -0,0 +1,33 @@
/*
* File:file.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _SYS_FILE_H
#define _SYS_FILE_H
#include <sys/fcntl.h>
/* Flag for open() */
#define O_RDONLY FREAD
#define O_WRONLY FWRITE
#define O_RDWR FREAD|FWRITE
#define O_CREAT FCREAT /* open with file create */
#define O_NOBUF FNBUF /* no device buffer and console interrupt */
#define O_NBLOCK FNBLOCK /* non blocking mode */
#define O_NOWAIT FASYNC /* asyncronous i/o */
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif
#ifndef SEEK_END
#define SEEK_END 2
#endif
#endif /* _SYS_FILE_H */
+103
View File
@@ -0,0 +1,103 @@
/*
* File:fs.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _FS_H
#define _FS_H
#if defined(_LANGUAGE_C)||defined(LANGUAGE_C)||defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
/* device table */
struct device_table {
char *dt_string; /* device name */
int dt_type; /* device "type" */
int dt_bsize; /* file system type */
char *dt_desc; /* device description */
int (*dt_init)(); /* device init routine */
int (*dt_open)(); /* device open routine */
int (*dt_strategy)(); /* device strategy routine, returns cnt */
int (*dt_close)(); /* device close routine */
int (*dt_ioctl)(); /* device ioctl routine */
int (*dt_read)(); /* fs read routine, returns count */
int (*dt_write)(); /* fs write routine, return count */
int (*dt_delete)(); /* file delete routine */
int (*dt_undelete)(); /* file delete routine */
int (*dt_firstfile)(); /* directory serach routine */
int (*dt_nextfile)(); /* directory serach routine */
int (*dt_format)();
int (*dt_cd)();
int (*dt_rename)();
int (*dt_remove)();
int (*dt_else)();
};
#endif /* LANGUAGE_C */
/* device types */
#define DTTYPE_CHAR 0x1 /* character device */
#define DTTYPE_CONS 0x2 /* can be console */
#define DTTYPE_BLOCK 0x4 /* block device */
#define DTTYPE_RAW 0x8 /* raw device that uses fs switch */
#define DTTYPE_FS 0x10
/* character device flags */
#define DB_RAW 0x1 /* don't interpret special chars */
#define DB_STOPPED 0x2 /* stop output */
#define DB_BREAK 0x4 /* cntl-c raise console interrpt */
/* character device buffer */
#define CBUFSIZE 256
#if defined(_LANGUAGE_C)||defined(LANGUAGE_C)||defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
struct device_buf {
int db_flags; /* character device flags */
char *db_in; /* pts at next free char */
char *db_out; /* pts at next filled char */
char db_buf[CBUFSIZE]; /* circular buffer for input */
};
#endif /* LANGUAGE_C */
/* circular buffer functions */
#define CIRC_EMPTY(x) ((x)->db_in == (x)->db_out)
#define CIRC_FLUSH(x) ((x)->db_in = (x)->db_out = (x)->db_buf)
#define CIRC_STOPPED(x) ((x)->db_flags & DB_STOPPED)
/* io block */
#if defined(_LANGUAGE_C)||defined(LANGUAGE_C)||defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
struct iob {
int i_flgs;
int i_unit; /* pseudo device unit */
char *i_ma; /* memory address of i/o buffer */
unsigned int i_cc; /* character count of transfer */
unsigned long i_offset; /* seek offset in file */
int i_fstype; /* file system type */
int i_errno; /* error # return */
struct device_table *i_dp; /* pointer into device_table */
unsigned long i_size;
long i_head;
long i_fd; /* file descriptor */
};
#endif /* LANGUAGE_C */
#ifndef NULL
#define NULL 0
#endif
/* Request codes */
#define READ 1
#define WRITE 2
#define NIOB 16 /* max number of open files */
/*
extern int _nulldev();
extern int _nodev();
*/
#endif /* _FS_H */
+358
View File
@@ -0,0 +1,358 @@
/*
* $PSLibId: Run-time Library Release 4.7$
*/
/*
* GTE inline functions(Simple)
*/
#define gte_RotTransPers(r1,r2,r3,r4,r5) \
{ gte_ldv0(r1); \
gte_rtps(); \
gte_stsxy(r2); \
gte_stdp(r3); \
gte_stflg(r4); \
gte_stszotz(r5); }
#define gte_RotTransPers3(r1,r2,r3,r4,r5,r6,r7,r8,r9) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stsxy3(r4,r5,r6); \
gte_stdp(r7); \
gte_stflg(r8); \
gte_stszotz(r9); }
#define gte_RotTrans(r1,r2,r3) \
{ gte_ldv0(r1); \
gte_rt(); \
gte_stlvnl(r2); \
gte_stflg(r3); }
#define gte_LocalLight(r1,r2) \
{ gte_ldv0(r1); \
gte_ll(); \
gte_stlvl(r2); }
#define gte_LightColor(r1,r2) \
{ gte_ldlvl(r1); \
gte_lc(); \
gte_stlvl(r2); }
#define gte_DpqColorLight(r1,r2,r3,r4) \
{ gte_ldlvl(r1); \
gte_ldrgb(r2); \
gte_lddp(r3); \
gte_dpcl(); \
gte_strgb(r4); }
#define gte_DpqColor(r1,r2,r3) \
{ gte_ldrgb(r1); \
gte_lddp(r2); \
gte_dpcs(); \
gte_strgb(r3); }
#define gte_DpqColor3(r1,r2,r3,r4,r5,r6,r7) \
{ gte_ldrgb3(r1,r2,r3); \
gte_lddp(r4); \
gte_dpct(); \
gte_strgb3(r5,r6,r7); }
#define gte_Intpl(r1,r2,r3) \
{ gte_ldlvl(r1); \
gte_lddp(r2); \
gte_intpl(); \
gte_strgb(r3); }
#define gte_Square12(r1,r2) \
{ gte_ldlvl(r1); \
gte_sqr12(); \
gte_stlvnl(r2); }
#define gte_Square0(r1,r2) \
{ gte_ldlvl(r1); \
gte_sqr0(); \
gte_stlvnl(r2); }
#define gte_NormalColor(r1,r2) \
{ gte_ldv0(r1); \
gte_ncs(); \
gte_strgb(r2); }
#define gte_NormalColor3(r1,r2,r3,r4,r5,r6) \
{ gte_ldv3(r1,r2,r3); \
gte_nct(); \
gte_strgb3(r4,r5,r6); }
#define gte_NormalColorDpq(r1,r2,r3,r4) \
{ gte_ldv0(r1); \
gte_ldrgb(r2); \
gte_lddp(r3); \
gte_ncds(); \
gte_strgb(r4); }
#define gte_NormalColorDpq3(r1,r2,r3,r4,r5,r6,r7,r8) \
{ gte_ldv3(r1,r2,r3); \
gte_ldrgb(r4); \
gte_lddp(r5); \
gte_ncdt(); \
gte_strgb3(r6,r7,r8); }
#define gte_NormalColorCol(r1,r2,r3) \
{ gte_ldv0(r1); \
gte_ldrgb(r2); \
gte_nccs(); \
gte_strgb(r3); }
#define gte_NormalColorCol3(r1,r2,r3,r4,r5,r6,r7) \
{ gte_ldv3(r1,r2,r3); \
gte_ldrgb(r4); \
gte_ncct(); \
gte_strgb3(r5,r6,r7); }
#define gte_ColorDpq(r1,r2,r3,r4) \
{ gte_ldlvl(r1); \
gte_ldrgb(r2); \
gte_lddp(r3); \
gte_cdp(); \
gte_strgb(r4); }
#define gte_ColorCol(r1,r2,r3) \
{ gte_ldlvl(r1); \
gte_ldrgb(r2); \
gte_cc(); \
gte_strgb(r3); }
#define gte_NormalClip(r1,r2,r3,r4) \
{ gte_ldsxy3(r1,r2,r3); \
gte_nclip(); \
gte_stopz(r4); }
#define gte_AverageZ3(r1,r2,r3,r4) \
{ gte_ldsz3(r1,r2,r3); \
gte_avsz3(); \
gte_stotz(r4); }
#define gte_AverageZ4(r1,r2,r3,r4,r5) \
{ gte_ldsz4(r1,r2,r3,r4); \
gte_avsz4(); \
gte_stotz(r5); }
#define gte_OuterProduct12(r1,r2,r3) \
{ gte_ldopv1(r1); \
gte_ldopv2(r2); \
gte_op12(); \
gte_stlvnl(r3); }
#define gte_OuterProduct0(r1,r2,r3) \
{ gte_ldopv1(r1); \
gte_ldopv2(r2); \
gte_op0(); \
gte_stlvnl(r3); }
#define gte_OuterProduct12SVL(r1,r2,r3) \
{ gte_ldopv1SV(r1); \
gte_ldopv2SV(r2); \
gte_op12(); \
gte_stlvnl(r3); }
#define gte_OuterProduct0SVL(r1,r2,r3) \
{ gte_ldopv1SV(r1); \
gte_ldopv2SV(r2); \
gte_op0(); \
gte_stlvnl(r3); }
#define gte_OuterProduct12SV(r1,r2,r3) \
{ gte_ldopv1SV(r1); \
gte_ldopv2SV(r2); \
gte_op12(); \
gte_stsv(r3); }
#define gte_OuterProduct0SV(r1,r2,r3) \
{ gte_ldopv1SV(r1); \
gte_ldopv2SV(r2); \
gte_op0(); \
gte_stsv(r3); }
#define gte_Lzc(r1,r2) \
{ gte_ldlzc(r1); \
gte_nop(); \
gte_nop(); \
gte_stlzc(r2); }
/*
* GTE inline functions(Combination)
* 4 vertices functions can't be replaced by equivalent macros
* because they use OR of flags after rtpt & rtps
* Please write directry in your program.
*/
#define gte_RotAverage3(r1,r2,r3,r4,r5,r6,r7,r8,r9) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stsxy3(r4,r5,r6); \
gte_stdp(r7); \
gte_stflg(r8); \
gte_avsz3(); \
gte_stotz(r9); }
#define gte_RotNclip3(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stflg(r9); \
gte_nclip(); \
gte_stopz(r10); \
gte_stsxy3(r4,r5,r6); \
gte_stdp(r7); \
gte_stszotz(r8); }
#define gte_RotAverageNclip3(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stflg(r9); \
gte_nclip(); \
gte_stopz(r10); \
gte_stsxy3(r4,r5,r6); \
gte_stdp(r7); \
gte_avsz3(); \
gte_stotz(r8); }
#define gte_RotColorDpq(r1,r2,r3,r4,r5,r6,r7) \
{ gte_ldv0(r1); \
gte_rtps(); \
gte_stsxy(r4); \
gte_stflg(r6); \
gte_ldv0(r2); \
gte_ldrgb(r3); \
gte_ncds(); \
gte_strgb(r5); \
gte_stszotz(r7); }
#define gte_RotColorDpq3(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stsxy3(r8,r9,r10); \
gte_stflg(r14); \
gte_ldv3(r4,r5,r6); \
gte_ldrgb(r7); \
gte_ncdt(); \
gte_strgb3(r11,r12,r13);\
gte_stszotz(r15); }
#define gte_RotAverageNclipColorDpq3(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stflg(r15); \
gte_nclip(); \
gte_stopz(r16); \
gte_ldv3(r4,r5,r6); \
gte_ldrgb(r7); \
gte_ncdt(); \
gte_stsxy3(r8,r9,r10); \
gte_strgb3(r11,r12,r13);\
gte_avsz3(); \
gte_stotz(r14); }
#define gte_RotAverageNclipColorCol3(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stflg(r15); \
gte_nclip(); \
gte_stopz(r16); \
gte_ldv3(r4,r5,r6); \
gte_ldrgb(r7); \
gte_ncct(); \
gte_stsxy3(r8,r9,r10); \
gte_strgb3(r11,r12,r13);\
gte_avsz3(); \
gte_stotz(r14); }
#define gte_LoadAverage12(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldlvl(r1); \
gte_gpf12(); \
gte_lddp(r4); \
gte_ldlvl(r2); \
gte_gpl12(); \
gte_stlvl(r5); }
#define gte_LoadAverage0(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldlvl(r1); \
gte_gpf0(); \
gte_lddp(r4); \
gte_ldlvl(r2); \
gte_gpl0(); \
gte_stlvl(r5); }
#define gte_LoadAverageShort12(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldsv(r1); \
gte_gpf12(); \
gte_lddp(r4); \
gte_ldsv(r2); \
gte_gpl12(); \
gte_stsv(r5); }
#define gte_LoadAverageShort0(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldsv(r1); \
gte_gpf0(); \
gte_lddp(r4); \
gte_ldsv(r2); \
gte_gpl0(); \
gte_stsv(r5); }
#define gte_LoadAverageByte(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldbv(r1); \
gte_gpf12(); \
gte_lddp(r4); \
gte_ldbv(r2); \
gte_gpl12(); \
gte_stbv(r5); }
#define gte_LoadAverageCol(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldcv(r1); \
gte_gpf12(); \
gte_lddp(r4); \
gte_ldcv(r2); \
gte_gpl12(); \
gte_stcv(r5); }
/*
*
*/
#define gte_MulMatrix0(r1,r2,r3) \
{ gte_SetRotMatrix(r1); \
gte_ldclmv(r2); \
gte_rtir(); \
gte_stclmv(r3); \
gte_ldclmv((char*)r2+2);\
gte_rtir(); \
gte_stclmv((char*)r3+2);\
gte_ldclmv((char*)r2+4);\
gte_rtir(); \
gte_stclmv((char*)r3+4); }
#define gte_ApplyMatrix(r1,r2,r3) \
{ gte_SetRotMatrix(r1); \
gte_ldv0(r2); \
gte_rtv0(); \
gte_stlvnl(r3); }
#define gte_ApplyMatrixSV(r1,r2,r3) \
{ gte_SetRotMatrix(r1); \
gte_ldv0(r2); \
gte_rtv0(); \
gte_stsv(r3); }
#define gte_CompMatrix(r1,r2,r3) \
{ gte_MulMatrix0(r1,r2,r3);\
gte_SetTransMatrix(r1); \
gte_ldlv0((char*)r2+20);\
gte_rt(); \
gte_stlvnl((char*)r3+20); }
#define gte_ApplyRotMatrix(r1,r2) \
{ gte_ldv0(r1); \
gte_rtv0(); \
gte_stlvnl(r2); }
+167
View File
@@ -0,0 +1,167 @@
;
; $PSLibId: Run-time Library Release 4.7$
;
;
; gtenom.h
; Copyright(C) 1995,1996,1997 Sony Computer Entertainment Inc.
; All rights reserved.
;
read_sz_fifo3 macro reg1,reg2,reg3
mfc2 reg1,r17
mfc2 reg2,r18
mfc2 reg3,r19
nop
endm
read_sz_fifo4 macro reg1,reg2,reg3,reg4
mfc2 reg1,r16
mfc2 reg2,r17
mfc2 reg3,r18
mfc2 reg4,r19
nop
endm
read_szx macro reg1
mfc2 reg1,r16
nop
endm
read_sz0 macro reg1
mfc2 reg1,r17
nop
endm
read_sz1 macro reg1
mfc2 reg1,r18
nop
endm
read_sz2 macro reg1
mfc2 reg1,r19
nop
endm
read_sxsy_fifo3 macro reg1,reg2,reg3
mfc2 reg1,r12
mfc2 reg2,r13
mfc2 reg3,r14
nop
endm
read_sxsy0 macro reg1
mfc2 reg1,r12
nop
endm
read_sxsy1 macro reg1
mfc2 reg1,r13
nop
endm
read_sxsy2 macro reg1
mfc2 reg1,r14
nop
endm
read_rgb_fifo macro reg1,reg2,reg3
mfc2 reg1,r20
mfc2 reg2,r21
mfc2 reg3,r22
nop
endm
read_rgb0 macro reg1
mfc2 reg1,r20
nop
endm
read_rgb1 macro reg1
mfc2 reg1,r21
nop
endm
read_rgb2 macro reg1
mfc2 reg1,r22
nop
endm
read_flag macro reg1
cfc2 reg1,r31
nop
endm
read_p macro reg1
mfc2 reg1,r8
nop
endm
read_otz macro reg1
mfc2 reg1,r7
nop
endm
read_opz macro reg1
mfc2 reg1,r24
nop
endm
read_mt macro reg1,reg2,reg3
mfc2 reg1,r25
mfc2 reg2,r26
mfc2 reg3,r27
nop
endm
store_sxsy_fifo3 macro reg1,reg2,reg3
swc2 r12,(reg1)
swc2 r13,(reg2)
swc2 r14,(reg3)
nop
endm
store_sxsy0 macro reg1
swc2 r12,(reg1)
nop
endm
store_sxsy1 macro reg1
swc2 r13,(reg1)
nop
endm
store_sxsy2 macro reg1
swc2 r14,(reg1)
nop
endm
store_rgb_fifo macro reg1,reg2,reg3
swc2 r20,(reg1)
swc2 r21,(reg2)
swc2 r22,(reg3)
nop
endm
store_rgb0 macro reg1
swc2 r20,(reg1)
nop
endm
store_rgb1 macro reg1
swc2 r21,(reg1)
nop
endm
store_rgb2 macro reg1
swc2 r22,(reg1)
nop
endm
set_trans_matrix macro reg1,reg2,reg3
ctc2 reg1,r5
ctc2 reg2,r6
ctc2 reg3,r7
nop
endm
+87
View File
@@ -0,0 +1,87 @@
;
; $PSLibId: Run-time Library Release 4.7$
;
;
; gtereg.h
; Copyright(C) 1995,1996,1997 Sony Computer Entertainment Inc.
; All rights reserved.
;
;
; GTE data registers
;
C2_VXY0 equs "r0"
C2_VZ0 equs "r1"
C2_VXY1 equs "r2"
C2_VZ1 equs "r3"
C2_VXY2 equs "r4"
C2_VZ2 equs "r5"
C2_RGB equs "r6"
C2_OTZ equs "r7"
C2_IR0 equs "r8"
C2_IR1 equs "r9"
C2_IR2 equs "r10"
C2_IR3 equs "r11"
C2_SXY0 equs "r12"
C2_SXY1 equs "r13"
C2_SXY2 equs "r14"
C2_SXYP equs "r15"
C2_SZ0 equs "r16"
C2_SZ1 equs "r17"
C2_SZ2 equs "r18"
C2_SZ3 equs "r19"
C2_RGB0 equs "r20"
C2_RGB1 equs "r21"
C2_RGB2 equs "r22"
C2_MAC0 equs "r24"
C2_MAC1 equs "r25"
C2_MAC2 equs "r26"
C2_MAC3 equs "r27"
C2_IRGB equs "r28"
C2_ORGB equs "r29"
C2_LZCS equs "r30"
C2_LZCR equs "r31"
;
; GTE control registers
;
C2_R11R12 equs "r0"
C2_R13R21 equs "r1"
C2_R22R23 equs "r2"
C2_R31R32 equs "r3"
C2_R33 equs "r4"
C2_TRX equs "r5"
C2_TRY equs "r6"
C2_TRZ equs "r7"
C2_L11L12 equs "r8"
C2_L13L21 equs "r9"
C2_L22L23 equs "r10"
C2_L31L32 equs "r11"
C2_L33 equs "r12"
C2_RBK equs "r13"
C2_GBK equs "r14"
C2_BBK equs "r15"
C2_LR1LR2 equs "r16"
C2_LR3LG1 equs "r17"
C2_LG2LG3 equs "r18"
C2_LB1LB2 equs "r19"
C2_LB3 equs "r20"
C2_RFC equs "r21"
C2_GFC equs "r22"
C2_BFC equs "r23"
C2_OFX equs "r24"
C2_OFY equs "r25"
C2_H equs "r26"
C2_DQA equs "r27"
C2_DQB equs "r28"
C2_ZSF3 equs "r29"
C2_ZSF4 equs "r30"
C2_FLAG equs "r31"
+87
View File
@@ -0,0 +1,87 @@
/*
* $PSLibId: Run-time Library Release 4.7$
*/
/*
* gtereg_s.h
* Copyright(C) 1998 Sony Computer Entertainment Inc.
* All rights reserved.
*/
/*
* GTE data registers
*/
#define C2_VXY0 R0
#define C2_VZ0 R1
#define C2_VXY1 R2
#define C2_VZ1 R3
#define C2_VXY2 R4
#define C2_VZ2 R5
#define C2_RGB R6
#define C2_OTZ R7
#define C2_IR0 R8
#define C2_IR1 R9
#define C2_IR2 R10
#define C2_IR3 R11
#define C2_SXY0 R12
#define C2_SXY1 R13
#define C2_SXY2 R14
#define C2_SXYP R15
#define C2_SZ0 R16
#define C2_SZ1 R17
#define C2_SZ2 R18
#define C2_SZ3 R19
#define C2_RGB0 R20
#define C2_RGB1 R21
#define C2_RGB2 R22
#define C2_MAC0 R24
#define C2_MAC1 R25
#define C2_MAC2 R26
#define C2_MAC3 R27
#define C2_IRGB R28
#define C2_ORGB R29
#define C2_LZCS R30
#define C2_LZCR R31
/*
* GTE control Registers
*/
#define C2_R11R12 R0
#define C2_R13R21 R1
#define C2_R22R23 R2
#define C2_R31R32 R3
#define C2_R33 R4
#define C2_TRX R5
#define C2_TRY R6
#define C2_TRZ R7
#define C2_L11L12 R8
#define C2_L13L21 R9
#define C2_L22L23 R10
#define C2_L31L32 R11
#define C2_L33 R12
#define C2_RBK R13
#define C2_GBK R14
#define C2_BBK R15
#define C2_LR1LR2 R16
#define C2_LR3LG1 R17
#define C2_LG2LG3 R18
#define C2_LB1LB2 R19
#define C2_LB3 R20
#define C2_RFC R21
#define C2_GFC R22
#define C2_BFC R23
#define C2_OFX R24
#define C2_OFY R25
#define C2_H R26
#define C2_DQA R27
#define C2_DQB R28
#define C2_ZSF3 R29
#define C2_ZSF4 R30
#define C2_FLAG R31
+233
View File
@@ -0,0 +1,233 @@
; $PSLibId: Run-time Library Release 4.7$
;
; Macro definitions of DMPSX version 3 for Assembler programs
; inline_a.h
; Copyright(C) 1996, Sony Computer Entertainment Inc.
; All rights reserved.
;
;
; GTE commands with 2 nops
;
nRTPS macro
nop
nop
dw $0000007f
endm
nRTPT macro
nop
nop
dw $000000bf
endm
nDCPL macro
nop
nop
dw $00000dff
endm
nDPCS macro
nop
nop
dw $00000e3f
endm
nDPCT macro
nop
nop
dw $00000e7f
endm
nINTPL macro
nop
nop
dw $00000ebf
endm
nNCS macro
nop
nop
dw $00000f7f
endm
nNCT macro
nop
nop
dw $00000fbf
endm
nNCDS macro
nop
nop
dw $00000fff
endm
nNCDT macro
nop
nop
dw $0000103f
endm
nNCCS macro
nop
nop
dw $0000107f
endm
nNCCT macro
nop
nop
dw $000010bf
endm
nCDP macro
nop
nop
dw $000010ff
endm
nCC macro
nop
nop
dw $0000113f
endm
nNCLIP macro
nop
nop
dw $0000117f
endm
nAVSZ3 macro
nop
nop
dw $000011bf
endm
nAVSZ4 macro
nop
nop
dw $000011ff
endm
nMVMVA macro sf,mx,v,cv,lm
nop
nop
dw $000013bf|sf<<25|mx<<23|v<<21|cv<<19|lm<<18
endm
nSQR macro sf
nop
nop
dw $000013ff|sf<<25
endm
nOP macro sf
nop
nop
dw $0000143f|sf<<25
endm
nGPF macro sf
nop
nop
dw $0000147f|sf<<25
endm
nGPL macro sf
nop
nop
dw $000014bf|sf<<25
endm
;
; GTE commands without nops
;
RTPS macro
dw $0000007f
endm
RTPT macro
dw $000000bf
endm
DCPL macro
dw $00000dff
endm
DPCS macro
dw $00000e3f
endm
DPCT macro
dw $00000e7f
endm
INTPL macro
dw $00000ebf
endm
NCS macro
dw $00000f7f
endm
NCT macro
dw $00000fbf
endm
NCDS macro
dw $00000fff
endm
NCDT macro
dw $0000103f
endm
NCCS macro
dw $0000107f
endm
NCCT macro
dw $000010bf
endm
CDP macro
dw $000010ff
endm
CC macro
dw $0000113f
endm
NCLIP macro
dw $0000117f
endm
AVSZ3 macro
dw $000011bf
endm
AVSZ4 macro
dw $000011ff
endm
MVMVA macro sf,mx,v,cv,lm
dw $000013bf|sf<<25|mx<<23|v<<21|cv<<19|lm<<18
endm
SQR macro sf
dw $000013ff|sf<<25
endm
OP macro sf
dw $0000143f|sf<<25
endm
GPF macro sf
dw $0000147f|sf<<25
endm
GPL macro sf
dw $000014bf|sf<<25
endm
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+194
View File
@@ -0,0 +1,194 @@
/* $PSLibId: Run-time Library Release 4.7$
*
* Macro definitions of DMPSX version 3 for Assembler(aspsx) programs
* inline_s.h
* Copyright(C) 1998 Sony Computer Entertainment Inc.
* All rights reserved.
*/
/*
* GTE commands with 2 nops
*/
#define nRTPS \
nop; \
nop; \
.word 0x0000007f
#define nRTPT \
nop; \
nop; \
.word 0x000000bf
#define nDCPL \
nop; \
nop; \
.word 0x00000dff
#define nDPCS \
nop; \
nop; \
.word 0x00000e3f
#define nDPCT \
nop; \
nop; \
.word 0x00000e7f
#define nINTPL \
nop; \
nop; \
.word 0x00000ebf
#define nNCS \
nop; \
nop; \
.word 0x00000f7f
#define nNCT \
nop; \
nop; \
.word 0x00000fbf
#define nNCDS \
nop; \
nop; \
.word 0x00000fff
#define nNCDT \
nop; \
nop; \
.word 0x0000103f
#define nNCCS \
nop; \
nop; \
.word 0x0000107f
#define nNCCT \
nop; \
nop; \
.word 0x000010bf
#define nCDP \
nop; \
nop; \
.word 0x000010ff
#define nCC \
nop; \
nop; \
.word 0x0000113f
#define nNCLIP \
nop; \
nop; \
.word 0x0000117f
#define nAVSZ3 \
nop; \
nop; \
.word 0x000011bf
#define nAVSZ4 \
nop; \
nop; \
.word 0x000011ff
#define nMVMVA(sf,mx,v,cv,lm) \
nop; \
nop; \
.word 0x000013bf|sf<<25|mx<<23|v<<21|cv<<19|lm<<18
#define nSQR(sf) \
nop; \
nop; \
.word 0x000013ff|sf<<25
#define nOP(sf) \
nop; \
nop; \
.word 0x0000143f|sf<<25
#define nGPF(sf) \
nop; \
nop; \
.word 0x0000147f|sf<<25
#define nGPL(sf) \
nop; \
nop; \
.word 0x000014bf|sf<<25
/*
* GTE commands without nops
*/
#define RTPS \
.word 0x0000007f
#define RTPT \
.word 0x000000bf
#define DCPL \
.word 0x00000dff
#define DPCS \
.word 0x00000e3f
#define DPCT \
.word 0x00000e7f
#define INTPL \
.word 0x00000ebf
#define NCS \
.word 0x00000f7f
#define NCT \
.word 0x00000fbf
#define NCDS \
.word 0x00000fff
#define NCDT \
.word 0x0000103f
#define NCCS \
.word 0x0000107f
#define NCCT \
.word 0x000010bf
#define CDP \
.word 0x000010ff
#define CC \
.word 0x0000113f
#define NCLIP \
.word 0x0000117f
#define AVSZ3 \
.word 0x000011bf
#define AVSZ4 \
.word 0x000011ff
#define MVMVA(sf,mx,v,cv,lm) \
.word 0x000013bf|sf<<25|mx<<23|v<<21|cv<<19|lm<<18
#define SQR(sf) \
.word 0x000013ff|sf<<25
#define OP(sf) \
.word 0x0000143f|sf<<25
#define GPF(sf) \
.word 0x0000147f|sf<<25
#define GPL(sf) \
.word 0x000014bf|sf<<25
+44
View File
@@ -0,0 +1,44 @@
/*
* File:ioctl.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _SYS_IOCTL_H
#define _SYS_IOCTL_H
#ifndef NULL
#define NULL 0
#endif
#ifndef EOF
#define EOF (-1) /* EOF from getc() */
#endif
/* general */
#define FIOCNBLOCK (('f'<<8)|1) /* set non-blocking io */
#define FIOCSCAN (('f'<<8)|2) /* scan for input */
/* tty and sio */
#define TIOCRAW (('t'<<8)|1) /* disable xon/xoff control */
#define TIOCFLUSH (('t'<<8)|2) /* flush input buffer */
#define TIOCREOPEN (('t'<<8)|3) /* reopen */
#define TIOCBAUD (('t'<<8)|4) /* set baud rate */
#define TIOCEXIT (('t'<<8)|5) /* console interrup */
#define TIOCDTR (('t'<<8)|6) /* control DTR line */
#define TIOCRTS (('t'<<8)|7) /* control RTS line */
#define TIOCLEN (('t'<<8)|8) /* stop<<16 | char */
/* stop 0:none 1:1 2:1.5 3:2bit */
/* char 0:5 1:6 2:7 3:8bit */
#define TIOCPARITY (('t'<<8)|9) /* parity 0:none 1:e 3:o */
#define TIOSTATUS (('t'<<8)|10) /* return status */
#define TIOERRRST (('t'<<8)|11) /* error reset */
#define TIOEXIST (('t'<<8)|12) /* exist test with DTR/CTS */
#define TIORLEN (('t'<<8)|13) /* receive buffer length */
/* disk */
#define DIOFORMAT (('d'<<8)|1) /* format */
#endif /* _SYS_IOCTL_H */
+171
View File
@@ -0,0 +1,171 @@
#ifndef _KERNEL_H
#define _KERNEL_H
/*
* File:kernel.h Rev. 3
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _R3000_H
#include <r3000.h>
#endif
#ifndef _ASM_H
#include <asm.h>
#endif
/* don't change these macros and structures which is refereced in kernel code */
#define DescMask 0xff000000
#define DescTH DescMask
#define DescHW 0xf0000000
#define DescEV 0xf1000000
#define DescRC 0xf2000000
#define DescUEV 0xf3000000 /* User event */
#define DescSW 0xf4000000 /* BIOS */
#define HwVBLANK (DescHW|0x01) /* VBLANK */
#define HwGPU (DescHW|0x02) /* GPU */
#define HwCdRom (DescHW|0x03) /* CDROM Decorder */
#define HwDMAC (DescHW|0x04) /* DMA controller */
#define HwRTC0 (DescHW|0x05) /* RTC0 */
#define HwRTC1 (DescHW|0x06) /* RTC1 */
#define HwRTC2 (DescHW|0x07) /* RTC2 */
#define HwCNTL (DescHW|0x08) /* Controller */
#define HwSPU (DescHW|0x09) /* SPU */
#define HwPIO (DescHW|0x0a) /* PIO */
#define HwSIO (DescHW|0x0b) /* SIO */
#define HwCPU (DescHW|0x10) /* Exception */
#define HwCARD (DescHW|0x11) /* memory card */
#define HwCARD_0 (DescHW|0x12) /* memory card */
#define HwCARD_1 (DescHW|0x13) /* memory card */
#define SwCARD (DescSW|0x01) /* memory card */
#define SwMATH (DescSW|0x02) /* libmath */
#define RCntCNT0 (DescRC|0x00) /* display pixel */
#define RCntCNT1 (DescRC|0x01) /* horizontal sync */
#define RCntCNT2 (DescRC|0x02) /* one-eighth of system clock */
#define RCntCNT3 (DescRC|0x03) /* vertical sync target value fixed to 1 */
#define RCntMdINTR 0x1000
#define RCntMdNOINTR 0x2000
#define RCntMdSC 0x0001
#define RCntMdSP 0x0000
#define RCntMdFR 0x0000
#define RCntMdGATE 0x0010
#define EvSpCZ 0x0001 /* counter becomes zero */
#define EvSpINT 0x0002 /* interrupted */
#define EvSpIOE 0x0004 /* end of i/o */
#define EvSpCLOSE 0x0008 /* file was closed */
#define EvSpACK 0x0010 /* command acknowledged */
#define EvSpCOMP 0x0020 /* command completed */
#define EvSpDR 0x0040 /* data ready */
#define EvSpDE 0x0080 /* data end */
#define EvSpTIMOUT 0x0100 /* time out */
#define EvSpUNKNOWN 0x0200 /* unknown command */
#define EvSpIOER 0x0400 /* end of read buffer */
#define EvSpIOEW 0x0800 /* end of write buffer */
#define EvSpTRAP 0x1000 /* general interrupt */
#define EvSpNEW 0x2000 /* new device */
#define EvSpSYSCALL 0x4000 /* system call instruction */
#define EvSpERROR 0x8000 /* error happned */
#define EvSpPERROR 0x8001 /* previous write error happned */
#define EvSpEDOM 0x0301 /* domain error in libmath */
#define EvSpERANGE 0x0302 /* range error in libmath */
#define EvMdINTR 0x1000
#define EvMdNOINTR 0x2000
#define EvStUNUSED 0x0000
#define EvStWAIT 0x1000
#define EvStACTIVE 0x2000
#define EvStALREADY 0x4000
#define TcbMdRT 0x1000 /* reserved by system */
#define TcbMdPRI 0x2000 /* reserved by system */
#define TcbStUNUSED 0x1000
#define TcbStACTIVE 0x4000
#if defined(_LANGUAGE_C)||defined(LANGUAGE_C)||defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
struct ToT {
unsigned long *head;
long size;
};
struct TCBH {
struct TCB *entry; /* NULL */
long flag;
};
struct TCB {
long status;
long mode;
unsigned long reg[NREGS]; /* never change the offset of this */
long system[6]; /* reserved by system */
};
struct EvCB {
unsigned long desc;
long status;
long spec;
long mode;
long (*FHandler)();
long system[2]; /* reserved by system */
};
struct EXEC {
unsigned long pc0;
unsigned long gp0;
unsigned long t_addr;
unsigned long t_size;
unsigned long d_addr;
unsigned long d_size;
unsigned long b_addr;
unsigned long b_size;
unsigned long s_addr;
unsigned long s_size;
unsigned long sp,fp,gp,ret,base;
};
struct XF_HDR {
char key[8];
unsigned long text;
unsigned long data;
struct EXEC exec;
char title[60]; /* "PlayStation(tm) Executable A1" */
};
struct DIRENTRY {
char name[20];
long attr;
long size;
struct DIRENTRY *next;
long head;
char system[4];
};
extern struct ToT SysToT[32];
extern long SysClearRCnt[];
#ifndef NULL
#define NULL (0)
#endif
#if defined(_LANGUAGE_C)||defined(LANGUAGE_C)
#define delete erase
#endif /* LANGUAGE_C */
#endif /* LANGUAGE_C||_LANGUAGE_C_PLUS_PLUS||__cplusplus||c_plusplus */
#endif /* _KERNEL_H */
+134
View File
@@ -0,0 +1,134 @@
#ifndef _LIBAPI_H_
#define _LIBAPI_H_
/*
* File:libapi.h
* Copyright (C) 1997 by Sony Computer Entertainment Inc.
* All rights Reserved
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _KERNEL_H
#include "kernel.h"
#endif
/* don't change these macros and structures which is referred in controler code */
/*
* Prototypes
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
/* prototypes added by suzu 96/03/01 and changed by hakama 96/06/06*/
extern long SetRCnt(unsigned long, unsigned short, long);
extern long GetRCnt(unsigned long);
extern long ResetRCnt(unsigned long);
extern long StartRCnt(unsigned long);
extern long StopRCnt(unsigned long);
extern long OpenEvent(unsigned long,long,long,long (*func)());
extern long CloseEvent(long);
extern long WaitEvent(long);
extern long TestEvent(long);
extern long EnableEvent(long);
extern long DisableEvent(long);
extern void DeliverEvent(unsigned long, unsigned long);
extern void UnDeliverEvent(unsigned long, unsigned long);
extern long OpenTh(long (*func)(), unsigned long , unsigned long);
extern int CloseTh(long);
extern int ChangeTh(long);
extern long open(char *, unsigned long);
extern long close(long);
extern long lseek(long, long, long);
extern long read(long, void *, long);
extern long write(long, void *, long);
extern long ioctl(long, long, long);
extern struct DIRENTRY * firstfile(char *, struct DIRENTRY *);
extern struct DIRENTRY * nextfile(struct DIRENTRY *);
extern long erase(char *);
extern long undelete(char *);
extern long format(char *);
extern long rename(char *, char *);
extern long cd(char *);
extern long LoadTest(char *, struct EXEC *);
extern long Load(char *, struct EXEC *);
extern long Exec(struct EXEC *, long, char **);
extern long LoadExec(char *, unsigned long, unsigned long);
extern long InitPAD(char *,long ,char *,long);
extern long StartPAD(void);
extern void StopPAD(void);
extern void EnablePAD(void);
extern void DisablePAD(void);
extern void FlushCache(void);
extern void ReturnFromException(void);
extern int EnterCriticalSection(void);
extern void ExitCriticalSection(void);
extern void Exception(void);
extern void SwEnterCriticalSection(void);
extern void SwExitCriticalSection(void);
extern unsigned long SetSp(unsigned long);
extern unsigned long GetSp( void );
extern unsigned long GetGp( void );
extern unsigned long GetCr( void );
extern unsigned long GetSr( void );
extern unsigned long GetSysSp(void);
extern long SetConf(unsigned long,unsigned long,unsigned long);
extern void GetConf(unsigned long *,unsigned long *,unsigned long *);
extern long _get_errno(void);
extern long _get_error(long);
extern void SystemError( char, long);
extern void SetMem(long);
extern long Krom2RawAdd( unsigned long );
extern long Krom2RawAdd2(unsigned short);
extern void _96_init(void);
extern void _96_remove(void);
extern void _boot(void);
extern void ChangeClearPAD( long );
/* prototypes added by shino 96/05/22 */
extern void InitCARD(long val);
extern long StartCARD(void);
extern long StopCARD(void);
extern void _bu_init(void);
extern long _card_info(long chan);
extern long _card_clear(long chan);
extern long _card_load(long chan);
extern long _card_auto(long val);
extern void _new_card(void);
extern long _card_status(long drv);
extern long _card_wait(long drv);
extern unsigned long _card_chan(void);
extern long _card_write(long chan, long block, unsigned char *buf);
extern long _card_read(long chan, long block, unsigned char *buf);
extern long _card_format(long chan); /* added by iwano 98/03/24 */
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBAPI_H_ */
/* don't add stuff after this */
+326
View File
@@ -0,0 +1,326 @@
/* $PSLibId: Run-time Library Release 4.7$ */
#ifndef _LIBCD_H_
#define _LIBCD_H_
/*
* (C) Copyright 1993/1994 Sony Computer Entertainment ,Tokyo,Japan.
* All Rights Reserved
*
* libcd.h: CD-ROM sub system hendler
*
* CD-ROM Primitive Command list:
*
* Symbol type Contents
* ------------------------------------------------------
* CdlNop B NOP
* CdlSetloc B Set position
* CdlPlay B CD-DA Play
* CdlForward B Forward
* CdlBackward B Backward
* CdlReadN B Read with retry
* CdlStanby N Standby
* CdlStop N Stop
* CdlPause N Pause
* CdlMute B Mute on
* CdlDemute B Mute off
* CdlSetfilter B Set SubHeader filter
* CdlSetmode B Set mode
* CdlGetlocL B Get logical position
* CdlGetlocP B Get phisycal position
* CdlSeekL N Logical Seek
* CdlSeekP N Phisical Seek
* CdlReadS B Read without retry
* ------------------------------------------------------
* B: Blocking, N: Non-Blocking operation
*
*
* Symbol arg result
* --------------------------------------------------------------
* CdlNop - status
* CdlSetloc min,sec,sector status
* CdlPlay - status
* CdlForward - status
* CdlBackward - status
* CdlReadN - status
* CdlStanby - status
* CdlStop - status
* CdlPause - status
* CdlMute - status
* CdlDemute - status
* CdlSetfilter file,chan status
* CdlSetmode mode status
* CdlGetlocL - min,sec,sector,mode,file, chan
* CdlGetlocP - track,index,min,sec,frame,
* amin,asec,aframe
* CdlSeekL - status
* CdlSeekP - status
* CdlReadS - status
* --------------------------------------------------------------
*/
/*
* CD-ROM Basic System
*/
/*
* CD-ROM Mode (used int CdlSetmode)
*/
#define CdlModeStream 0x100 /* Normal Streaming */
#define CdlModeStream2 0x120 /* SUB HEADER information includes */
#define CdlModeSpeed 0x80 /* 0: normal speed 1: double speed */
#define CdlModeRT 0x40 /* 0: ADPCM off 1: ADPCM on */
#define CdlModeSize1 0x20 /* 0: 2048 byte 1: 2340byte */
#define CdlModeSize0 0x10 /* 0: - 1: 2328byte */
#define CdlModeSF 0x08 /* 0: Channel off 1: Channel on */
#define CdlModeRept 0x04 /* 0: Report off 1: Report on */
#define CdlModeAP 0x02 /* 0: AutoPause off 1: AutoPause on */
#define CdlModeDA 0x01 /* 0: CD-DA off 1: CD-DA on */
/*
* Status Contents
*/
#define CdlStatPlay 0x80 /* playing CD-DA */
#define CdlStatSeek 0x40 /* seeking */
#define CdlStatRead 0x20 /* reading data sectors */
#define CdlStatShellOpen 0x10 /* once shell open */
#define CdlStatSeekError 0x04 /* seek error detected */
#define CdlStatStandby 0x02 /* spindle motor rotating */
#define CdlStatError 0x01 /* command error detected */
/*
* Macros for CdGetDiskType()
*/
#define CdlStatNoDisk 0
#define CdlOtherFormat 1
#define CdlCdromFormat 2
/*
* CD-ROM Primitive Commands
*/
#define CdlNop 0x01
#define CdlSetloc 0x02
#define CdlPlay 0x03
#define CdlForward 0x04
#define CdlBackward 0x05
#define CdlReadN 0x06
#define CdlStandby 0x07
#define CdlStop 0x08
#define CdlPause 0x09
#define CdlMute 0x0b
#define CdlDemute 0x0c
#define CdlSetfilter 0x0d
#define CdlSetmode 0x0e
#define CdlGetparam 0x0f
#define CdlGetlocL 0x10
#define CdlGetlocP 0x11
#define CdlGetTN 0x13
#define CdlGetTD 0x14
#define CdlSeekL 0x15
#define CdlSeekP 0x16
#define CdlReadS 0x1B
/*
* Interrupts
*/
#define CdlNoIntr 0x00 /* No interrupt */
#define CdlDataReady 0x01 /* Data Ready */
#define CdlComplete 0x02 /* Command Complete */
#define CdlAcknowledge 0x03 /* Acknowledge (reserved) */
#define CdlDataEnd 0x04 /* End of Data Detected */
#define CdlDiskError 0x05 /* Error Detected */
/*
* Library Macros
*/
#ifndef btoi
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
#endif
#ifndef itob
#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
#endif
#define CdSeekL(p) CdControl(CdlSeekL, (u_char *)p, 0)
#define CdSeekP(p) CdControl(CdlSeekP, (u_char *)p, 0)
#define CdStandby() CdControl(CdlStandby, 0, 0)
#define CdPause() CdControl(CdlPause, 0, 0)
#define CdStop() CdControl(CdlStop, 0, 0)
#define CdMute() CdControl(CdlMute, 0, 0)
#define CdDeMute() CdControl(CdlDemute, 0, 0)
#define CdForward() CdControl(CdlForward, 0, 0)
#define CdBackward() CdControl(CdlBackward, 0, 0)
/*
* Position
*/
#define CdlMAXTOC 100
/*
* Callback
*/
typedef void (*CdlCB)(u_char,u_char *);
/*
* Location
*/
typedef struct {
u_char minute; /* minute (BCD) */
u_char second; /* second (BCD) */
u_char sector; /* sector (BCD) */
u_char track; /* track (void) */
} CdlLOC;
/*
* ADPCM Filter
*/
typedef struct {
u_char file; /* file ID (always 1) */
u_char chan; /* channel ID */
u_short pad;
} CdlFILTER;
/*
* Attenuator
*/
typedef struct {
u_char val0; /* volume for CD(L) -> SPU (L) */
u_char val1; /* volume for CD(L) -> SPU (R) */
u_char val2; /* volume for CD(R) -> SPU (L) */
u_char val3; /* volume for CD(R) -> SPU (R) */
} CdlATV;
/*
* Low Level File System for CdSearchFile()
*/
#define CdlMAXFILE 64 /* max number of files in a directory */
#define CdlMAXDIR 128 /* max number of total directories */
#define CdlMAXLEVEL 8 /* max levels of directories */
typedef struct {
CdlLOC pos; /* file location */
u_long size; /* file size */
char name[16]; /* file name (body) */
} CdlFILE;
/*#define MULTI_INTERRUPT */
#ifndef MULTI_INTERRUPT
#define pauseMULI()
#define restartMULI()
#endif
#ifndef _LIBDS_H_
/*
* Streaming Structures
*/
typedef struct {
u_short id;
u_short type;
u_short secCount;
u_short nSectors;
u_long frameCount;
u_long frameSize;
u_short width;
u_short height;
u_long dummy1;
u_long dummy2;
CdlLOC loc;
} StHEADER; /* CD-ROM STR structure */
#define StFREE 0x0000
#define StREWIND 0x0001
#define StCOMPLETE 0x0002
#define StBUSY 0x0003
#define StLOCK 0x0004
#define EDC 0
#define SECTOR_SIZE (512) /* Sector Size (word) */
#define HEADER_SIZE (8) /* Header Size (word) */
#define StSTATUS 0x00
#define StVER 0x00
#define StTYPE 0x01
#define StSECTOR_OFFSET 0x02
#define StSECTOR_SIZE 0x03
#define StFRAME_NO 0x04
#define StFRAME_SIZE 0x06
#define StMOVIE_WIDTH 0x08
#define StMOVIE_HEIGHT 0x09
/*
* Prototypes for Streaming
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
void StSetRing(u_long *ring_addr,u_long ring_size);
void StClearRing(void);
void StUnSetRing(void);
void StSetStream(u_long mode,u_long start_frame,u_long end_frame,
void (*func1)(),void (*func2)());
void StSetEmulate(u_long *addr,u_long mode,u_long start_frame,
u_long end_frame,void (*func1)(),void (*func2)());
u_long StFreeRing(u_long *base);
u_long StGetNext(u_long **addr,u_long **header);
u_long StGetNextS(u_long **addr,u_long **header);
u_short StNextStatus(u_long **addr,u_long **header);
void StRingStatus(short *free_sectors,short *over_sectors);
void StSetMask(u_long mask,u_long start,u_long end);
void StCdInterrupt(void);
int StGetBackloc(CdlLOC *loc);
int StSetChannel(u_long channel);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* ifndef _LIBDS_H_ */
/*
* Prototypes
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
void CdFlush(void);
CdlFILE *CdSearchFile(CdlFILE *fp, char *name);
CdlLOC *CdIntToPos(int i, CdlLOC *p) ;
char *CdComstr(u_char com);
char *CdIntstr(u_char intr);
int CdControl(u_char com, u_char *param, u_char *result);
int CdControlB(u_char com, u_char *param, u_char *result);
int CdControlF(u_char com, u_char *param);
int CdGetSector(void *madr, int size);
int CdGetSector2( void* madr, int size );
int CdDataSync(int mode);
int CdGetToc(CdlLOC *loc) ;
int CdPlay(int mode, int *track, int offset);
int CdMix(CdlATV *vol);
int CdPosToInt(CdlLOC *p);
int CdRead(int sectors, u_long *buf, int mode);
int CdRead2(long mode);
int CdReadFile(char *file, u_long *addr, int nbyte);
int CdReadSync(int mode, u_char *result);
int CdReady(int mode, u_char *result) ;
int CdSetDebug(int level);
int CdSync(int mode, u_char *result) ;
void (*CdDataCallback(void (*func)()));
CdlCB CdReadCallback(CdlCB func);
CdlCB CdReadyCallback(CdlCB func);
CdlCB CdSyncCallback(CdlCB func);
int CdInit(void);
int CdReset(int mode);
int CdStatus(void);
int CdLastCom(void);
CdlLOC *CdLastPos(void);
int CdMode(void);
int CdDiskReady( int mode );
int CdGetDiskType( void );
struct EXEC *CdReadExec(char *file);
void CdReadBreak( void );
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBCD_H_ */
+67
View File
@@ -0,0 +1,67 @@
/*
* $PSLibId: Run-time Library Release 4.7$
*/
/*
* File:libcomb.h
*/
#ifndef _LIBCOMB_H_
#define _LIBCOMB_H_
/* Status bits */
#define COMB_CTS 0x100
#define COMB_DSR 0x80
#define COMB_FE 0x20
#define COMB_OE 0x10
#define COMB_PERROR 0x8
#define COMB_TXU 0x4
#define COMB_RXRDY 0x2
#define COMB_TXRDY 0x1
/* Control bits */
#define COMB_BIT_DTR 0x1
#define COMB_BIT_RTS 0x2
/* Macros */
#define CombSioStatus() _comb_control(0,0,0) /* Return serial controller status */
#define CombControlStatus() _comb_control(0,1,0) /* Return control line status */
#define CombGetMode() _comb_control(0,2,0) /* Return communication mode */
#define CombGetBPS() _comb_control(0,3,0) /* Return transfer rate */
#define CombGetPacketSize() _comb_control(0,4,0) /* Return current packet size */
#define CombBytesToWrite() _comb_control(0,5,0) /* Return # bytes remaining in write buffer */
#define CombBytesToRead() _comb_control(0,5,1) /* Return # bytes remaining to be read */
#define CombBytesRemaining(a) _comb_control(0,5,a) /* Return # bytes remaining to read or write */
#define CombAsyncRequest(a) _comb_control(0,6,a) /* Return async read/write request */
#define CombSetControl(a) _comb_control(1,1,a) /* Set the control line status */
#define CombSetMode(a) _comb_control(1,2,a) /* Sets communications mode */
#define CombSetBPS(a) _comb_control(1,3,a) /* Sets the transfer rate */
#define CombSetPacketSize(a) _comb_control(1,4,a) /* Sets the packet size */
#define CombReset() _comb_control(2,0,0) /* Reset serial controller */
#define CombResetError() _comb_control(2,1,0) /* Reset error bits */
#define CombCancelWrite() _comb_control(2,2,0) /* Cancel async write request */
#define CombCancelRead() _comb_control(2,3,0) /* Cancel async read request */
#define CombSetRTS(a) _comb_control(3,0,a) /* Set RTS to 'a' */
#define CombCTS() _comb_control(3,1,0) /* Return status of CTS */
#define CombWaitCallback(a) _comb_control(4,0,a) /* Install wait callback function */
#define CombResetVBLANK() _comb_control(5,0,0) /* Restart VBLANK signal */
/* Prototypes */
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void AddCOMB(void);
extern void DelCOMB(void);
extern void ChangeClearSIO(long);
extern long _comb_control(unsigned long,unsigned long,unsigned long);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /*_LIBCOMB_H_*/
+286
View File
@@ -0,0 +1,286 @@
/* $PSLibId: Run-time Library Release 4.7$ */
/*
* libds.h
* Copyright(C) 1996 1997, Sony Computer Entertainment Inc.
* All Rights Reserved.
*/
#ifndef _LIBDS_H_
#define _LIBDS_H_
#include <kernel.h>
/*
* CD-ROM Mode (used int CdlSetmode)
*/
#define DslModeStream 0x100 /* Normal Streaming */
#define DslModeStream2 0x120 /* SUB HEADER information includes */
#define DslModeSpeed 0x80 /* 0: normal speed 1: double speed */
#define DslModeRT 0x40 /* 0: ADPCM off 1: ADPCM on */
#define DslModeSize1 0x20 /* 0: 2048 byte 1: 2340byte */
#define DslModeSize0 0x10 /* 0: - 1: 2328byte */
#define DslModeSF 0x08 /* 0: Channel off 1: Channel on */
#define DslModeRept 0x04 /* 0: Report off 1: Report on */
#define DslModeAP 0x02 /* 0: AutoPause off 1: AutoPause on */
#define DslModeDA 0x01 /* 0: CD-DA off 1: CD-DA on */
/*
* Status contents
*/
#define DslStatPlay 0x80 /* playing CD-DA */
#define DslStatSeek 0x40 /* seeking */
#define DslStatRead 0x20 /* reading data sectors */
#define DslStatShellOpen 0x10 /* once shell open */
#define DslStatSeekError 0x04 /* seek error detected */
#define DslStatStandby 0x02 /* spindle motor rotating */
#define DslStatError 0x01 /* command error detected */
/*
* Macros for DsGetDiskType()
*/
#define DslStatNoDisk 0x01
#define DslOtherFormat 0x02
#define DslCdromFormat 0x04
/*
* CD-ROM Primitive Commands
*/
#define DslNop 0x01 /* no operation */
#define DslSetloc 0x02 /* set head position */
#define DslPlay 0x03 /* play CD-DA */
#define DslForward 0x04 /* forward DA play */
#define DslBackward 0x05 /* backward DA play */
#define DslReadN 0x06 /* read data with retry */
#define DslStandby 0x07 /* start spindle motor */
#define DslStop 0x08 /* stop spindle motor */
#define DslPause 0x09 /* pause */
#define DslMute 0x0b /* mute on */
#define DslDemute 0x0c /* mute off */
#define DslSetfilter 0x0d /* set subheader filter */
#define DslSetmode 0x0e /* set mode */
#define DslGetparam 0x0f /* get mode */
#define DslGetlocL 0x10 /* get head position (data sector) */
#define DslGetlocP 0x11 /* get head position (DA sector) */
#define DslGetTN 0x13 /* get number of TOC */
#define DslGetTD 0x14 /* get TOC data */
#define DslSeekL 0x15 /* logical seek */
#define DslSeekP 0x16 /* phisical seek */
#define DslReadS 0x1B /* read data without retry */
/*
* Interrupts
*/
#define DslNoIntr 0x00 /* No interrupt */
#define DslDataReady 0x01 /* Data Ready */
#define DslComplete 0x02 /* Command Complete */
#define DslAcknowledge 0x03 /* Acknowledge (reserved) */
#define DslDataEnd 0x04 /* End of Data Detected */
#define DslDiskError 0x05 /* Error Detected */
#define DslNoResult 0x06
#define DslFinished 0x07
#ifndef btoi
#define btoi( b ) ( ( b ) / 16 * 10 + ( b ) % 16 )
#endif
#ifndef itob
#define itob( i ) ( ( i ) / 10 * 16 + ( i ) % 10 )
#endif
/*
* Position
*/
#define DslMAXTOC 100
/*
* Callback
*/
typedef void ( *DslCB )( u_char, u_char* );
typedef void ( *DslRCB )( u_char, u_char*, u_long* );
/*
* Location
*/
typedef struct {
u_char minute; /* minute (BCD) */
u_char second; /* second (BCD) */
u_char sector; /* sector (BCD) */
u_char track; /* track (void) */
} DslLOC;
/*
* ADPCM Filter
*/
typedef struct {
u_char file; /* file ID (always 1) */
u_char chan; /* channel ID */
u_short pad;
} DslFILTER;
/*
* Attenuator
*/
typedef struct {
u_char val0; /* volume for CD(L) -> SPU (L) */
u_char val1; /* volume for CD(L) -> SPU (R) */
u_char val2; /* volume for CD(R) -> SPU (L) */
u_char val3; /* volume for CD(R) -> SPU (R) */
} DslATV;
/*
* Low Level File System for DsSearchFile()
*/
#define DslMAXFILE 64 /* max number of files in a directory */
#define DslMAXDIR 128 /* max number of total directories */
#define DslMAXLEVEL 8 /* max levels of directories */
typedef struct {
DslLOC pos; /* file location */
u_long size; /* file size */
char name[ 16 ]; /* file name (body) */
} DslFILE;
#ifndef _LIBCD_H_
/*
* Streaming Structures
*/
typedef struct {
u_short id;
u_short type;
u_short secCount;
u_short nSectors;
u_long frameCount;
u_long frameSize;
u_short width;
u_short height;
u_long dummy1;
u_long dummy2;
DslLOC loc;
} StHEADER; /* CD-ROM STR structure */
#define StFREE 0x0000
#define StREWIND 0x0001
#define StCOMPLETE 0x0002
#define StBUSY 0x0003
#define StLOCK 0x0004
#define EDC 0
#define SECTOR_SIZE ( 512 ) /* Sector Size (word) */
#define HEADER_SIZE ( 8 ) /* Header Size (word) */
#define StSTATUS 0x00
#define StVER 0x00
#define StTYPE 0x01
#define StSECTOR_OFFSET 0x02
#define StSECTOR_SIZE 0x03
#define StFRAME_NO 0x04
#define StFRAME_SIZE 0x06
#define StMOVIE_WIDTH 0x08
#define StMOVIE_HEIGHT 0x09
/*
* streaming library prototype declarations */
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
void StSetRing( u_long* ring_addr, u_long ring_size );
void StClearRing( void );
void StUnSetRing( void );
void StSetStream( u_long mode, u_long start_frame, u_long end_frame,
void ( *func1 )(), void ( *func2 )() );
void StSetEmulate( u_long* addr, u_long mode, u_long start_frame,
u_long end_frame, void ( *func1 )(), void ( *func2 )() );
u_long StFreeRing( u_long* base );
u_long StGetNext( u_long** addr, u_long** header );
u_long StGetNextS( u_long** addr, u_long** header );
u_short StNextStatus( u_long** addr, u_long** header );
void StRingStatus( short* free_sectors, short* over_sectors );
void StSetMask( u_long mask, u_long start, u_long end );
void StCdInterrupt( void );
int StGetBackloc( DslLOC* loc );
int StSetChannel( u_long channel );
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBCD_H_ */
/* **** system status **** */
#define DslReady 1
#define DslBusy 2
#define DslNoCD 3
/* **** maximum number of commands that can be added to the queue **** */
#define DslMaxCOMMANDS 8
/***** maximum number of command execution results **** */
#define DslMaxRESULTS 8
/***** DS function prototype **** */
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
int DsInit( void );
int DsReset( void );
void DsClose( void );
int DsCommand( u_char com, u_char* param, DslCB cbsync, int count );
int DsPacket( u_char mode, DslLOC* pos, u_char com, DslCB func, int count );
DslCB DsSyncCallback( DslCB func );
DslCB DsReadyCallback( DslCB func );
int DsSync( int id, u_char* result );
int DsReady( u_char* result );
void DsFlush( void );
int DsSystemStatus( void );
int DsQueueLen( void );
u_char DsStatus( void );
int DsShellOpen( void );
int DsMix( DslATV* vol );
int DsGetSector( void* madr, int size );
int DsGetSector2( void* madr, int size );
int DsGetToc( DslLOC* loc );
void ( *DsDataCallback( void ( *func )() ) );
int DsDataSync( int mode );
DslLOC* DsIntToPos( int i, DslLOC* p );
int DsPosToInt( DslLOC* p );
int DsSetDebug( int level );
DslLOC* DsLastPos( DslLOC* p );
u_char DsLastCom( void );
char* DsComstr( u_char com );
char* DsIntstr( u_char intr );
int DsStartReadySystem( DslRCB func, int count );
void DsEndReadySystem( void );
int DsReadySystemMode( int mode );
int DsControlF( u_char com, u_char* param );
int DsControl( u_char com, u_char* param, u_char* result );
int DsControlB( u_char com, u_char* param, u_char* result );
int DsRead( DslLOC* pos, int sectors, u_long* buf, int mode );
int DsReadSync( u_char* result );
DslCB DsReadCallback( DslCB func );
void DsReadBreak( void );
int DsRead2( DslLOC* pos, int mode );
DslFILE* DsSearchFile( DslFILE* fp, char* name );
int DsReadFile( char* file, u_long* addr, int nbyte );
struct EXEC* DsReadExec( char* file );
int DsPlay( int mode, int* tracks, int offset );
int DsGetDiskType( void );
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBDS_H_ */
+81
View File
@@ -0,0 +1,81 @@
/* $PSLibId: Run-time Library Release 4.7$ */
#ifndef _LIBETC_H_
#define _LIBETC_H_
/*
* (C) Copyright 1993/1994 Sony Corporation,Tokyo,Japan. All Rights Reserved
*
* libetc.h: Pad Interface
*/
extern int PadIdentifier;
/*
* PAD I/O (SIO Pad)
*/
#define PADLup (1<<12)
#define PADLdown (1<<14)
#define PADLleft (1<<15)
#define PADLright (1<<13)
#define PADRup (1<< 4)
#define PADRdown (1<< 6)
#define PADRleft (1<< 7)
#define PADRright (1<< 5)
#define PADi (1<< 9)
#define PADj (1<<10)
#define PADk (1<< 8)
#define PADl (1<< 3)
#define PADm (1<< 1)
#define PADn (1<< 2)
#define PADo (1<< 0)
#define PADh (1<<11)
#define PADL1 PADn
#define PADL2 PADo
#define PADR1 PADl
#define PADR2 PADm
#define PADstart PADh
#define PADselect PADk
#define MOUSEleft (1<<3)
#define MOUSEright (1<<2)
/*
* PAD utility macro: _PAD(x,y)
* x: controller ID (0 or 1)
* y: PAD assign macro
*
* Example: _PAD(0,PADstart) ... PADstart of controller 1
* _PAD(1,PADLup) ... PADLup of controller 2
*/
#define _PAD(x,y) ((y)<<((x)<<4))
/* scratch pad address 0x1f800000 - 0x1f800400 */
#define getScratchAddr(offset) ((u_long *)(0x1f800000+(offset)*4))
/*
* Video Mode: NTSC/PAL
*/
#define MODE_NTSC 0
#define MODE_PAL 1
/*
* Prototypes
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
int CheckCallback(void) ;
void PadInit(int mode);
int ResetCallback(void) ;
int RestartCallback(void) ;
int StopCallback(void) ;
int VSync(int mode);
int VSyncCallback(void (*f)(void)) ;
long GetVideoMode (void);
long SetVideoMode (long mode);
u_long PadRead(int id);
void PadStop(void);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBETC_H_ */
+824
View File
@@ -0,0 +1,824 @@
/* $PSLibId: Run-time Library Release 4.7$ */
#ifndef _LIBGPU_H_
#define _LIBGPU_H_
/*
* (C) Copyright 1993-1995 Sony Corporation,Tokyo,Japan. All Rights Reserved
*
* libgpu.h: Graphic Primitive Structures Database
*
* Primitive list:
*
* Name |Size*1|Shade |Vertex |Texture| Function
* ---------+------+-------+-------+-------+------------------------
* POLY_F3 | 5 |Flat | 3 |OFF | Flat Triangle
* POLY_FT3 | 8 |Flat | 3 |ON | Flat Textured Triangle
* POLY_G3 | 7 |Gouraud| 3 |OFF | Gouraud Triangle
* POLY_GT3 |10 |Gouraud| 3 |ON | Gouraud Textured Triangle
* POLY_F4 | 6 |Flat | 4 |OFF | Flat Quadrangle
* POLY_FT4 |10 |Flat | 4 |ON | Flat Textured Quadrangle
* POLY_G4 | 9 |Gouraud| 4 |OFF | Gouraud Quadrangle
* POLY_GT4 |13 |Gouraud| 4 |ON | Gouraud Textured Quadrangle
* ---------+------+-------+-------+-------+------------------------
* LINE_F2 | 4 |Flat | 2 | - | unconnected Flat Line
* LINE_G2 | 5 |Gouraud| 2 | - | unconnected Gouraud Line
* LINE_F3 | 6 |Flat | 3 | - | 3-connected Flat Line
* LINE_G3 | 8 |Gouraud| 3 | - | 3-connected Gouraud Line
* LINE_F4 | 7 |Flat | 4 | - | 4-connected Flat Line
* LINE_G4 |10 |Gouraud| 4 | - | 4-connected Gouraud Line
* ---------+------+-------+-------+-------+------------------------
* SPRT | 5 |Flat | 1 |ON | free size Sprite
* SPRT_16 | 4 |Flat | 1 |ON | 16x16 Sprite
* SPRT_8 | 4 |Flat | 1 |ON | 8x8 Sprite
* ---------+------+-------+-------+-------+------------------------
* TILE | 4 |Flat | 1 |OFF | free size Sprite
* TILE_16 | 3 |Flat | 1 |OFF | 16x16 Sprite
* TILE_8 | 3 |Flat | 1 |OFF | 8x8 Sprite
* TILE_1 | 3 |Flat | 1 |OFF | 1x1 Sprite
* ---------+------+-------+-------+-------+------------------------
* DR_TWIN | 3 | - | - | - | Texture Window
* DR_AREA | 3 | - | - | - | Drawing Area
* DR_OFFSET| 3 | - | - | - | Drawing Offset
* DR_MODE | 3 | - | - | - | Drawing Mode
* DR_ENV |16 | - | - | - | Drawing Environment
* DR_MOVE | 6 | - | - | - | MoveImage
* DR_LOAD |17 | - | - | - | LoadImage
* DR_TPAGE | 2 | - | - | - | Drawing TPage
* DR_STP | 3 | - | - | - | Drawing STP
*
* *1: in long-word
*
* Texture Attributes:
* abr: ambient rate
* abr 0 1 2 3
* -------------------------------------
* Front 0.5 1.0 0.5 -1.0
* Back 0.5 1.0 1.0 1.0
*
* tp: texture mode
* tp 0 1 2
* -----------------------------
* depth 4bit 8bit 16bit
* color CLUT CLUT DIRECT
*/
/*
* Externals
*/
extern int (*GPU_printf)(char *fmt, ...); /* printf() object */
/*
* Time-out Cycle
*/
#define WAIT_TIME 0x800000
/*
* General Macros
*/
#define limitRange(x, l, h) ((x)=((x)<(l)?(l):(x)>(h)?(h):(x)))
/*
* Set/Add Vector/Rectangle Attributes
*/
#define setVector(v, _x, _y, _z) \
(v)->vx = _x, (v)->vy = _y, (v)->vz = _z
#define applyVector(v, _x, _y, _z, op) \
(v)->vx op _x, (v)->vy op _y, (v)->vz op _z
#define copyVector(v0, v1) \
(v0)->vx = (v1)->vx, (v0)->vy = (v1)->vy, (v0)->vz = (v1)->vz
#define addVector(v0, v1) \
(v0)->vx += (v1)->vx, \
(v0)->vy += (v1)->vy, \
(v0)->vz += (v1)->vz
#define dumpVector(str, v) \
GPU_printf("%s=(%d,%d,%d)\n", str, (v)->vx, (v)->vy, (v)->vz)
#define dumpMatrix(x) \
GPU_printf("\t%5d,%5d,%5d\n",(x)->m[0][0],(x)->m[0][1],(x)->m[0][2]),\
GPU_printf("\t%5d,%5d,%5d\n",(x)->m[1][0],(x)->m[1][1],(x)->m[1][2]),\
GPU_printf("\t%5d,%5d,%5d\n",(x)->m[2][0],(x)->m[2][1],(x)->m[2][2])
#define setRECT(r, _x, _y, _w, _h) \
(r)->x = (_x),(r)->y = (_y),(r)->w = (_w),(r)->h = (_h)
/*
* Set Primitive Attributes
*/
#define setTPage(p,tp,abr,x,y) \
((p)->tpage = getTPage(tp,abr,x,y))
#define setClut(p,x,y) \
((p)->clut = getClut(x,y))
/*
* Set Primitive Colors
*/
#define setRGB0(p,_r0,_g0,_b0) \
(p)->r0 = _r0,(p)->g0 = _g0,(p)->b0 = _b0
#define setRGB1(p,_r1,_g1,_b1) \
(p)->r1 = _r1,(p)->g1 = _g1,(p)->b1 = _b1
#define setRGB2(p,_r2,_g2,_b2) \
(p)->r2 = _r2,(p)->g2 = _g2,(p)->b2 = _b2
#define setRGB3(p,_r3,_g3,_b3) \
(p)->r3 = _r3,(p)->g3 = _g3,(p)->b3 = _b3
/*
* Set Primitive Screen Points
*/
#define setXY0(p,_x0,_y0) \
(p)->x0 = (_x0), (p)->y0 = (_y0) \
#define setXY2(p,_x0,_y0,_x1,_y1) \
(p)->x0 = (_x0), (p)->y0 = (_y0), \
(p)->x1 = (_x1), (p)->y1 = (_y1)
#define setXY3(p,_x0,_y0,_x1,_y1,_x2,_y2) \
(p)->x0 = (_x0), (p)->y0 = (_y0), \
(p)->x1 = (_x1), (p)->y1 = (_y1), \
(p)->x2 = (_x2), (p)->y2 = (_y2)
#define setXY4(p,_x0,_y0,_x1,_y1,_x2,_y2,_x3,_y3) \
(p)->x0 = (_x0), (p)->y0 = (_y0), \
(p)->x1 = (_x1), (p)->y1 = (_y1), \
(p)->x2 = (_x2), (p)->y2 = (_y2), \
(p)->x3 = (_x3), (p)->y3 = (_y3)
#define setXYWH(p,_x0,_y0,_w,_h) \
(p)->x0 = (_x0), (p)->y0 = (_y0), \
(p)->x1 = (_x0)+(_w), (p)->y1 = (_y0), \
(p)->x2 = (_x0), (p)->y2 = (_y0)+(_h), \
(p)->x3 = (_x0)+(_w), (p)->y3 = (_y0)+(_h)
/*
* Set Primitive Width/Height
*/
#define setWH(p,_w,_h) (p)->w = _w, (p)->h = _h
/*
* Set Primitive Texture Points
*/
#define setUV0(p,_u0,_v0) \
(p)->u0 = (_u0), (p)->v0 = (_v0) \
#define setUV3(p,_u0,_v0,_u1,_v1,_u2,_v2) \
(p)->u0 = (_u0), (p)->v0 = (_v0), \
(p)->u1 = (_u1), (p)->v1 = (_v1), \
(p)->u2 = (_u2), (p)->v2 = (_v2)
#define setUV4(p,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3) \
(p)->u0 = (_u0), (p)->v0 = (_v0), \
(p)->u1 = (_u1), (p)->v1 = (_v1), \
(p)->u2 = (_u2), (p)->v2 = (_v2), \
(p)->u3 = (_u3), (p)->v3 = (_v3)
#define setUVWH(p,_u0,_v0,_w,_h) \
(p)->u0 = (_u0), (p)->v0 = (_v0), \
(p)->u1 = (_u0)+(_w), (p)->v1 = (_v0), \
(p)->u2 = (_u0), (p)->v2 = (_v0)+(_h), \
(p)->u3 = (_u0)+(_w), (p)->v3 = (_v0)+(_h)
/*
* Dump Primivie Parameters
*/
#define dumpRECT(r) \
GPU_printf("(%d,%d)-(%d,%d)\n", (r)->x,(r)->y,(r)->w,(r)->h)
#define dumpWH(p) GPU_printf("(%d,%d)\n", (p)->w, (p)->h )
#define dumpXY0(p) GPU_printf("(%d,%d)\n", (p)->x0, (p)->y0)
#define dumpUV0(p) GPU_printf("(%d,%d)\n", (p)->u0, (p)->v0)
#define dumpXY2(p) \
GPU_printf("(%d,%d)-(%d,%d)\n", \
(p)->x0, (p)->y0, (p)->x1, (p)->y1)
#define dumpXY3(p) \
GPU_printf("(%d,%d)-(%d,%d)-(%d,%d)\n", \
(p)->x0, (p)->y0, (p)->x1, (p)->y1, \
(p)->x2, (p)->y2)
#define dumpUV3(p) \
GPU_printf("(%d,%d)-(%d,%d)-(%d,%d)\n", \
(p)->u0, (p)->v0, (p)->u1, (p)->v1, \
(p)->u2, (p)->v2)
#define dumpXY4(p) \
GPU_printf("(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n", \
(p)->x0, (p)->y0, (p)->x1, (p)->y1, \
(p)->x2, (p)->y2, (p)->x3, (p)->y3)
#define dumpUV4(p) \
GPU_printf("(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n", \
(p)->u0, (p)->v0, (p)->u1, (p)->v1, \
(p)->u2, (p)->v2, (p)->u3, (p)->v3)
#define dumpRGB0(p) \
GPU_printf("(%3d,%3d,%3d)\n", (p)->r0, (p)->g0, (p)->b0)
#define dumpRGB1(p) \
GPU_printf("(%3d,%3d,%3d)\n", (p)->r1, (p)->g1, (p)->b1)
#define dumpRGB2(p) \
GPU_printf("(%3d,%3d,%3d)\n", (p)->r2, (p)->g2, (p)->b2)
#define dumpRGB3(p) \
GPU_printf("(%3d,%3d,%3d)\n", (p)->r3, (p)->g3, (p)->b3)
/*
* Primitive Handling Macros
*/
#define setlen( p, _len) (((P_TAG *)(p))->len = (u_char)(_len))
#define setaddr(p, _addr) (((P_TAG *)(p))->addr = (u_long)(_addr))
#define setcode(p, _code) (((P_TAG *)(p))->code = (u_char)(_code))
#define getlen(p) (u_char)(((P_TAG *)(p))->len)
#define getcode(p) (u_char)(((P_TAG *)(p))->code)
#define getaddr(p) (u_long)(((P_TAG *)(p))->addr)
#define nextPrim(p) (void *)((((P_TAG *)(p))->addr)|0x80000000)
#define isendprim(p) ((((P_TAG *)(p))->addr)==0xffffff)
#define addPrim(ot, p) setaddr(p, getaddr(ot)), setaddr(ot, p)
#define addPrims(ot, p0, p1) setaddr(p1, getaddr(ot)),setaddr(ot, p0)
#define catPrim(p0, p1) setaddr(p0, p1)
#define termPrim(p) setaddr(p, 0xffffffff)
#define setSemiTrans(p, abe) \
((abe)?setcode(p, getcode(p)|0x02):setcode(p, getcode(p)&~0x02))
#define setShadeTex(p, tge) \
((tge)?setcode(p, getcode(p)|0x01):setcode(p, getcode(p)&~0x01))
#define getTPage(tp, abr, x, y) \
((((tp)&0x3)<<7)|(((abr)&0x3)<<5)|(((y)&0x100)>>4)|(((x)&0x3ff)>>6)| \
(((y)&0x200)<<2))
#define getClut(x, y) \
(((y)<<6)|(((x)>>4)&0x3f))
#define dumpTPage(tpage) \
GPU_printf("tpage: (%d,%d,%d,%d)\n", \
((tpage)>>7)&0x003,((tpage)>>5)&0x003, \
((tpage)<<6)&0x7c0, \
(((tpage)<<4)&0x100)+(((tpage)>>2)&0x200))
#define dumpClut(clut) \
GPU_printf("clut: (%d,%d)\n", (clut&0x3f)<<4, (clut>>6))
#define _get_mode(dfe, dtd, tpage) \
((0xe1000000)|((dtd)?0x0200:0)| \
((dfe)?0x0400:0)|((tpage)&0x9ff))
#define setDrawTPage(p, dfe, dtd, tpage) \
setlen(p, 1), \
((u_long *)(p))[1] = _get_mode(dfe, dtd, tpage)
#define _get_tw(tw) \
(tw ? ((0xe2000000)|((((tw)->y&0xff)>>3)<<15)| \
((((tw)->x&0xff)>>3)<<10)|(((~((tw)->h-1)&0xff)>>3)<<5)| \
(((~((tw)->w-1)&0xff)>>3))) : 0)
#define setTexWindow(p, tw) \
setlen(p, 2), \
((u_long *)(p))[1] = _get_tw(tw), \
((u_long *)(p))[2] = 0
#define _get_len(rect) \
(((rect)->w*(rect)->h+1)/2+4)
#define setDrawLoad(pt, rect) \
(_get_len(rect) <= 16) ? ( \
(setlen(pt, _get_len(rect))), \
((pt)->code[0] = 0xa0000000), \
((pt)->code[1] = *((u_long *)&(rect)->x)), \
((pt)->code[2] = *((u_long *)&(rect)->w)), \
((pt)->p[_get_len(rect)-4] = 0x01000000) \
) : ( \
(setlen(pt,0)) \
)
#define setDrawStp(p, pbw) \
setlen(p, 2), \
((u_long *)p)[1] = 0xe6000000|(pbw?0x01:0), \
((u_long *)p)[2] = 0
#define setDrawMode(p, dfe, dtd, tpage, tw) \
setlen(p, 2), \
((u_long *)p)[1] = _get_mode(dfe, dtd, tpage), \
((u_long *)p)[2] = _get_tw((RECT *)tw)
/* Primitive Lentgh Code */
/*-------------------------------------------------------------------- */
/* */
#define setPolyF3(p) setlen(p, 4), setcode(p, 0x20)
#define setPolyFT3(p) setlen(p, 7), setcode(p, 0x24)
#define setPolyG3(p) setlen(p, 6), setcode(p, 0x30)
#define setPolyGT3(p) setlen(p, 9), setcode(p, 0x34)
#define setPolyF4(p) setlen(p, 5), setcode(p, 0x28)
#define setPolyFT4(p) setlen(p, 9), setcode(p, 0x2c)
#define setPolyG4(p) setlen(p, 8), setcode(p, 0x38)
#define setPolyGT4(p) setlen(p, 12), setcode(p, 0x3c)
#define setSprt8(p) setlen(p, 3), setcode(p, 0x74)
#define setSprt16(p) setlen(p, 3), setcode(p, 0x7c)
#define setSprt(p) setlen(p, 4), setcode(p, 0x64)
#define setTile1(p) setlen(p, 2), setcode(p, 0x68)
#define setTile8(p) setlen(p, 2), setcode(p, 0x70)
#define setTile16(p) setlen(p, 2), setcode(p, 0x78)
#define setTile(p) setlen(p, 3), setcode(p, 0x60)
#define setLineF2(p) setlen(p, 3), setcode(p, 0x40)
#define setLineG2(p) setlen(p, 4), setcode(p, 0x50)
#define setLineF3(p) setlen(p, 5), setcode(p, 0x48),(p)->pad = 0x55555555
#define setLineG3(p) setlen(p, 7), setcode(p, 0x58),(p)->pad = 0x55555555, \
(p)->p2 = 0
#define setLineF4(p) setlen(p, 6), setcode(p, 0x4c),(p)->pad = 0x55555555
#define setLineG4(p) setlen(p, 9), setcode(p, 0x5c),(p)->pad = 0x55555555, \
(p)->p2 = 0, (p)->p3 = 0
/*
* Rectangle:
*/
typedef struct {
short x, y; /* offset point on VRAM */
short w, h; /* width and height */
} RECT;
typedef struct {
int x, y; /* offset point on VRAM */
int w, h; /* width and height */
} RECT32;
/*
* Environment
*/
typedef struct {
u_long tag;
u_long code[15];
} DR_ENV; /* Packed Drawing Environment */
typedef struct {
RECT clip; /* clip area */
short ofs[2]; /* drawing offset */
RECT tw; /* texture window */
u_short tpage; /* texture page */
u_char dtd; /* dither flag (0:off, 1:on) */
u_char dfe; /* flag to draw on display area (0:off 1:on) */
u_char isbg; /* enable to auto-clear */
u_char r0, g0, b0; /* initital background color */
DR_ENV dr_env; /* reserved */
} DRAWENV;
typedef struct {
RECT disp; /* display area */
RECT screen; /* display start point */
u_char isinter; /* interlace 0: off 1: on */
u_char isrgb24; /* RGB24 bit mode */
u_char pad0, pad1; /* reserved */
} DISPENV;
/*
* Polygon Primitive Definitions
*/
typedef struct {
unsigned addr: 24;
unsigned len: 8;
u_char r0, g0, b0, code;
} P_TAG;
typedef struct {
u_char r0, g0, b0, code;
} P_CODE;
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
short x1, y1;
short x2, y2;
} POLY_F3; /* Flat Triangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
short x1, y1;
short x2, y2;
short x3, y3;
} POLY_F4; /* Flat Quadrangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
short x1, y1;
u_char u1, v1; u_short tpage;
short x2, y2;
u_char u2, v2; u_short pad1;
} POLY_FT3; /* Flat Textured Triangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
short x1, y1;
u_char u1, v1; u_short tpage;
short x2, y2;
u_char u2, v2; u_short pad1;
short x3, y3;
u_char u3, v3; u_short pad2;
} POLY_FT4; /* Flat Textured Quadrangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char r1, g1, b1, pad1;
short x1, y1;
u_char r2, g2, b2, pad2;
short x2, y2;
} POLY_G3; /* Gouraud Triangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char r1, g1, b1, pad1;
short x1, y1;
u_char r2, g2, b2, pad2;
short x2, y2;
u_char r3, g3, b3, pad3;
short x3, y3;
} POLY_G4; /* Gouraud Quadrangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
u_char r1, g1, b1, p1;
short x1, y1;
u_char u1, v1; u_short tpage;
u_char r2, g2, b2, p2;
short x2, y2;
u_char u2, v2; u_short pad2;
} POLY_GT3; /* Gouraud Textured Triangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
u_char r1, g1, b1, p1;
short x1, y1;
u_char u1, v1; u_short tpage;
u_char r2, g2, b2, p2;
short x2, y2;
u_char u2, v2; u_short pad2;
u_char r3, g3, b3, p3;
short x3, y3;
u_char u3, v3; u_short pad3;
} POLY_GT4; /* Gouraud Textured Quadrangle */
/*
* Line Primitive Definitions
*/
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
short x1, y1;
} LINE_F2; /* Unconnected Flat Line */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char r1, g1, b1, p1;
short x1, y1;
} LINE_G2; /* Unconnected Gouraud Line */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
short x1, y1;
short x2, y2;
u_long pad;
} LINE_F3; /* 2 connected Flat Line */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char r1, g1, b1, p1;
short x1, y1;
u_char r2, g2, b2, p2;
short x2, y2;
u_long pad;
} LINE_G3; /* 2 connected Gouraud Line */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
short x1, y1;
short x2, y2;
short x3, y3;
u_long pad;
} LINE_F4; /* 3 connected Flat Line Quadrangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char r1, g1, b1, p1;
short x1, y1;
u_char r2, g2, b2, p2;
short x2, y2;
u_char r3, g3, b3, p3;
short x3, y3;
u_long pad;
} LINE_G4; /* 3 connected Gouraud Line */
/*
* Sprite Primitive Definitions
*/
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
short w, h;
} SPRT; /* free size Sprite */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
} SPRT_16; /* 16x16 Sprite */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
} SPRT_8; /* 8x8 Sprite */
/*
* Tile Primitive Definitions
*/
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
short w, h;
} TILE; /* free size Tile */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
} TILE_16; /* 16x16 Tile */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
} TILE_8; /* 8x8 Tile */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
} TILE_1; /* 1x1 Tile */
/*
* Special Primitive Definitions
*/
typedef struct {
u_long tag;
u_long code[2];
} DR_MODE; /* Drawing Mode */
typedef struct {
u_long tag;
u_long code[2];
} DR_TWIN; /* Texture Window */
typedef struct {
u_long tag;
u_long code[2];
} DR_AREA; /* Drawing Area */
typedef struct {
u_long tag;
u_long code[2];
} DR_OFFSET; /* Drawing Offset */
typedef struct { /* MoveImage */
u_long tag;
u_long code[5];
} DR_MOVE;
typedef struct { /* LoadImage */
u_long tag;
u_long code[3];
u_long p[13];
} DR_LOAD;
typedef struct {
u_long tag;
u_long code[1];
} DR_TPAGE; /* Drawing TPage */
typedef struct {
u_long tag;
u_long code[2];
} DR_STP; /* Drawing STP */
/*
* Font Stream Parameters
*/
#define FNT_MAX_ID 8 /* max number of stream ID */
#define FNT_MAX_SPRT 1024 /* max number of sprites in all streams */
/*
* Multi-purpose Sony-TMD primitive
*/
typedef struct {
u_long id;
u_char r0, g0, b0, p0; /* Color of vertex 0 */
u_char r1, g1, b1, p1; /* Color of vertex 1 */
u_char r2, g2, b2, p2; /* Color of vertex 2 */
u_char r3, g3, b3, p3; /* Color of vertex 3 */
u_short tpage, clut; /* texture page ID, clut ID */
u_char u0, v0, u1, v1; /* texture corner point */
u_char u2, v2, u3, v3;
/* independent vertex model */
SVECTOR x0, x1, x2, x3; /* 3D corner point */
SVECTOR n0, n1, n2, n3; /* 3D corner normal vector */
/* Common vertex model */
SVECTOR *v_ofs; /* offset to vertex database */
SVECTOR *n_ofs; /* offset to normal database */
u_short vert0, vert1; /* index of vertex */
u_short vert2, vert3;
u_short norm0, norm1; /* index of normal */
u_short norm2, norm3;
} TMD_PRIM;
/*
* Multi-purpose TIM image
*/
typedef struct {
u_long mode; /* pixel mode */
RECT *crect; /* CLUT rectangle on frame buffer */
u_long *caddr; /* CLUT address on main memory */
RECT *prect; /* texture image rectangle on frame buffer */
u_long *paddr; /* texture image address on main memory */
} TIM_IMAGE;
/*
* Prototypes
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#ifndef _FNTPRINT_
#define _FNTPRINT_
extern int FntPrint(...);
#endif /* _FNTPRINT_ */
#ifndef _KANJIFNTPRINT_
#define _KANJIFNTPRINT_
extern int KanjiFntPrint(...);
#endif /* _KANJIFNTPRINT_ */
#else
#ifndef _FNTPRINT_
#define _FNTPRINT_
extern int FntPrint();
#endif /* _FNTPRINT_ */
#ifndef _KANJIFNTPRINT_
#define _KANJIFNTPRINT_
extern int KanjiFntPrint();
#endif /* _KANJIFNTPRINT_ */
#endif
extern DISPENV *GetDispEnv(DISPENV *env);
extern DISPENV *PutDispEnv(DISPENV *env);
extern DISPENV *SetDefDispEnv(DISPENV *env, int x, int y, int w, int h);
extern DRAWENV *GetDrawEnv(DRAWENV *env);
extern DRAWENV *PutDrawEnv(DRAWENV *env);
extern DRAWENV *SetDefDrawEnv(DRAWENV *env, int x, int y, int w, int h);
extern TIM_IMAGE *ReadTIM(TIM_IMAGE *timimg);
extern TMD_PRIM *ReadTMD(TMD_PRIM *tmdprim);
extern int CheckPrim(char *s, u_long *p);
extern int ClearImage(RECT *rect, u_char r, u_char g, u_char b);
extern int ClearImage2(RECT *rect, u_char r, u_char g, u_char b);
extern int DrawSync(int mode);
extern int FntOpen(int x, int y, int w, int h, int isbg, int n);
extern int GetGraphDebug(void) ;
extern int GetTimSize(u_char *sjis);
extern int IsEndPrim(void *p) ;
extern int KanjiFntOpen(int x, int y, int w, int h, int dx, int dy, int cx, int cy, int isbg, int n);
extern void KanjiFntClose(void);
extern int Krom2Tim(u_char *sjis, u_long *taddr, int dx, int dy, int cdx, int cdy, u_int fg, u_int bg);
extern int LoadImage(RECT *rect, u_long *p);
extern int MargePrim(void *p0, void *p1);
extern int MoveImage(RECT *rect, int x, int y);
extern int OpenTIM(u_long *addr);
extern int OpenTMD(u_long *tmd, int obj_no);
extern int ResetGraph(int mode);
extern int SetGraphDebug(int level);
extern int StoreImage(RECT *rect, u_long *p);
extern u_long *ClearOTag(u_long *ot, int n);
extern u_long *ClearOTagR(u_long *ot, int n);
extern u_long *FntFlush(int id);
extern u_long *KanjiFntFlush(int id);
extern u_long DrawSyncCallback(void (*func)(void));
extern u_short GetClut(int x, int y) ;
extern u_short GetTPage(int tp, int abr, int x, int y) ;
extern u_short LoadClut(u_long *clut, int x, int y);
extern u_short LoadClut2(u_long *clut, int x, int y);
extern u_short LoadTPage(u_long *pix, int tp, int abr, int x, int y, int w, int h);
extern void *NextPrim(void *p) ;
extern void AddPrim(void *ot, void *p) ;
extern void AddPrims(void *ot, void *p0, void *p1) ;
extern void CatPrim(void *p0, void *p1) ;
extern void DrawOTag(u_long *p);
extern void DrawOTagIO(u_long *p);
extern void DrawOTagEnv(u_long *p, DRAWENV *env);
extern void DrawPrim(void *p);
extern void DumpClut(u_short clut) ;
extern void DumpDispEnv(DISPENV *env);
extern void DumpDrawEnv(DRAWENV *env);
extern void DumpOTag(u_long *p);
extern void DumpTPage(u_short tpage) ;
extern void FntLoad(int tx, int ty);
extern void SetDispMask(int mask);
extern void SetDrawArea(DR_AREA *p, RECT *r);
extern void SetDrawEnv(DR_ENV *dr_env, DRAWENV *env);
extern void SetDrawLoad(DR_LOAD *p, RECT *rect);
extern void SetDrawMode(DR_MODE *p, int dfe, int dtd, int tpage, RECT *tw);
extern void SetDrawTPage(DR_TPAGE *p, int dfe, int dtd, int tpage);
extern void SetDrawMove(DR_MOVE *p, RECT *rect, int x, int y) ;
extern void SetDrawOffset(DR_OFFSET *p, u_short *ofs);
extern void SetDrawStp(DR_STP *p, int pbw);
extern void SetDumpFnt(int id);
extern void SetLineF2(LINE_F2 *p) ;
extern void SetLineF3(LINE_F3 *p) ;
extern void SetLineF4(LINE_F4 *p) ;
extern void SetLineG2(LINE_G2 *p) ;
extern void SetLineG3(LINE_G3 *p) ;
extern void SetLineG4(LINE_G4 *p) ;
extern void SetPolyF3(POLY_F3 *p) ;
extern void SetPolyF4(POLY_F4 *p) ;
extern void SetPolyFT3(POLY_FT3 *p) ;
extern void SetPolyFT4(POLY_FT4 *p) ;
extern void SetPolyG3(POLY_G3 *p) ;
extern void SetPolyG4(POLY_G4 *p) ;
extern void SetPolyGT3(POLY_GT3 *p) ;
extern void SetPolyGT4(POLY_GT4 *p) ;
extern void SetSemiTrans(void *p, int abe) ;
extern void SetShadeTex(void *p, int tge) ;
extern void SetSprt(SPRT *p) ;
extern void SetSprt16(SPRT_16 *p) ;
extern void SetSprt8(SPRT_8 *p) ;
extern void SetTexWindow(DR_TWIN *p, RECT *tw);
extern void SetTile(TILE *p) ;
extern void SetTile1(TILE_1 *p) ;
extern void SetTile16(TILE_16 *p) ;
extern void SetTile8(TILE_8 *p) ;
extern void TermPrim(void *p) ;
extern u_long *BreakDraw(void);
extern void ContinueDraw(u_long *insaddr, u_long *contaddr);
extern int IsIdleGPU(int max_count);
extern int GetODE(void);
extern int LoadImage2(RECT *rect, u_long *p);
extern int StoreImage2(RECT *rect, u_long *p);
extern int MoveImage2(RECT *rect, int x, int y);
extern int DrawOTag2(u_long *p);
extern void GetDrawMode(DR_MODE *p);
extern void GetTexWindow(DR_TWIN *p);
extern void GetDrawArea(DR_AREA *p);
extern void GetDrawOffset(DR_OFFSET *p);
extern void GetDrawEnv2(DR_ENV *p);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBGPU_H_ */
File diff suppressed because it is too large Load Diff
+766
View File
@@ -0,0 +1,766 @@
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _LIBGTE_H_
#define _LIBGTE_H_
/*
* (C) Copyright 1993/1994/1995 Sony Computer Entertainment ,Tokyo,Japan.
* All Rights Reserved
*
* libgte.h: Geometry Basic Structures Database
*
*$Id: libgte.h,v 1.35 1998/03/10 03:52:35 noda Exp $
*/
/*
* Geometry Structures:
*/
#define ONE 4096 /* GTE regards 4096 as 1.0 */
#define TMPVTXNUM 16 /* Clip Function Header */
#define OUTVTXNUM 10
#ifdef ASSEMBLER
/*
* GTE read macros
*/
#define read_sz_fifo3(r1,r2,r3) mfc2 r1,$17; \
mfc2 r2,$18; \
mfc2 r3,$19; \
nop
#define read_sz_fifo4(r1,r2,r3,r4) mfc2 r1,$16; \
mfc2 r2,$17; \
mfc2 r3,$18; \
mfc2 r4,$19; \
nop
#define read_szx(r1) mfc2 r1,$16; \
nop
#define read_sz0(r1) mfc2 r1,$17; \
nop
#define read_sz1(r1) mfc2 r1,$18; \
nop
#define read_sz2(r1) mfc2 r1,$19; \
nop
#define read_sxsy_fifo3(r1,r2,r3) mfc2 r1,$12; \
mfc2 r2,$13; \
mfc2 r3,$14; \
nop
#define read_sxsy0(r1) mfc2 r1,$12; \
nop
#define read_sxsy1(r1) mfc2 r1,$13; \
nop
#define read_sxsy2(r1) mfc2 r1,$14; \
nop
#define read_rgb_fifo(r1,r2,r3) mfc2 r1,$20; \
mfc2 r2,$21; \
mfc2 r3,$22; \
nop
#define read_rgb0(r1) mfc2 r1,$20; \
nop
#define read_rgb1(r1) mfc2 r1,$21; \
nop
#define read_rgb2(r1) mfc2 r1,$22; \
nop
#define read_flag(r1) cfc2 r1,$31; \
nop
#define read_p(r1) mfc2 r1,$8; \
nop
#define read_otz(r1) mfc2 r1,$7; \
nop
#define read_opz(r1) mfc2 r1,$24; \
nop
#define read_mt(r1,r2,r3) mfc2 r1,$25; \
mfc2 r2,$26; \
mfc2 r3,$27; \
nop
/*
* GTE store macros
*/
#define store_sxsy_fifo3(r1,r2,r3) swc2 $12,(r1); \
swc2 $13,(r2); \
swc2 $14,(r3); \
nop
#define store_sxsy0(r1) swc2 $12,(r1); \
nop
#define store_sxsy1(r1) swc2 $13,(r1); \
nop
#define store_sxsy2(r1) swc2 $14,(r1); \
nop
#define store_rgb_fifo(r1,r2,r3) swc2 $20,(r1); \
swc2 $21,(r2); \
swc2 $22,(r3); \
nop
#define store_rgb0(r1) swc2 $20,(r1); \
nop
#define store_rgb1(r1) swc2 $21,(r1); \
nop
#define store_rgb2(r1) swc2 $22,(r1); \
nop
/*
* GTE set macros
*/
#define set_trans_matrix(r1,r2,r3) ctc2 r1,$5; \
ctc2 r2,$6; \
ctc2 r3,$7; \
nop
#endif
#ifndef ASSEMBLER
typedef struct {
short m[3][3]; /* 3x3 rotation matrix */
long t[3]; /* transfer vector */
} MATRIX;
typedef struct { /* long word type 3D vector */
long vx, vy;
long vz, pad;
} VECTOR;
typedef struct { /* short word type 3D vector */
short vx, vy;
short vz, pad;
} SVECTOR;
typedef struct { /* color type vector */
u_char r, g, b, cd;
} CVECTOR;
typedef struct { /* 2D short vector */
short vx, vy;
} DVECTOR;
typedef struct {
SVECTOR v; /* Object(Local) 3D Vertex */
VECTOR sxyz; /* Screen 3D Vertex */
DVECTOR sxy; /* Screen 2D Vertex */
CVECTOR rgb; /* Vertex Color Data */
short txuv,pad; /* Texture Mapping Data */
long chx,chy; /* Clip Window Data */
} EVECTOR;
typedef struct {
SVECTOR v;
u_char uv[2]; u_short pad; /* */
CVECTOR c;
DVECTOR sxy;
u_long sz; /* clip z-data */
} RVECTOR; /* division vertex data vector */
typedef struct {
RVECTOR r01,r12,r20;
RVECTOR *r0,*r1,*r2;
u_long *rtn;
} CRVECTOR3; /* recursive vector for triangles */
typedef struct {
u_long ndiv; /* number of divisions */
u_long pih,piv; /* clipping area */
u_short clut,tpage;
CVECTOR rgbc;
u_long *ot;
RVECTOR r0,r1,r2;
CRVECTOR3 cr[5];
} DIVPOLYGON3; /* division buffer for triangles */
typedef struct {
RVECTOR r01,r02,r31,r32,rc;
RVECTOR *r0,*r1,*r2,*r3;
u_long *rtn;
} CRVECTOR4; /* recursive vector for four-sided polygons */
typedef struct {
u_long ndiv; /* number of divisions */
u_long pih,piv; /* clipping area */
u_short clut,tpage;
CVECTOR rgbc;
u_long *ot;
RVECTOR r0,r1,r2,r3;
CRVECTOR4 cr[5];
} DIVPOLYGON4; /* division buffer for four-sided polygons */
typedef struct {
short xy[3];
short uv[2];
short rgb[3];
} SPOL;
/*polygon: 41 bytes/1 polygon*/
typedef struct {
short sxy[4][2]; /*0..7*/
short sz[4][2]; /*8..15sz[][1] is dummy*/
short uv[4][2]; /*16..23*/
short rgb[4][3]; /*23..34*/
short code; /*35... F4:5,TF4:6,G4:7,TG4:8*/
} POL4;
typedef struct {
short sxy[3][2];
short sz[3][2]; /*sz[][1] is dummy*/
short uv[3][2];
short rgb[3][3];
short code; /*F3:1,TF3:2,G3:3,TG3:4*/
} POL3;
typedef struct {
SVECTOR *v; /*shared vertices*/
SVECTOR *n; /*shared normals*/
SVECTOR *u; /*shared texture addresses*/
CVECTOR *c; /*shared colors*/
u_long len; /*mesh length(=#vertex)*/
} TMESH;
typedef struct {
SVECTOR *v; /*shared vertices*/
SVECTOR *n; /*shared normals*/
SVECTOR *u; /*shared texture addresses*/
CVECTOR *c; /*shared colors*/
u_long lenv; /*mesh length_V(=#vertex_V)*/
u_long lenh; /*mesh length_H(=#vertex_H)*/
} QMESH;
/*
* ProtoTypes
*/
#ifndef NO_PROTOTYPE
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void InitGeom();
extern void EigenMatrix(MATRIX *m, MATRIX *t);
extern int IsIdMatrix(MATRIX *m);
extern MATRIX *MulMatrix0(MATRIX *m0,MATRIX *m1,MATRIX *m2);
extern MATRIX *MulRotMatrix0(MATRIX *m0,MATRIX *m1);
extern MATRIX *MulMatrix(MATRIX *m0,MATRIX *m1);
extern MATRIX *MulMatrix2(MATRIX *m0,MATRIX *m1);
extern MATRIX *MulRotMatrix(MATRIX *m0);
extern MATRIX *SetMulMatrix(MATRIX *m0,MATRIX *m1);
extern MATRIX *SetMulRotMatrix(MATRIX *m0);
extern VECTOR *ApplyMatrix(MATRIX *m,SVECTOR *v0,VECTOR *v1);
extern VECTOR *ApplyRotMatrix(SVECTOR *v0,VECTOR *v1);
extern VECTOR *ApplyRotMatrixLV(VECTOR *v0,VECTOR *v1);
extern VECTOR *ApplyMatrixLV(MATRIX *m,VECTOR *v0,VECTOR *v1);
extern SVECTOR *ApplyMatrixSV(MATRIX *m,SVECTOR *v0,SVECTOR *v1);
extern VECTOR *ApplyTransposeMatrixLV(MATRIX *m,VECTOR *v0,VECTOR *v1);
extern MATRIX *RotMatrix(SVECTOR *r,MATRIX *m);
extern MATRIX *RotMatrixXZY(SVECTOR *r,MATRIX *m);
extern MATRIX *RotMatrixYXZ(SVECTOR *r,MATRIX *m);
extern MATRIX *RotMatrixYZX(SVECTOR *r,MATRIX *m);
extern MATRIX *RotMatrixZXY(SVECTOR *r,MATRIX *m);
extern MATRIX *RotMatrixZYX(SVECTOR *r,MATRIX *m);
extern MATRIX *RotMatrix_gte(SVECTOR *r,MATRIX *m);
extern MATRIX *RotMatrixYXZ_gte(SVECTOR *r,MATRIX *m);
extern MATRIX *RotMatrixZYX_gte(SVECTOR *r,MATRIX *m);
extern MATRIX *RotMatrixX(long r,MATRIX *m);
extern MATRIX *RotMatrixY(long r,MATRIX *m);
extern MATRIX *RotMatrixZ(long r,MATRIX *m);
extern MATRIX *RotMatrixC(SVECTOR *r,MATRIX *m);
extern MATRIX *TransMatrix(MATRIX *m,VECTOR *v);
extern MATRIX *ScaleMatrix(MATRIX *m,VECTOR *v);
extern MATRIX *ScaleMatrixL(MATRIX *m,VECTOR *v);
extern MATRIX *TransposeMatrix(MATRIX *m0,MATRIX *m1);
extern MATRIX *CompMatrix(MATRIX *m0,MATRIX *m1,MATRIX *m2);
extern MATRIX *CompMatrixLV(MATRIX *m0,MATRIX *m1,MATRIX *m2);
extern void MatrixNormal(MATRIX *m, MATRIX *n);
extern void MatrixNormal_0(MATRIX *m, MATRIX *n);
extern void MatrixNormal_1(MATRIX *m, MATRIX *n);
extern void MatrixNormal_2(MATRIX *m, MATRIX *n);
extern void SetRotMatrix(MATRIX *m);
extern void SetLightMatrix(MATRIX *m);
extern void SetColorMatrix(MATRIX *m);
extern void SetTransMatrix(MATRIX *m);
extern void PushMatrix();
extern void PopMatrix();
extern void ReadRotMatrix(MATRIX *m);
extern void ReadLightMatrix(MATRIX *m);
extern void ReadColorMatrix(MATRIX *m);
extern void SetRGBcd(CVECTOR *v);
extern void SetBackColor(long rbk,long gbk,long bbk);
extern void SetFarColor(long rfc,long gfc,long bfc);
extern void SetGeomOffset(long ofx,long ofy);
extern void SetGeomScreen(long h);
extern void ReadSZfifo3(long *sz0,long *sz1,long *sz2);
extern void ReadSZfifo4(long *szx,long *sz0,long *sz1,long *sz2);
extern void ReadSXSYfifo(long *sxy0,long *sxy1,long *sxy2);
extern void ReadRGBfifo(CVECTOR *v0,CVECTOR *v1,CVECTOR *v2);
extern void ReadGeomOffset(long *ofx,long *ofy);
extern long ReadGeomScreen();
extern void TransRot_32(VECTOR *v0, VECTOR *v1, long *flag);
extern long TransRotPers(SVECTOR *v0, long *sxy, long *p, long *flag);
extern long TransRotPers3(SVECTOR *v0, SVECTOR *v1, SVECTOR *v2, long *sxy0,
long *sxy1, long *sxy2, long *p, long *flag);
extern void pers_map(int abuf, SVECTOR **vertex, int tex[4][2], u_short *dtext);
extern void PhongLine(int istart_x, int iend_x, int p, int q, u_short **pixx,
int fs, int ft, int i4, int det);
extern long RotTransPers(SVECTOR *v0,long *sxy,long *p,long *flag);
extern long RotTransPers3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
long *sxy0,long *sxy1,long *sxy2,long *p,long *flag);
extern void RotTrans(SVECTOR *v0,VECTOR *v1,long *flag);
extern void RotTransSV(SVECTOR *v0,SVECTOR *v1,long *flag);
extern void LocalLight(SVECTOR *v0,VECTOR *v1);
extern void LightColor(VECTOR *v0,VECTOR *v1);
extern void DpqColorLight(VECTOR *v0,CVECTOR *v1,long p,CVECTOR *v2);
extern void DpqColor(CVECTOR *v0,long p,CVECTOR *v1);
extern void DpqColor3(CVECTOR *v0,CVECTOR *v1,CVECTOR *v2,
long p,CVECTOR *v3,CVECTOR *v4,CVECTOR *v5);
extern void Intpl(VECTOR *v0,long p,CVECTOR *v1);
extern VECTOR *Square12(VECTOR *v0,VECTOR *v1);
extern VECTOR *Square0(VECTOR *v0,VECTOR *v1);
extern VECTOR *SquareSL12(SVECTOR *v0,VECTOR *v1);
extern VECTOR *SquareSL0(SVECTOR *v0,VECTOR *v1);
extern SVECTOR *SquareSS12(SVECTOR *v0,SVECTOR *v1);
extern SVECTOR *SquareSS0(SVECTOR *v0,SVECTOR *v1);
extern void NormalColor(SVECTOR *v0,CVECTOR *v1);
extern void NormalColor3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
CVECTOR *v3,CVECTOR *v4,CVECTOR *v5);
extern void NormalColorDpq(SVECTOR *v0,CVECTOR *v1,long p,CVECTOR *v2);
extern void NormalColorDpq3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,CVECTOR *v3,
long p,CVECTOR *v4,CVECTOR *v5,CVECTOR *v6);
extern void NormalColorCol(SVECTOR *v0,CVECTOR *v1,CVECTOR *v2);
extern void NormalColorCol3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,CVECTOR *v3,
CVECTOR *v4,CVECTOR *v5,CVECTOR *v6);
extern void ColorDpq(VECTOR *v0,CVECTOR *v1,long p,CVECTOR *v2);
extern void ColorCol(VECTOR *v0,CVECTOR *v1,CVECTOR *v2);
extern long NormalClip(long sxy0,long sxy1,long sxy2);
extern long AverageZ3(long sz0,long sz1,long sz2);
extern long AverageZ4(long sz0,long sz1,long sz2,long sz3);
extern void OuterProduct12(VECTOR *v0,VECTOR *v1,VECTOR *v2);
extern void OuterProduct0(VECTOR *v0,VECTOR *v1,VECTOR *v2);
extern long Lzc(long data);
extern long RotTransPers4(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
long *sxy0,long *sxy1,long *sxy2,long *sxy3,
long *p,long *flag);
extern void RotTransPersN(SVECTOR *v0,DVECTOR *v1,u_short *sz,u_short *p,
u_short *flag,long n);
extern void RotTransPers3N(SVECTOR *v0,DVECTOR *v1,u_short *sz,u_short *flag,
long n);
extern void RotMeshH(short *Yheight,DVECTOR *Vo,u_short *sz,u_short *flag,
short Xoffset,short Zoffset,short m,short n,
DVECTOR *base);
extern long RotAverage3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
long *sxy0,long *sxy1,long *sxy2,long *p,long *flag);
extern long RotAverage4(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
long *sxy0,long *sxy1,long *sxy2,long *sxy3,
long *p,long *flag);
extern long RotNclip3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
long *sxy0,long *sxy1,long *sxy2,long *p,long *otz,
long *flag);
extern long RotNclip4(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
long *sxy0,long *sxy1,long *sxy2,long *sxy3,
long *p,long *otz,long *flag);
extern long RotAverageNclip3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
long *sxy0,long *sxy1,long *sxy2,
long *p,long *otz,long *flag);
extern long RotAverageNclip4(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
long *sxy0,long *sxy1,long *sxy2,long *sxy3,
long *p,long *otz,long *flag);
extern long RotColorDpq(SVECTOR *v0,SVECTOR *v1,CVECTOR *v2,
long *sxy,CVECTOR *v3,long *flag);
extern long RotColorDpq3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
SVECTOR *v3,SVECTOR *v4,SVECTOR *v5,CVECTOR *v6,
long *sxy0,long *sxy1,long *sxy2,
CVECTOR *v7,CVECTOR *v8,CVECTOR *v9,long *flag);
extern long RotAverageNclipColorDpq3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
SVECTOR *v3,SVECTOR *v4,SVECTOR *v5,CVECTOR *v6,
long *sxy0,long *sxy1,long *sxy2,
CVECTOR *v7,CVECTOR *v8,CVECTOR *v9,
long *otz,long *flag);
extern long RotAverageNclipColorCol3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
SVECTOR *v3,SVECTOR *v4,SVECTOR *v5,CVECTOR *v6,
long *sxy0,long *sxy1,long *sxy2,
CVECTOR *v7,CVECTOR *v8,CVECTOR *v9,
long *otz,long *flag);
extern long RotColorMatDpq(SVECTOR *v0,SVECTOR *v1,CVECTOR *v2,long *sxy,
CVECTOR *v3,long matc,long flag);
extern void ColorMatDpq(SVECTOR *v0,CVECTOR *v1,long p,CVECTOR *v2,long matc);
extern void ColorMatCol(SVECTOR *v0,CVECTOR *v1,CVECTOR *v2,long matc);
extern void LoadAverage12(VECTOR *v0,VECTOR *v1,long p0,long p1,VECTOR *v2);
extern void LoadAverageShort12(SVECTOR *v0,SVECTOR *v1,long p0,long p1,
SVECTOR *v2);
extern void LoadAverage0(VECTOR *v0,VECTOR *v1,long p0,long p1,VECTOR *v2);
extern void LoadAverageShort0(SVECTOR *v0,SVECTOR *v1,long p0,long p1,
SVECTOR *v2);
extern void LoadAverageByte(u_char *v0,u_char *v1,long p0,long p1,u_char *v2);
extern void LoadAverageCol(u_char *v0,u_char *v1,long p0,long p1,u_char *v2);
extern long VectorNormal(VECTOR *v0, VECTOR *v1);
extern long VectorNormalS(VECTOR *v0, SVECTOR *v1);
extern long VectorNormalSS(SVECTOR *v0, SVECTOR *v1);
extern long SquareRoot0(long a);
extern long SquareRoot12(long a);
extern void InvSquareRoot(long a, long *b, long *c);
extern void gteMIMefunc(SVECTOR *otp, SVECTOR *dfp, long n, long p);
extern void SetFogFar(long a,long h);
extern void SetFogNear(long a,long h);
extern void SetFogNearFar(long a,long b,long h);
extern void SubPol4(POL4 *p, SPOL *sp, int ndiv);
extern void SubPol3(POL3 *p, SPOL *sp, int ndiv);
extern int rcos(int a);
extern int rsin(int a);
extern int ccos(int a);
extern int csin(int a);
extern int cln(int a);
extern int csqrt(int a);
extern int catan(int a);
extern long ratan2(long y, long x);
extern void RotPMD_F3(long *pa,u_long *ot,int otlen,int id,int backc);
extern void RotPMD_G3(long *pa,u_long *ot,int otlen,int id,int backc);
extern void RotPMD_FT3(long *pa,u_long *ot,int otlen,int id,int backc);
extern void RotPMD_GT3(long *pa,u_long *ot,int otlen,int id,int backc);
extern void RotPMD_F4(long *pa,u_long *ot,int otlen,int id,int backc);
extern void RotPMD_G4(long *pa,u_long *ot,int otlen,int id,int backc);
extern void RotPMD_FT4(long *pa,u_long *ot,int otlen,int id,int backc);
extern void RotPMD_GT4(long *pa,u_long *ot,int otlen,int id,int backc);
extern void RotPMD_SV_F3(long *pa,long *va,u_long *ot,int otlen,int id,
int backc);
extern void RotPMD_SV_G3(long *pa,long *va,u_long *ot,int otlen,int id,
int backc);
extern void RotPMD_SV_FT3(long *pa,long *va,u_long *ot,int otlen,int id,
int backc);
extern void RotPMD_SV_GT3(long *pa,long *va,u_long *ot,int otlen,int id,
int backc);
extern void RotPMD_SV_F4(long *pa,long *va,u_long *ot,int otlen,int id,
int backc);
extern void RotPMD_SV_G4(long *pa,long *va,u_long *ot,int otlen,int id,
int backc);
extern void RotPMD_SV_FT4(long *pa,long *va,u_long *ot,int otlen,int id,
int backc);
extern void RotPMD_SV_GT4(long *pa,long *va,u_long *ot,int otlen,int id,
int backc);
extern void InitClip(EVECTOR *evbfad,long hw,long vw,long h,long near,long far);
extern long Clip3F(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,EVECTOR **evmx);
extern long Clip3FP(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,EVECTOR **evmx);
extern long Clip4F(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
EVECTOR **evmx);
extern long Clip4FP(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
EVECTOR **evmx);
extern long Clip3FT(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
short *uv0,short *uv1,short *uv2,EVECTOR **evmx);
extern long Clip3FTP(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
short *uv0,short *uv1,short *uv2,EVECTOR **evmx);
extern long Clip4FT(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
short *uv0,short *uv1,short *uv2,short *uv3,EVECTOR **evmx);
extern long Clip4FTP(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
short *uv0,short *uv1,short *uv2,short *uv3,EVECTOR **evmx);
extern long Clip3G(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
CVECTOR *rgb0,CVECTOR *rgb1,CVECTOR *rgb2,EVECTOR **evmx);
extern long Clip3GP(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
CVECTOR *rgb0,CVECTOR *rgb1,CVECTOR *rgb2,EVECTOR **evmx);
extern long Clip4G(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
CVECTOR *rgb0,CVECTOR *rgb1,CVECTOR *rgb2,CVECTOR *rgb3,
EVECTOR **evmx);
extern long Clip4GP(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
CVECTOR *rgb0,CVECTOR *rgb1,CVECTOR *rgb2,CVECTOR *rgb3,
EVECTOR **evmx);
extern long Clip3GT(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
short *uv0,short *uv1,short *uv2,
CVECTOR *rgb0,CVECTOR *rgb1,CVECTOR *rgb2,
EVECTOR **evmx);
extern long Clip3GTP(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
short *uv0,short *uv1,short *uv2,
CVECTOR *rgb0,CVECTOR *rgb1,CVECTOR *rgb2,
EVECTOR **evmx);
extern long Clip4GT(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
short *uv0,short *uv1,short *uv2,short *uv3,
CVECTOR *rgb0,CVECTOR *rgb1,CVECTOR *rgb2,CVECTOR *rgb3,
EVECTOR **evmx);
extern long Clip4GTP(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3,
short *uv0,short *uv1,short *uv2,short *uv3,
CVECTOR *rgb0,CVECTOR *rgb1,CVECTOR *rgb2,CVECTOR *rgb3,
EVECTOR **evmx);
extern void RotTransPers_nom(SVECTOR *v0);
extern void RotTransPers3_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2);
extern void RotTransPers4_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,SVECTOR *v3);
extern void RotTrans_nom(SVECTOR *v0);
extern void RotAverage3_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2);
extern void RotNclip3_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2);
extern void RotAverageNclip3_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2);
extern void RotAverageNclipColorDpq3_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
SVECTOR *v3,SVECTOR *v4,SVECTOR *v5,CVECTOR *v6);
extern void RotAverageNclipColorCol3_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
SVECTOR *v3,SVECTOR *v4,SVECTOR *v5,CVECTOR *v6);
extern void RotColorDpq_nom(SVECTOR *v0,SVECTOR *v1,CVECTOR *v2);
extern long RotColorDpq3_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
SVECTOR *v3,SVECTOR *v4,SVECTOR *v5,CVECTOR *v6);
extern void NormalColor_nom(SVECTOR *v0);
extern void NormalColor3_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2);
extern void NormalColorDpq_nom(SVECTOR *v0,CVECTOR *v1,long p);
extern void NormalColorDpq3_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
CVECTOR *v3,long p);
extern void NormalColorCol_nom(SVECTOR *v0,CVECTOR *v1);
extern void NormalColorCol3_nom(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,
CVECTOR *v3);
/*
extern u_long *DivideF3(SVECTOR *v0,SVECTOR *v1,SVECTOR *v2,CVECTOR *rgbc,
POLY *otp);
extern u_long *GsPrng n,u_long shift,GsOT *otp);
extern u_long *GsTMDfastTG3LB(TMD_P_TG3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_GT3 *s,u_long n,u_long shift,GsOT *otp);
extern u_long *GsTMDfastTG3LFGB(TMD_P_TG3 *primtop,SVECTOR *vertop,
SVECTOR *nortop,POLY_GT3 *s,u_long n,u_long shift,GsOT *otp);
extern u_long *GsTMDfastTG3NLB(TMD_P_TG3 *primtop,SVECTOR *vertop,
SVECTOR *nortop,POLY_GT3 *s,u_long n,u_long shift,GsOT *otp);
extern u_long *GsTMDfastTNG3B(TMD_P_TNG3 *primtop,SVECTOR *vertop,
POLY_GT3 *s,u_long n,u_long shift,GsOT *otp);
extern u_long *GsTMDfastTG4LB(TMD_P_TG4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_GT4 *s,u_long n,u_long shift,GsOT *otp);
extern u_long *GsTMDfastTG4LFGB(TMD_P_TG4 *primtop,SVECTOR *vertop,
SVECTOR *nortop,POLY_GT4 *s,u_long n,u_long shift,GsOT *otp);
extern u_long *GsTMDfastTG4NLB(TMD_P_TG4 *primtop,SVECTOR *vertop,
SVECTOR *nortop,POLY_GT4 *s,u_long n,u_long shift,GsOT *otp);
extern u_long *GsTMDfastTNG4B(TMD_P_TNG4 *primtop,SVECTOR *vertop,
POLY_GT4 *s,u_long n,u_long shift,GsOT *otp);
extern u_long *GsTMDdivF3LB(TMD_P_F3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_F3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivF3LFGB(TMD_P_F3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_F3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivF3NLB(TMD_P_F3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_F3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivNF3B(TMD_P_NF3 *primtop,SVECTOR *vertop,
POLY_F3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivF4LB(TMD_P_F4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_F4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivF4LFGB(TMD_P_F4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_F4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivF4NLB(TMD_P_F4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_F4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivNF4B(TMD_P_NF4 *primtop,SVECTOR *vertop,
POLY_F4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivTF3LB(TMD_P_TF3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_FT3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivTF3LFGB(TMD_P_TF3 *primtop,SVECTOR *vertop,
SVECTOR *nortop,POLY_FT3 *s,u_long n,u_long shift,
GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivTF3NLB(TMD_P_TF3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_FT3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivTNF3B(TMD_P_TNF3 *primtop,SVECTOR *vertop,
POLY_FT3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivTF4LB(TMD_P_TF4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_FT4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivTF4LFGB(TMD_P_TF4 *primtop,SVECTOR *vertop,
SVECTOR *nortop,POLY_FT4 *s,u_long n,u_long shift,
GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivTF4NLB(TMD_P_TF4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_FT4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivTNF4B(TMD_P_TNF4 *primtop,SVECTOR *vertop,
POLY_FT4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivG3LB(TMD_P_G3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_G3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivG3LFGB(TMD_P_G3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_G3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivG3NLB(TMD_P_G3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_G3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivNG3B(TMD_P_NG3 *primtop,SVECTOR *vertop,
POLY_G3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivG4LB(TMD_P_G4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_G4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivG4LFGB(TMD_P_G4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_G4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivG4NLB(TMD_P_G4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_G4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivNG4B(TMD_P_NG4 *primtop,SVECTOR *vertop,
POLY_G4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivTG3LB(TMD_P_TG3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_GT3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivTG3LFGB(TMD_P_TG3 *primtop,SVECTOR *vertop,
SVECTOR *nortop,POLY_GT3 *s,u_long n,u_long shift,
GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivTG3NLB(TMD_P_TG3 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_GT3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivTNG3B(TMD_P_TNG3 *primtop,SVECTOR *vertop,
POLY_GT3 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON3 *divp);
extern u_long *GsTMDdivTG4LB(TMD_P_TG4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_GT4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivTG4LFGB(TMD_P_TG4 *primtop,SVECTOR *vertop,
SVECTOR *nortop,POLY_GT4 *s,u_long n,u_long shift,
GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivTG4NLB(TMD_P_TG4 *primtop,SVECTOR *vertop,SVECTOR *nortop,
POLY_GT4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
extern u_long *GsTMDdivTNG4B(TMD_P_TNG4 *primtop,SVECTOR *vertop,
POLY_GT4 *s,u_long n,u_long shift,GsOT *otp,DIVPOLYGON4 *divp);
*/
extern void RotSMD_F3(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_G3(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_FT3(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_GT3(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_F4(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_G4(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_FT4(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_GT4(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_SV_F3(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_SV_G3(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_SV_FT3(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_SV_GT3(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_SV_F4(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_SV_G4(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_SV_FT4(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotSMD_SV_GT4(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_F3(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_G3(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_FT3(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_GT3(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_F4(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_G4(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_FT4(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_GT4(long *pa,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_SV_F3(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_SV_G3(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_SV_FT3(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_SV_GT3(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_SV_F4(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_SV_G4(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_SV_FT4(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern void RotRMD_SV_GT4(long *pa,long *va,u_long *ot,int otlen,int id,
int sclip, int hclip, int vclip, int nclipmode);
extern long p2otz(long p, long projection);
extern long otz2p(long otz, long projection);
/*
extern void RotMeshPrimS_F3(TMESH *msh,POLY_F3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimS_G3(TMESH *msh,POLY_G3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimS_FC3(TMESH *msh,POLY_F3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimS_GC3(TMESH *msh,POLY_G3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimS_FT3(TMESH *msh,POLY_FT3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimS_GT3(TMESH *msh,POLY_GT3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimS_FCT3(TMESH *msh,POLY_FT3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimS_GCT3(TMESH *msh,POLY_GT3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimS_T3(TMESH *msh,POLY_FT3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimR_F3(TMESH *msh,POLY_F3 *prim,u_long *ot,
u_long otlen,long dpq,u _long backc);
extern void RotMeshPrimR_G3(TMESH *msh,POLY_G3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimR_FC3(TMESH *msh,POLY_F3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimR_GC3(TMESH *msh,POLY_G3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimR_FT3(TMESH *msh,POLY_FT3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimR_GT3(TMESH *msh,POLY_GT3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimR_FCT3(TMESH *msh,POLY_FT3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimR_GCT3(TMESH *msh,POLY_GT3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimR_T3(TMESH *msh,POLY_FT3 *prim,u_long *ot,
u_long otlen,long dpq,u_long backc);
extern void RotMeshPrimQ_T(QMESH *msh,POLY_FT4 *prim,u_long *ot,
u_long otlen,long dpq,long backc);
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif
#endif
#endif /* _LIBGTE_H_ */
+25
View File
@@ -0,0 +1,25 @@
/* $PSLibId: Run-time Library Release 4.7$ */
#ifndef _LIBGUN_H_
#define _LIBGUN_H_
/*
* Copyright (C) 1996 Sony Computer Entertainment America. All Rights Reserved
* libetc.h: Light Gun Interface
*/
/*
* Prototypes
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
void InitGUN(char *bufA, long lenA, char *bufB, long lenB, char *buf1, char *buf2, long len);
void RemoveGUN(void);
void SelectGUN(int ch, unsigned char mask);
long StartGUN(void);
void StopGUN(void);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBGUN_H_ */
File diff suppressed because it is too large Load Diff
+44
View File
@@ -0,0 +1,44 @@
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _LIBMATH_H_
#define _LIBMATH_H_
/*
libmath.h
*/
#define _ABS(x) ((x) < 0 ? -(x) : (x))
#define fabs(x) _ABS(x)
extern int math_errno;
extern int math_err_point;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
double pow(double, double),exp(double);
double log(double), log10(double);
double floor(double), ceil(double);
double fmod(double,double),modf(double,double *);
double sin(double), cos(double), tan(double);
double asin(double), acos(double);
double atan(double), atan2(double, double);
double sinh(double), cosh(double), tanh(double);
double sqrt(double);
double hypot(double, double);
double ldexp(double, int), frexp(double, int *);
double atof(char *);
double strtod(char *, char **);
int printf2(char *, ...);
int sprintf2(char *, char *, ...);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBMATH_H_ */
+59
View File
@@ -0,0 +1,59 @@
#ifndef _MEMCARD_H_
#define _MEMCARD_H_
/*
* File:libmcrd.h Rev. 4.2
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#include <kernel.h>
typedef void (*MemCB)( long cmds, long rslt );
#define McFuncExist (1)
#define McFuncAccept (2)
#define McFuncReadFile (3)
#define McFuncWriteFile (4)
#define McFuncReadData (5)
#define McFuncWriteData (6)
#define McErrNone (0)
#define McErrCardNotExist (1)
#define McErrCardInvalid (2)
#define McErrNewCard (3)
#define McErrNotFormat (4)
#define McErrFileNotExist (5)
#define McErrAlreadyExist (6)
#define McErrBlockFull (7)
#define McErrExtend (0x8000)
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
void MemCardInit( long val );
void MemCardEnd( void );
void MemCardStart(void);
void MemCardStop(void);
long MemCardExist( long chan );
long MemCardAccept( long chan );
long MemCardOpen( long chan, char* file, long flag );
void MemCardClose(void);
long MemCardReadData( unsigned long* adrs, long ofs, long bytes );
long MemCardReadFile( long chan, char* file, unsigned long* adrs, long ofs, long bytes );
long MemCardWriteData( unsigned long* adrs, long ofs, long bytes );
long MemCardWriteFile( long chan, char* file, unsigned long* adrs, long ofs ,long bytes );
long MemCardCreateFile( long chan, char* file, long blocks );
long MemCardDeleteFile( long chan, char* file );
long MemCardFormat( long chan );
long MemCardUnformat(long chan);
long MemCardSync( long mode, long* cmds, long* rslt );
MemCB MemCardCallback( MemCB func );
long MemCardGetDirentry( long chan, char* name, struct DIRENTRY* dir, long* files, long ofs, long max );
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _MEMCARD_H_ */
+101
View File
@@ -0,0 +1,101 @@
#ifndef _LIBMCX_H_
#define _LIBMCX_H_
/*
* File:libmcx.h
* Copyright (C) 1998 by Sony Computer Entertainment Inc.
* All rights Reserved
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
/* don't change these macros and structures which is referred in mcx code */
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef ERROR
#define ERROR (-1)
#endif
#define McxFuncGetApl 1
#define McxFuncExecApl 2
#define McxFuncGetTime 3
#define McxFuncGetMem 4
#define McxFuncSetMem 5
#define McxFuncShowTrans 6
#define McxFuncHideTrans 7
#define McxFuncCurrCtrl 8
#define McxFuncSetLED 9
#define McxFuncGetSerial 10
#define McxFuncExecFlag 11
#define McxFuncAllInfo 12
#define McxFuncFlashAcs 13
#define McxFuncReadDev 14
#define McxFuncWriteDev 15
#define McxFuncGetUIFS 16
#define McxFuncSetUIFS 17
#define McxFuncSetTime 18
#define McxFuncCardType 19
#define McxSyncRun 0
#define McxSyncNone (-1)
#define McxSyncFin 1
#define McxErrSuccess 0
#define McxErrNoCard 1
#define McxErrInvalid 2
#define McxErrNewCard 3
/*
* Prototypes
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
void McxStartCom(void);
void McxStopCom(void);
int McxSync(int, long *, long *);
int McxGetApl(int , long *);
int McxExecApl(int, int, long);
int McxGetTime(int, unsigned char *);
int McxGetMem(int, unsigned char *, unsigned, unsigned);
int McxSetMem(int, unsigned char *, unsigned, unsigned);
int McxShowTrans(int, int, int);
int McxHideTrans(int);
int McxCurrCtrl(int, int, int, int);
int McxFlashAcs(int, int);
int McxGetSerial(int, unsigned long *);
int McxSetLED(int, int);
int McxAllInfo(int, unsigned char *);
int McxExecFlag(int, int, int);
int McxReadDev(int, int, unsigned char *, unsigned char *);
int McxWriteDev(int, int, unsigned char *, unsigned char *);
int McxSetTime(int, unsigned char *);
int McxGetUIFS(int, unsigned char *);
int McxSetUIFS(int, unsigned char *);
int McxCardType(int);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBMCX_H_ */
/* don't add stuff after this */
+82
View File
@@ -0,0 +1,82 @@
#ifndef _LIBPAD_H_
#define _LIBPAD_H_
/*
* File:libpad.h
* Copyright (C) 1997 by Sony Computer Entertainment Inc.
* All rights Reserved
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
/* don't change these macros and structures which is referred in controler code */
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif
#define PadStateDiscon 0
#define PadStateFindPad 1
#define PadStateFindCTP1 2
#define PadStateFindCTP2 3
#define PadStateReqInfo 4
#define PadStateExecCmd 5
#define PadStateStable 6
#define InfoModeCurID 1
#define InfoModeCurExID 2
#define InfoModeCurExOffs 3
#define InfoModeIdTable 4
#define InfoActFunc 1
#define InfoActSub 2
#define InfoActSize 3
#define InfoActCurr 4
#define InfoActSign 5
#define PadMaxCurr 60 /* PS maximum current supply */
#define PadCurrCTP1 10 /* SCPH-1150 biblator current */
/*
* Prototypes
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
void PadInitDirect(unsigned char *, unsigned char *);
void PadInitMtap(unsigned char *, unsigned char *);
void PadInitGun(unsigned char *, int);
int PadChkVsync(void);
void PadStartCom(void);
void PadStopCom(void);
unsigned PadEnableCom(unsigned);
void PadEnableGun(unsigned char);
void PadRemoveGun(void);
int PadGetState(int);
int PadInfoMode(int, int, int);
int PadInfoAct(int, int, int);
int PadInfoComb(int, int, int);
int PadSetActAlign(int, unsigned char *);
int PadSetMainMode(int socket, int offs, int lock);
void PadSetAct(int, unsigned char *, int);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBPAD_H_ */
/* don't add stuff after this */
+73
View File
@@ -0,0 +1,73 @@
/* $PSLibId: Run-time Library Release 4.7$ */
#ifndef _LIBPRESS_H_
#define _LIBPRESS_H_
/*
* (C) Copyright 1995 Sony Corporation,Tokyo,Japan. All Rights Reserved
*
* libpress.h: Prototypes for libpress
*
*/
/* DecDCTvlc Table */
typedef u_short DECDCTTAB[34816];
/* DecDCTEnv */
typedef struct {
u_char iq_y[64]; /* IQ (Y): zig-zag order */
u_char iq_c[64]; /* IQ (Cb,Cr): zig-zag order */
short dct[64]; /* IDCT coef (reserved) */
} DECDCTENV;
typedef struct {
short *src; /* 16-bit strait PCM */
short *dest; /* PlayStation original waveform data */
short *work; /* scratch pad or NULL */
long size; /* size (unit: byte) of source data */
long loop_start; /* loop start point (unit: byte) of source data */
char loop; /* whether loop or not */
char byte_swap; /* source data is 16-bit big endian (1) / little endian (0) */
char proceed; /* proceeding ? whole (0) / start (1) / cont. (2) / end (4) */
char quality; /* quality ? middle (0) / high (1) */
} ENCSPUENV;
#define ENCSPU_ENCODE_ERROR (-1)
#define ENCSPU_ENCODE_WHOLE 0
#define ENCSPU_ENCODE_START (1<<0)
#define ENCSPU_ENCODE_CONTINUE (1<<1)
#define ENCSPU_ENCODE_END (1<<2)
#define ENCSPU_ENCODE_LOOP 1
#define ENCSPU_ENCODE_NO_LOOP 0
#define ENCSPU_ENCODE_ENDIAN_LITTLE 0
#define ENCSPU_ENCODE_ENDIAN_BIG 1
#define ENCSPU_ENCODE_MIDDLE_QULITY 0
#define ENCSPU_ENCODE_HIGH_QULITY 1
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void DecDCTReset(int mode);
extern DECDCTENV *DecDCTGetEnv(DECDCTENV *env);
extern DECDCTENV *DecDCTPutEnv(DECDCTENV *env);
extern int DecDCTBufSize(u_long *bs);
extern int DecDCTvlc(u_long *bs, u_long *buf);
extern int DecDCTvlc2(u_long *bs, u_long *buf, DECDCTTAB table);
extern int DecDCTvlcSize(int size);
extern int DecDCTvlcSize2(int size);
extern void DecDCTvlcBuild(u_short *table);
extern void DecDCTin(u_long *buf, int mode);
extern void DecDCTout(u_long *buf, int size);
extern int DecDCTinSync( int mode) ;
extern int DecDCToutSync( int mode) ;
extern int DecDCTinCallback(void (*func)());
extern int DecDCToutCallback(void (*func)());
extern long EncSPU (ENCSPUENV *env);
extern long EncSPU2(ENCSPUENV *env);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBPRESS_H_ */
+79
View File
@@ -0,0 +1,79 @@
/* $PSLibId: Run-time Library Release 4.7$ */
#ifndef _LIBSIO_H_
#define _LIBSIO_H_
/*
* Copyright (C) 1996,1997 Sony Computer Entertainment Inc. All Rights Reserved
* libsio.h: Sio Interface
*/
/* status bits */
#define SR_IRQ 0x200
#define SR_CTS 0x100
#define SR_DSR 0x80
#define SR_FE 0x20
#define SR_OE 0x10
#define SR_PERROR 0x8
#define SR_TXU 0x4
#define SR_RXRDY 0x2
#define SR_TXRDY 0x1
#define SIO_CTS 0x100
#define SIO_DSR 0x80
#define SIO_FE 0x20
#define SIO_OE 0x10
#define SIO_PERROR 0x8
#define SIO_TXU 0x4
#define SIO_RXRDY 0x2
#define SIO_TXRDY 0x1
/* control bits */
#define CR_DSRIEN 0x1000
#define CR_RXIEN 0x800
#define CR_TXIEN 0x400
#define CR_BUFSZ_1 0x0
#define CR_BUFSZ_2 0x100
#define CR_BUFSZ_4 0x200
#define CR_BUFSZ_8 0x300
#define CR_INTRST 0x40
#define CR_RTS 0x20
#define CR_ERRRST 0x10
#define CR_BRK 0x8
#define CR_RXEN 0x4
#define CR_DTR 0x2
#define CR_TXEN 0x1
#define SIO_BIT_DTR CR_DTR
#define SIO_BIT_RTS CR_RTS
/* mode bits */
#define MR_SB_00 0x0
#define MR_SB_01 0x40
#define MR_SB_10 0x80
#define MR_SB_11 0xC0
#define MR_P_EVEN 0x20
#define MR_PEN 0x10
#define MR_CHLEN_5 0x0
#define MR_CHLEN_6 0x4
#define MR_CHLEN_7 0x8
#define MR_CHLEN_8 0xC
#define MR_BR_1 0x1
#define MR_BR_16 0x2
#define MR_BR_64 0x3
/*
* Prototypes
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern long AddSIO(int baud);
extern long DelSIO(void);
extern long _sio_control(unsigned long cmd, unsigned long arg, unsigned long param);
extern int Sio1Callback (void (*func)());
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBSIO_H_ */
+158
View File
@@ -0,0 +1,158 @@
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _LIBSN_H_
#define _LIBSN_H_
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
/*
** LIBSN.H declare libary functions provided by LIBSN.LIB
**
** 05/02/94 ADB
** 21/03/94 ADB added user notes as comments
** 18/09/94 ADB added PCcreat() - it was missing before
** 31/05/95 ADB added PSYQpause() for new debug stub 4.04
** 20/09/95 ADB added SNFlushCache - but removed after email from Tom Boyd
** 27/03/97 GJ v2.00
C++ linkage
Call to global destructors in snmain.s
** 12.2.98 GJ v2.01
C++ structor functions added in ctors.c
snmain.s shuffled - __do_global_dtors removed
Compiler support functions moved to libsngcc.lib
** 18.2.98 GJ v2.02
C++ structor functions trimmed down because of assumptions about group names
** 24.3.98 GJ v2.03
Initialise GP from __SN_GP_BASE linker symbol
*/
#define pollhost() __asm__ volatile ("break 1024") /* inline to keep variable scope */
#define PSYQpause() __asm__ volatile ("break 1031") /* inline to keep variable scope */
/*
** C++ static class object functions
** These are here for when you can't use __SN_ENTRY_POINT (eg a final build)
** or when you need to instantiate static class objects from an overlay.
** Static class objects are those declared with non-function scope which
** have constructors. How do these get called? In the startup code, normally!
** But in final builds you can't link with our startup code, and the Sony
** startup objects don't have hooks for C++ initialisation. So:
** Call __sn_cpp_structors to initialise your standard static class
** objects, or to destroy them. Memory has already
** been allocated for these objects in the image; these functions just call
** the constructors to populate that memory appropriately.
** Call __sn_cpp_structors(section_obj, section_objend),
** supplying the obj and objend variables for a ctors section, to initialise
** the class objects referenced in that section. Or supply the obj and
** objend variables for a dtors section to call the corresponding
** destructors.
*/
extern void __sn_cpp_structors (long, long);
/*
** FILESERVER FUNCTIONS:
**
** NOTE: For PCread and PCwrite do not load files by passing extreme
** values for count as you might on UNIX as this will cause the full
** amount specified to be transferred - the file will be padded to
** that length with zeroes which may over-write memory beyond the
** end of the file.
**
** If you are unsure of the length of a file which you are about
** to read into memory then perform a
** len = PClseek( fd, 0, 2);
** This will set len to the length of the file which you can then
** pass to a PCread() function call.
**
*/
/*
** re-initialise PC filing system, close open files etc
**
** passed: void
**
** return: error code (0 if no error)
*/
int PCinit (void);
/*
** open a file on PC host
**
** passed: PC file pathname, open mode, permission flags
**
** return: file-handle or -1 if error
**
** note: perms should be zero (it is ignored)
**
** open mode: 0 => read only
** 1 => write only
** 2 => read/write
*/
int PCopen (char *name, int flags, int perms);
/*
** create (and open) a file on PC host
**
** passed: PC file pathname, open mode, permission flags
**
** return: file-handle or -1 if error
**
** note: perms should be zero (it is ignored)
*/
int PCcreat (char *name, int perms);
/*
** seek file pointer to new position in file
**
** passed: file-handle, seek offset, seek mode
**
** return: absolute value of new file pointer position
**
** (mode 0 = rel to start, mode 1 = rel to current fp, mode 2 = rel to end)
*/
int PClseek (int fd, int offset, int mode);
/*
** read bytes from file on PC
**
** passed: file-handle, buffer address, count
**
** return: count of number of bytes actually read
**
** note: unlike assembler function this provides for full 32 bit count
*/
int PCread (int fd, char *buff, int len);
/*
** write bytes to file on PC
**
** passed: file-handle, buffer address, count
**
** return: count of number of bytes actually written
**
** note: unlike assembler function this provides for full 32 bit count
*/
int PCwrite (int fd, char *buff, int len);
/*
** close an open file on PC
**
** passed: file-handle
**
** return: negative if error
**
*/
int PCclose (int fd);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBSN_H_ */
+508
View File
@@ -0,0 +1,508 @@
#ifndef _LIBSND_H_
#define _LIBSND_H_
/*****************************************************************
*
* $RCSfile: libsnd.h,v $
*
* Copyright (C) 1994 by Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* Sony Computer Entertainment Inc. Development Department
*
*****************************************************************/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#include <sys/types.h>
/*
* Macro
*/
#define SSPLAY_INFINITY 0
#define SS_NOTICK 0x1000
#define SS_NOTICK0 0
#define SS_TICK60 1
#define SS_TICK240 2
#define SS_TICK120 3
#define SS_TICK50 4
#define SS_TICKVSYNC 5
#define SS_TICKMODE_MAX 6
#define SSPLAY_PAUSE 0
#define SSPLAY_PLAY 1
#define SS_SOFF 0
#define SS_SON 1
#define SS_MIX 0
#define SS_REV 1
#define SS_SERIAL_A 0
#define SS_SERIAL_B 1
#define SS_MUTE_OFF 0
#define SS_MUTE_ON 1
#define SS_IMEDIATE 0
#define SS_IMMEDIATE 0
#define SS_WAIT_COMPLETED 1
#define SS_REV_TYPE_OFF 0
#define SS_REV_TYPE_ROOM 1
#define SS_REV_TYPE_STUDIO_A 2
#define SS_REV_TYPE_STUDIO_B 3
#define SS_REV_TYPE_STUDIO_C 4
#define SS_REV_TYPE_HALL 5
#define SS_REV_TYPE_SPACE 6
#define SS_REV_TYPE_ECHO 7
#define SS_REV_TYPE_DELAY 8
#define SS_REV_TYPE_PIPE 9
#define SSSKIP_TICK 0
#define SSSKIP_NOTE4 1
#define SSSKIP_NOTE8 2
#define SSSKIP_BAR 3
#define SS_SEQ_TABSIZ 176
#define SND_VOLL 1
#define SND_VOLR 2
#define SND_ADSR1 4
#define SND_ADSR2 8
#define SND_ADDR 16
#define SND_PITCH 32
#ifndef NULL
#define NULL 0
#endif
/*
* Vag & Vab Structure
*/
typedef struct VabHdr { /* VAB Bank Headdings */
long form; /* always 'VABp' */
long ver; /* VAB file version number */
long id; /* VAB id */
unsigned long fsize; /* VAB file size */
unsigned short reserved0; /* system reserved */
unsigned short ps; /* # of the programs in this bank */
unsigned short ts; /* # of the tones in this bank */
unsigned short vs; /* # of the vags in this bank */
unsigned char mvol; /* master volume for this bank */
unsigned char pan; /* master panning for this bank */
unsigned char attr1; /* bank attributes1 */
unsigned char attr2; /* bank attributes2 */
unsigned long reserved1; /* system reserved */
} VabHdr; /* 32 byte */
typedef struct ProgAtr { /* Program Headdings */
unsigned char tones; /* # of tones */
unsigned char mvol; /* program volume */
unsigned char prior; /* program priority */
unsigned char mode; /* program mode */
unsigned char mpan; /* program pan */
char reserved0; /* system reserved */
short attr; /* program attribute */
unsigned long reserved1; /* system reserved */
unsigned long reserved2; /* system reserved */
} ProgAtr; /* 16 byte */
typedef struct VagAtr { /* VAG Tone Headdings */
unsigned char prior; /* tone priority */
unsigned char mode; /* play mode */
unsigned char vol; /* tone volume*/
unsigned char pan; /* tone panning */
unsigned char center; /* center note */
unsigned char shift; /* center note fine tune */
unsigned char min; /* minimam note limit */
unsigned char max; /* maximam note limit */
unsigned char vibW; /* vibrate depth */
unsigned char vibT; /* vibrate duration */
unsigned char porW; /* portamento depth */
unsigned char porT; /* portamento duration */
unsigned char pbmin; /* under pitch bend max */
unsigned char pbmax; /* upper pitch bend max */
unsigned char reserved1; /* system reserved */
unsigned char reserved2; /* system reserved */
unsigned short adsr1; /* adsr1 */
unsigned short adsr2; /* adsr2 */
short prog; /* parent program*/
short vag; /* vag reference */
short reserved[4]; /* system reserved */
} VagAtr; /* 32 byte */
/*
* Volume Structure
*/
typedef struct {
unsigned short left; /* L Channel */
unsigned short right; /* R Channel */
} SndVolume;
typedef struct SndVolume2 {
short left;
short right;
} SndVolume2;
typedef struct SndRegisterAttr {
SndVolume2 volume;
short pitch;
short mask;
short addr;
short adsr1;
short adsr2;
} SndRegisterAttr;
typedef struct SndVoiceStats {
short vagId;
short vabId;
unsigned short pitch;
short note;
short tone;
short prog_num;
short prog_actual;
short vol;
short pan;
} SndVoiceStats;
/*
* CallBack
*/
typedef void (*SsMarkCallbackProc)(short, short, short);
/*
* Prototype
*/
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern short SsVabOpenHead(unsigned char*, short);
extern short SsVabOpenHeadSticky(unsigned char*, short, unsigned long);
extern short SsVabTransBody(unsigned char*, short);
extern short SsVabTransBodyPartly(unsigned char*, unsigned long, short);
extern short SsVabTransfer(unsigned char *, unsigned char *, short, short);
extern short SsVabTransCompleted(short);
extern void SsVabClose(short);
extern void SsInit(void);
extern void SsInitHot(void);
extern void SsSetTableSize(char*, short, short);
extern void SsSetTickMode(long);
extern int SsSetTickCallback(void (*cb)());
extern void SsStart(void);
extern void SsStart2(void);
extern void SsEnd(void);
extern void SsQuit(void);
extern void SsSeqCalledTbyT(void);
extern short SsSeqOpen(unsigned long*, short);
extern void SsSeqPlay(short, char, short);
extern void SsSeqPlayPtoP(short, short, unsigned char *, unsigned char *, char, short);
extern void SsSeqPause(short);
extern void SsSeqReplay(short);
extern int SsSeqSkip(short, short, char, short);
extern void SsSeqStop(short);
extern void SsSeqSetVol(short, short, short);
extern void SsSeqSetNext(short, short);
extern void SsSeqSetCrescendo(short, short, long);
extern void SsSeqSetDecrescendo(short, short, long);
extern void SsSeqSetAccelerando(short, long, long);
extern void SsSeqSetRitardando(short, long, long);
extern void SsSeqClose(short);
extern short SsSepOpen(unsigned long*, short, short);
extern void SsSepPlay(short, short, char, short);
extern void SsSepPause(short, short);
extern void SsSepReplay(short, short);
extern void SsSepStop(short, short);
extern void SsSepSetVol(short, short, short, short);
extern void SsSepSetCrescendo(short, short, short, long);
extern void SsSepSetDecrescendo(short, short, short, long);
extern void SsSepSetAccelerando(short, short, long, long);
extern void SsSepSetRitardando(short, short, long, long);
extern void SsSepClose(short);
extern long SsVoKeyOn(long, long, unsigned short, unsigned short);
extern long SsVoKeyOff(long, long);
extern void SsSetMVol(short, short);
extern void SsGetMVol(SndVolume*);
extern void SsSetRVol(short, short);
extern void SsGetRVol(SndVolume*);
extern void SsSetMute(char);
extern char SsGetMute(void);
extern void SsSetSerialAttr(char, char, char);
extern char SsGetSerialAttr(char, char);
extern void SsSetSerialVol(char, short, short);
extern void SsGetSerialVol(char, SndVolume*);
extern void SsSetNck(short);
extern short SsGetNck(void);
extern void SsSetNoiseOn(short, short);
extern void SsSetNoiseOff(void);
extern void SsSetMono(void);
extern void SsSetStereo(void);
extern void SsSetTempo(short, short, short);
extern void SsSetLoop(short, short, short);
extern short SsIsEos(short, short);
extern void SsPlayBack(short, short, short);
extern void SsSetMarkCallback(short, short, SsMarkCallbackProc);
extern char SsSetReservedVoice(char);
extern short SsUtKeyOn(short, short, short, short, short, short, short);
extern short SsUtKeyOff(short, short, short, short, short);
extern short SsUtKeyOnV(short voice, short vabId, short prog, short tone,
short note, short fine, short voll, short volr);
extern short SsUtKeyOffV(short voice);
extern short SsUtPitchBend(short, short, short, short, short);
extern short SsUtChangePitch(short, short, short, short, short,
short, short);
extern short SsUtChangeADSR(short, short, short, short,
unsigned short, unsigned short);
extern short SsUtSetVabHdr(short, VabHdr*);
extern short SsUtGetVabHdr(short, VabHdr*);
extern short SsUtSetProgAtr(short, short, ProgAtr*);
extern short SsUtGetProgAtr(short, short, ProgAtr*);
extern short SsUtSetVagAtr(short, short, short, VagAtr*);
extern short SsUtGetVagAtr(short, short, short, VagAtr*);
extern short SsUtSetDetVVol(short, short, short);
extern short SsUtGetDetVVol(short, short*, short*);
extern short SsUtSetVVol(short, short, short);
extern short SsUtGetVVol(short, short*, short*);
extern short SsUtAutoVol(short, short, short, short);
extern short SsUtAutoPan(short, short, short, short);
extern void SsUtReverbOn(void);
extern void SsUtReverbOff(void);
extern short SsUtSetReverbType(short);
extern short SsUtGetReverbType(void);
extern void SsUtSetReverbDepth(short, short);
extern void SsUtSetReverbFeedback(short);
extern void SsUtSetReverbDelay(short);
extern void SsUtAllKeyOff(short);
extern void SsSetAutoKeyOffMode (short mode);
extern void SsUtFlush(void);
extern short SsVabFakeHead(unsigned char*, short, unsigned long);
extern short SsVabFakeBody(short);
extern unsigned long SsUtGetVBaddrInSB(short);
extern long SsUtGetVagAddr(short vabId, short vagId);
extern unsigned long SsUtGetVagAddrFromTone(short vabId, short progId,
short toneId);
extern void SsSetNext(short, short, short, short);
extern void SsSeqGetVol(short, short, short*, short*);
extern void SsChannelMute(short, short, long);
extern short SsSeqOpenJ(unsigned long*, short);
extern short SsSepOpenJ(unsigned long*, short, short);
extern unsigned char* SsGetCurrentPoint(short, short);
extern int SsSetCurrentPoint(short, short, unsigned char *);
extern long SsGetChannelMute(short, short);
extern void SsSetVoiceMask(unsigned long);
extern unsigned long SsGetVoiceMask(void);
extern void SsQueueRegisters(long, SndRegisterAttr*);
extern void SsQueueKeyOn(long);
extern void SsQueueReverb(long, long);
extern short SsGetActualProgFromProg(short, short);
extern void SsSetVoiceSettings(long, SndVoiceStats*);
extern unsigned short SsPitchFromNote(short, short, unsigned char,
unsigned char);
extern short SsVoiceCheck(long, long, short);
extern char SsBlockVoiceAllocation(void);
extern char SsUnBlockVoiceAllocation(void);
extern long SsAllocateVoices(unsigned char, unsigned char);
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
}
#endif
/*
* for function table
*/
#define CC_NUMBER 0
#define CC_BANKCHANGE 1
#define CC_DATAENTRY 2
#define CC_MAINVOL 3
#define CC_PANPOT 4
#define CC_EXPRESSION 5
#define CC_DAMPER 6
#define CC_NRPN1 7
#define CC_NRPN2 8
#define CC_RPN1 9
#define CC_RPN2 10
#define CC_EXTERNAL 11
#define CC_RESETALL 12
#define DE_PRIORITY 0
#define DE_MODE 1
#define DE_LIMITL 2
#define DE_LIMITH 3
#define DE_ADSR_AR_L 4
#define DE_ADSR_AR_E 5
#define DE_ADSR_DR 6
#define DE_ADSR_SL 7
#define DE_ADSR_SR_L 8
#define DE_ADSR_SR_E 9
#define DE_ADSR_RR_L 10
#define DE_ADSR_RR_E 11
#define DE_ADSR_SR 12
#define DE_VIB_TIME 13
#define DE_PORTA_DEPTH 14
#define DE_REV_TYPE 15
#define DE_REV_DEPTH 16
#define DE_ECHO_FB 17
#define DE_ECHO_DELAY 18
#define DE_DELAY 19
typedef struct {
void (*noteon) ();
void (*programchange) ();
void (*pitchbend) ();
void (*metaevent) ();
void (*control[13]) ();
void (*ccentry[20]) ();
} _SsFCALL;
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern void _SsNoteOn (short, short, unsigned char, unsigned char);
extern void _SsSetProgramChange(short, short, unsigned char);
extern void _SsGetMetaEvent(short, short, unsigned char);
extern void _SsSetPitchBend(short, short);
extern void _SsSetControlChange(short, short, unsigned char);
extern void _SsContBankChange(short, short);
extern void _SsContDataEntry(short, short, unsigned char);
extern void _SsContMainVol(short, short, unsigned char);
extern void _SsContPanpot(short, short, unsigned char);
extern void _SsContExpression(short, short, unsigned char);
extern void _SsContDamper(short, short, unsigned char);
extern void _SsContExternal(short, short, unsigned char);
extern void _SsContNrpn1(short, short, unsigned char);
extern void _SsContNrpn2(short, short, unsigned char);
extern void _SsContRpn1(short, short, unsigned char);
extern void _SsContRpn2(short, short, unsigned char);
extern void _SsContResetAll(short, short);
extern void _SsSetNrpnVabAttr0(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr1(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr2(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr3(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr4(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr5(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr6(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr7(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr8(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr9(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr10(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr11(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr12(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr13(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr14(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr15(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr16(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr17(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr18(short, short, short, VagAtr, short, unsigned char);
extern void _SsSetNrpnVabAttr19(short, short, short, VagAtr, short, unsigned char);
extern void dmy_nothing1(short, short, unsigned char, unsigned char);
extern void dmy_SsNoteOn (short, short, unsigned char, unsigned char);
extern void dmy_SsSetProgramChange(short, short, unsigned char);
extern void dmy_SsGetMetaEvent(short, short, unsigned char);
extern void dmy_SsSetPitchBend(short, short);
extern void dmy_SsSetControlChange(short, short, unsigned char);
extern void dmy_SsContBankChange(short, short);
extern void dmy_SsContDataEntry(short, short, unsigned char);
extern void dmy_SsContMainVol(short, short, unsigned char);
extern void dmy_SsContPanpot(short, short, unsigned char);
extern void dmy_SsContExpression(short, short, unsigned char);
extern void dmy_SsContDamper(short, short, unsigned char);
extern void dmy_SsContExternal(short, short, unsigned char);
extern void dmy_SsContNrpn1(short, short, unsigned char);
extern void dmy_SsContNrpn2(short, short, unsigned char);
extern void dmy_SsContRpn1(short, short, unsigned char);
extern void dmy_SsContRpn2(short, short, unsigned char);
extern void dmy_SsContResetAll(short, short);
extern void dmy_SsSetNrpnVabAttr0(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr1(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr2(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr3(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr4(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr5(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr6(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr7(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr8(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr9(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr10(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr11(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr12(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr13(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr14(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr15(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr16(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr17(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr18(short, short, short, VagAtr, short, unsigned char);
extern void dmy_SsSetNrpnVabAttr19(short, short, short, VagAtr, short, unsigned char);
extern _SsFCALL SsFCALL;
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
}
#endif
#if 0
jt_SsInit ()
{
SsFCALL.noteon = (void (*)())_SsNoteOn;
SsFCALL.programchange = (void (*)())_SsSetProgramChange;
SsFCALL.metaevent = (void (*)())_SsGetMetaEvent;
SsFCALL.pitchbend = (void (*)())_SsSetPitchBend;
SsFCALL.control [CC_NUMBER] = (void (*)())_SsSetControlChange;
SsFCALL.control [CC_BANKCHANGE] = (void (*)())_SsContBankChange;
SsFCALL.control [CC_MAINVOL] = (void (*)())_SsContMainVol;
SsFCALL.control [CC_PANPOT] = (void (*)())_SsContPanpot;
SsFCALL.control [CC_EXPRESSION] = (void (*)())_SsContExpression;
SsFCALL.control [CC_DAMPER] = (void (*)())_SsContDamper;
SsFCALL.control [CC_NRPN1] = (void (*)())_SsContNrpn1;
SsFCALL.control [CC_NRPN2] = (void (*)())_SsContNrpn2;
SsFCALL.control [CC_RPN1] = (void (*)())_SsContRpn1;
SsFCALL.control [CC_RPN2] = (void (*)())_SsContRpn2;
SsFCALL.control [CC_EXTERNAL] = (void (*)())_SsContExternal;
SsFCALL.control [CC_RESETALL] = (void (*)())_SsContResetAll;
SsFCALL.control [CC_DATAENTRY] = (void (*)())_SsContDataEntry;
SsFCALL.ccentry [DE_PRIORITY] = (void (*)())_SsSetNrpnVabAttr0;
SsFCALL.ccentry [DE_MODE] = (void (*)())_SsSetNrpnVabAttr1;
SsFCALL.ccentry [DE_LIMITL] = (void (*)())_SsSetNrpnVabAttr2;
SsFCALL.ccentry [DE_LIMITH] = (void (*)())_SsSetNrpnVabAttr3;
SsFCALL.ccentry [DE_ADSR_AR_L] = (void (*)())_SsSetNrpnVabAttr4;
SsFCALL.ccentry [DE_ADSR_AR_E] = (void (*)())_SsSetNrpnVabAttr5;
SsFCALL.ccentry [DE_ADSR_DR] = (void (*)())_SsSetNrpnVabAttr6;
SsFCALL.ccentry [DE_ADSR_SL] = (void (*)())_SsSetNrpnVabAttr7;
SsFCALL.ccentry [DE_ADSR_SR_L] = (void (*)())_SsSetNrpnVabAttr8;
SsFCALL.ccentry [DE_ADSR_SR_E] = (void (*)())_SsSetNrpnVabAttr9;
SsFCALL.ccentry [DE_ADSR_RR_L] = (void (*)())_SsSetNrpnVabAttr10;
SsFCALL.ccentry [DE_ADSR_RR_E] = (void (*)())_SsSetNrpnVabAttr11;
SsFCALL.ccentry [DE_ADSR_SR] = (void (*)())_SsSetNrpnVabAttr12;
SsFCALL.ccentry [DE_VIB_TIME] = (void (*)())_SsSetNrpnVabAttr13;
SsFCALL.ccentry [DE_PORTA_DEPTH] = (void (*)())_SsSetNrpnVabAttr14;
SsFCALL.ccentry [DE_REV_TYPE] = (void (*)())_SsSetNrpnVabAttr15;
SsFCALL.ccentry [DE_REV_DEPTH] = (void (*)())_SsSetNrpnVabAttr16;
SsFCALL.ccentry [DE_ECHO_FB] = (void (*)())_SsSetNrpnVabAttr17;
SsFCALL.ccentry [DE_ECHO_DELAY] = (void (*)())_SsSetNrpnVabAttr18;
SsFCALL.ccentry [DE_DELAY] = (void (*)())_SsSetNrpnVabAttr19;
}
#endif
/* ----------------------------------------------------------------
* End on File
* ---------------------------------------------------------------- */
#endif /* _LIBSND_H_ */
/* DON'T ADD STUFF AFTER THIS */
+552
View File
@@ -0,0 +1,552 @@
#ifndef _LIBSPU_H_
#define _LIBSPU_H_
/*****************************************************************
* -*- c -*-
* $RCSfile: libspu.h,v $
*
* Copyright (c) 1993, 1994, 1995, 1996 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* This file is part of ``PlayStation(R)'' Programmer Tool /
* Runtime Library.
*
* R & D Division, Sony Computer Entertainment Inc.
*
* $Id: libspu.h,v 1.80 1997/06/24 11:14:04 kaol Exp $
*
*****************************************************************/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
/* ----------------------------------------------------------------
* CONSTANT
* ---------------------------------------------------------------- */
#define SPU_SUCCESS 0
#define SPU_INVALID_ARGS (-3)
#define SPU_DIAG (-2)
#define SPU_CHECK (-1)
#define SPU_OFF 0
#define SPU_ON 1
#define SPU_CLEAR 2
#define SPU_RESET 3
#define SPU_DONT_CARE 4
#define SPU_ALL 0
#define SPU_CDONLY 5
#define SPU_VOICEONLY 6
#define SPU_CONT 7
#define SPU_BIT 8
#define SPU_NULL 0
/* Macros below will be obsoleted. */
#define SpuDiag SPU_DIAG
#define SpuCheck SPU_CHECK
#define SpuOff SPU_OFF
#define SpuOn SPU_ON
#define SpuClear SPU_CLEAR
#define SpuReset SPU_RESET
#define SpuDontCare SPU_DONT_CARE
#define SpuALL SPU_ALL
#define SpuCDOnly SPU_CDONLY
#define SpuVoiceOnly SPU_VOICEONLY
#define SpuCont SPU_CONT
#define SpuNull SPU_NULL
#define SPU_OFF_ENV_ON 2
#define SPU_ON_ENV_OFF 3
/* Macros below will be obsoleted. */
#define SpuOffEnvOn SPU_OFF_ENV_ON
#define SpuOnEnvOff SPU_ON_ENV_OFF
#define SPU_ERROR (-1)
/* Macros below will be obsoleted. */
#define SpuError SPU_ERROR
#define SPU_TRANSFER_BY_DMA 0L
#define SPU_TRANSFER_BY_IO 1L
/* Macros below will be obsoleted. */
#define SpuTransferByDMA SPU_TRANSFER_BY_DMA
#define SpuTransferByIO SPU_TRANSFER_BY_IO
#define SpuTransByDMA SpuTransferByDMA
#define SpuTransByIO SpuTransferByIO
#define SPU_TRANSFER_WAIT 1
#define SPU_TRANSFER_PEEK 0
#define SPU_TRANSFER_GLANCE SPU_TRANSFER_PEEK
/*
* Voice designate
*/
#ifndef __SPU_VOICE
#define __SPU_VOICE
#define SPU_00CH (0x1L<< 0)
#define SPU_01CH (0x1L<< 1)
#define SPU_02CH (0x1L<< 2)
#define SPU_03CH (0x1L<< 3)
#define SPU_04CH (0x1L<< 4)
#define SPU_05CH (0x1L<< 5)
#define SPU_06CH (0x1L<< 6)
#define SPU_07CH (0x1L<< 7)
#define SPU_08CH (0x1L<< 8)
#define SPU_09CH (0x1L<< 9)
#define SPU_10CH (0x1L<<10)
#define SPU_11CH (0x1L<<11)
#define SPU_12CH (0x1L<<12)
#define SPU_13CH (0x1L<<13)
#define SPU_14CH (0x1L<<14)
#define SPU_15CH (0x1L<<15)
#define SPU_16CH (0x1L<<16)
#define SPU_17CH (0x1L<<17)
#define SPU_18CH (0x1L<<18)
#define SPU_19CH (0x1L<<19)
#define SPU_20CH (0x1L<<20)
#define SPU_21CH (0x1L<<21)
#define SPU_22CH (0x1L<<22)
#define SPU_23CH (0x1L<<23)
#define SPU_0CH SPU_00CH
#define SPU_1CH SPU_01CH
#define SPU_2CH SPU_02CH
#define SPU_3CH SPU_03CH
#define SPU_4CH SPU_04CH
#define SPU_5CH SPU_05CH
#define SPU_6CH SPU_06CH
#define SPU_7CH SPU_07CH
#define SPU_8CH SPU_08CH
#define SPU_9CH SPU_09CH
#define SPU_ALLCH (SPU_00CH | SPU_01CH | SPU_02CH | SPU_03CH | SPU_04CH | \
SPU_05CH | SPU_06CH | SPU_07CH | SPU_08CH | SPU_09CH | \
SPU_10CH | SPU_11CH | SPU_12CH | SPU_13CH | SPU_14CH | \
SPU_15CH | SPU_16CH | SPU_17CH | SPU_18CH | SPU_19CH | \
SPU_20CH | SPU_21CH | SPU_22CH | SPU_23CH)
#define SPU_KEYCH(x) (0x1L<<(x))
#define SPU_VOICECH(x) SPU_KEYCH(x)
#endif /* __SPU_VOICE */
/* for Voice setting */
#define SPU_VOICE_VOLL (0x01 << 0) /* volume (left) */
#define SPU_VOICE_VOLR (0x01 << 1) /* volume (right) */
#define SPU_VOICE_VOLMODEL (0x01 << 2) /* volume mode (left) */
#define SPU_VOICE_VOLMODER (0x01 << 3) /* volume mode (right) */
#define SPU_VOICE_PITCH (0x01 << 4) /* tone (pitch setting) */
#define SPU_VOICE_NOTE (0x01 << 5) /* tone (note setting) */
#define SPU_VOICE_SAMPLE_NOTE (0x01 << 6) /* waveform data sample note */
#define SPU_VOICE_WDSA (0x01 << 7) /* waveform data start address */
#define SPU_VOICE_ADSR_AMODE (0x01 << 8) /* ADSR Attack rate mode */
#define SPU_VOICE_ADSR_SMODE (0x01 << 9) /* ADSR Sustain rate mode */
#define SPU_VOICE_ADSR_RMODE (0x01 << 10) /* ADSR Release rate mode */
#define SPU_VOICE_ADSR_AR (0x01 << 11) /* ADSR Attack rate */
#define SPU_VOICE_ADSR_DR (0x01 << 12) /* ADSR Decay rate */
#define SPU_VOICE_ADSR_SR (0x01 << 13) /* ADSR Sustain rate */
#define SPU_VOICE_ADSR_RR (0x01 << 14) /* ADSR Release rate */
#define SPU_VOICE_ADSR_SL (0x01 << 15) /* ADSR Sustain level */
#define SPU_VOICE_LSAX (0x01 << 16) /* start address for loop */
#define SPU_VOICE_ADSR_ADSR1 (0x01 << 17) /* ADSR adsr1 for `VagAtr' */
#define SPU_VOICE_ADSR_ADSR2 (0x01 << 18) /* ADSR adsr2 for `VagAtr' */
#define SPU_VOICE_DIRECT 0
#define SPU_VOICE_LINEARIncN 1
#define SPU_VOICE_LINEARIncR 2
#define SPU_VOICE_LINEARDecN 3
#define SPU_VOICE_LINEARDecR 4
#define SPU_VOICE_EXPIncN 5
#define SPU_VOICE_EXPIncR 6
#define SPU_VOICE_EXPDec 7
#define SPU_VOICE_EXPDecN SPU_VOICE_EXPDec
#define SPU_VOICE_EXPDecR SPU_VOICE_EXPDec
#define SPU_DECODED_FIRSTHALF 0
#define SPU_DECODED_SECONDHALF 1
#define SPU_DECODE_FIRSTHALF SPU_DECODED_FIRSTHALF
#define SPU_DECODE_SECONDHALF SPU_DECODED_SECONDHALF
#define SPU_COMMON_MVOLL (0x01 << 0) /* master volume (left) */
#define SPU_COMMON_MVOLR (0x01 << 1) /* master volume (right) */
#define SPU_COMMON_MVOLMODEL (0x01 << 2) /* master volume mode (left) */
#define SPU_COMMON_MVOLMODER (0x01 << 3) /* master volume mode (right) */
#define SPU_COMMON_RVOLL (0x01 << 4) /* reverb volume (left) */
#define SPU_COMMON_RVOLR (0x01 << 5) /* reverb volume (right) */
#define SPU_COMMON_CDVOLL (0x01 << 6) /* CD input volume (left) */
#define SPU_COMMON_CDVOLR (0x01 << 7) /* CD input volume (right) */
#define SPU_COMMON_CDREV (0x01 << 8) /* CD input reverb on/off */
#define SPU_COMMON_CDMIX (0x01 << 9) /* CD input on/off */
#define SPU_COMMON_EXTVOLL (0x01 << 10) /* external digital input volume (left) */
#define SPU_COMMON_EXTVOLR (0x01 << 11) /* external digital input volume (right) */
#define SPU_COMMON_EXTREV (0x01 << 12) /* external digital input reverb on/off */
#define SPU_COMMON_EXTMIX (0x01 << 13) /* external digital input on/off */
/* for Reverb setting */
#define SPU_REV_MODE (0x01 << 0) /* mode setting */
#define SPU_REV_DEPTHL (0x01 << 1) /* reverb depth (left) */
#define SPU_REV_DEPTHR (0x01 << 2) /* reverb depth (right) */
#define SPU_REV_DELAYTIME (0x01 << 3) /* Delay Time (ECHO, DELAY only) */
#define SPU_REV_FEEDBACK (0x01 << 4) /* Feedback (ECHO only) */
#define SPU_REV_MODE_CHECK (-1)
#define SPU_REV_MODE_OFF 0
#define SPU_REV_MODE_ROOM 1
#define SPU_REV_MODE_STUDIO_A 2
#define SPU_REV_MODE_STUDIO_B 3
#define SPU_REV_MODE_STUDIO_C 4
#define SPU_REV_MODE_HALL 5
#define SPU_REV_MODE_SPACE 6
#define SPU_REV_MODE_ECHO 7
#define SPU_REV_MODE_DELAY 8
#define SPU_REV_MODE_PIPE 9
#define SPU_REV_MODE_MAX 10
#define SPU_REV_MODE_CLEAR_WA 0x100
/* ----------------------------------------------------------------
* Event flushing
* ---------------------------------------------------------------- */
#define SPU_EVENT_KEY (0x01 << 0)
#define SPU_EVENT_PITCHLFO (0x01 << 1)
#define SPU_EVENT_NOISE (0x01 << 2)
#define SPU_EVENT_REVERB (0x01 << 3)
#define SPU_EVENT_ALL 0
/* ----------------------------------------------------------------
* Structure
* ---------------------------------------------------------------- */
typedef struct {
short left; /* Lch */
short right; /* Rch */
} SpuVolume;
typedef struct {
unsigned long voice; /* set voice:
SpuSetVoiceAttr: each voice is a bit array
SpuGetVoiceAttr: voice is a bit value */
unsigned long mask; /* settings attribute bit (invalid with Get) */
SpuVolume volume; /* volume */
SpuVolume volmode; /* volume mode */
SpuVolume volumex; /* current volume (invalid with Set) */
unsigned short pitch; /* tone (pitch setting) */
unsigned short note; /* tone (note setting) */
unsigned short sample_note; /* tone (note setting) */
short envx; /* current envelope value (invalid with Set) */
unsigned long addr; /* waveform data start address */
unsigned long loop_addr; /* loop start address */
long a_mode; /* Attack rate mode */
long s_mode; /* Sustain rate mode */
long r_mode; /* Release rate mode */
unsigned short ar; /* Attack rate */
unsigned short dr; /* Decay rate */
unsigned short sr; /* Sustain rate */
unsigned short rr; /* Release rate */
unsigned short sl; /* Sustain level */
unsigned short adsr1; /* adsr1 for `VagAtr' */
unsigned short adsr2; /* adsr2 for `VagAtr' */
} SpuVoiceAttr;
typedef struct {
short voiceNum; /* voice number */
short pad; /* padding */
SpuVoiceAttr attr; /* voice attribute */
} SpuLVoiceAttr;
typedef struct {
unsigned long mask; /* settings mask */
long mode; /* reverb mode */
SpuVolume depth; /* reverb depth */
long delay; /* Delay Time (ECHO, DELAY only) */
long feedback; /* Feedback (ECHO only) */
} SpuReverbAttr;
#define SPU_DECODEDDATA_SIZE 0x200
#define SPU_DECODEDATA_SIZE SPU_DECODEDDATA_SIZE
typedef struct {
short cd_left [SPU_DECODEDDATA_SIZE];
short cd_right [SPU_DECODEDDATA_SIZE];
short voice1 [SPU_DECODEDDATA_SIZE];
short voice3 [SPU_DECODEDDATA_SIZE];
} SpuDecodedData;
typedef SpuDecodedData SpuDecodeData;
typedef struct {
SpuVolume volume; /* volume */
long reverb; /* reverb on/off */
long mix; /* mixing on/off */
} SpuExtAttr;
typedef struct {
unsigned long mask; /* settings mask */
SpuVolume mvol; /* master volume */
SpuVolume mvolmode; /* master volume mode */
SpuVolume mvolx; /* current master volume */
SpuExtAttr cd; /* CD input attributes */
SpuExtAttr ext; /* external digital input attributes */
} SpuCommonAttr;
#ifndef __SPU_IRQCALLBACK_PROC
#define __SPU_IRQCALLBACK_PROC
typedef void (*SpuIRQCallbackProc)(void);
#endif /* __SPU_IRQCALLBACK_PROC */
#ifndef __SPU_TRANSFERCALLBACK_PROC
#define __SPU_TRANSFERCALLBACK_PROC
typedef void (*SpuTransferCallbackProc)(void);
#endif /* __SPU_TRANSFERCALLBACK_PROC */
/* ----------------------------------------------------------------
* for SPU Malloc (used in SpuInitMalloc())
* ---------------------------------------------------------------- */
#define SPU_MALLOC_RECSIZ 8
/* ----------------------------------------------------------------
* User specifiable global environment
* ---------------------------------------------------------------- */
typedef struct {
unsigned long mask;
unsigned long queueing;
} SpuEnv;
#define SPU_ENV_EVENT_QUEUEING (0x01 << 0)
/* ----------------------------------------------------------------
* prototype declaration
* ---------------------------------------------------------------- */
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern void SpuInit (void);
extern void SpuInitHot (void);
extern void SpuStart (void);
extern void SpuQuit (void);
extern long SpuSetMute (long on_off);
extern long SpuGetMute (void);
extern void SpuSetEnv (SpuEnv *env);
extern long SpuSetNoiseClock (long n_clock);
extern long SpuGetNoiseClock (void);
extern unsigned long SpuSetNoiseVoice (long on_off, unsigned long voice_bit);
extern unsigned long SpuGetNoiseVoice (void);
extern long SpuSetReverb (long on_off);
extern long SpuGetReverb (void);
extern long SpuSetReverbModeParam (SpuReverbAttr *attr);
extern void SpuGetReverbModeParam (SpuReverbAttr *attr);
extern long SpuSetReverbDepth (SpuReverbAttr *attr);
extern long SpuReserveReverbWorkArea (long on_off);
extern long SpuIsReverbWorkAreaReserved (long on_off);
extern unsigned long SpuSetReverbVoice (long on_off, unsigned long voice_bit);
extern unsigned long SpuGetReverbVoice (void);
extern long SpuClearReverbWorkArea (long mode);
extern unsigned long SpuWrite (unsigned char *addr, unsigned long size);
extern unsigned long SpuWrite0 (unsigned long size);
extern unsigned long SpuRead (unsigned char *addr, unsigned long size);
extern long SpuSetTransferMode (long mode);
#define SpuSetTransMode(mode) SpuSetTransferMode((mode))
extern long SpuGetTransferMode (void);
#define SpuGetTransMode() SpuGetTransferMode()
extern unsigned long SpuSetTransferStartAddr (unsigned long addr);
#define SpuSetTransStartAddr(addr) SpuSetTransferStartAddr((addr))
extern unsigned long SpuGetTransferStartAddr (void);
#define SpuGetTransStartAddr() SpuGetTransferStartAddr()
extern unsigned long SpuWritePartly (unsigned char *addr, unsigned long size);
extern long SpuIsTransferCompleted (long flag);
extern SpuTransferCallbackProc SpuSetTransferCallback (SpuTransferCallbackProc func);
extern long SpuReadDecodedData (SpuDecodedData *d_data, long flag);
#define SpuReadDecodeData(d_data,flag) SpuReadDecodedData((d_data), (flag))
extern long SpuSetIRQ (long on_off);
extern long SpuGetIRQ (void);
extern unsigned long SpuSetIRQAddr (unsigned long);
extern unsigned long SpuGetIRQAddr (void);
extern SpuIRQCallbackProc SpuSetIRQCallback (SpuIRQCallbackProc);
extern void SpuSetVoiceAttr (SpuVoiceAttr *arg);
extern void SpuGetVoiceAttr (SpuVoiceAttr *arg);
extern void SpuSetKey (long on_off, unsigned long voice_bit);
extern void SpuSetKeyOnWithAttr (SpuVoiceAttr *attr);
extern long SpuGetKeyStatus (unsigned long voice_bit);
extern void SpuGetAllKeysStatus (char *status);
extern unsigned long SpuFlush (unsigned long ev);
extern unsigned long SpuSetPitchLFOVoice (long on_off, unsigned long voice_bit);
extern unsigned long SpuGetPitchLFOVoice (void);
extern void SpuSetCommonAttr (SpuCommonAttr *attr);
extern void SpuGetCommonAttr (SpuCommonAttr *attr);
extern long SpuInitMalloc (long num, char *top);
extern long SpuMalloc (long size);
extern long SpuMallocWithStartAddr (unsigned long addr, long size);
extern void SpuFree (unsigned long addr);
extern long SpuRGetAllKeysStatus (long min_, long max_, char *status);
extern long SpuRSetVoiceAttr (long min_, long max_, SpuVoiceAttr *arg);
extern void SpuNSetVoiceAttr (int vNum, SpuVoiceAttr *arg);
extern void SpuNGetVoiceAttr (int vNum, SpuVoiceAttr *arg);
extern void SpuLSetVoiceAttr (int num, SpuLVoiceAttr *argList);
extern void SpuSetVoiceVolume (int vNum, short volL, short volR);
extern void SpuSetVoiceVolumeAttr (int vNum, short volL, short volR,
short volModeL, short volModeR);
extern void SpuSetVoicePitch (int vNum, unsigned short pitch);
extern void SpuSetVoiceNote (int vNum, unsigned short note);
extern void SpuSetVoiceSampleNote (int vNum, unsigned short sampleNote);
extern void SpuSetVoiceStartAddr (int vNum, unsigned long startAddr);
extern void SpuSetVoiceLoopStartAddr (int vNum, unsigned long lsa);
extern void SpuSetVoiceAR (int vNum, unsigned short AR);
extern void SpuSetVoiceDR (int vNum, unsigned short DR);
extern void SpuSetVoiceSR (int vNum, unsigned short SR);
extern void SpuSetVoiceRR (int vNum, unsigned short RR);
extern void SpuSetVoiceSL (int vNum, unsigned short SL);
extern void SpuSetVoiceARAttr (int vNum, unsigned short AR, long ARmode);
extern void SpuSetVoiceSRAttr (int vNum, unsigned short SR, long SRmode);
extern void SpuSetVoiceRRAttr (int vNum, unsigned short RR, long RRmode);
extern void SpuSetVoiceADSR (int vNum, unsigned short AR, unsigned short DR,
unsigned short SR, unsigned short RR,
unsigned short SL);
extern void SpuSetVoiceADSRAttr (int vNum,
unsigned short AR, unsigned short DR,
unsigned short SR, unsigned short RR,
unsigned short SL,
long ARmode, long SRmode, long RRmode);
extern void SpuGetVoiceVolume (int vNum, short *volL, short *volR);
extern void SpuGetVoiceVolumeAttr (int vNum, short *volL, short *volR,
short *volModeL, short *volModeR);
extern void SpuGetVoiceVolumeX (int vNum, short *volXL, short *volXR);
extern void SpuGetVoicePitch (int vNum, unsigned short *pitch);
extern void SpuGetVoiceNote (int vNum, unsigned short *note);
extern void SpuGetVoiceSampleNote (int vNum, unsigned short *sampleNote);
extern void SpuGetVoiceEnvelope (int vNum, short *envx);
extern void SpuGetVoiceStartAddr (int vNum, unsigned long *startAddr);
extern void SpuGetVoiceLoopStartAddr (int vNum, unsigned long *loopStartAddr);
extern void SpuGetVoiceAR (int vNum, unsigned short *AR);
extern void SpuGetVoiceDR (int vNum, unsigned short *DR);
extern void SpuGetVoiceSR (int vNum, unsigned short *SR);
extern void SpuGetVoiceRR (int vNum, unsigned short *RR);
extern void SpuGetVoiceSL (int vNum, unsigned short *SL);
extern void SpuGetVoiceARAttr (int vNum, unsigned short *AR, long *ARmode);
extern void SpuGetVoiceSRAttr (int vNum, unsigned short *SR, long *SRmode);
extern void SpuGetVoiceRRAttr (int vNum, unsigned short *RR, long *RRmode);
extern void SpuGetVoiceADSR (int vNum,
unsigned short *AR, unsigned short *DR,
unsigned short *SR, unsigned short *RR,
unsigned short *SL);
extern void SpuGetVoiceADSRAttr (int vNum,
unsigned short *AR, unsigned short *DR,
unsigned short *SR, unsigned short *RR,
unsigned short *SL,
long *ARmode, long *SRmode, long *RRmode);
extern void SpuGetVoiceEnvelopeAttr (int vNum, long *keyStat, short *envx );
extern void SpuSetCommonMasterVolume (short mvol_left, short mvol_right);
extern void SpuSetCommonMasterVolumeAttr (short mvol_left, short mvol_right,
short mvolmode_left,
short mvolmode_right);
extern void SpuSetCommonCDMix (long cd_mix);
extern void SpuSetCommonCDVolume (short cd_left, short cd_right);
extern void SpuSetCommonCDReverb (long cd_reverb);
extern void SpuGetCommonMasterVolume (short *mvol_left, short *mvol_right);
extern void SpuGetCommonMasterVolumeX (short *mvolx_left, short *mvolx_right);
extern void SpuGetCommonMasterVolumeAttr (short *mvol_left, short *mvol_right,
short *mvolmode_left,
short *mvolmode_right);
extern void SpuGetCommonCDMix (long *cd_mix);
extern void SpuGetCommonCDVolume (short *cd_left, short *cd_right);
extern void SpuGetCommonCDReverb (long *cd_reverb);
extern long SpuSetReverbModeType (long mode);
extern void SpuSetReverbModeDepth (short depth_left, short depth_right);
extern void SpuSetReverbModeDelayTime (long delay);
extern void SpuSetReverbModeFeedback (long feedback);
extern void SpuGetReverbModeType (long *mode);
extern void SpuGetReverbModeDepth (short *depth_left, short *depth_right);
extern void SpuGetReverbModeDelayTime (long *delay);
extern void SpuGetReverbModeFeedback (long *feedback);
extern void SpuSetESA( long revAddr );
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
}
#endif
/* ---------------------------------------------------------------- */
#define SPU_ST_NOT_AVAILABLE 0
#define SPU_ST_ACCEPT 1
#define SPU_ST_ERROR (-1)
#define SPU_ST_INVALID_ARGUMENT (-2)
#define SPU_ST_WRONG_STATUS (-3)
#define SPU_ST_STOP 2
#define SPU_ST_IDLE 3
#define SPU_ST_PREPARE 4
#define SPU_ST_START 5
#define SPU_ST_PLAY 6
#define SPU_ST_TRANSFER 7
#define SPU_ST_FINAL 8
/* VAG's header size */
#define SPU_ST_VAG_HEADER_SIZE 0x30
typedef struct {
char status; /* stream status */
char pad1; /* padding */
char pad2; /* padding */
char pad3; /* padding */
long last_size; /* the size of last transferring
(last_size <= (size / 2)) */
unsigned long buf_addr; /* The start address of stream buffer */
unsigned long data_addr; /* The start address of SPU streaming
data in main memory */
} SpuStVoiceAttr;
typedef struct {
long size; /* The size of stream buffer */
long low_priority; /* transfer priority */
SpuStVoiceAttr voice [24];
} SpuStEnv;
#ifndef __SPU_ST_TRANSFERCALLBACK_PROC
#define __SPU_ST_TRANSFERCALLBACK_PROC
typedef void (*SpuStCallbackProc)(unsigned long, long);
#endif /* __SPU_TRANSFERCALLBACK_PROC */
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern SpuStEnv *SpuStInit (long);
extern long SpuStQuit (void);
extern long SpuStGetStatus (void);
extern unsigned long SpuStGetVoiceStatus (void);
extern long SpuStTransfer (long flag, unsigned long voice_bit);
extern SpuStCallbackProc SpuStSetPreparationFinishedCallback (SpuStCallbackProc func);
extern SpuStCallbackProc SpuStSetTransferFinishedCallback (SpuStCallbackProc func);
extern SpuStCallbackProc SpuStSetStreamFinishedCallback (SpuStCallbackProc func);
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
}
#endif
/* ----------------------------------------------------------------
* End on File
* ---------------------------------------------------------------- */
#endif /* _LIBSPU_H_ */
/* DON'T ADD STUFF AFTER THIS */
+25
View File
@@ -0,0 +1,25 @@
/* $PSLibId: Run-time Library Release 4.7$ */
#ifndef _LIBTAP_H_
#define _LIBTAP_H_
/*
* Copyright (C) 1996 Sony Computer Entertainment Inc. All Rights Reserved
* libtap.h: Multi Tap Interface
*/
/*
* Prototypes
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void InitTAP(char *, long, char *, long);
extern void StartTAP(void);
extern void StopTAP(void);
extern void EnableTAP(void);
extern void DisableTAP(void);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBTAP_H_ */
+38
View File
@@ -0,0 +1,38 @@
/*
* File:limits.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _LIMITS_H
#define _LIMITS_H
/*
* This file specifies the sizes of intergral types as required by the
* proposed ANSI C standard.
*/
#define CHAR_BIT 8
#define SCHAR_MIN (-128)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
#define CHAR_MIN SCHAR_MIN
#define CHAR_MAX SCHAR_MAX
#define SHRT_MIN (-32768)
#define SHRT_MAX 32767
#define USHRT_MAX 65535
#define INT_MIN (-2147483647-1)
#define INT_MAX 2147483647
#define UINT_MAX 4294967295U
#define LONG_MIN (-2147483647-1)
#define LONG_MAX 2147483647
#define ULONG_MAX 4294967295UL
#define USI_MAX 4294967295 /* max decimal value of an "unsigned" */
#define WORD_BIT 32 /* # of bits in a "word" or "int" */
#ifndef MB_LEN_MAX
#define MB_LEN_MAX 4
#endif
#endif /* _LIMITS_H */
+41
View File
@@ -0,0 +1,41 @@
/*
* File:malloc.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _MALLOC_H
#define _MALLOC_H
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */
#endif
#ifndef NULL
#define NULL 0 /* null pointer constant */
#endif
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void InitHeap (unsigned long *, unsigned long);
extern void free(void *);
extern void *malloc(size_t);
extern void *calloc(size_t, size_t);
extern void *realloc(void *, size_t);
extern void InitHeap2 (unsigned long *, unsigned long);
extern void free2(void *);
extern void *malloc2(size_t);
extern void *calloc2(size_t, size_t);
extern void *realloc2(void *, size_t);
extern void InitHeap3(unsigned long *, unsigned long);
extern void free3(void *);
extern void *malloc3(size_t);
extern void *calloc3(size_t, size_t);
extern void *realloc3(void *, size_t);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _MALLOC_H */
+132
View File
@@ -0,0 +1,132 @@
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _MCGUI_H_
#define _MCGUI_H_
#define NEGICON_A (0x20)
#define NEGICON_B (0x10)
#define MOUSE_LBUTTON (0x08)
#define MOUSE_RBUTTON (0x04)
#define MCGUI_INTERNAL_FONT (0)
#define MCGUI_EXTERNAL_FONT (1)
/* Texture Information Structure */
typedef struct {
unsigned long* addr;
} sMcGuiTexture;
/* Memory Card Information Structure */
typedef struct {
char file[21];
char title[65];
char frame;
char block;
long dataBytes;
unsigned long* iconAddr;
unsigned long* dataAddr;
} sMcGuiCards;
/* BG Information Structure */
typedef struct {
short mode;
signed char scrollDirect; /* 0:Up 1:Up&Left 2:Left 3:Down&left 4:Down ...*/
signed char scrollSpeed; /* 0:no scroll 1:1/60 2:1/30 3:1/20 */
unsigned long* timadr;
} sMcGuiBg;
/* Cursor Information Structure */
typedef struct {
char type;
unsigned char r;
unsigned char g;
unsigned char b;
} sMcGuiCursor;
/* BGM,Sound Effects Information Structure */
typedef struct {
int MVOL;
struct {
int isbgm;
unsigned long* seq;
unsigned long* vh;
unsigned long* vb;
int SVOL;
int isReverb;
int reverbType;
int reverbDepth;
} bgm;
struct {
int isse;
unsigned long* vh;
unsigned long* vb;
int vol;
int prog;
int TONE_OK;
int TONE_CANCEL;
int TONE_CURSOR;
int TONE_ERROR;
} se;
} sMcGuiSnd;
/* Controller Related Information Structure */
typedef struct {
volatile unsigned char* buf[2];
struct {
int flag;
unsigned long BUTTON_OK;
unsigned long BUTTON_CANCEL;
} type1;
struct {
int flag;
unsigned long BUTTON_OK;
unsigned long BUTTON_CANCEL;
} type2;
struct {
int flag;
unsigned long BUTTON_OK;
unsigned long BUTTON_CANCEL;
} type3;
struct {
int flag;
unsigned long BUTTON_OK;
unsigned long BUTTON_CANCEL;
} type4;
} sMcGuiController;
/* Memory Card Screen Configuration Structure */
typedef struct {
sMcGuiCards cards; /* Memory Card Information */
sMcGuiBg bg; /* BG Information */
sMcGuiController controller; /* Controller Related Information */
sMcGuiSnd sound; /* BGM Sound Effects Information */
sMcGuiTexture texture; /* Texture Information */
sMcGuiCursor cursor; /* Cursor Information */
} McGuiEnv;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int McGuiSave(McGuiEnv* env);
extern int McGuiLoad(McGuiEnv* env);
int McGuiSetExternalFont(McGuiEnv* env, int mode);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _MCGUI_H_ */
+44
View File
@@ -0,0 +1,44 @@
/*
* File:memory.h
* memory functions pseudo definition header
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _MEMORY_H
#define _MEMORY_H
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */
#endif
#ifndef NULL
#define NULL 0 /* null pointer constant */
#endif
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
/* To avoid conflicting */
extern void *memcpy (/* unsigned char *, unsigned char *, int */);
extern void *memmove(unsigned char *, const unsigned char *, int);
/* To avoid conflicting */
extern int memcmp (/* unsigned char *, unsigned char *, int */);
extern void *memchr (const unsigned char *, unsigned char, int);
extern void *memset (/* unsigned char *, unsigned char, int */);
extern void *bcopy(const unsigned char *, unsigned char *, int); /* src,dest */
extern void *bzero(unsigned char *, int);
extern int bcmp (const unsigned char *, const unsigned char *, int);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _MEMORY_H */
+37
View File
@@ -0,0 +1,37 @@
#ifndef pad_h
#define pad_h
/* Controller Pad 1 Defines */
#define Pad1Up (1<<12)
#define Pad1Down (1<<14)
#define Pad1Left (1<<15)
#define Pad1Right (1<<13)
#define Pad1L1 (1<< 2)
#define Pad1L2 (1<< 0)
#define Pad1R1 (1<< 3)
#define Pad1R2 (1<< 1)
#define Pad1tri (1<< 4)
#define Pad1sqr (1<< 7)
#define Pad1crc (1<< 5)
#define Pad1x (1<< 6)
#define Pad1Start (1<<11)
#define Pad1Select (1<<8)
/* Controller Pad 2 Defines */
#define Pad2Up (1<<28)
#define Pad2Down (1<<30)
#define Pad2Left (1<<31)
#define Pad2Right (1<<29)
#define Pad2L1 (1<<18)
#define Pad2L2 (1<<16)
#define Pad2R1 (1<<19)
#define Pad2R2 (1<<17)
#define Pad2tri (1<<20)
#define Pad2sqr (1<<23)
#define Pad2crc (1<<21)
#define Pad2x (1<<22)
#define Pad2Start (1<<27)
#define Pad2Select (1<<24)
#endif
+30
View File
@@ -0,0 +1,30 @@
/*
* File:qsort.h
* memory functions pseudo definition header
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _QSORT_H
#define _QSORT_H
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */
#endif
#ifndef NULL
#define NULL 0 /* null pointer constant */
#endif
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void qsort(void *, size_t, size_t, int (*)());
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _QSORT_H */
+244
View File
@@ -0,0 +1,244 @@
/*
* File:r3000.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _R3000_H
#define _R3000_H
/*
* Segment base addresses and sizes
*/
#define K0BASE 0x80000000
#define K0SIZE 0x20000000
#define K1BASE 0xA0000000
#define K1SIZE 0x20000000
#define K2BASE 0xC0000000
#define K2SIZE 0x20000000
/*
* Exception vectors
*/
#define UT_VEC K0BASE /* utlbmiss vector */
#define E_VEC (K0BASE+0x80) /* exception vector */
#define R_VEC (K1BASE+0x1fc00000) /* reset vector */
/*
* Address conversion macros
*/
#define K0_TO_K1(x) ((unsigned)(x)|0xA0000000) /* kseg0 to kseg1 */
#define K1_TO_K0(x) ((unsigned)(x)&0x9FFFFFFF) /* kseg1 to kseg0 */
#define K0_TO_PHYS(x) ((unsigned)(x)&0x1FFFFFFF) /* kseg0 to physical */
#define K1_TO_PHYS(x) ((unsigned)(x)&0x1FFFFFFF) /* kseg1 to physical */
#define PHYS_TO_K0(x) ((unsigned)(x)|0x80000000) /* physical to kseg0 */
#define PHYS_TO_K1(x) ((unsigned)(x)|0xA0000000) /* physical to kseg1 */
/*
* Address predicates
*/
#define IS_KSEG0(x) ((unsigned)(x) >= K0BASE && (unsigned)(x) < K1BASE)
#define IS_KSEG1(x) ((unsigned)(x) >= K1BASE && (unsigned)(x) < K2BASE)
#define IS_KSEG2(x) ((unsigned)(x) >= K2BASE && (unsigned)(x) < KPTEBASE)
#define IS_KPTESEG(x) ((unsigned)(x) >= KPTEBASE)
#define IS_KUSEG(x) ((unsigned)(x) < K0BASE)
/*
* Cache size constants
*/
#define MINCACHE +(4*1024) /* leading plus for mas's benefit */
#define MAXCACHE +(64*1024) /* leading plus for mas's benefit */
/*
* 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_BEV 0x00400000 /* use boot exception vectors */
/* Cache control bits */
#define SR_TS 0x00200000 /* TLB shutdown */
#define SR_PE 0x00100000 /* cache parity error */
#define SR_CM 0x00080000 /* cache miss */
#define SR_PZ 0x00040000 /* cache parity zero */
#define SR_SWC 0x00020000 /* swap cache */
#define SR_ISC 0x00010000 /* Isolate data cache */
#define SR_MM_MODE 0x00010000 /* lwl/swl/etc become scache/etc */
#define lcache lwl
#define scache swl
#define flush lwr $0,
#define inval swr $0,
/*
* 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_KUO 0x00000020 /* old kernel/user, 0 => k, 1 => u */
#define SR_IEO 0x00000010 /* old interrupt enable, 1 => enable */
#define SR_KUP 0x00000008 /* prev kernel/user, 0 => k, 1 => u */
#define SR_IEP 0x00000004 /* prev interrupt enable, 1 => enable */
#define SR_KUC 0x00000002 /* cur kernel/user, 0 => k, 1 => u */
#define SR_IEC 0x00000001 /* cur interrupt enable, 1 => enable */
#define SR_IMASKSHIFT 8
#define SR_FMT "\20\40BD\26TS\25PE\24CM\23PZ\22SwC\21IsC\20IM7\17IM6\16IM5\15IM4\14IM3\13IM2\12IM1\11IM0\6KUo\5IEo\4KUp\3IEp\2KUc\1IEc"
/*
* 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 */
#define CAUSE_IP7 0x00004000 /* External level 7 pending */
#define CAUSE_IP6 0x00002000 /* External level 6 pending */
#define CAUSE_IP5 0x00001000 /* External level 5 pending */
#define CAUSE_IP4 0x00000800 /* External level 4 pending */
#define CAUSE_IP3 0x00000400 /* External level 3 pending */
#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 0x0000003C /* Cause code bits */
#define CAUSE_EXCSHIFT 2
#define CAUSE_FMT "\20\40BD\36CE1\35CE0\20IP8\17IP7\16IP6\15IP5\14IP4\13IP3\12SW2\11SW1\1INT"
/* 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 */
/* software exception codes */
#define SEXC_SEGV EXC_CODE(16) /* Software detected seg viol */
#define SEXC_RESCHED EXC_CODE(17) /* resched request */
#define SEXC_PAGEIN EXC_CODE(18) /* page-in request */
#define SEXC_CPU EXC_CODE(19) /* coprocessor unusable */
/*
* Coprocessor 0 registers
*/
#define C0_INX $0 /* tlb index */
#define C0_RAND $1 /* tlb random */
#define C0_TLBLO $2 /* tlb entry low */
#define C0_CTXT $4 /* tlb context */
#define C0_PIDMASK $6 /* Mips2 */
#define C0_BADVADDR $8 /* bad virtual address */
#define C0_TLBHI $10 /* tlb entry hi */
#define C0_PID $10 /* Mips2 */
#define C0_SR $12 /* status register */
#define C0_CAUSE $13 /* exception cause */
#define C0_EPC $14 /* exception pc */
#define C0_PRID $15 /* revision identifier */
#define C0_ERREG $16 /* Mips2 */
/*
* 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 */
/*
* Flags for the nofault handler. 0 means no fault is expected.
*/
#define NF_BADADDR 1 /* badaddr, wbadaddr */
#define NF_COPYIO 2 /* copyin, copyout */
#define NF_ADDUPC 3 /* addupc */
#define NF_FSUMEM 4 /* fubyte, subyte, fuword, suword */
#define NF_USERACC 5 /* useracc */
#define NF_SOFTFP 6 /* softfp */
#define NF_REVID 7 /* revision ids */
#define NF_NENTRIES 8
/*
* TLB size constants
*/
#define TLBWIREDBASE 0 /* WAG for now */
#define NWIREDENTRIES 8 /* WAG for now */
#define TLBRANDOMBASE NWIREDENTRIES
#define NRANDOMENTRIES (NTLBENTRIES-NWIREDENTRIES)
#define NTLBENTRIES 64 /* WAG for now */
#define TLBRAND_RANDMASK 0x00003f00
#define TLBRAND_RANDSHIFT 8
/*
* Chip interrupt vector
*/
#define NC0VECS 8
#ifndef LOCORE
#ifdef KERNEL
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int (*c0vec_tbl[])();
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif
#endif /* !LOCORE */
#define BRK_KERNEL 0xf1
#define EXCEPT_NORM 1
#define EXCEPT_UTLB 2
#define EXCEPT_BRKPT 3
#define EXCEPT_DB 4
#define EXCEPT_GDB 4
#define EXCEPT_INT 9
#define EXCEPT_ELSE 0xff
#endif /* _R3000_H */
+22
View File
@@ -0,0 +1,22 @@
/*
* File:rand.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _RAND_H
#define _RAND_H
#define RAND_MAX 32767
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int rand(void);
extern void srand(unsigned int);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _RAND_H */
+15
View File
@@ -0,0 +1,15 @@
/*
* romio.h
*
* rom monitor i/o
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _ROMIO_H
#define _ROMIO_H
#include <sys/file.h>
#endif /* _ROMIO_H */
+40
View File
@@ -0,0 +1,40 @@
/*
* $PSLibId: Run-time Library Release 4.7$
*/
/*
* File:setjmp.h
* simple non-local-jump for single task environment
*/
#ifndef _SETJMP_H
#define _SETJMP_H
/* jmp_buf indices */
#define JB_PC 0
#define JB_SP 1
#define JB_FP 2
#define JB_S0 3
#define JB_S1 4
#define JB_S2 5
#define JB_S3 6
#define JB_S4 7
#define JB_S5 8
#define JB_S6 9
#define JB_S7 10
#define JB_GP 11
#define JB_SIZE 12
#if defined(_LANGUAGE_C)||defined(LANGUAGE_C)||defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
typedef int jmp_buf[JB_SIZE];
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int setjmp(jmp_buf);
extern void longjmp(jmp_buf, int);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif
#endif /* _SETJMP_H */
+27
View File
@@ -0,0 +1,27 @@
/*
* File:stdarg.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _STDARG_H
#define _STDARG_H
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#define va_start(AP, LASTARG) \
(AP = ((char *)&(LASTARG) + __va_rounded_size(LASTARG)))
#define va_end(AP) AP = (char *)NULL
#define va_arg(AP, TYPE) \
(AP = ((char *) (AP)) += __va_rounded_size (TYPE), \
*((TYPE *) ((char *) (AP) - __va_rounded_size (TYPE))))
typedef void *va_list;
#endif /* _STDARG_H */
+50
View File
@@ -0,0 +1,50 @@
/*
* File:stddef.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _STDDEF_H
#define _STDDEF_H
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */
#endif
#ifndef _WCHAR_T
#define _WCHAR_T
typedef unsigned long wchar_t; /* type of a wide character */
#endif
#ifndef _UCHAR_T
#define _UCHAR_T
typedef unsigned char u_char;
#endif
#ifndef _USHORT_T
#define _USHORT_T
typedef unsigned short u_short;
#endif
#ifndef _UINT_T
#define _UINT_T
typedef unsigned int u_int;
#endif
#ifndef _ULONG_T
#define _ULONG_T
typedef unsigned long u_long;
#endif
#ifndef WEOF
#define WEOF 0xffffffff
#endif
#ifndef NULL
#define NULL 0 /* null pointer constant */
#endif
#endif /* _STDDEF_H */
+47
View File
@@ -0,0 +1,47 @@
/*
* $PSLibId: Run-time Library Release 4.7$
*/
/*
* File:stdio.h
*/
#ifndef _STDIO_H
#define _STDIO_H
#define BUFSIZ 1024
#define EOF (-1)
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif
#ifndef SEEK_END
#define SEEK_END 2
#endif
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */
#endif
/* under constraction now */
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int printf(const char *fmt, ...); /**/
extern int sprintf(char *buffer, const char *fmt, ...);
extern char getc(int); /**/
extern char getchar(void);
extern char *gets(char *);
extern void putc(char, int); /**/
extern void putchar(char);
extern void puts(const char *);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _STDIO_H */
+30
View File
@@ -0,0 +1,30 @@
/*
* File:stdlib.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _STDLIB_H
#define _STDLIB_H
#include <stddef.h>
#include <abs.h>
#include <convert.h>
#include <malloc.h>
#include <qsort.h>
#include <rand.h>
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void *bsearch(const unsigned char *, const unsigned char *,
size_t, size_t, int (*)());
extern void exit();
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _STDLIB_H */
+26
View File
@@ -0,0 +1,26 @@
#ifndef _STRING_H
#define _STRING_H
/*****************************************************************
* -*- c -*-
* $RCSfile$
*
* Copyright (C) 1994, 1995 by Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* Sony Computer Entertainment Inc. R & D Division
*
* $Id$
*
*****************************************************************/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#include <strings.h>
/* ----------------------------------------------------------------
* End on File
* ---------------------------------------------------------------- */
#endif /* _STRING_H_ */
/* DON'T ADD STUFF AFTER THIS */
+52
View File
@@ -0,0 +1,52 @@
/*
* File:strings.h
* string functions pseudo definition header
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _STRINGS_H
#define _STRINGS_H
#define LMAX 256
#ifndef NULL
#define NULL 0 /* null pointer constant */
#endif
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */
#endif
#include <memory.h>
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern char *strcat (char *, const char *);
extern char *strncat(char *, const char *, int);
extern int strcmp (/* char *, char * */); /* To avoid conflicting */
extern int strncmp(const char *,const char *, int);
extern char *strcpy (/* char *, char * */); /* To avoid conflicting */
extern char *strncpy(char *, const char *, int);
extern unsigned int strlen (/* char * */); /* To avoid conflicting */
extern char *index (const char *, char);
extern char *rindex (const char *, char);
extern char *strchr (const char *, char);
extern char *strrchr(const char *, char);
extern char *strpbrk(const char *, const char *);
extern int strspn (const char *, const char *);
extern int strcspn(const char *, const char *);
extern char *strtok (char *, const char *);
extern char *strstr (const char *, const char *);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#define strdup(p) ( strcpy(malloc(strlen(p)+1),p); )
#endif /* _STRINGS_H */
+59
View File
@@ -0,0 +1,59 @@
/*
* Error codes
* $RCSfile: errno.h,v $
* $Id: errno.h,v 1.3 1995/02/28 10:02:53 yoshi Exp $
*/
/*
* $PSLibId: Run-time Library Release 4.6$
*/
#ifndef _ERRNO_H
#define _ERRNO_H
/* Error codes */
#define EPERM 1 /* Not owner */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No children */
#define EAGAIN 11 /* No more processes */
#define ENOMEM 12 /* Not enough core */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Mount device busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory*/
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* File table overflow */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Not a typewriter */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only file system */
#define EFORMAT 31 /* Bad file format */
#define EPIPE 32 /* Broken pipe */
/* math software */
#define EDOM 33 /* Argument too large */
#define ERANGE 34 /* Result too large */
/* non-blocking and interrupt i/o */
#define EWOULDBLOCK 35 /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */
#define EALREADY 37 /* Operation already in progress */
extern int errno;
#endif /* _ERRNO_H */
+25
View File
@@ -0,0 +1,25 @@
/*
* File:fcntl.h
*/
/*
* $PSLibId: Run-time Library Release 4.6$
*/
#ifndef _SYS_FCNTL_H
#define _SYS_FCNTL_H
/* flags */
#define FREAD 0x0001 /* readable */
#define FWRITE 0x0002 /* writable */
#define FNBLOCK 0x0004 /* non-blocking reads */
#define FRLOCK 0x0010 /* read locked (non-shared) */
#define FWLOCK 0x0020 /* write locked (non-shared) */
#define FAPPEND 0x0100 /* append on each write */
#define FCREAT 0x0200 /* create if nonexistant */
#define FTRUNC 0x0400 /* truncate to zero length */
#define FSCAN 0x1000 /* scan type */
#define FRCOM 0x2000 /* remote command entry */
#define FNBUF 0x4000 /* no ring buf. and console interrupt */
#define FASYNC 0x8000 /* asyncronous i/o */
#endif /* _SYS_FCNTL_H */
+33
View File
@@ -0,0 +1,33 @@
/*
* File:file.h
*/
/*
* $PSLibId: Run-time Library Release 4.6$
*/
#ifndef _SYS_FILE_H
#define _SYS_FILE_H
#include <sys/fcntl.h>
/* Flag for open() */
#define O_RDONLY FREAD
#define O_WRONLY FWRITE
#define O_RDWR FREAD|FWRITE
#define O_CREAT FCREAT /* open with file create */
#define O_NOBUF FNBUF /* no device buffer and console interrupt */
#define O_NBLOCK FNBLOCK /* non blocking mode */
#define O_NOWAIT FASYNC /* asyncronous i/o */
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif
#ifndef SEEK_END
#define SEEK_END 2
#endif
#endif /* _SYS_FILE_H */
+44
View File
@@ -0,0 +1,44 @@
/*
* File:ioctl.h
*/
/*
* $PSLibId: Run-time Library Release 4.6$
*/
#ifndef _SYS_IOCTL_H
#define _SYS_IOCTL_H
#ifndef NULL
#define NULL 0
#endif
#ifndef EOF
#define EOF (-1) /* EOF from getc() */
#endif
/* general */
#define FIOCNBLOCK (('f'<<8)|1) /* set non-blocking io */
#define FIOCSCAN (('f'<<8)|2) /* scan for input */
/* tty and sio */
#define TIOCRAW (('t'<<8)|1) /* disable xon/xoff control */
#define TIOCFLUSH (('t'<<8)|2) /* flush input buffer */
#define TIOCREOPEN (('t'<<8)|3) /* reopen */
#define TIOCBAUD (('t'<<8)|4) /* set baud rate */
#define TIOCEXIT (('t'<<8)|5) /* console interrup */
#define TIOCDTR (('t'<<8)|6) /* control DTR line */
#define TIOCRTS (('t'<<8)|7) /* control RTS line */
#define TIOCLEN (('t'<<8)|8) /* stop<<16 | char */
/* stop 0:none 1:1 2:1.5 3:2bit */
/* char 0:5 1:6 2:7 3:8bit */
#define TIOCPARITY (('t'<<8)|9) /* parity 0:none 1:e 3:o */
#define TIOSTATUS (('t'<<8)|10) /* return status */
#define TIOERRRST (('t'<<8)|11) /* error reset */
#define TIOEXIST (('t'<<8)|12) /* exist test with DTR/CTS */
#define TIORLEN (('t'<<8)|13) /* receive buffer length */
/* disk */
#define DIOFORMAT (('d'<<8)|1) /* format */
#endif /* _SYS_IOCTL_H */
+80
View File
@@ -0,0 +1,80 @@
/*
* File:types.h
*/
/*
* $PSLibId: Run-time Library Release 4.6$
*/
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
/*
* Basic system types and major/minor device constructing/busting macros.
*/
/* major part of a device */
#define major(x) ((int)(((unsigned)(x)>>8)&0377))
/* minor part of a device */
#define minor(x) ((int)((x)&0377))
/* make a device number */
#define makedev(x,y) ((dev_t)(((x)<<8) | (y)))
#ifndef _UCHAR_T
#define _UCHAR_T
typedef unsigned char u_char;
#endif
#ifndef _USHORT_T
#define _USHORT_T
typedef unsigned short u_short;
#endif
#ifndef _UINT_T
#define _UINT_T
typedef unsigned int u_int;
#endif
#ifndef _ULONG_T
#define _ULONG_T
typedef unsigned long u_long;
#endif
#ifndef _SYSIII_USHORT
#define _SYSIII_USHORT
typedef unsigned short ushort; /* sys III compat */
#endif
#ifndef __psx__
#ifndef _SYSV_UINT
#define _SYSV_UINT
typedef unsigned int uint; /* sys V compat */
#endif
#ifndef _SYSV_ULONG
#define _SYSV_ULONG
typedef unsigned long ulong; /* sys V compat */
#endif
#endif /* ! __psx__ */
typedef struct _physadr { int r[1]; } *physadr;
typedef struct label_t {
int val[12];
} label_t;
typedef struct _quad { long val[2]; } quad;
typedef long daddr_t;
typedef char * caddr_t;
typedef long * qaddr_t; /* should be typedef quad * qaddr_t; */
typedef u_long ino_t;
typedef long swblk_t;
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t;
#endif
typedef long time_t;
typedef short dev_t;
typedef long off_t;
typedef u_short uid_t;
typedef u_short gid_t;
#define NBBY 8 /* number of bits in a byte */
#endif /* _SYS_TYPES_H */
+80
View File
@@ -0,0 +1,80 @@
/*
* File:types.h
*/
/*
* $PSLibId: Run-time Library Release 4.7$
*/
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
/*
* Basic system types and major/minor device constructing/busting macros.
*/
/* major part of a device */
#define major(x) ((int)(((unsigned)(x)>>8)&0377))
/* minor part of a device */
#define minor(x) ((int)((x)&0377))
/* make a device number */
#define makedev(x,y) ((dev_t)(((x)<<8) | (y)))
#ifndef _UCHAR_T
#define _UCHAR_T
typedef unsigned char u_char;
#endif
#ifndef _USHORT_T
#define _USHORT_T
typedef unsigned short u_short;
#endif
#ifndef _UINT_T
#define _UINT_T
typedef unsigned int u_int;
#endif
#ifndef _ULONG_T
#define _ULONG_T
typedef unsigned long u_long;
#endif
#ifndef _SYSIII_USHORT
#define _SYSIII_USHORT
typedef unsigned short ushort; /* sys III compat */
#endif
#ifndef __psx__
#ifndef _SYSV_UINT
#define _SYSV_UINT
typedef unsigned int uint; /* sys V compat */
#endif
#ifndef _SYSV_ULONG
#define _SYSV_ULONG
typedef unsigned long ulong; /* sys V compat */
#endif
#endif /* ! __psx__ */
typedef struct _physadr { int r[1]; } *physadr;
typedef struct label_t {
int val[12];
} label_t;
typedef struct _quad { long val[2]; } quad;
typedef long daddr_t;
typedef char * caddr_t;
typedef long * qaddr_t; /* should be typedef quad * qaddr_t; */
typedef u_long ino_t;
typedef long swblk_t;
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t;
#endif
typedef long time_t;
typedef short dev_t;
typedef long off_t;
typedef u_short uid_t;
typedef u_short gid_t;
#define NBBY 8 /* number of bits in a byte */
#endif /* _SYS_TYPES_H */
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.