PageRenderTime 31ms CodeModel.GetById 24ms app.highlight 5ms RepoModel.GetById 0ms app.codeStats 1ms

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