git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

gbdk-lib/include/asm/types.h

      1 /** @file asm/types.h
      2     Shared types definitions.
      3 */
      4 #ifndef ASM_TYPES_INCLUDE
      5 #define ASM_TYPES_INCLUDE
      6 
      7 #if defined(__PORT_sm83)
      8 #include <asm/sm83/types.h>
      9 #elif defined(__PORT_z80)
     10 #include <asm/z80/types.h>
     11 #elif defined(__PORT_mos6502)
     12 #include <asm/mos6502/types.h>
     13 #else
     14 #error Unrecognised port
     15 #endif
     16 
     17 #ifndef OLDCALL
     18 #if __SDCC_REVISION >= 12608
     19 #define OLDCALL __sdcccall(0)
     20 #else
     21 #define OLDCALL
     22 #endif
     23 #endif
     24 
     25 #ifdef __SDCC
     26 #define PRESERVES_REGS(...) __preserves_regs(__VA_ARGS__)
     27 #define NAKED    __naked
     28 #define SFR      __sfr
     29 #define AT(A)    __at(A)
     30 #define NORETURN _Noreturn
     31 #else
     32 #define PRESERVES_REGS(...)
     33 #define NAKED
     34 #define SFR
     35 #define AT(A)
     36 #define NORETURN
     37 #endif
     38 
     39 #ifndef NONBANKED
     40 #define NONBANKED
     41 #endif
     42 #ifndef BANKED
     43 #define BANKED
     44 #endif
     45 #ifndef CRITICAL
     46 #define CRITICAL
     47 #endif
     48 #ifndef INTERRUPT
     49 #define INTERRUPT
     50 #endif
     51 
     52 /** TRUE or FALSE.
     53     @anchor file_asm_types_h
     54  */
     55 typedef INT8    BOOLEAN;
     56 
     57 /** Signed 8 bit.
     58  */
     59 typedef INT8    BYTE;
     60 /** Unsigned 8 bit.
     61  */
     62 typedef UINT8   UBYTE;
     63 /** Signed 16 bit */
     64 typedef INT16   WORD;
     65 /** Unsigned 16 bit */
     66 typedef UINT16  UWORD;
     67 /** Signed 32 bit */
     68 typedef INT32   LWORD;
     69 /** Unsigned 32 bit */
     70 typedef UINT32  ULWORD;
     71 /** Signed 32 bit */
     72 typedef INT32	  DWORD;
     73 /** Unsigned 32 bit */
     74 typedef UINT32	UDWORD;
     75 
     76 /** Useful definition for working with 8 bit + 8 bit fixed point values
     77 
     78     Use `.w` to access the variable as unsigned 16 bit type.
     79 
     80     Use `.b.h` and `.b.l` (or just `.h` and `.l`) to directly access it's high and low unsigned 8 bit values.
     81  */
     82 typedef union _fixed {
     83     struct {
     84         UBYTE l;
     85         UBYTE h;
     86     };
     87     struct {
     88         UBYTE l;
     89         UBYTE h;
     90     } b;
     91     UWORD w;
     92 } fixed;
     93 
     94 #endif

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.