mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 04:29:29 +02:00
psy-q-sdk bindings
This commit is contained in:
parent
3d0cea88e9
commit
ccc6fa0ec6
@ -923,7 +923,7 @@ ifdef NO_EXCEPTIONS_IN_SYSTEM
|
||||
override FPCOPT+=-dNO_EXCEPTIONS_IN_SYSTEM
|
||||
endif
|
||||
ifeq ($(CPU_OS_TARGET),mipsel-ps1)
|
||||
override TARGET_UNITS+=$(SYSTEMUNIT) $(OBJPASUNIT) $(FPINTRESUNIT) $(ISO7185UNIT) $(CTYPESUNIT) $(SYSCONSTUNIT) $(UUCHARUNIT) $(STRINGSUNIT) libstd libetc libgpu libgte
|
||||
override TARGET_UNITS+=$(SYSTEMUNIT) $(OBJPASUNIT) $(FPINTRESUNIT) $(ISO7185UNIT) $(CTYPESUNIT) $(SYSCONSTUNIT) $(UUCHARUNIT) $(STRINGSUNIT) libstd libetc libgpu libgte libapi libcd libcomb libgs libsnd libspu libds libgun libmcrd libtap libpad libmcx libpress libsn libmcgui libhmd
|
||||
endif
|
||||
override INSTALL_FPCPACKAGE=y y
|
||||
ifeq ($(CPU_OS_TARGET),mipsel-ps1)
|
||||
@ -2926,7 +2926,39 @@ libstd$(PPUEXT) : psy-q-sdk/libstd.pas $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libetc$(PPUEXT) : psy-q-sdk/libetc.pas $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libgpu$(PPUEXT) : psy-q-sdk/libgpu.pas libgte$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
libgpu$(PPUEXT) : psy-q-sdk/libgpu.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libgte$(PPUEXT) : psy-q-sdk/libgte.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libapi$(PPUEXT) : psy-q-sdk/libapi.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libcd$(PPUEXT) : psy-q-sdk/libcd.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libcomb$(PPUEXT) : psy-q-sdk/libcomb.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libgs$(PPUEXT) : psy-q-sdk/libgs.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libsnd$(PPUEXT) : psy-q-sdk/libsnd.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libspu$(PPUEXT) : psy-q-sdk/libspu.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libds$(PPUEXT) : psy-q-sdk/libds.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libgun$(PPUEXT) : psy-q-sdk/libgun.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libmcrd$(PPUEXT) : psy-q-sdk/libmcrd.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libtap$(PPUEXT) : psy-q-sdk/libtap.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libpad$(PPUEXT) : psy-q-sdk/libpad.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libmcx$(PPUEXT) : psy-q-sdk/libmcx.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libpress$(PPUEXT) : psy-q-sdk/libpress.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libsn$(PPUEXT) : psy-q-sdk/libsn.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libmcgui$(PPUEXT) : psy-q-sdk/libmcgui.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
libhmd$(PPUEXT) : psy-q-sdk/libhmd.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
@ -7,7 +7,7 @@ main=rtl
|
||||
loaders=
|
||||
units=$(SYSTEMUNIT) $(OBJPASUNIT) $(FPINTRESUNIT) $(ISO7185UNIT) $(CTYPESUNIT) \
|
||||
$(SYSCONSTUNIT) $(UUCHARUNIT) $(STRINGSUNIT) \
|
||||
libstd libetc libgpu libgte
|
||||
libstd libetc libgpu libgte libapi libcd libcomb libgs libsnd libspu libds libgun libmcrd libtap libpad libmcx libpress libsn libmcgui libhmd
|
||||
|
||||
[require]
|
||||
nortl=y
|
||||
@ -57,12 +57,59 @@ libstd$(PPUEXT) : psy-q-sdk/libstd.pas $(SYSTEMUNIT)$(PPUEXT)
|
||||
libetc$(PPUEXT) : psy-q-sdk/libetc.pas $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libgpu$(PPUEXT) : psy-q-sdk/libgpu.pas libgte$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
libgpu$(PPUEXT) : psy-q-sdk/libgpu.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libgte$(PPUEXT) : psy-q-sdk/libgte.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libapi$(PPUEXT) : psy-q-sdk/libapi.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libcd$(PPUEXT) : psy-q-sdk/libcd.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libcomb$(PPUEXT) : psy-q-sdk/libcomb.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libgs$(PPUEXT) : psy-q-sdk/libgs.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libsnd$(PPUEXT) : psy-q-sdk/libsnd.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libspu$(PPUEXT) : psy-q-sdk/libspu.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libds$(PPUEXT) : psy-q-sdk/libds.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libgun$(PPUEXT) : psy-q-sdk/libgun.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libmcrd$(PPUEXT) : psy-q-sdk/libmcrd.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libtap$(PPUEXT) : psy-q-sdk/libtap.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libpad$(PPUEXT) : psy-q-sdk/libpad.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libmcx$(PPUEXT) : psy-q-sdk/libmcx.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libpress$(PPUEXT) : psy-q-sdk/libpress.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libsn$(PPUEXT) : psy-q-sdk/libsn.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libmcgui$(PPUEXT) : psy-q-sdk/libmcgui.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
|
||||
libhmd$(PPUEXT) : psy-q-sdk/libhmd.pas $(OBJPASUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $<
|
||||
#
|
||||
# Loaders
|
||||
#
|
@ -1,5 +0,0 @@
|
||||
{$MODE OBJFPC}
|
||||
unit buildrtl;
|
||||
interface
|
||||
implementation
|
||||
end.
|
@ -1,7 +0,0 @@
|
||||
// $PSLibId: Run-time Library Release 4.6
|
||||
unit libabs;
|
||||
interface
|
||||
function abs(num: longint): longint; stdcall; external;
|
||||
implementation
|
||||
begin
|
||||
end.
|
@ -233,44 +233,44 @@ function StNextStatus(addr: pointer; header: pointer): u_short; stdcall external
|
||||
procedure StRingStatus(free_sectors: Pshort; over_sectors: Pshort); stdcall external;
|
||||
procedure StSetMask(mask: u_long; start, _end: u_long); stdcall external;
|
||||
procedure StCdInterrupt; stdcall external;
|
||||
function StGetBackloc(loc: PCdlLOC): integer; stdcall external;
|
||||
function StSetChannel(channel: u_long): integer; stdcall external;
|
||||
function StGetBackloc(loc: PCdlLOC): longint; stdcall external;
|
||||
function StSetChannel(channel: u_long): longint; stdcall external;
|
||||
|
||||
// Prototypes
|
||||
procedure CdFlush; stdcall external;
|
||||
function CdSearchFile(fp: PCdlFILE; name: pchar): PCdlFILE; stdcall external;
|
||||
function CdIntToPos(i: integer; p: PCdlLOC): PCdlLOC; stdcall external;
|
||||
function CdIntToPos(i: longint; p: PCdlLOC): PCdlLOC; stdcall external;
|
||||
function CdComstr(com: byte): pchar; stdcall external;
|
||||
function CdIntstr(intr: byte): pchar; stdcall external;
|
||||
function CdControl(com: byte; param: Pbyte; result: Pbyte): integer; stdcall external;
|
||||
function CdControlB(com: byte; param: Pbyte; result: Pbyte): integer; stdcall external;
|
||||
function CdControlF(com: byte; param: Pbyte): integer; stdcall external;
|
||||
function CdGetSector(madr: pointer; size: integer): integer; stdcall external;
|
||||
function CdGetSector2(madr: pointer; size: integer): integer; stdcall external;
|
||||
function CdDataSync(mode: integer): integer; stdcall external;
|
||||
function CdGetToc(loc: PCdlLOC): integer; stdcall external;
|
||||
function CdPlay(mode: integer; track: Pinteger; offset: integer): integer; stdcall external;
|
||||
function CdMix(vol: PCdlATV): integer; stdcall external;
|
||||
function CdPosToInt(p: PCdlLOC): integer; stdcall external;
|
||||
function CdRead(sectors: integer; buf: pointer; mode: integer): integer; stdcall external;
|
||||
function CdRead2(mode: longint): integer; stdcall external;
|
||||
function CdReadFile(_file: pchar; addr: pointer; nbyte: integer): integer; stdcall external;
|
||||
function CdReadSync(mode: integer; res: pointer): integer; stdcall external;
|
||||
function CdReady(mode: integer; res: pointer): integer; stdcall external;
|
||||
function CdSetDebug(level: integer): integer; stdcall external;
|
||||
procedure CdSync(mode: integer; res: pointer); stdcall external;
|
||||
function CdControl(com: byte; param: Pbyte; result: Pbyte): longint; stdcall external;
|
||||
function CdControlB(com: byte; param: Pbyte; result: Pbyte): longint; stdcall external;
|
||||
function CdControlF(com: byte; param: Pbyte): longint; stdcall external;
|
||||
function CdGetSector(madr: pointer; size: longint): longint; stdcall external;
|
||||
function CdGetSector2(madr: pointer; size: longint): longint; stdcall external;
|
||||
function CdDataSync(mode: longint): longint; stdcall external;
|
||||
function CdGetToc(loc: PCdlLOC): longint; stdcall external;
|
||||
function CdPlay(mode: longint; track: Plongint; offset: longint): longint; stdcall external;
|
||||
function CdMix(vol: PCdlATV): longint; stdcall external;
|
||||
function CdPosToInt(p: PCdlLOC): longint; stdcall external;
|
||||
function CdRead(sectors: longint; buf: pointer; mode: longint): longint; stdcall external;
|
||||
function CdRead2(mode: longint): longint; stdcall external;
|
||||
function CdReadFile(_file: pchar; addr: pointer; nbyte: longint): longint; stdcall external;
|
||||
function CdReadSync(mode: longint; res: pointer): longint; stdcall external;
|
||||
function CdReady(mode: longint; res: pointer): longint; stdcall external;
|
||||
function CdSetDebug(level: longint): longint; stdcall external;
|
||||
procedure CdSync(mode: longint; res: pointer); stdcall external;
|
||||
function CdDataCallback(func: pointer): pointer; stdcall external;
|
||||
function CdReadCallback(func: CdlCB): CdlCB; stdcall external;
|
||||
function CdReadyCallback(func: CdlCB): CdlCB; stdcall external;
|
||||
function CdSyncCallback(func: CdlCB): CdlCB; stdcall external;
|
||||
function CdInit: integer; stdcall external;
|
||||
function CdReset(mode: integer): integer; stdcall external;
|
||||
function CdStatus: integer; stdcall external;
|
||||
function CdLastCom: integer; stdcall external;
|
||||
function CdInit: longint; stdcall external;
|
||||
function CdReset(mode: longint): longint; stdcall external;
|
||||
function CdStatus: longint; stdcall external;
|
||||
function CdLastCom: longint; stdcall external;
|
||||
function CdLastPos: PCdlLOC; stdcall external;
|
||||
function CdMode: integer; stdcall external;
|
||||
function CdDiskReady(mode: integer): integer; stdcall external;
|
||||
function CdGetDiskType: integer; stdcall external;
|
||||
function CdMode: longint; stdcall external;
|
||||
function CdDiskReady(mode: longint): longint; stdcall external;
|
||||
function CdGetDiskType: longint; stdcall external;
|
||||
// CdReadExec(char *file): EXEC;
|
||||
procedure CdReadBreak; stdcall external;
|
||||
|
||||
|
@ -130,56 +130,56 @@ const
|
||||
// maximum number of command execution results
|
||||
DslMaxRESULTS = 8;
|
||||
|
||||
function DsInit: integer; stdcall external;
|
||||
function DsReset: integer; stdcall external;
|
||||
function DsInit: longint; stdcall external;
|
||||
function DsReset: longint; stdcall external;
|
||||
procedure DsClose; stdcall external;
|
||||
function DsCommand(com: byte; param: pchar; cbsync: DslCB; count: integer ): integer; stdcall external;
|
||||
function DsPacket(mode: byte; pos:PDslLOC; com: byte; func: DslCB; count: integer): integer; stdcall external;
|
||||
function DsCommand(com: byte; param: pchar; cbsync: DslCB; count: longint ): longint; stdcall external;
|
||||
function DsPacket(mode: byte; pos:PDslLOC; com: byte; func: DslCB; count: longint): longint; stdcall external;
|
||||
function DsSyncCallback(func: DslCB): DslCB; stdcall external;
|
||||
function DsReadyCallback(func: DslCB): DslCB; stdcall external;
|
||||
function DsSync(id: integer; res: pointer): integer; stdcall external;
|
||||
function DsReady(res: pointer): integer; stdcall external;
|
||||
function DsSync(id: longint; res: pointer): longint; stdcall external;
|
||||
function DsReady(res: pointer): longint; stdcall external;
|
||||
procedure DsFlush; stdcall external;
|
||||
function DsSystemStatus: integer; stdcall external;
|
||||
function DsQueueLen: integer; stdcall external;
|
||||
function DsSystemStatus: longint; stdcall external;
|
||||
function DsQueueLen: longint; stdcall external;
|
||||
function DsStatus: byte; stdcall external;
|
||||
function DsShellOpen: integer; stdcall external;
|
||||
function DsShellOpen: longint; stdcall external;
|
||||
|
||||
function DsMix(vol: PDslATV): integer; stdcall external;
|
||||
function DsGetSector(madr: pointer; size: integer): integer; stdcall external;
|
||||
function DsGetSector2(madr: pointer; size: integer): integer; stdcall external;
|
||||
function DsGetToc(loc: PDslLOC): integer; stdcall external;
|
||||
function DsMix(vol: PDslATV): longint; stdcall external;
|
||||
function DsGetSector(madr: pointer; size: longint): longint; stdcall external;
|
||||
function DsGetSector2(madr: pointer; size: longint): longint; stdcall external;
|
||||
function DsGetToc(loc: PDslLOC): longint; stdcall external;
|
||||
procedure DsDataCallback(func: pointer); stdcall external;
|
||||
function DsDataSync(mode: integer): integer; stdcall external;
|
||||
function DsIntToPos(i: integer; p: PDslLOC): PDslLOC; stdcall external;
|
||||
function DsPosToInt(p: PDslLOC): integer; stdcall external;
|
||||
function DsSetDebug(level: integer ): integer; stdcall external;
|
||||
function DsDataSync(mode: longint): longint; stdcall external;
|
||||
function DsIntToPos(i: longint; p: PDslLOC): PDslLOC; stdcall external;
|
||||
function DsPosToInt(p: PDslLOC): longint; stdcall external;
|
||||
function DsSetDebug(level: longint ): longint; stdcall external;
|
||||
function DsLastPos(p: PDslLOC): PDslLOC; stdcall external;
|
||||
function DsLastCom: byte; stdcall external;
|
||||
|
||||
function DsComstr(com: byte): pchar; stdcall external;
|
||||
function DsIntstr(intr: byte): pchar; stdcall external;
|
||||
|
||||
function DsStartReadySystem(func: DslRCB; count: integer): integer; stdcall external;
|
||||
function DsStartReadySystem(func: DslRCB; count: longint): longint; stdcall external;
|
||||
procedure DsEndReadySystem; stdcall external;
|
||||
function DsReadySystemMode(mode: integer): integer; stdcall external;
|
||||
function DsReadySystemMode(mode: longint): longint; stdcall external;
|
||||
|
||||
function DsControlF(com: byte; param: pchar): integer; stdcall external;
|
||||
function DsControl(com: byte; param: pchar; res: pointer): integer; stdcall external;
|
||||
function DsControlB(com: byte; param: pchar; res: pointer): integer; stdcall external;
|
||||
function DsControlF(com: byte; param: pchar): longint; stdcall external;
|
||||
function DsControl(com: byte; param: pchar; res: pointer): longint; stdcall external;
|
||||
function DsControlB(com: byte; param: pchar; res: pointer): longint; stdcall external;
|
||||
|
||||
function DsRead(pos: PDslLOC; sectors: integer; buf: Plongint; mode: integer): integer; stdcall external;
|
||||
function DsReadSync(res: pointer): integer; stdcall external;
|
||||
function DsRead(pos: PDslLOC; sectors: longint; buf: Plongint; mode: longint): longint; stdcall external;
|
||||
function DsReadSync(res: pointer): longint; stdcall external;
|
||||
function DsReadCallback(func: DslCB): DslCB; stdcall external;
|
||||
procedure DsReadBreak; stdcall external;
|
||||
function DsRead2(pos: PDslLOC; mode: integer): integer; stdcall external;
|
||||
function DsRead2(pos: PDslLOC; mode: longint): longint; stdcall external;
|
||||
|
||||
function DsSearchFile(fp: PDslFILE; name: pchar ): PDslFILE; stdcall external;
|
||||
function DsReadFile(_file: pchar; addr: Plongint; nbyte: integer): integer; stdcall external;
|
||||
//struct EXEC* DsReadExec( char* file ); stdcall external;
|
||||
function DsPlay(mode: integer; tracks: Pinteger; offset: integer): integer; stdcall external;
|
||||
function DsReadFile(_file: pchar; addr: Plongint; nbyte: longint): longint; stdcall external;
|
||||
function DsReadExec(name: pchar): PEXEC; stdcall external;
|
||||
function DsPlay(mode: longint; tracks: Plongint; offset: longint): longint; stdcall external;
|
||||
|
||||
procedure DsGetDiskType; stdcall external;
|
||||
function DsGetDiskType: longint; stdcall external;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -4,7 +4,7 @@ unit libetc;
|
||||
interface
|
||||
|
||||
var
|
||||
PadIdentifier: integer; external;
|
||||
PadIdentifier: longint; external;
|
||||
// PAD I/O (SIO Pad)
|
||||
const
|
||||
PADLup = 1 shl 12;
|
||||
@ -50,16 +50,16 @@ const
|
||||
MODE_NTSC = 0;
|
||||
MODE_PAL = 1;
|
||||
|
||||
function CheckCallback: integer; stdcall; external;
|
||||
procedure PadInit(mode: integer); stdcall; external;
|
||||
function ResetCallback: integer; stdcall; external;
|
||||
function RestartCallback: integer; stdcall; external;
|
||||
function StopCallback: integer; stdcall; external;
|
||||
function VSync(mode: integer): integer; stdcall; external;
|
||||
function VSyncCallback(f: pointer): integer; stdcall; external;
|
||||
function CheckCallback: longint; stdcall; external;
|
||||
procedure PadInit(mode: longint); stdcall; external;
|
||||
function ResetCallback: longint; stdcall; external;
|
||||
function RestartCallback: longint; stdcall; external;
|
||||
function StopCallback: longint; stdcall; external;
|
||||
function VSync(mode: longint): longint; stdcall; external;
|
||||
function VSyncCallback(f: pointer): longint; stdcall; external;
|
||||
function GetVideoMode: longint; stdcall; external;
|
||||
function SetVideoMode(mode: longint): longint; stdcall; external;
|
||||
function PadRead(id: integer): dword; stdcall; external;
|
||||
function PadRead(id: longint): dword; stdcall; external;
|
||||
procedure PadStop; stdcall; external;
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -15,9 +15,9 @@ type
|
||||
m : array [0..2, 0..2] of smallint; // 3x3 rotation matrix
|
||||
t : array [0..2] of longint; // transfer vector
|
||||
end;
|
||||
PMATRIX = ^MATRIX;
|
||||
PMATRIX = ^MATRIX;
|
||||
|
||||
VECTOR = packed record // long word type 3D vector
|
||||
VECTOR = packed record // long word type 3D vector
|
||||
vx, vy : longint;
|
||||
vz, pad : longint;
|
||||
end;
|
||||
|
13
rtl/ps1/psy-q-sdk/libgun.pas
Normal file
13
rtl/ps1/psy-q-sdk/libgun.pas
Normal file
@ -0,0 +1,13 @@
|
||||
// libetc.h: Light Gun Interface
|
||||
unit libgun;
|
||||
interface
|
||||
|
||||
procedure InitGUN(bufA: Pbyte; lenA: longint; bufB: Pbyte; lenB: longint; buf1: Pbyte; buf2: Pbyte; len: longint); external;
|
||||
procedure RemoveGUN; external;
|
||||
procedure SelectGUN(ch: longint; mask: byte); external;
|
||||
function StartGUN: longint; external;
|
||||
procedure StopGUN; external;
|
||||
|
||||
implementation
|
||||
begin
|
||||
end.
|
1119
rtl/ps1/psy-q-sdk/libhmd.pas
Normal file
1119
rtl/ps1/psy-q-sdk/libhmd.pas
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,25 +0,0 @@
|
||||
{$MODE OBJFPC}
|
||||
{$L libgtemacro.o}
|
||||
unit libmacro;
|
||||
interface
|
||||
|
||||
procedure gte_ldv0(r0: pdword); stdcall; external;
|
||||
procedure gte_ldv1(r0: pdword); stdcall; external;
|
||||
procedure gte_ldv2(r0: pdword); stdcall; external;
|
||||
|
||||
procedure gte_rtpt; stdcall; external;
|
||||
procedure gte_nclip; stdcall; external;
|
||||
procedure gte_stopz(r0: plongint); stdcall; external;
|
||||
|
||||
procedure gte_stsxy0(r0: pdword); stdcall; external;
|
||||
procedure gte_stsxy3(r0, r1, r2: pdword); stdcall; external;
|
||||
|
||||
procedure gte_avsz3; stdcall; external;
|
||||
procedure gte_avsz4; stdcall; external;
|
||||
|
||||
procedure gte_stotz(r0: plongint); stdcall; external;
|
||||
|
||||
|
||||
implementation
|
||||
begin
|
||||
end.
|
117
rtl/ps1/psy-q-sdk/libmcgui.pas
Normal file
117
rtl/ps1/psy-q-sdk/libmcgui.pas
Normal file
@ -0,0 +1,117 @@
|
||||
unit libmcgui;
|
||||
interface
|
||||
const
|
||||
NEGICON_A = $20;
|
||||
NEGICON_B = $10;
|
||||
|
||||
MOUSE_LBUTTON = $08;
|
||||
MOUSE_RBUTTON = $04;
|
||||
|
||||
MCGUI_INTERNAL_FONT = 0;
|
||||
MCGUI_EXTERNAL_FONT = 1;
|
||||
|
||||
type
|
||||
|
||||
// Texture Information Structure
|
||||
sMcGuiTexture = packed record
|
||||
addr : pointer;
|
||||
end;
|
||||
|
||||
|
||||
// Memory Card Information Structure */
|
||||
sMcGuiCards = packed record
|
||||
_file : array [0..20] of char;
|
||||
title : array [0..64] of char;
|
||||
frame : byte;
|
||||
block : byte;
|
||||
dataBytes : longint;
|
||||
iconAddr : pointer;
|
||||
dataAddr : pointer;
|
||||
end;
|
||||
|
||||
// BG Information Structure
|
||||
sMcGuiBg = packed record
|
||||
mode : smallint;
|
||||
scrollDirect : shortint; // 0:Up 1:Up&Left 2:Left 3:Down&left 4:Down ...
|
||||
scrollSpeed : shortint; // 0:no scroll 1:1/60 2:1/30 3:1/20
|
||||
timadr : pointer;
|
||||
end;
|
||||
|
||||
|
||||
// Cursor Information Structure
|
||||
sMcGuiCursor = packed record
|
||||
mode : byte;
|
||||
r, g, b : byte;
|
||||
end;
|
||||
|
||||
|
||||
// BGM,Sound Effects Information Structure
|
||||
Tbgm = packed record
|
||||
isbgm : longint;
|
||||
seq : pdword;
|
||||
vh : pdword;
|
||||
vb : pdword;
|
||||
SVOL : longint;
|
||||
isReverb : longint;
|
||||
reverbType : longint;
|
||||
reverbDepth : longint;
|
||||
end;
|
||||
|
||||
Tse = packed record
|
||||
isse : longint;
|
||||
vh : pdword;
|
||||
vb : pdword;
|
||||
vol : longint;
|
||||
prog : longint;
|
||||
TONE_OK : longint;
|
||||
TONE_CANCEL : longint;
|
||||
TONE_CURSOR : longint;
|
||||
TONE_ERROR : longint;
|
||||
end;
|
||||
|
||||
|
||||
sMcGuiSnd = packed record
|
||||
MVOL : longint;
|
||||
bgm : Tbgm;
|
||||
se : Tse;
|
||||
end;
|
||||
|
||||
|
||||
// Controller Related Information Structure
|
||||
|
||||
TType = packed record
|
||||
flag : longint;
|
||||
BUTTON_OK : dword;
|
||||
BUTTON_CANCEL : dword;
|
||||
end;
|
||||
|
||||
sMcGuiController = packed record
|
||||
buf : array [0..1] of byte;
|
||||
type1 : Ttype;
|
||||
type2 : Ttype;
|
||||
type3 : Ttype;
|
||||
type4 : Ttype;
|
||||
end;
|
||||
|
||||
|
||||
// Memory Card Screen Configuration Structure
|
||||
McGuiEnv = packed record
|
||||
cards : sMcGuiCards; // Memory Card Information
|
||||
bg : sMcGuiBg; // BG Information
|
||||
controller : sMcGuiController; // Controller Related Information
|
||||
sound : sMcGuiSnd; // BGM Sound Effects Information
|
||||
texture : sMcGuiTexture; // Texture Information
|
||||
cursor : sMcGuiCursor; // Cursor Information
|
||||
end;
|
||||
PMcGuiEnv = ^McGuiEnv;
|
||||
|
||||
|
||||
function McGuiSave(env:PMcGuiEnv): longint; external;
|
||||
function McGuiLoad(env:PMcGuiEnv): longint; external;
|
||||
|
||||
function McGuiSetExternalFont(env: PMcGuiEnv; mode: longint): longint; external;
|
||||
|
||||
implementation
|
||||
|
||||
begin
|
||||
end.
|
48
rtl/ps1/psy-q-sdk/libmcrd.pas
Normal file
48
rtl/ps1/psy-q-sdk/libmcrd.pas
Normal file
@ -0,0 +1,48 @@
|
||||
// libmcrd.h Rev. 4.2
|
||||
unit libmcrd;
|
||||
interface
|
||||
uses libstd;
|
||||
type
|
||||
MemCB = function(cmds, rslt: longint): pointer;
|
||||
const
|
||||
McFuncExist = 1;
|
||||
McFuncAccept = 2;
|
||||
McFuncReadFile = 3;
|
||||
McFuncWriteFile = 4;
|
||||
McFuncReadData = 5;
|
||||
McFuncWriteData = 6;
|
||||
|
||||
McErrNone = 0;
|
||||
McErrCardNotExist = 1;
|
||||
McErrCardInvalid = 2;
|
||||
McErrNewCard = 3;
|
||||
McErrNotFormat = 4;
|
||||
McErrFileNotExist = 5;
|
||||
McErrAlreadyExist = 6;
|
||||
McErrBlockFull = 7;
|
||||
McErrExtend = $8000;
|
||||
|
||||
|
||||
procedure MemCardInit(val: longint); external;
|
||||
procedure MemCardEnd; external;
|
||||
procedure MemCardStart; external;
|
||||
procedure MemCardStop; external;
|
||||
function MemCardExist(chan: longint): longint; external;
|
||||
function MemCardAccept(chan: longint): longint; external;
|
||||
function MemCardOpen(chan: longint; filename: pchar; flag: longint): longint; external;
|
||||
procedure MemCardClose; external;
|
||||
function MemCardReadData(adrs: pdword; ofs: longint; bytes: longint): longint; external;
|
||||
function MemCardReadFile(chan: longint; filename: pchar; adrs: pdword; ofs: longint; bytes: longint): longint; external;
|
||||
function MemCardWriteData(adrs: pdword; ofs: longint; bytes: longint): longint; external;
|
||||
function MemCardWriteFile(chan: longint; filename: pchar; adrs: pdword; ofs: longint; bytes: longint): longint; external;
|
||||
function MemCardCreateFile(chan: longint; filename: pchar; blocks: longint): longint; external;
|
||||
function MemCardDeleteFile(chan: longint; filename: pchar): longint; external;
|
||||
function MemCardFormat(chan: longint): longint; external;
|
||||
function MemCardUnformat(chan: longint): longint; external;
|
||||
function MemCardSync(mode: longint; cmds: plongint; rslt: plongint): longint; external;
|
||||
function MemCardCallback(func: MemCB): MemCB; external;
|
||||
function MemCardGetDirentry(chan: longint; name: pchar; dir: PDIRENTRY; files: plongint; ofs: longint; max: longint): longint; external;
|
||||
|
||||
implementation
|
||||
begin
|
||||
end.
|
65
rtl/ps1/psy-q-sdk/libmcx.pas
Normal file
65
rtl/ps1/psy-q-sdk/libmcx.pas
Normal file
@ -0,0 +1,65 @@
|
||||
// libmcx.h
|
||||
unit libmcx;
|
||||
interface
|
||||
|
||||
const
|
||||
McxFuncGetApl = 1;
|
||||
McxFuncExecApl = 2;
|
||||
McxFuncGetTime = 3;
|
||||
McxFuncGetMem = 4;
|
||||
McxFuncSetMem = 5;
|
||||
McxFuncShowTrans = 6;
|
||||
McxFuncHideTrans = 7;
|
||||
McxFuncCurrCtrl = 8;
|
||||
McxFuncSetLED = 9;
|
||||
McxFuncGetSerial = 10;
|
||||
McxFuncExecFlag = 11;
|
||||
McxFuncAllInfo = 12;
|
||||
McxFuncFlashAcs = 13;
|
||||
McxFuncReadDev = 14;
|
||||
McxFuncWriteDev = 15;
|
||||
McxFuncGetUIFS = 16;
|
||||
McxFuncSetUIFS = 17;
|
||||
McxFuncSetTime = 18;
|
||||
McxFuncCardType = 19;
|
||||
|
||||
|
||||
McxSyncRun = 0;
|
||||
McxSyncNone = -1;
|
||||
McxSyncFin = 1;
|
||||
|
||||
McxErrSuccess = 0;
|
||||
McxErrNoCard = 1;
|
||||
McxErrInvalid = 2;
|
||||
McxErrNewCard = 3;
|
||||
|
||||
|
||||
|
||||
procedure McxStartCom; external;
|
||||
procedure McxStopCom; external;
|
||||
function McxSync(mode: longint; cmd: plongint; res: plongint): longint; external;
|
||||
|
||||
function McxGetApl(port: longint; aplno: plongint): longint; external;
|
||||
function McxExecApl(port: longint; aplno: longint; arg: longint): longint; external;
|
||||
function McxGetTime(port: longint; time: pointer): longint; external;
|
||||
function McxGetMem(port: longint; data: pointer; start, len: dword): longint; external;
|
||||
function McxSetMem(port: longint; data: pointer; start, len: dword): longint; external;
|
||||
function McxShowTrans(port, dir, timeout: longint): longint; external;
|
||||
function McxHideTrans(port: longint): longint; external;
|
||||
function McxCurrCtrl(port, sound, infred, led: longint): longint; external;
|
||||
function McxFlashAcs(port, mode: longint): longint; external;
|
||||
function McxGetSerial(port: longint; serial: pdword): longint; external;
|
||||
function McxSetLED(port, mode: longint): longint; external;
|
||||
function McxAllInfo(port: longint; state: pointer): longint; external;
|
||||
function McxExecFlag(port, block, exec: longint): longint; external;
|
||||
function McxReadDev(port, dev: longint; param, data: pointer): longint; external;
|
||||
function McxWriteDev(port, dev: longint; param, data: pointer): longint; external;
|
||||
function McxSetTime(port: longint; time: pointer): longint; external;
|
||||
function McxGetUIFS(port: longint; data: pointer): longint; external;
|
||||
function McxSetUIFS(port: longint; data: pointer): longint; external;
|
||||
function McxCardType(port: longint): longint; external;
|
||||
|
||||
|
||||
implementation
|
||||
begin
|
||||
end.
|
47
rtl/ps1/psy-q-sdk/libpad.pas
Normal file
47
rtl/ps1/psy-q-sdk/libpad.pas
Normal file
@ -0,0 +1,47 @@
|
||||
// libpad.h
|
||||
unit libpad;
|
||||
interface
|
||||
const
|
||||
PadStateDiscon = 0;
|
||||
PadStateFindPad = 1;
|
||||
PadStateFindCTP1 = 2;
|
||||
PadStateFindCTP2 = 3;
|
||||
PadStateReqInfo = 4;
|
||||
PadStateExecCmd = 5;
|
||||
PadStateStable = 6;
|
||||
|
||||
InfoModeCurID = 1;
|
||||
InfoModeCurExID = 2;
|
||||
InfoModeCurExOffs = 3;
|
||||
InfoModeIdTable = 4;
|
||||
|
||||
InfoActFunc = 1;
|
||||
InfoActSub = 2;
|
||||
InfoActSize = 3;
|
||||
InfoActCurr = 4;
|
||||
InfoActSign = 5;
|
||||
|
||||
PadMaxCurr = 60; // PS maximum current supply
|
||||
PadCurrCTP1 = 10; // SCPH-1150 biblator current
|
||||
|
||||
|
||||
procedure PadInitDirect(pad1, pad2: pbyte); external;
|
||||
procedure PadInitMtap(pad1, pad2: pbyte); external;
|
||||
procedure PadInitGun(buf: pbyte; len: longint); external;
|
||||
function PadChkVsync: longint; external;
|
||||
procedure PadStartCom; external;
|
||||
procedure PadStopCom; external;
|
||||
function PadEnableCom(mode: dword): dword; external;
|
||||
procedure PadEnableGun(mask: byte); external;
|
||||
procedure PadRemoveGun; external;
|
||||
function PadGetState(port: longint): longint; external;
|
||||
function PadInfoMode(port, term, ofs: longint): longint; external;
|
||||
function PadInfoAct(port, actno, term: longint): longint; external;
|
||||
function PadInfoComb(port, listno, term: longint): longint; external;
|
||||
function PadSetActAlign(port: longint; data: pointer): longint; external;
|
||||
function PadSetMainMode(socket, offs, lock: longint): longint; external;
|
||||
procedure PadSetAct(port: longint; data: pointer; len: longint); external;
|
||||
|
||||
implementation
|
||||
begin
|
||||
end.
|
70
rtl/ps1/psy-q-sdk/libpress.pas
Normal file
70
rtl/ps1/psy-q-sdk/libpress.pas
Normal file
@ -0,0 +1,70 @@
|
||||
// libpress.h
|
||||
unit libpress;
|
||||
interface
|
||||
type
|
||||
// DecDCTvlc Table
|
||||
DECDCTTAB = array [0..34815] of word;
|
||||
|
||||
DECDCTENV = packed record
|
||||
iq_y : array [0..63] of byte; // IQ (Y): zig-zag order
|
||||
iq_c : array [0..63] of byte; // IQ (Cb,Cr): zig-zag order
|
||||
dct : array [0..63] of smallint; // IDCT coef (reserved)
|
||||
end;
|
||||
PDECDCTENV = ^DECDCTENV;
|
||||
|
||||
ENCSPUENV = packed record
|
||||
src : psmallint; // 16-bit strait PCM
|
||||
dest : psmallint; // PlayStation original waveform data
|
||||
work : psmallint; // scratch pad or NULL
|
||||
size : longint; // size (unit: byte) of source data
|
||||
loop_start : longint; // loop start point (unit: byte) of source data
|
||||
loop : byte; // whether loop or not
|
||||
byte_swap : byte; // source data is 16-bit big endian (1) / little endian (0)
|
||||
proceed : byte; // proceeding ? whole (0) / start (1) / cont. (2) / end (4)
|
||||
quality : byte; // quality ? middle (0) / high (1)
|
||||
end;
|
||||
PENCSPUENV = ^ENCSPUENV;
|
||||
|
||||
DecDCTinCallbackFunc = procedure;
|
||||
|
||||
const
|
||||
ENCSPU_ENCODE_ERROR = -1;
|
||||
ENCSPU_ENCODE_WHOLE = 0;
|
||||
ENCSPU_ENCODE_START = 1 shl 0;
|
||||
ENCSPU_ENCODE_CONTINUE = 1 shl 1;
|
||||
ENCSPU_ENCODE_END = 1 shl 2;
|
||||
|
||||
ENCSPU_ENCODE_LOOP = 1;
|
||||
ENCSPU_ENCODE_NO_LOOP = 0;
|
||||
|
||||
ENCSPU_ENCODE_ENDIAN_LITTLE = 0;
|
||||
ENCSPU_ENCODE_ENDIAN_BIG = 1;
|
||||
|
||||
ENCSPU_ENCODE_MIDDLE_QULITY = 0;
|
||||
ENCSPU_ENCODE_HIGH_QULITY = 1;
|
||||
|
||||
|
||||
procedure DecDCTReset(mode: longint); external;
|
||||
function DecDCTGetEnv(env: PDECDCTENV): PDECDCTENV; external;
|
||||
function DecDCTPutEnv(env: PDECDCTENV): PDECDCTENV; external;
|
||||
function DecDCTBufSize(bs: pdword): longint; external;
|
||||
function DecDCTvlc(bs: pdword; buf: pdword): longint; external;
|
||||
function DecDCTvlc2(bs: pdword; buf: pdword; table: DECDCTTAB): longint; external;
|
||||
function DecDCTvlcSize(size: longint): longint; external;
|
||||
function DecDCTvlcSize2(size: longint): longint; external;
|
||||
procedure DecDCTvlcBuild(table: pword); external;
|
||||
procedure DecDCTin(buf: pdword; mode: longint); external;
|
||||
procedure DecDCTout(buf: pdword; size: longint); external;
|
||||
function DecDCTinSync(mode: longint): longint; external;
|
||||
function DecDCToutSync(mode: longint): longint; external;
|
||||
|
||||
function DecDCTinCallback(func: DecDCTinCallbackFunc): longint; external;
|
||||
function DecDCToutCallback(func: DecDCTinCallbackFunc): longint; external;
|
||||
|
||||
function EncSPU (env: PENCSPUENV): longint; external;
|
||||
function EncSPU2(env: PENCSPUENV): longint; external;
|
||||
|
||||
implementation
|
||||
|
||||
begin
|
||||
end.
|
101
rtl/ps1/psy-q-sdk/libsn.pas
Normal file
101
rtl/ps1/psy-q-sdk/libsn.pas
Normal file
@ -0,0 +1,101 @@
|
||||
// LIBSN.H
|
||||
unit libsn;
|
||||
interface
|
||||
{
|
||||
** 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)
|
||||
}
|
||||
function PCinit: longint; external;
|
||||
|
||||
{
|
||||
** 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
|
||||
}
|
||||
function PCopen(name: pchar; flags, perms: longint): longint; external;
|
||||
|
||||
{
|
||||
** 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)
|
||||
}
|
||||
function PCcreat(name: pchar; perms: longint): longint; external;
|
||||
|
||||
{
|
||||
** 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)
|
||||
}
|
||||
function PClseek(fd: longint; offset: longint; mode: longint): longint; external;
|
||||
|
||||
{
|
||||
** 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
|
||||
}
|
||||
function PCread(fd: longint; buff: pointer; len: longint): longint; external;
|
||||
|
||||
{
|
||||
** 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
|
||||
}
|
||||
function PCwrite(fd: longint; buff: pointer; len: longint): longint; external;
|
||||
|
||||
{
|
||||
** close an open file on PC
|
||||
**
|
||||
** passed: file-handle
|
||||
**
|
||||
** return: negative if error
|
||||
**
|
||||
}
|
||||
function PCclose(fd: longint): longint; external;
|
||||
|
||||
implementation
|
||||
|
||||
begin
|
||||
end.
|
@ -1,3 +1,4 @@
|
||||
{$MODE OBJFPC}
|
||||
unit libstd;
|
||||
interface
|
||||
|
||||
@ -74,8 +75,149 @@ var
|
||||
errno : longint; external;
|
||||
|
||||
|
||||
// asm.h
|
||||
const
|
||||
R0 = 0;
|
||||
R1 = 1;
|
||||
R2 = 2;
|
||||
R3 = 3;
|
||||
R4 = 4;
|
||||
R5 = 5;
|
||||
R6 = 6;
|
||||
R7 = 7;
|
||||
R8 = 8;
|
||||
R9 = 9;
|
||||
R10 = 10;
|
||||
R11 = 11;
|
||||
R12 = 12;
|
||||
R13 = 13;
|
||||
R14 = 14;
|
||||
R15 = 15;
|
||||
R16 = 16;
|
||||
R17 = 17;
|
||||
R18 = 18;
|
||||
R19 = 19;
|
||||
R20 = 20;
|
||||
R21 = 21;
|
||||
R22 = 22;
|
||||
R23 = 23;
|
||||
R24 = 24;
|
||||
R25 = 25;
|
||||
R26 = 26;
|
||||
R27 = 27;
|
||||
R28 = 28;
|
||||
R29 = 29;
|
||||
R30 = 30;
|
||||
R31 = 31;
|
||||
|
||||
zero = 0;
|
||||
AT = 1; // assembler temp
|
||||
v0 = 2; // return value
|
||||
v1 = 3;
|
||||
a0 = 4; // argument registers
|
||||
a1 = 5;
|
||||
a2 = 6;
|
||||
a3 = 7;
|
||||
t0 = 8; // caller saved
|
||||
t1 = 9;
|
||||
t2 = 10;
|
||||
t3 = 11;
|
||||
t4 = 12;
|
||||
t5 = 13;
|
||||
t6 = 14;
|
||||
t7 = 15;
|
||||
s0 = 16; // callee saved
|
||||
s1 = 17;
|
||||
s2 = 18;
|
||||
s3 = 19;
|
||||
s4 = 20;
|
||||
s5 = 21;
|
||||
s6 = 22;
|
||||
s7 = 23;
|
||||
t8 = 24; // code generator
|
||||
t9 = 25;
|
||||
k0 = 26; // kernel temporary
|
||||
k1 = 27;
|
||||
gp = 28; // global pointer
|
||||
sp = 29; // stack pointer
|
||||
fp = 30; // frame pointer
|
||||
ra = 31; // return address
|
||||
|
||||
// register offset
|
||||
R_R0 = 0;
|
||||
R_R1 = 1;
|
||||
R_R2 = 2;
|
||||
R_R3 = 3;
|
||||
R_R4 = 4;
|
||||
R_R5 = 5;
|
||||
R_R6 = 6;
|
||||
R_R7 = 7;
|
||||
R_R8 = 8;
|
||||
R_R9 = 9;
|
||||
R_R10 = 10;
|
||||
R_R11 = 11;
|
||||
R_R12 = 12;
|
||||
R_R13 = 13;
|
||||
R_R14 = 14;
|
||||
R_R15 = 15;
|
||||
R_R16 = 16;
|
||||
R_R17 = 17;
|
||||
R_R18 = 18;
|
||||
R_R19 = 19;
|
||||
R_R20 = 20;
|
||||
R_R21 = 21;
|
||||
R_R22 = 22;
|
||||
R_R23 = 23;
|
||||
R_R24 = 24;
|
||||
R_R25 = 25;
|
||||
R_R26 = 26;
|
||||
R_R27 = 27;
|
||||
R_R28 = 28;
|
||||
R_R29 = 29;
|
||||
R_R30 = 30;
|
||||
R_R31 = 31;
|
||||
R_EPC = 32;
|
||||
R_MDHI= 33;
|
||||
R_MDLO= 34;
|
||||
R_SR = 35;
|
||||
R_CAUSE= 36;
|
||||
NREGS = 40;
|
||||
|
||||
|
||||
// compiler defined bindings
|
||||
R_ZERO = R_R0;
|
||||
R_AT = R_R1;
|
||||
R_V0 = R_R2;
|
||||
R_V1 = R_R3;
|
||||
R_A0 = R_R4;
|
||||
R_A1 = R_R5;
|
||||
R_A2 = R_R6;
|
||||
R_A3 = R_R7;
|
||||
R_T0 = R_R8;
|
||||
R_T1 = R_R9;
|
||||
R_T2 = R_R10;
|
||||
R_T3 = R_R11;
|
||||
R_T4 = R_R12;
|
||||
R_T5 = R_R13;
|
||||
R_T6 = R_R14;
|
||||
R_T7 = R_R15;
|
||||
R_S0 = R_R16;
|
||||
R_S1 = R_R17;
|
||||
R_S2 = R_R18;
|
||||
R_S3 = R_R19;
|
||||
R_S4 = R_R20;
|
||||
R_S5 = R_R21;
|
||||
R_S6 = R_R22;
|
||||
R_S7 = R_R23;
|
||||
R_T8 = R_R24;
|
||||
R_T9 = R_R25;
|
||||
R_K0 = R_R26;
|
||||
R_K1 = R_R27;
|
||||
R_GP = R_R28;
|
||||
R_SP = R_R29;
|
||||
R_FP = R_R30;
|
||||
R_RA = R_R31;
|
||||
|
||||
|
||||
// types.h
|
||||
type
|
||||
@ -114,7 +256,7 @@ type
|
||||
end;
|
||||
|
||||
|
||||
|
||||
// kernel.h Rev. 3
|
||||
const
|
||||
DescMask = $ff000000;
|
||||
DescTH = DescMask;
|
||||
@ -189,7 +331,6 @@ const
|
||||
TcbStUNUSED = $1000;
|
||||
TcbStACTIVE = $4000;
|
||||
|
||||
NREGS = 40;
|
||||
|
||||
type
|
||||
|
||||
@ -267,10 +408,11 @@ type
|
||||
|
||||
|
||||
|
||||
// abs.h
|
||||
function abs(num: longint): longint; stdcall; external;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Basic system types and major/minor device constructing/busting macros.
|
||||
function major(x: longint): dword; // major part of a device
|
||||
function minor(x: longint): longint; // minor part of a device
|
||||
@ -278,8 +420,6 @@ function makedev(x, y: longint): longint; // make a device number
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// memory.h
|
||||
function memcpy(dest: pointer; src: pointer; count: dword): pointer; stdcall external;
|
||||
function memmove(dest: pointer; const src: pointer; count: dword): pointer; stdcall external;
|
||||
@ -292,13 +432,12 @@ function bcmp(const s1: pointer; const s2: pointer; n: dword): longint; stdcall
|
||||
|
||||
|
||||
|
||||
|
||||
// malloc.h
|
||||
procedure InitHeap(p: pdword; l: dword); stdcall external;
|
||||
procedure free(p: pointer); stdcall external;
|
||||
function malloc(l: size_t): pointer; stdcall external;
|
||||
function calloc(nitems: size_t; l: size_t): pointer; stdcall external;
|
||||
function realloc(p: pointer; l: size_t): pointer; stdcall external;
|
||||
procedure InitHeap(p: pdword; l: dword); stdcall external; // this doesn't work - use InitHeap2
|
||||
procedure free(p: pointer); stdcall external; // this doesn't work - use free2
|
||||
function malloc(l: size_t): pointer; stdcall external; // this doesn't work - use malloc2
|
||||
function calloc(nitems: size_t; l: size_t): pointer; stdcall external; // this doesn't work - use calloc2
|
||||
function realloc(p: pointer; l: size_t): pointer; stdcall external; // this doesn't work - use realloc2
|
||||
procedure InitHeap2(p: pdword; l: dword); stdcall external;
|
||||
procedure free2(p: pointer); stdcall external;
|
||||
function malloc2(l: size_t): pointer; stdcall external;
|
||||
@ -311,8 +450,6 @@ function calloc3(l1: size_t; l2: size_t): pointer; stdcall external;
|
||||
function realloc3(p: pointer; l: size_t): pointer; stdcall external;
|
||||
|
||||
|
||||
|
||||
|
||||
// strings.h
|
||||
const
|
||||
LMAX = 256;
|
||||
@ -338,8 +475,6 @@ function strstr(const str1: pchar; const str2: pchar): pchar; stdcall; external;
|
||||
function strdup(p: pchar): pchar;
|
||||
|
||||
|
||||
|
||||
|
||||
// rand.h
|
||||
const
|
||||
RAND_MAX = 32767;
|
||||
@ -349,7 +484,6 @@ procedure srand(x: longint); stdcall; external;
|
||||
|
||||
|
||||
|
||||
|
||||
// stdlib.h
|
||||
type
|
||||
Tcmp = function (const a: pointer; const b: pointer): longint;
|
||||
@ -360,7 +494,6 @@ procedure exit; stdcall; external;
|
||||
|
||||
|
||||
|
||||
|
||||
// stdio.h
|
||||
const
|
||||
BUFSIZ = 1024;
|
||||
@ -381,13 +514,6 @@ procedure puts(const s: pchar); stdcall; external;
|
||||
|
||||
|
||||
|
||||
|
||||
// abs.h
|
||||
function abs(x: longint): longint; stdcall; external;
|
||||
|
||||
|
||||
|
||||
|
||||
// convert.h
|
||||
function atoi(const str: pchar): longint; stdcall; external;
|
||||
function atol(const str: pchar): longint; stdcall; external;
|
||||
@ -397,8 +523,7 @@ function labs(x: longint): longint; stdcall; external;
|
||||
|
||||
|
||||
|
||||
|
||||
//limits.h
|
||||
// limits.h
|
||||
const
|
||||
CHAR_BIT = 8;
|
||||
SCHAR_MIN = -128;
|
||||
@ -423,14 +548,11 @@ const
|
||||
|
||||
|
||||
|
||||
|
||||
// qsort.h
|
||||
procedure qsort(base: pointer; num: size_t; size: size_t; compar: pointer); stdcall; external;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ctype.h
|
||||
const
|
||||
_U = $01; // upper case letter
|
||||
@ -465,8 +587,6 @@ function toascii(ch: char): char;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ioctl.h
|
||||
function FIOCNBLOCK: longint;
|
||||
function FIOCSCAN: longint; // scan for input
|
||||
@ -509,7 +629,6 @@ const
|
||||
|
||||
|
||||
|
||||
|
||||
// file.h
|
||||
const
|
||||
// Flag for open()
|
||||
@ -523,11 +642,430 @@ const
|
||||
|
||||
|
||||
|
||||
// fs.h
|
||||
// device table
|
||||
type
|
||||
|
||||
Tdevice_table = packed record
|
||||
dt_string : pchar; // device name
|
||||
dt_type : longint; // device "type"
|
||||
dt_bsize : longint; // file system type
|
||||
dt_desc : pchar; // device description
|
||||
dt_init : function(): plongint; // device init routine
|
||||
dt_open : function(): plongint; // device open routine
|
||||
dt_strategy : function(): plongint; // device strategy routine, returns cnt
|
||||
dt_close : function(): plongint; // device close routine
|
||||
dt_ioctl : function(): plongint; // device ioctl routine
|
||||
dt_read : function(): plongint; // fs read routine, returns count
|
||||
dt_write : function(): plongint; // fs write routine, return count
|
||||
dt_delete : function(): plongint; // file delete routine
|
||||
dt_undelete : function(): plongint; // file delete routine
|
||||
dt_firstfile : function(): plongint;// directory serach routine
|
||||
dt_nextfile : function(): plongint; // directory serach routine
|
||||
dt_format : function(): plongint;
|
||||
dt_cd : function(): plongint;
|
||||
dt_rename : function(): plongint;
|
||||
dt_remove : function(): plongint;
|
||||
dt_else : function(): plongint;
|
||||
end;
|
||||
Pdevice_table = ^Tdevice_table;
|
||||
|
||||
// device types
|
||||
const
|
||||
DTTYPE_CHAR = $1; // character device
|
||||
DTTYPE_CONS = $2; // can be console
|
||||
DTTYPE_BLOCK = $4; // block device
|
||||
DTTYPE_RAW = $8; // raw device that uses fs switch
|
||||
DTTYPE_FS = $10;
|
||||
|
||||
|
||||
// character device flags
|
||||
DB_RAW = $1; // don't interpret special chars
|
||||
DB_STOPPED = $2; // stop output
|
||||
DB_BREAK = $4; // cntl-c raise console interrpt
|
||||
|
||||
// character device buffer
|
||||
CBUFSIZE = 256;
|
||||
|
||||
type
|
||||
device_buf = packed record
|
||||
db_flags : longint; // character device flags
|
||||
db_in : pchar; // pts at next free char
|
||||
db_out : pchar; // pts at next filled char
|
||||
db_buf : array [0..CBUFSIZE - 1] of char; // circular buffer for input
|
||||
end;
|
||||
|
||||
// circular buffer functions */
|
||||
{
|
||||
CIRC_EMPTY(x) ((x)->db_in == (x)->db_out)
|
||||
CIRC_FLUSH(x) ((x)->db_in = (x)->db_out = (x)->db_buf)
|
||||
CIRC_STOPPED(x) ((x)->db_flags & DB_STOPPED)
|
||||
}
|
||||
|
||||
// io block
|
||||
iob = packed record
|
||||
i_flgs : longint;
|
||||
i_unit : longint; // pseudo device unit
|
||||
i_ma : pchar; // memory address of i/o buffer
|
||||
i_cc : dword; // character count of transfer
|
||||
i_offset : dword; // seek offset in file
|
||||
i_fstype : longint; // file system type
|
||||
i_errno : longint; // error # return
|
||||
i_dp : Pdevice_table; // pointer into device_table
|
||||
i_size : dword;
|
||||
i_head : longint;
|
||||
i_fd : longint; // file descriptor
|
||||
end;
|
||||
|
||||
// Request codes
|
||||
const
|
||||
READ = 1;
|
||||
WRITE = 2;
|
||||
|
||||
NIOB = 16; // max number of open files
|
||||
|
||||
|
||||
|
||||
// r3000.h
|
||||
// Segment base addresses and sizes
|
||||
K0BASE = $80000000;
|
||||
K0SIZE = $20000000;
|
||||
K1BASE = $A0000000;
|
||||
K1SIZE = $20000000;
|
||||
K2BASE = $C0000000;
|
||||
K2SIZE = $20000000;
|
||||
|
||||
// Exception vectors
|
||||
UT_VEC = K0BASE; // utlbmiss vector
|
||||
E_VEC = K0BASE + $80; // exception vector
|
||||
R_VEC = K1BASE + $1fc00000; // reset vector
|
||||
|
||||
// Address conversion macros
|
||||
function K0_TO_K1(x: dword): dword; // kseg0 to kseg1
|
||||
function K1_TO_K0(x: dword): dword; // kseg1 to kseg0
|
||||
function K0_TO_PHYS(x: dword): dword; // kseg0 to physical
|
||||
function K1_TO_PHYS(x: dword): dword; // kseg1 to physical
|
||||
function PHYS_TO_K0(x: dword): dword; // physical to kseg0
|
||||
function PHYS_TO_K1(x: dword): dword; // physical to kseg1
|
||||
|
||||
// Address predicates
|
||||
function IS_KSEG0(x: dword): boolean;
|
||||
function IS_KSEG1(x: dword): boolean;
|
||||
//function IS_KSEG2(x: dword): boolean;
|
||||
//function IS_KPTESEG(x: dword): boolean;
|
||||
function IS_KUSEG(x: dword): boolean;
|
||||
|
||||
|
||||
const
|
||||
// Cache size constants
|
||||
MINCACHE = 4 * 1024;
|
||||
MAXCACHE = 64 * 1024;
|
||||
|
||||
|
||||
// Status register
|
||||
SR_CUMASK = $f0000000; // coproc usable bits
|
||||
|
||||
SR_CU3 = $80000000; // Coprocessor 3 usable
|
||||
SR_CU2 = $40000000; // Coprocessor 2 usable
|
||||
SR_CU1 = $20000000; // Coprocessor 1 usable
|
||||
SR_CU0 = $10000000; // Coprocessor 0 usable
|
||||
|
||||
SR_BEV = $00400000; // use boot exception vectors
|
||||
|
||||
// Cache control bits
|
||||
SR_TS = $00200000; // TLB shutdown
|
||||
SR_PE = $00100000; // cache parity error
|
||||
SR_CM = $00080000; // cache miss
|
||||
SR_PZ = $00040000; // cache parity zero
|
||||
SR_SWC = $00020000; // swap cache
|
||||
SR_ISC = $00010000; // Isolate data cache
|
||||
|
||||
SR_MM_MODE = $00010000; // lwl/swl/etc become scache/etc
|
||||
{
|
||||
define:
|
||||
lcache lwl
|
||||
scache swl
|
||||
flush lwr $0,
|
||||
inval swr $0,
|
||||
}
|
||||
|
||||
|
||||
// Interrupt enable bits
|
||||
// (NOTE: bits set to 1 enable the corresponding level interrupt)
|
||||
SR_IMASK = $0000ff00; // Interrupt mask
|
||||
SR_IMASK8 = $00000000; // mask level 8
|
||||
SR_IMASK7 = $00008000; // mask level 7
|
||||
SR_IMASK6 = $0000c000; // mask level 6
|
||||
SR_IMASK5 = $0000e000; // mask level 5
|
||||
SR_IMASK4 = $0000f000; // mask level 4
|
||||
SR_IMASK3 = $0000f800; // mask level 3
|
||||
SR_IMASK2 = $0000fc00; // mask level 2
|
||||
SR_IMASK1 = $0000fe00; // mask level 1
|
||||
SR_IMASK0 = $0000ff00; // mask level 0
|
||||
|
||||
SR_IBIT8 = $00008000; // bit level 8
|
||||
SR_IBIT7 = $00004000; // bit level 7
|
||||
SR_IBIT6 = $00002000; // bit level 6
|
||||
SR_IBIT5 = $00001000; // bit level 5
|
||||
SR_IBIT4 = $00000800; // bit level 4
|
||||
SR_IBIT3 = $00000400; // bit level 3
|
||||
SR_IBIT2 = $00000200; // bit level 2
|
||||
SR_IBIT1 = $00000100; // bit level 1
|
||||
|
||||
SR_KUO = $00000020; // old kernel/user, 0 => k, 1 => u
|
||||
SR_IEO = $00000010; // old interrupt enable, 1 => enable
|
||||
SR_KUP = $00000008; // prev kernel/user, 0 => k, 1 => u
|
||||
SR_IEP = $00000004; // prev interrupt enable, 1 => enable
|
||||
SR_KUC = $00000002; // cur kernel/user, 0 => k, 1 => u
|
||||
SR_IEC = $00000001; // cur interrupt enable, 1 => enable
|
||||
|
||||
SR_IMASKSHIFT = 8;
|
||||
|
||||
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
|
||||
|
||||
CAUSE_BD = $80000000; // Branch delay slot */
|
||||
CAUSE_CEMASK = $30000000; // coprocessor error */
|
||||
CAUSE_CESHIFT = 28;
|
||||
|
||||
/// Interrupt pending bits
|
||||
CAUSE_IP8 = $00008000; // External level 8 pending
|
||||
CAUSE_IP7 = $00004000; // External level 7 pending
|
||||
CAUSE_IP6 = $00002000; // External level 6 pending
|
||||
CAUSE_IP5 = $00001000; // External level 5 pending
|
||||
CAUSE_IP4 = $00000800; // External level 4 pending
|
||||
CAUSE_IP3 = $00000400; // External level 3 pending
|
||||
CAUSE_SW2 = $00000200; // Software level 2 pending
|
||||
CAUSE_SW1 = $00000100; // Software level 1 pending
|
||||
|
||||
CAUSE_IPMASK = $0000FF00; // Pending interrupt mask
|
||||
CAUSE_IPSHIFT = 8;
|
||||
|
||||
CAUSE_EXCMASK = $0000003C; // Cause code bits
|
||||
CAUSE_EXCSHIFT = 2;
|
||||
|
||||
CAUSE_FMT = '\20\40BD\36CE1\35CE0\20IP8\17IP7\16IP6\15IP5\14IP4\13IP3\12SW2\11SW1\1INT';
|
||||
|
||||
|
||||
// Cause register exception codes
|
||||
function EXC_CODE(x: dword): dword;
|
||||
|
||||
const
|
||||
// Hardware exception codes
|
||||
EXC_INT = 0 shl 2; // interrupt
|
||||
EXC_MOD = 1 shl 2; // TLB mod
|
||||
EXC_RMISS = 2 shl 2; // Read TLB Miss
|
||||
EXC_WMISS = 3 shl 2; // Write TLB Miss
|
||||
EXC_RADE = 4 shl 2; // Read Address Error
|
||||
EXC_WADE = 5 shl 2; // Write Address Error
|
||||
EXC_IBE = 6 shl 2; // Instruction Bus Error
|
||||
EXC_DBE = 7 shl 2; // Data Bus Error
|
||||
EXC_SYSCALL = 8 shl 2; // SYSCALL
|
||||
EXC_BREAK = 9 shl 2; // BREAKpoint
|
||||
EXC_II = 10 shl 2; // Illegal Instruction
|
||||
EXC_CPU = 11 shl 2; // CoProcessor Unusable
|
||||
EXC_OV = 12 shl 2; // OVerflow
|
||||
|
||||
// software exception codes
|
||||
SEXC_SEGV = 16 shl 2; // Software detected seg viol
|
||||
SEXC_RESCHED= 17 shl 2; // resched request
|
||||
SEXC_PAGEIN = 18 shl 2; // page-in request
|
||||
SEXC_CPU = 19 shl 2; // coprocessor unusable
|
||||
|
||||
|
||||
// Coprocessor 0 registers
|
||||
C0_INX = 0; // tlb index
|
||||
C0_RAND = 1; // tlb random
|
||||
C0_TLBLO = 2; // tlb entry low
|
||||
C0_CTXT = 4; // tlb context
|
||||
|
||||
C0_PIDMASK = 6; // Mips2
|
||||
|
||||
C0_BADVADDR = 8; // bad virtual address
|
||||
|
||||
C0_TLBHI = 10; // tlb entry hi
|
||||
C0_PID = 10; // Mips2
|
||||
|
||||
C0_SR = 12; // status register
|
||||
C0_CAUSE = 13; // exception cause
|
||||
C0_EPC = 14; // exception pc
|
||||
C0_PRID = 15; // revision identifier
|
||||
C0_ERREG = 16; // Mips2
|
||||
|
||||
// Coprocessor 0 operations
|
||||
C0_READI = $1; // read ITLB entry addressed by C0_INDEX
|
||||
C0_WRITEI = $2; // write ITLB entry addressed by C0_INDEX
|
||||
C0_WRITER = $6; // write ITLB entry addressed by C0_RAND
|
||||
C0_PROBE = $8; // probe for ITLB entry addressed by TLBHI
|
||||
C0_RFE = $10; // restore for exception
|
||||
|
||||
// Flags for the nofault handler. 0 means no fault is expected.
|
||||
NF_BADADDR = 1; // badaddr, wbadaddr
|
||||
NF_COPYIO = 2; // copyin, copyout
|
||||
NF_ADDUPC = 3; // addupc
|
||||
NF_FSUMEM = 4; // fubyte, subyte, fuword, suword
|
||||
NF_USERACC = 5; // useracc
|
||||
NF_SOFTFP = 6; // softfp
|
||||
NF_REVID = 7; // revision ids
|
||||
NF_NENTRIES = 8;
|
||||
|
||||
// TLB size constants
|
||||
TLBWIREDBASE = 0; // WAG for now
|
||||
NWIREDENTRIES = 8; // WAG for now
|
||||
TLBRANDOMBASE = NWIREDENTRIES;
|
||||
NTLBENTRIES = 64;
|
||||
NRANDOMENTRIES = (NTLBENTRIES - NWIREDENTRIES);
|
||||
|
||||
|
||||
TLBRAND_RANDMASK = $00003f00;
|
||||
TLBRAND_RANDSHIFT = 8;
|
||||
|
||||
|
||||
// Chip interrupt vector
|
||||
NC0VECS = 8;
|
||||
|
||||
|
||||
|
||||
// extern int (*c0vec_tbl[])();
|
||||
var
|
||||
c0vec_tbl : array of function: longint; external;
|
||||
|
||||
|
||||
const
|
||||
BRK_KERNEL = $f1;
|
||||
EXCEPT_NORM = 1;
|
||||
EXCEPT_UTLB = 2;
|
||||
EXCEPT_BRKPT = 3;
|
||||
EXCEPT_DB = 4;
|
||||
EXCEPT_GDB = 4;
|
||||
EXCEPT_INT = 9;
|
||||
EXCEPT_ELSE = $ff;
|
||||
|
||||
|
||||
|
||||
// setjmp.h
|
||||
// simple non-local-jump for single task environment
|
||||
// jmp_buf indices
|
||||
const
|
||||
JB_PC = 0;
|
||||
JB_SP = 1;
|
||||
JB_FP = 2;
|
||||
JB_S0 = 3;
|
||||
JB_S1 = 4;
|
||||
JB_S2 = 5;
|
||||
JB_S3 = 6;
|
||||
JB_S4 = 7;
|
||||
JB_S5 = 8;
|
||||
JB_S6 = 9;
|
||||
JB_S7 = 10;
|
||||
JB_GP = 11;
|
||||
JB_SIZE = 12;
|
||||
|
||||
type
|
||||
jmp_buf = array [0..JB_SIZE - 1] of longint;
|
||||
|
||||
function setjmp(buf: jmp_buf): longint; external;
|
||||
procedure longjmp(buf: jmp_buf; i: longint); external;
|
||||
|
||||
|
||||
|
||||
// libsio.h
|
||||
// status bits
|
||||
const
|
||||
SR_IRQ = $200;
|
||||
SR_CTS = $100;
|
||||
SR_DSR = $80;
|
||||
SR_FE = $20;
|
||||
SR_OE = $10;
|
||||
SR_PERROR = $8;
|
||||
SR_TXU = $4;
|
||||
SR_RXRDY = $2;
|
||||
SR_TXRDY = $1;
|
||||
|
||||
SIO_CTS = $100;
|
||||
SIO_DSR = $80;
|
||||
SIO_FE = $20;
|
||||
SIO_OE = $10;
|
||||
SIO_PERROR = $8;
|
||||
SIO_TXU = $4;
|
||||
SIO_RXRDY = $2;
|
||||
SIO_TXRDY = $1;
|
||||
|
||||
|
||||
// control bits
|
||||
CR_DSRIEN = $1000;
|
||||
CR_RXIEN = $800;
|
||||
CR_TXIEN = $400;
|
||||
CR_BUFSZ_1 = $0;
|
||||
CR_BUFSZ_2 = $100;
|
||||
CR_BUFSZ_4 = $200;
|
||||
CR_BUFSZ_8 = $300;
|
||||
CR_INTRST = $40;
|
||||
CR_RTS = $20;
|
||||
CR_ERRRST = $10;
|
||||
CR_BRK = $8;
|
||||
CR_RXEN = $4;
|
||||
CR_DTR = $2;
|
||||
CR_TXEN = $1;
|
||||
|
||||
SIO_BIT_DTR = CR_DTR;
|
||||
SIO_BIT_RTS = CR_RTS;
|
||||
|
||||
// mode bits
|
||||
MR_SB_00 = $0;
|
||||
MR_SB_01 = $40;
|
||||
MR_SB_10 = $80;
|
||||
MR_SB_11 = $C0;
|
||||
MR_P_EVEN = $20;
|
||||
MR_PEN = $10;
|
||||
MR_CHLEN_5 = $0;
|
||||
MR_CHLEN_6 = $4;
|
||||
MR_CHLEN_7 = $8;
|
||||
MR_CHLEN_8 = $C;
|
||||
MR_BR_1 = $1;
|
||||
MR_BR_16 = $2;
|
||||
MR_BR_64 = $3;
|
||||
|
||||
type
|
||||
Sio1CallbackFunction = function: pointer;
|
||||
|
||||
function AddSIO(baud: longint): longint; external;
|
||||
function DelSIO: longint; external;
|
||||
function _sio_control(cmd, arg, param: dword): longint; external;
|
||||
function Sio1Callback(func: Sio1CallbackFunction): longint; external;
|
||||
|
||||
|
||||
generic function __va_rounded_size<T>: SizeInt;
|
||||
generic procedure va_start<T>(out AP: Pointer; var LastArg: T);
|
||||
procedure va_end(out AP: Pointer);
|
||||
generic function va_arg<T>(var AP: Pointer):T;
|
||||
|
||||
implementation
|
||||
|
||||
generic function __va_rounded_size<T>: SizeInt;inline;
|
||||
begin
|
||||
Result := ((sizeof(T) + sizeof (longint) - 1) div sizeof (longint)) * sizeof (longint);
|
||||
end;
|
||||
|
||||
generic procedure va_start<T>(out AP: Pointer; var LastArg: T);inline;
|
||||
begin
|
||||
AP := Pointer(@LastArg) + specialize __va_rounded_size<T>;
|
||||
end;
|
||||
|
||||
procedure va_end(out AP: Pointer);inline;
|
||||
begin
|
||||
AP := nil;
|
||||
end;
|
||||
|
||||
generic function va_arg<T>(var AP: Pointer):T;inline;
|
||||
type
|
||||
PT=^T;
|
||||
begin
|
||||
Result := PT(AP)^;
|
||||
Inc(AP, specialize __va_rounded_size<T>);
|
||||
end;
|
||||
|
||||
|
||||
function strdup(p: pchar): pchar;
|
||||
begin
|
||||
@ -728,6 +1266,69 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
// Address conversion macros
|
||||
function K0_TO_K1(x: dword): dword;
|
||||
begin
|
||||
result:= x or $A0000000;
|
||||
end;
|
||||
|
||||
function K1_TO_K0(x: dword): dword;
|
||||
begin
|
||||
result:= x and $9FFFFFFF;
|
||||
end;
|
||||
|
||||
function K0_TO_PHYS(x: dword): dword;
|
||||
begin
|
||||
result:= x and $1FFFFFFF;
|
||||
end;
|
||||
|
||||
function K1_TO_PHYS(x: dword): dword;
|
||||
begin
|
||||
result:= x and $1FFFFFFF;
|
||||
end;
|
||||
|
||||
function PHYS_TO_K0(x: dword): dword;
|
||||
begin
|
||||
result:= x or $80000000;
|
||||
end;
|
||||
|
||||
function PHYS_TO_K1(x: dword): dword;
|
||||
begin
|
||||
result:= x or $A0000000;
|
||||
end;
|
||||
|
||||
// Address predicates
|
||||
function IS_KSEG0(x: dword): boolean;
|
||||
begin
|
||||
result:= ((x >= K0BASE) and (x < K1BASE));
|
||||
end;
|
||||
|
||||
function IS_KSEG1(x: dword): boolean;
|
||||
begin
|
||||
result:= ((x >= K1BASE) and (x < K2BASE));
|
||||
end;
|
||||
|
||||
{
|
||||
function IS_KSEG2(x: dword): boolean;
|
||||
begin
|
||||
result:= ((x >= K2BASE) and (x < KPTEBASE));
|
||||
end;
|
||||
|
||||
function IS_KPTESEG(x: dword): boolean;
|
||||
begin
|
||||
result:= (x >= KPTEBASE);
|
||||
end;
|
||||
}
|
||||
|
||||
function IS_KUSEG(x: dword): boolean;
|
||||
begin
|
||||
result:= (x < K0BASE);
|
||||
end;
|
||||
|
||||
function EXC_CODE(x: dword): dword;
|
||||
begin
|
||||
result:= x shl 2;
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
13
rtl/ps1/psy-q-sdk/libtap.pas
Normal file
13
rtl/ps1/psy-q-sdk/libtap.pas
Normal file
@ -0,0 +1,13 @@
|
||||
// libtap.h: Multi Tap Interface
|
||||
unit libtap;
|
||||
interface
|
||||
|
||||
procedure InitTAP(bufA: pbyte; lenA: longint; bufB: pbyte; lenB: longint); external;
|
||||
procedure StartTAP; external;
|
||||
procedure StopTAP; external;
|
||||
procedure EnableTAP; external;
|
||||
procedure DisableTAP; external;
|
||||
|
||||
implementation
|
||||
begin
|
||||
end.
|
@ -1,296 +0,0 @@
|
||||
//
|
||||
// $PSLibId: Run-time Library Release 4.6$
|
||||
//
|
||||
{$MODE OBJFPC}
|
||||
unit r3000;
|
||||
interface
|
||||
const
|
||||
|
||||
// Segment base addresses and sizes
|
||||
K0BASE = $80000000;
|
||||
K0SIZE = $20000000;
|
||||
K1BASE = $A0000000;
|
||||
K1SIZE = $20000000;
|
||||
K2BASE = $C0000000;
|
||||
K2SIZE = $20000000;
|
||||
|
||||
// Exception vectors
|
||||
UT_VEC = K0BASE; // utlbmiss vector
|
||||
E_VEC = K0BASE + $80; // exception vector
|
||||
R_VEC = K1BASE + $1fc00000; // reset vector
|
||||
|
||||
// Address conversion macros
|
||||
function K0_TO_K1(x: dword): dword; // kseg0 to kseg1
|
||||
function K1_TO_K0(x: dword): dword; // kseg1 to kseg0
|
||||
function K0_TO_PHYS(x: dword): dword; // kseg0 to physical
|
||||
function K1_TO_PHYS(x: dword): dword; // kseg1 to physical
|
||||
function PHYS_TO_K0(x: dword): dword; // physical to kseg0
|
||||
function PHYS_TO_K1(x: dword): dword; // physical to kseg1
|
||||
|
||||
// Address predicates
|
||||
function IS_KSEG0(x: dword): boolean;
|
||||
function IS_KSEG1(x: dword): boolean;
|
||||
// function IS_KSEG2(x: dword): boolean;
|
||||
// function IS_KPTESEG(x: dword): boolean;
|
||||
function IS_KUSEG(x: dword): boolean;
|
||||
|
||||
|
||||
const
|
||||
// Cache size constants
|
||||
MINCACHE = 4 * 1024;
|
||||
MAXCACHE = 64 * 1024;
|
||||
|
||||
|
||||
// Status register
|
||||
SR_CUMASK = $f0000000; // coproc usable bits
|
||||
|
||||
SR_CU3 = $80000000; // Coprocessor 3 usable
|
||||
SR_CU2 = $40000000; // Coprocessor 2 usable
|
||||
SR_CU1 = $20000000; // Coprocessor 1 usable
|
||||
SR_CU0 = $10000000; // Coprocessor 0 usable
|
||||
|
||||
SR_BEV = $00400000; // use boot exception vectors
|
||||
|
||||
// Cache control bits
|
||||
SR_TS = $00200000; // TLB shutdown
|
||||
SR_PE = $00100000; // cache parity error
|
||||
SR_CM = $00080000; // cache miss
|
||||
SR_PZ = $00040000; // cache parity zero
|
||||
SR_SWC = $00020000; // swap cache
|
||||
SR_ISC = $00010000; // Isolate data cache
|
||||
|
||||
SR_MM_MODE = $00010000; // lwl/swl/etc become scache/etc
|
||||
{
|
||||
define:
|
||||
lcache lwl
|
||||
scache swl
|
||||
flush lwr $0,
|
||||
inval swr $0,
|
||||
}
|
||||
|
||||
|
||||
// Interrupt enable bits
|
||||
// (NOTE: bits set to 1 enable the corresponding level interrupt)
|
||||
SR_IMASK = $0000ff00; // Interrupt mask
|
||||
SR_IMASK8 = $00000000; // mask level 8
|
||||
SR_IMASK7 = $00008000; // mask level 7
|
||||
SR_IMASK6 = $0000c000; // mask level 6
|
||||
SR_IMASK5 = $0000e000; // mask level 5
|
||||
SR_IMASK4 = $0000f000; // mask level 4
|
||||
SR_IMASK3 = $0000f800; // mask level 3
|
||||
SR_IMASK2 = $0000fc00; // mask level 2
|
||||
SR_IMASK1 = $0000fe00; // mask level 1
|
||||
SR_IMASK0 = $0000ff00; // mask level 0
|
||||
|
||||
SR_IBIT8 = $00008000; // bit level 8
|
||||
SR_IBIT7 = $00004000; // bit level 7
|
||||
SR_IBIT6 = $00002000; // bit level 6
|
||||
SR_IBIT5 = $00001000; // bit level 5
|
||||
SR_IBIT4 = $00000800; // bit level 4
|
||||
SR_IBIT3 = $00000400; // bit level 3
|
||||
SR_IBIT2 = $00000200; // bit level 2
|
||||
SR_IBIT1 = $00000100; // bit level 1
|
||||
|
||||
SR_KUO = $00000020; // old kernel/user, 0 => k, 1 => u
|
||||
SR_IEO = $00000010; // old interrupt enable, 1 => enable
|
||||
SR_KUP = $00000008; // prev kernel/user, 0 => k, 1 => u
|
||||
SR_IEP = $00000004; // prev interrupt enable, 1 => enable
|
||||
SR_KUC = $00000002; // cur kernel/user, 0 => k, 1 => u
|
||||
SR_IEC = $00000001; // cur interrupt enable, 1 => enable
|
||||
|
||||
SR_IMASKSHIFT = 8;
|
||||
|
||||
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
|
||||
|
||||
CAUSE_BD = $80000000; // Branch delay slot */
|
||||
CAUSE_CEMASK = $30000000; // coprocessor error */
|
||||
CAUSE_CESHIFT = 28;
|
||||
|
||||
/// Interrupt pending bits
|
||||
CAUSE_IP8 = $00008000; // External level 8 pending
|
||||
CAUSE_IP7 = $00004000; // External level 7 pending
|
||||
CAUSE_IP6 = $00002000; // External level 6 pending
|
||||
CAUSE_IP5 = $00001000; // External level 5 pending
|
||||
CAUSE_IP4 = $00000800; // External level 4 pending
|
||||
CAUSE_IP3 = $00000400; // External level 3 pending
|
||||
CAUSE_SW2 = $00000200; // Software level 2 pending
|
||||
CAUSE_SW1 = $00000100; // Software level 1 pending
|
||||
|
||||
CAUSE_IPMASK = $0000FF00; // Pending interrupt mask
|
||||
CAUSE_IPSHIFT = 8;
|
||||
|
||||
CAUSE_EXCMASK = $0000003C; // Cause code bits
|
||||
CAUSE_EXCSHIFT = 2;
|
||||
|
||||
CAUSE_FMT = '\20\40BD\36CE1\35CE0\20IP8\17IP7\16IP6\15IP5\14IP4\13IP3\12SW2\11SW1\1INT';
|
||||
|
||||
|
||||
// Cause register exception codes
|
||||
function EXC_CODE(x: dword): dword;
|
||||
|
||||
const
|
||||
// Hardware exception codes
|
||||
EXC_INT = 0 shl 2; // interrupt
|
||||
EXC_MOD = 1 shl 2; // TLB mod
|
||||
EXC_RMISS = 2 shl 2; // Read TLB Miss
|
||||
EXC_WMISS = 3 shl 2; // Write TLB Miss
|
||||
EXC_RADE = 4 shl 2; // Read Address Error
|
||||
EXC_WADE = 5 shl 2; // Write Address Error
|
||||
EXC_IBE = 6 shl 2; // Instruction Bus Error
|
||||
EXC_DBE = 7 shl 2; // Data Bus Error
|
||||
EXC_SYSCALL = 8 shl 2; // SYSCALL
|
||||
EXC_BREAK = 9 shl 2; // BREAKpoint
|
||||
EXC_II = 10 shl 2; // Illegal Instruction
|
||||
EXC_CPU = 11 shl 2; // CoProcessor Unusable
|
||||
EXC_OV = 12 shl 2; // OVerflow
|
||||
|
||||
// software exception codes
|
||||
SEXC_SEGV = 16 shl 2; // Software detected seg viol
|
||||
SEXC_RESCHED= 17 shl 2; // resched request
|
||||
SEXC_PAGEIN = 18 shl 2; // page-in request
|
||||
SEXC_CPU = 19 shl 2; // 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
|
||||
C0_READI = $1; // read ITLB entry addressed by C0_INDEX
|
||||
C0_WRITEI = $2; // write ITLB entry addressed by C0_INDEX
|
||||
C0_WRITER = $6; // write ITLB entry addressed by C0_RAND
|
||||
C0_PROBE = $8; // probe for ITLB entry addressed by TLBHI
|
||||
C0_RFE = $10; // restore for exception
|
||||
|
||||
// Flags for the nofault handler. 0 means no fault is expected.
|
||||
NF_BADADDR = 1; // badaddr, wbadaddr
|
||||
NF_COPYIO = 2; // copyin, copyout
|
||||
NF_ADDUPC = 3; // addupc
|
||||
NF_FSUMEM = 4; // fubyte, subyte, fuword, suword
|
||||
NF_USERACC = 5; // useracc
|
||||
NF_SOFTFP = 6; // softfp
|
||||
NF_REVID = 7; // revision ids
|
||||
NF_NENTRIES = 8;
|
||||
|
||||
// TLB size constants
|
||||
TLBWIREDBASE = 0; // WAG for now
|
||||
NWIREDENTRIES = 8; // WAG for now
|
||||
TLBRANDOMBASE = NWIREDENTRIES;
|
||||
NTLBENTRIES = 64;
|
||||
NRANDOMENTRIES = (NTLBENTRIES - NWIREDENTRIES);
|
||||
|
||||
|
||||
TLBRAND_RANDMASK = $00003f00;
|
||||
TLBRAND_RANDSHIFT = 8;
|
||||
|
||||
|
||||
// Chip interrupt vector
|
||||
NC0VECS = 8;
|
||||
|
||||
|
||||
|
||||
// extern int (*c0vec_tbl[])();
|
||||
var
|
||||
c0vec_tbl : array of function: longint; external;
|
||||
|
||||
|
||||
const
|
||||
BRK_KERNEL = $f1;
|
||||
EXCEPT_NORM = 1;
|
||||
EXCEPT_UTLB = 2;
|
||||
EXCEPT_BRKPT = 3;
|
||||
EXCEPT_DB = 4;
|
||||
EXCEPT_GDB = 4;
|
||||
EXCEPT_INT = 9;
|
||||
EXCEPT_ELSE = $ff;
|
||||
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
// Address conversion macros
|
||||
function K0_TO_K1(x: dword): dword;
|
||||
begin
|
||||
result:= x or $A0000000;
|
||||
end;
|
||||
|
||||
function K1_TO_K0(x: dword): dword;
|
||||
begin
|
||||
result:= x and $9FFFFFFF;
|
||||
end;
|
||||
|
||||
function K0_TO_PHYS(x: dword): dword;
|
||||
begin
|
||||
result:= x and $1FFFFFFF;
|
||||
end;
|
||||
|
||||
function K1_TO_PHYS(x: dword): dword;
|
||||
begin
|
||||
result:= x and $1FFFFFFF;
|
||||
end;
|
||||
|
||||
function PHYS_TO_K0(x: dword): dword;
|
||||
begin
|
||||
result:= x or $80000000;
|
||||
end;
|
||||
|
||||
function PHYS_TO_K1(x: dword): dword;
|
||||
begin
|
||||
result:= x or $A0000000;
|
||||
end;
|
||||
|
||||
// Address predicates
|
||||
function IS_KSEG0(x: dword): boolean;
|
||||
begin
|
||||
result:= ((x >= K0BASE) and (x < K1BASE));
|
||||
end;
|
||||
|
||||
function IS_KSEG1(x: dword): boolean;
|
||||
begin
|
||||
result:= ((x >= K1BASE) and (x < K2BASE));
|
||||
end;
|
||||
|
||||
|
||||
{
|
||||
function IS_KSEG2(x: dword): boolean;
|
||||
begin
|
||||
result:= ((x >= K2BASE) and (x < KPTEBASE));
|
||||
end;
|
||||
|
||||
function IS_KPTESEG(x: dword): boolean;
|
||||
begin
|
||||
result:= (x >= KPTEBASE);
|
||||
end;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function IS_KUSEG(x: dword): boolean;
|
||||
begin
|
||||
result:= (x < K0BASE);
|
||||
end;
|
||||
|
||||
function EXC_CODE(x: dword): dword;
|
||||
begin
|
||||
result:= x shl 2;
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user