/packages/libndsfpc/src/nds/jtypes.inc

https://github.com/slibre/freepascal · Pascal · 128 lines · 51 code · 16 blank · 61 comment · 0 complexity · edd86a9f71925792f619b623473a4d4f MD5 · raw file

  1. //---------------------------------------------------------------------------------
  2. {
  3. //---------------------------------------------------------------------------------
  4. // libgba compatible section macros
  5. //---------------------------------------------------------------------------------
  6. #define ITCM_CODE __attribute__((section(".itcm"), long_call))
  7. #define DTCM_DATA __attribute__((section(".dtcm")))
  8. #define DTCM_BSS __attribute__((section(".sbss")))
  9. #define ALIGN(m) __attribute__((aligned (m)))
  10. #define PACKED __attribute__ ((packed))
  11. #define packed_struct struct PACKED
  12. }
  13. //---------------------------------------------------------------------------------
  14. // These are linked to the bin2o macro in the Makefile
  15. //---------------------------------------------------------------------------------
  16. { ### To do
  17. #define GETRAW(name) (name)
  18. #define GETRAWSIZE(name) ((int)name##_size)
  19. #define GETRAWEND(name) ((int)name##_end)
  20. }
  21. {$ifdef NDS_INTERFACE}
  22. type
  23. (* Unsigned types *)
  24. uint8 = cuint8;
  25. uint16 = cuint16;
  26. uint32 = cuint32;
  27. uint64 = cuint64;
  28. puint8 = pcuint8;
  29. puint16 = pcuint16;
  30. puint32 = pcuint32;
  31. puint64 = pcuint64;
  32. (* Signed types *)
  33. int8 = cint8;
  34. int16 = cint16;
  35. int32 = cint32;
  36. pint8 = pcint8;
  37. pint16 = pcint16;
  38. pint32 = pcint32;
  39. pint64 = pcint64;
  40. float32 = cfloat;
  41. {
  42. typedef volatile uint8 vuint8;
  43. typedef volatile uint16 vuint16;
  44. typedef volatile uint32 vuint32;
  45. typedef volatile uint64 vuint64;
  46. typedef volatile int8 vint8;
  47. typedef volatile int16 vint16;
  48. typedef volatile int32 vint32;
  49. typedef volatile int64 vint64;
  50. typedef volatile float32 vfloat32;
  51. typedef volatile float64 vfloat64;
  52. }
  53. {
  54. typedef volatile int32 vfixed;
  55. }
  56. u8 = cuint8;
  57. u16 = cuint16;
  58. u32 = cuint32;
  59. u64 = cuint64;
  60. pu8 = pcuint8;
  61. pu16 = pcuint16;
  62. pu32 = pcuint32;
  63. pu64 = pcuint64;
  64. s8 = cint8;
  65. s16 = cint16;
  66. s32 = cint32;
  67. s64 = cint64;
  68. ps8 = pcint8;
  69. ps16 = pcint16;
  70. ps32 = pcint32;
  71. ps64 = pcint64;
  72. {
  73. typedef volatile u8 vu8;
  74. typedef volatile u16 vu16;
  75. typedef volatile u32 vu32;
  76. typedef volatile u64 vu64;
  77. typedef volatile s8 vs8;
  78. typedef volatile s16 vs16;
  79. typedef volatile s32 vs32;
  80. typedef volatile s64 vs64;
  81. }
  82. touchPosition = record
  83. x: cint16;
  84. y: cint16;
  85. px: cint16;
  86. py: cint16;
  87. z1: cint16;
  88. z2: cint16;
  89. end;
  90. TtouchPosition = touchPosition;
  91. PtouchPosition = ^touchPosition;
  92. //IntFn = function: pointer;
  93. VoidFunctionPointer = function: pointer; cdecl;
  94. //fp = function: pointer;
  95. IntFn = procedure;
  96. //VoidFunctionPointer = procedure; cdecl;
  97. fp = procedure;
  98. {$endif NDS_INTERFACE}
  99. {$ifdef NDS_IMPLEMENTATION}
  100. function BIT(n: cint): cint; inline;
  101. begin
  102. BIT := (1 shl (n));
  103. end;
  104. {$endif NDS_IMPLEMENTATION}
  105. {$ifdef NDS_INTERFACE}
  106. function BIT(n: cint): cint; inline;
  107. {$endif NDS_INTERFACE}