sgdk
|
00001 00010 #ifndef _SYS_H_ 00011 #define _SYS_H_ 00012 00013 00014 #define PROCESS_PALETTE_FADING (1 << 0) 00015 #define PROCESS_BITMAP_TASK (1 << 1) 00016 #define PROCESS_DMA_TASK (1 << 2) 00017 #define PROCESS_XGM_TASK (1 << 3) 00018 #define PROCESS_VDP_SCROLL_TASK (1 << 4) 00019 00020 00021 #define ROM_ALIGN_BIT 17 00022 #define ROM_ALIGN (1 << ROM_ALIGN_BIT) 00023 #define ROM_ALIGN_MASK (ROM_ALIGN - 1) 00024 00025 #define ROM_START 0 00026 #define ROM_END (((u32) &_stext) + ((u32) &_sdata)) 00027 #define ROM_SIZE ((ROM_END + ROM_ALIGN_MASK) & (~ROM_ALIGN_MASK)) 00028 00029 00030 // exist through rom_head.c 00031 typedef struct 00032 { 00033 char console[16]; /* Console Name (16) */ 00034 char copyright[16]; /* Copyright Information (16) */ 00035 char title_local[48]; /* Domestic Name (48) */ 00036 char title_int[48]; /* Overseas Name (48) */ 00037 char serial[14]; /* Serial Number (2, 12) */ 00038 u16 checksum; /* Checksum (2) */ 00039 char IOSupport[16]; /* I/O Support (16) */ 00040 u32 rom_start; /* ROM Start Address (4) */ 00041 u32 rom_end; /* ROM End Address (4) */ 00042 u32 ram_start; /* Start of Backup RAM (4) */ 00043 u32 ram_end; /* End of Backup RAM (4) */ 00044 char sram_sig[2]; /* "RA" for save ram (2) */ 00045 u16 sram_type; /* 0xF820 for save ram on odd bytes (2) */ 00046 u32 sram_start; /* SRAM start address - normally 0x200001 (4) */ 00047 u32 sram_end; /* SRAM end address - start + 2*sram_size (4) */ 00048 char modem_support[12]; /* Modem Support (24) */ 00049 char notes[40]; /* Memo (40) */ 00050 char region[16]; /* Country Support (16) */ 00051 } ROMHeader; 00052 00053 extern const ROMHeader rom_header; 00054 00055 // size of text segment --> start of initialized data (RO) 00056 extern u32 _stext; 00057 // size of initialized data segment 00058 extern u32 _sdata; 00059 00064 typedef enum 00065 { 00066 IMMEDIATELY, 00067 ON_VBLANK , 00068 ON_VBLANK_START 00069 } VBlankProcessTime; 00070 00077 extern VoidCallback *busErrorCB; 00084 extern VoidCallback *addressErrorCB; 00091 extern VoidCallback *illegalInstCB; 00098 extern VoidCallback *zeroDivideCB; 00105 extern VoidCallback *chkInstCB; 00112 extern VoidCallback *trapvInstCB; 00119 extern VoidCallback *privilegeViolationCB; 00126 extern VoidCallback *traceCB; 00133 extern VoidCallback *line1x1xCB; 00140 extern VoidCallback *errorExceptionCB; 00147 extern VoidCallback *intCB; 00148 00149 00157 void SYS_assertReset(); 00164 void SYS_reset(); 00171 void SYS_hardReset(); 00172 00190 bool SYS_doVBlankProcess(); 00221 bool SYS_doVBlankProcessEx(VBlankProcessTime processTime); 00222 00229 u16 SYS_getInterruptMaskLevel(); 00248 void SYS_setInterruptMaskLevel(u16 value); 00249 00268 u16 SYS_getAndSetInterruptMaskLevel(u16 value); 00269 00283 void SYS_disableInts(); 00293 void SYS_enableInts(); 00294 00310 void SYS_setVBlankCallback(VoidCallback *CB); 00311 00330 void SYS_setVIntCallback(VoidCallback *CB); 00344 void SYS_setHIntCallback(VoidCallback *CB); 00355 void SYS_setExtIntCallback(VoidCallback *CB); 00356 00361 u16 SYS_isInVIntCallback(); 00366 u16 SYS_isInHIntCallback(); 00371 u16 SYS_isInExtIntCallback(); 00376 u16 SYS_isInInterrupt(); 00377 00384 bool SYS_isInVInt(); 00385 00390 void SYS_setVIntAligned(bool value); 00395 bool SYS_isVIntAligned(); 00396 00403 u16 SYS_isNTSC(); 00410 u16 SYS_isPAL(); 00411 00419 u32 SYS_getFPS(); 00427 fix32 SYS_getFPSAsFloat(); 00438 u16 SYS_getCPULoad(); 00452 void SYS_showFrameLoad(bool mean); 00459 void SYS_hideFrameLoad(); 00460 00461 00467 u16 SYS_computeChecksum(); 00472 bool SYS_isChecksumOk(); 00473 00481 void SYS_die(char *err); 00482 00483 #endif // _SYS_H_