mbv2.inc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. (*
  2. $Id$
  3. ------------------------------------------------------------------------------
  4. Header file for libgba mbv2 functions
  5. Copyright 2003-2004 by Dave Murphy.
  6. This library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Library General Public
  8. License as published by the Free Software Foundation; either
  9. version 2 of the License, or (at your option) any later version.
  10. This library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  17. USA.
  18. Please report all bugs and problems through the bug tracker at
  19. "http://sourceforge.net/tracker/?group_id=114505&atid=668551".
  20. ------------------------------------------------------------------------------
  21. Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
  22. (http://www.freepascal.org)
  23. Copyright (C) 2006 Francesco Lombardi
  24. Check http://sourceforge.net/projects/libndsfpc for updates
  25. ------------------------------------------------------------------------------
  26. $Log$
  27. *)
  28. {$ifdef GBA_INTERFACE}
  29. //---------------------------------------------------------------------------------
  30. // Don't Use these function names
  31. //---------------------------------------------------------------------------------
  32. procedure mbv2_dprintf(str: pchar; args: array of const); cdecl; external;
  33. procedure mbv2_dfprintf(fp: integer; str: pchar; args: array of const); cdecl; external;
  34. function mbv2_dputchar(c: integer): integer; cdecl; external;
  35. function mbv2_dgetch(): integer; cdecl; external;
  36. function mbv2_dkbhit(): integer; cdecl; external;
  37. function mbv2_dfopen(const _file: pchar; const _type: pchar): integer; cdecl; external;
  38. function mbv2_dfclose (fp: integer): integer; cdecl; external;
  39. function mbv2_dfgetc(fp: integer): integer; cdecl; external;
  40. function mbv2_dfputc(ch, fp: integer): integer; cdecl; external;
  41. procedure mbv2_drewind(fp: integer); cdecl; external;
  42. //---------------------------------------------------------------------------------
  43. // Use these function names instead
  44. // these will be repeated for VBA & Xcomms
  45. //---------------------------------------------------------------------------------
  46. procedure dprintf(str: pchar; args: array of const); inline;
  47. procedure dfprintf(fp: integer; str: pchar; args: array of const); inline;
  48. function dputchar(c: integer): integer; inline;
  49. function dgetch(): integer; inline;
  50. function dkbhit(): integer; inline;
  51. function dfopen(const _file: pchar; const _type: pchar): integer; inline;
  52. function dfclose (fp: integer): integer; inline;
  53. function dfgetc(fp: integer): integer; inline;
  54. function dfputc(ch, fp: integer): integer; inline;
  55. procedure drewind(fp: integer); inline;
  56. const
  57. __DOUTBUFSIZE = 256;
  58. __FINBUFSIZE = 256; //Must be a multiple of 2! (ex: 32,64,128,256,512..)
  59. __KINBUFSIZE = 64; //Must be a multiple of 2! (ex: 32,64,128,256,512..)
  60. __ESCCHR = 27;
  61. __ESC_NADA = 0;
  62. __ESC_ESCCHR = 1;
  63. __ESC_FOPEN = 2;
  64. __ESC_FCLOSE = 3;
  65. __ESC_FGETC = 4;
  66. __ESC_FPUTC = 5;
  67. __ESC_REWIND = 6;
  68. __ESC_FPUTC_PROCESSED = 7; // PC side add CR before LF if DOS machine
  69. __ESC_KBDCHR = 8;
  70. function __dputchar (c: integer): integer; cdecl; external;
  71. {$endif GBA_INTERFACE}
  72. {$ifdef GBA_IMPLEMENTATION}
  73. //---------------------------------------------------------------------------------
  74. // Use these function names instead
  75. // these will be repeated for VBA & Xcomms
  76. //---------------------------------------------------------------------------------
  77. procedure dprintf(str: pchar; args: array of const); inline;
  78. begin
  79. mbv2_dprintf(str, args);
  80. end;
  81. procedure dfprintf(fp: integer; str: pchar; args: array of const); inline;
  82. begin
  83. mbv2_dfprintf(fp, str, args);
  84. end;
  85. function dputchar(c: integer): integer; inline;
  86. begin
  87. dputchar := mbv2_dputchar(c);
  88. end;
  89. function dgetch(): integer; inline;
  90. begin
  91. dgetch := mbv2_dgetch();
  92. end;
  93. function dkbhit(): integer; inline;
  94. begin
  95. dkbhit := mbv2_dkbhit();
  96. end;
  97. function dfopen(const _file: pchar; const _type: pchar): integer; inline;
  98. begin
  99. dfopen := mbv2_dfopen(_file, _type);
  100. end;
  101. function dfclose (fp: integer): integer; inline;
  102. begin
  103. dfclose := mbv2_dfclose(fp);
  104. end;
  105. function dfgetc(fp: integer): integer; inline;
  106. begin
  107. dfgetc := mbv2_dfgetc(fp);
  108. end;
  109. function dfputc(ch, fp: integer): integer; inline;
  110. begin
  111. dfputc := mbv2_dfputc(ch, fp);
  112. end;
  113. procedure drewind(fp: integer); inline;
  114. begin
  115. mbv2_drewind(fp);
  116. end;
  117. {$endif GBA_IMPLEMENTATION}