bios.inc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. (*
  2. $Id: bios.inc 25 2007-12-10 21:06:46Z p4p3r0 $
  3. ------------------------------------------------------------------------------
  4. Copyright (C) 2005
  5. Jason Rogers (dovoto)
  6. Dave Murphy (WinterMute)
  7. This software is provided 'as-is', without any express or implied
  8. warranty. In no event will the authors be held liable for any
  9. damages arising from the use of this software.
  10. Permission is granted to anyone to use this software for any
  11. purpose, including commercial applications, and to alter it and
  12. redistribute it freely, subject to the following restrictions:
  13. 1. The origin of this software must not be misrepresented; you
  14. must not claim that you wrote the original software. If you use
  15. this software in a product, an acknowledgment in the product
  16. documentation would be appreciated but is not required.
  17. 2. Altered source versions must be plainly marked as such, and
  18. must not be misrepresented as being the original software.
  19. 3. This notice may not be removed or altered from any source
  20. distribution.
  21. ------------------------------------------------------------------------------
  22. Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
  23. (http://www.freepascal.org)
  24. Copyright (C) 2006 Francesco Lombardi
  25. Check http://sourceforge.net/projects/libndsfpc for updates
  26. ------------------------------------------------------------------------------
  27. $Log$
  28. *)
  29. {$ifdef NDS_INTERFACE}
  30. type
  31. TGetSize = function(source: pcuint8; dest: pcuint16; r2: cuint32): pcint;
  32. TGetResult = function(source: pcuint8): pcint;
  33. TReadByte = function(source: pcuint8): pcuint8;
  34. type
  35. DecompressionStream = packed record
  36. getSize: TGetSize;
  37. getResult: TGetResult;
  38. readByte: TReadByte;
  39. end;
  40. TDecompressionStream = DecompressionStream;
  41. PDecompressionStream = ^TDecompressionStream;
  42. UnpackStruct = packed record
  43. sourceSize: cuint16; // in bytes
  44. sourceWidth: cuint8;
  45. destWidth: cuint8;
  46. dataOffset: cuint32;
  47. end;
  48. TUnpackStruct = UnpackStruct;
  49. PUnpackStruct = ^TUnpackStruct;
  50. procedure swiSoftReset(); cdecl; external;
  51. procedure swiDelay(duration: cuint32); cdecl; external;
  52. procedure swiIntrWait(waitForSet: cint; flags: cuint32); cdecl; external;
  53. procedure swiWaitForVBlank(); cdecl; external;
  54. function swiDivide(numerator, divisor: cint): cint; cdecl; external;
  55. function swiRemainder(numerator, divisor: cint): cint; cdecl; external;
  56. procedure swiDivMod(numerator, divisor: cint; result, remainder: pcint); cdecl; external;
  57. const
  58. COPY_MODE_HWORD = (0);
  59. COPY_MODE_WORD = (1 shl 26);
  60. COPY_MODE_COPY = (0);
  61. COPY_MODE_FILL = (1 shl 24);
  62. procedure swiCopy(const source: pointer; dest: pointer; flags: cint); cdecl; external;
  63. procedure swiFastCopy(const source: pointer; dest: pointer; flags: cint); cdecl; external;
  64. function swiSqrt(value: cint): cint; cdecl; external;
  65. function swiCRC16(crc: cuint16; data: pointer; size: cuint32): cuint16; cdecl; external;
  66. function swiIsDebugger(): cint; cdecl; external;
  67. procedure swiUnpackBits(source: pcuint8; destination: pcuint32; params: PUnpackStruct); cdecl; external;
  68. procedure swiDecompressLZSSWram(source, destination: pointer); cdecl; external;
  69. function swiDecompressLZSSVram(source, destination: pointer; toGetSize: cuint32; stream: PDecompressionStream): cint; cdecl; external;
  70. function swiDecompressHuffman(source, destination: pointer; toGetSize: cuint32; stream: PDecompressionStream): cint; cdecl; external;
  71. procedure swiDecompressRLEWram(source, destination: pointer); cdecl; external;
  72. function swiDecompressRLEVram(source, destination: pointer; toGetSize: cuint32; stream: PDecompressionStream): cint; cdecl; external;
  73. {$endif NDS_INTERFACE}
  74. {$ifdef NDS_INTERFACE}
  75. {$ifdef ARM9}
  76. procedure swiWaitForIRQ(); cdecl; external;
  77. procedure swiSetHaltCR(data: cuint32); cdecl; external;
  78. procedure swiDecodeDelta8(source, destination: pointer); cdecl; external;
  79. procedure swiDecodeDelta16(source, destination: pointer); cdecl; external;
  80. {$endif ARM9}
  81. {$ifdef ARM7}
  82. procedure swiHalt(); cdecl; external;
  83. procedure swiSleep(); cdecl; external;
  84. procedure swiSwitchToGBAMode(); cdecl; external;
  85. procedure swiSetHaltCR(data: cuint8); cdecl; external;
  86. function swiGetSineTable(index: cint): cuint16; cdecl; external;
  87. function swiGetPitchTable(index: cint): cuint16; cdecl; external;
  88. function swiGetVolumeTable(index: cint): cuint8; cdecl; external;
  89. procedure swiChangeSoundBias(enabled, delay: cint); cdecl; external;
  90. {$endif ARM7}
  91. {$endif NDS_INTERFACE}