The SGADE Documentation

the SGADE The Socrates Gameboy Advance Development Engine

The SGADE is a development library for the Nintendo Gameboy Advance. It's free for all uses and is distributed without guarantees. For more information visit the SGADE page.


Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

SoDisplay.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00013 // ----------------------------------------------------------------------------
00014 
00015 #ifndef SO_DISPLAY_H
00016 #define SO_DISPLAY_H
00017 
00018 #ifdef __cplusplus
00019     extern "C" {
00020 #endif
00021 
00022 
00023 // ---------------------------------------------------------------------------- //! @{
00035 // ----------------------------------------------------------------------------
00036 
00037 // ----------------------------------------------------------------------------
00038 // Includes
00039 // ----------------------------------------------------------------------------
00040 
00041 #include "SoSystem.h"
00042 
00043 // ----------------------------------------------------------------------------
00044 // Defines
00045 // ----------------------------------------------------------------------------
00046 
00048 #define SO_REG_DISP_CNT             (*(volatile u16*)0x4000000) 
00049 
00051 #define SO_REG_DISP_STAT            (*(volatile u16*)0x4000004) 
00052 
00054 #define SO_REG_SCANLINE_COUNT       (*(volatile u16*)0x4000006) 
00055 
00058 #define     SO_REG_DISP_MOSAIC_W        (*(volatile u16*)0x400004C) 
00059 
00062 extern u16 SO_REG_DISP_MOSAIC_RW;
00063 
00064 // Screen dimensions;                   
00065 #define SO_SCREEN_WIDTH             240                         
00066 #define SO_SCREEN_HALF_WIDTH        (SO_SCREEN_WIDTH / 2)       
00067 #define SO_SCREEN_HEIGHT            160                         
00068 #define SO_SCREEN_HALF_HEIGHT       (SO_SCREEN_HEIGHT / 2)      
00069 
00070 // Colors
00071 #define SO_RED                      (SO_5_BITS)                     
00072 #define SO_GREEN                    (SO_5_BITS << 5)                
00073 #define SO_BLUE                     (SO_5_BITS << 10)               
00074 #define SO_WHITE                    (SO_RED | SO_GREEN | SO_BLUE)   
00075 #define SO_BLACK                    0                               
00076 #define SO_YELLOW                   (SO_RED | SO_GREEN)             
00077 #define SO_CYAN                     (SO_BLUE | SO_GREEN)            
00078 #define SO_MAGENTA                  (SO_RED | SO_BLUE)              
00079 #define SO_PURPLE                   SO_MAGENTA                      
00080 
00081 // ----------------------------------------------------------------------------
00082 // Macros
00083 // ----------------------------------------------------------------------------
00084 
00085 #define SO_RGB( r, g, b )       (((b)<<10)+((g)<<5)+(r))    
00086 #define SO_RGB_GET_R( c )       (((c)&(31    ))    )        
00087 #define SO_RGB_GET_G( c )       (((c)&(31<< 5))>> 5)        
00088 #define SO_RGB_GET_B( c )       (((c)&(31<<10))>>10)        
00089 
00090 #define SO_SCREEN_HALF_WIDTH_MULTIPLY( y ) (((y)<<7)-((y)<<3))  
00091 
00092 // ----------------------------------------------------------------------------
00093 // Functions
00094 // ----------------------------------------------------------------------------
00095 
00096 void SoDisplayInitialize(         void );
00097 
00098 void SoDisplayEnable(u32 a_Enable);
00099 
00100 void SoDisplaySetMode(u32 a_Mode);
00101 u32  SoDisplayGetMode(void);
00102 
00103 u32  SoDisplayGetVCounter(        void );
00104 
00105 bool SoDisplayIsInVBlank(         void );
00106 bool SoDisplayIsInHBlank(         void );
00107 
00108 void SoDisplayWaitForVBlankStart( void );
00109 void SoDisplayWaitForVBlankEnd(   void );
00110 
00111 // ----------------------------------------------------------------------------
00112 // EOF
00113 // ----------------------------------------------------------------------------
00114 
00116 
00117 #ifdef __cplusplus
00118 } // extern "C"
00119 #endif
00120     
00121 #endif

Copyright 2002 by the SGADE authors. See SoLicense.h or Visit the SGADE page for more information.