ãã®ã·ãªãŒãºã®èšäºã®åã®ããŒãã§ã¯ãDMGã®ããã»ããµãŒãšã¡ã¢ãªãŒã«ã€ããŠèª¿ã¹ãŸããã 次ã®è«ççãªã¹ãããã¯ãDMGãç»åã衚瀺ããæ¹æ³ããšãã¥ã¬ãŒãããããšã§ãã
ã²ãŒã ããŒã€ãšãã¥ã¬ãŒã¿ã®äœæãããŒã1
ã²ãŒã ããŒã€ãšãã¥ã¬ãŒã¿ã®äœæãããŒã2
ã²ãŒã ããŒã€ãšãã¥ã¬ãŒã¿ã®äœæãããŒã3
ç®æ¬¡
ãã£ã¹ãã¬ã€- LCDã³ã³ãããŒã©ãŒã çè«
- LCDã³ã³ãããŒã©ãŒã å®è£
- ã°ã©ãã£ãã¯ã¹ çè«
- ã°ã©ãã£ãã¯ã¹ å®è£
éå¶ç®¡ç
ãã¹ãŠããŸãšãã
ãã¹ãäž
ãããã«
ãã£ã¹ãã¬ã€
ãã®æ®µéã§ãDMGãç»é¢ã«ç»åã衚瀺ããæ¹æ³ããšãã¥ã¬ãŒãããå¿ èŠããããŸãã ãã¹ãŠãCookieboy :: GPUã¯ã©ã¹ã«ãããŸãïŒcookieboyãœãŒã¹ã³ãŒããžã®ãªã³ã¯ ïŒã ã¿ã¹ã¯ã¯2ã€ã®å€§ããªéšåã«åããããŸã-DMGãçµµãæãæ¹æ³ã®è©³çŽ°ã®ãšãã¥ã¬ãŒã·ã§ã³ã ç»é¢ãå¶åŸ¡ããããžãã¯ã®ãšãã¥ã¬ãŒã·ã§ã³ãLCDã³ã³ãããŒã©ãŒã çè«
ãã€ããäœãæããã¯åœŒå¥³ã決ããã®ã§ãããžãã¯ããå§ããŸãããã ãã€ãã®ããã«ãå®è£ ã®åã«ãã³ã³ããŒãã³ãã®åäœãç解ããå¿ èŠããããŸããDMGã¯ãç»é¢ã«1è¡ãã€ç»åã衚瀺ããCRTç»é¢ã«å žåçãªç¶æ ããšãã¥ã¬ãŒãããŸãã åç¶æ ã¯ãå³å¯ã«å®çŸ©ãããæ°ã®ã¡ãžã£ãŒãç¶ããŸãã ããã¯ãã¡ã¢ãªãžã®ã¢ã¯ã»ã¹ãæäŸããããã«å¿ èŠã§ãã ã°ã©ãã£ãã¯ãæç»ããã«ã¯ããããªã¡ã¢ãªãšOAMãžã®ã¢ã¯ã»ã¹ã2ã€ã®å Žæã§åæã«å¿ èŠã§ããç»é¢ã«ãã¹ãŠã衚瀺ããLCDã³ã³ãããŒã©ãŒã å¿ èŠãªãã¬ãŒã ã衚瀺ããããã«ã¡ã¢ãªãå€æŽããã²ãŒã ïŒCPUïŒã ãã®åé¡ã解決ããããã«ãã°ã©ãã£ãã¯ã¹åºåã®ã¿ã¹ã¯å šäœãééã«åå²ãïŒãããããç¹å®ã®ç¶æ ã«å¯Ÿå¿ïŒãç»é¢ãŸãã¯ã²ãŒã ã®ããžãã¯ãã¡ã¢ãªã«ã¢ã¯ã»ã¹ã§ããæéã決å®ããŸããã åèšã§4ã€ã®ç¶æ ããããŸãïŒæ°å€ã¯ã©ã³ãã ã§ã¯ãããŸããããDMGã«å¯ŸããŠå³å¯ã«å®çŸ©ãããŠããŸãïŒã
- 0. Hãã©ã³ã¯ã CRTç»é¢ã®å Žåããã®æç¹ã§ãèµ°æ»ããŒã ã¯æ¬¡ã®è¡ã®å é ã«ç§»åããŸãã ãã¡ãããDMGã«ã¯å ç·ããããŸããã ãã®ç¶æ ã¯2ã€ã®ããšãæå³ããŸãã æåã«ã1è¡ãåºåãããŸããã 次ã«ããããªã¡ã¢ãªãšOAMã¯LCDã³ã³ãããŒã©ã§äœ¿çšããããCPUã䜿çšå¯èœã§ãã
- 1. Vãã©ã³ã¯ã CRTã®äžçã®å¥ã®ç¶æ ãããã¯ãå ç·ãæåŸã®è¡ã®çµããã«å°éããæåã®è¡ã®å é ã«è¡ãç¬éãæå³ããŸãã ç§ãã¡ã«ãšã£ãŠãããã¯2ã€ã®ããšãæå³ããŸãã æåã«ã144ã®å¯èŠè¡ãã¹ãŠã衚瀺ãããŸããã 次ã«ããããªã¡ã¢ãªãšOAMã¯LCDã³ã³ãããŒã©ã§äœ¿çšããããCPUã䜿çšå¯èœã§ãã
- 2. OAMã ãã®ç¶æ ã¯ãLCDã³ã³ãããŒã©ãŒãOAMã¡ã¢ãªãŒã䜿çšããããšãæå³ããŸãã CPUã¯äœ¿çšã§ããŸãããããããªã¡ã¢ãªã¯äœ¿çšã§ããŸãã
- 3. OAMRAMã ãã®ã¹ããŒã¿ã¹ã¯ãLCDã³ã³ãããŒã©ãOAMãšãããªã¡ã¢ãªã䜿çšããããšãæå³ããŸãã CPUã¯äœ¿çšã§ããŸããã
LCDã³ã³ãããŒã©ãŒã¯ãåã©ã€ã³ãæç»ãããšãã«ã2ã3ã0ã®é åºã§ç¶æ ãééããŸããæåŸã®ã©ã€ã³ãæç»ããåŸãç¶æ 1ã«ãªããŸãããã®åŸãæåã®ã©ã€ã³ãããã¹ãŠãæ°ãã«å§ãŸããŸãã
1è¡ã¯æ£ç¢ºã«456ãµã€ã¯ã«ç¶ããŸãã ãã®æéã¯ãç¶æ 2ã3ã0ã®æéã§æ§æãããåžžã«456ã¯ããã¯ãµã€ã¯ã«ã«çãããªããŸãããç¶æ èªäœã®æéã¯ç°ãªãå ŽåããããŸãã ç»é¢ã«ã¯144è¡ãããããåºåã«ã¯65664ã¯ããã¯ãµã€ã¯ã«ããããŸãã ç¶æ 1ã®å Žåãæ£ç¢ºã«4560ã¯ããã¯ãµã€ã¯ã«ç¶ããŸãããã®æ°ããããã®æéã¯10è¡ã§ããããšãããããŸãã ããã¯äºå®ã§ã-ç¶æ 1ã§ã¯ãããããããã«10è¡æç»ããããã§ãã è¡ã«ãŠã³ã¿ïŒã¬ãžã¹ã¿LYïŒã¯143ã§åæ¢ããŸãããã153ã«éããŸãããã®çµæãå šç»é¢ã®æŽæ°ã«ã¯70,224ãµã€ã¯ã«ãŸãã¯456ãµã€ã¯ã«ã®154è¡ãããããŸãã
æå¹ã«ãªã£ãŠããå Žåãç¶æ é·ç§»ã«ã¯å²ã蟌ã¿èŠæ±ã䌎ããŸãã 3çªç®ãé€ã4ã€ã®ç¶æ ã®ãããããžã®ç§»è¡ã«ã¯ãLCDCå²ã蟌ã¿èŠæ±ã䌎ããŸãã ããã«ãLYãšLYCãçããå Žåããã®å²ã蟌ã¿ãèŠæ±ãããŸãã ãã®ç¶æ ã®LCDCå²ã蟌ã¿ãSTATã¬ãžã¹ã¿ã§æå¹ã«ãªã£ãŠããå Žåã«ã®ã¿ãèŠæ±ãè¡ãããŸãã ãã®æ§é ã¯æ¬¡ã®ãšããã§ãã
ããã | äºå® |
6 | LYããã³LYCã¬ãžã¹ã¿ãçããå ŽåãLCDCå²ã蟌ã¿ãèš±å¯ |
5 | ç¶æ 2ãžã®ç§»è¡æã«LCDCå²ã蟌ã¿ãèš±å¯ |
4 | ç¶æ 1ãžã®ç§»è¡æã«LCDCå²ã蟌ã¿ãèš±å¯ |
3 | ç¶æ 0ã«å ¥ããšãã«LCDCå²ã蟌ã¿ãèš±å¯ãã |
2 | LYãšLYCãçããå Žåãããããèšå®ãããŸãã ããã§ãªããã°ãªã»ãã |
0-1 | çŸåšã®ç¶æ |
éèŠãªè©³çŽ°-LCDCå²ã蟌ã¿ã¯1è¡ã«1åããèŠæ±ã§ããŸããã
ããã®å€ãã¯CPUããã¥ã¢ã«ããåéã§ããŸãããããã«1ã€ã®ããšããããŸã-ããã¯ãããããšãã¥ã¬ãŒãããLCDã³ã³ãããŒã©ãŒã®æäœã«ã€ããŠç¥ãå¿ èŠããããã¹ãŠããã¯çšé ãã§ãã ç§ã¯ãã¹ãŠã®è©³çŽ°ã«ã¯è§ŠããŸããã§ããïŒå®éããããã¯èŠã€ãããŸããã§ããïŒãããã¹ãããã²ãŒã ã§ã°ã©ãã£ãã¯ãæ£ãã衚瀺ããåæã«LCDã³ã³ãããŒã©ãŒãã¹ãã«åæ Œã§ãããšããäºå®ã«èœã¡çããŸããã
ã³ã³ãããŒã©ãŒãå°ãªããšãã»ãŒãšãã¥ã¬ãŒãããã«ã¯ãå¥ã®äžé£ã®ç¶æ ãå°å ¥ããå¿ èŠããããŸã-å éšããšãã¥ã¬ãŒã¿ãŒã§ã®ã¿äœ¿çšå¯èœã§ãã ãããã®8ã€ããããŸãã
enum InternalLCDModes { LCDMODE_LY00_HBLANK, LCDMODE_LYXX_HBLANK, LCDMODE_LYXX_HBLANK_INC, LCDMODE_LY00_VBLANK, LCDMODE_LY9X_VBLANK, LCDMODE_LY9X_VBLANK_INC, LCDMODE_LYXX_OAM, LCDMODE_LYXX_OAMRAM };
ååãããããããå®éã®ç¶æ ã«å¯Ÿå¿ããŠããããšã¯æããã§ãã 次ã®é åºã§æž¡ãããŸãã
ã²ã | å· |
0 | LYXX_OAM-> LYXX_OAMRAM-> LYXX_HBLANK-> LYXX_HBLANK_INC |
1 | LYXX_OAM-> LYXX_OAMRAM-> LYXX_HBLANK-> LYXX_HBLANK_INC |
... | ... |
143 | LYXX_OAM-> LYXX_OAMRAM-> LYXX_HBLANK-> LYXX_HBLANK_INC |
144 | LY9X_VBLANK-> LY9X_VBLANK_INC |
... | ... |
152 | LY9X_VBLANK-> LY9X_VBLANK_INC |
153 | LY00_VBLANK-> LY00_HBLANK |
äžéç¶æ ã¯ãããŸããŸãªã€ãã³ãã®ããæ£ç¢ºãªåæã«å¿ èŠã§ãã åç¶æ ããã詳现ã«æ€èšããŠãã ããã
LCDMODE_LYXX_OAM ã ãã®ç¶æ ã«ç§»è¡ãããšãSTATã¬ãžã¹ã¿ã®ç¶æ ã2ïŒOAMã®èªã¿åãïŒã«å€æŽããŸãã LCDCå²ã蟌ã¿ãæå¹ã«ãªã£ãŠãããã©ããã確èªããŸãã æåããå ŽåããããèŠæ±ããLCDCå²ã蟌ã¿ãèŠæ±ã§ããªããªã£ãããšãããŒã¯ããŸãã
ãã®ç¶æ ã§ã¯ãDMGã®1ã€ã®æ©èœãèæ ®ããŸãã SCXã¬ãžã¹ã¿ãããã2ã«èšå®ãããŠããå ŽåïŒããšãã°ãã¬ãžââã¹ã¿ã4ã§ããå ŽåïŒã次ã®ç¶æ ã4ã¡ãžã£ãŒåã ãæç¶æéãå€æŽããå¿ èŠãããããšã«æ³šæããå¿ èŠããããŸãã ãã®ç¶æ ã¯æ£ç¢ºã«80ã¯ããã¯ãµã€ã¯ã«ç¶ããŸãã
LCDMODE_LYXX_OAMRAM STATç¶æ ã3ã«å€æŽããŸããLCDCã¯äžæãããŸããã ãããŸã§ã®ãšãããã¹ãã©ã€ãã®ãããã¯ã«ã€ããŠã¯è§ŠããŠããŸããããããã§é¢æ°åŒã³åºããé 眮ãããŸããããã¯ãåŸã§ãã®è¡ã«è¡šç€ºãããã¹ãã©ã€ãã®ãã¥ãŒã§ãã
ããã¯DMGã®ãã1ã€ã®æ©èœã§ãã ã¹ãã©ã€ãã®åºåã¯ãç¶æ ã®æç¶æéãå€æŽããŸãã ãããã®æ°ãå€ãã»ã©ãç¶æ 3ãé·ãç¶ããç¶æ 0ãçããªããŸãïŒ456ã¯ããã¯ãµã€ã¯ã«ä»¥å ã«ç¶æããå¿ èŠãããããããã¹ãŠãæ¯äŸããŸãïŒã DMGã¯1è¡ã§æ倧10åã®ã¹ãã©ã€ããåºåã§ãããããç¶æ ã®ç¶ç¶æéã®å€åã瀺ãå€ãæã€11åã®èŠçŽ ã®é åãååã«ãããŸãã 次ã®å€ãå¿ èŠã§ãã
ã¹ãã©ã€ãã®æ° | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
ã㌠| 0 | 8 | 20 | 32 | 44 | 52 | 64 | 76 | 88 | 96 | 108 |
ãã®ç¶æ ã¯ã172ãµã€ã¯ã«+ SCXã¬ãžã¹ã¿ã«ãããµã€ã¯ã«æ°+ã¹ãã©ã€ãã«ãããµã€ã¯ã«æ°ã§ç¶ããŸãã ããšãã°ãåã®ç¶æ ã®SCXã¬ãžã¹ã¿ã4ã§ã6ã€ã®ã¹ãã©ã€ãã衚瀺ãããŠããå Žåãç¶æ ã®æç¶æéã¯172 + 4 + 64ãµã€ã¯ã«ã«ãªããŸãã
LCDMODE_LYXX_HBLANK ããã§ãLYã¬ãžã¹ã¿ããåŠç¿ã§ããçŸåšã®ç·ãæç»ããŸãã STATã¬ãžã¹ã¿ã§ç¶æ 0ãããŒã¯ããLCDCå²ã蟌ã¿ãèŠæ±ããŸãïŒãŸã èŠæ±ãããŠããªãå ŽåïŒã
å°ç¯ã®é·ãã¯æ¬¡ã®ããã«èšç®ãããŸãã200å°ç¯-SCXã«ããå°ç¯-ã¹ãã©ã€ãã«ããå°ç¯ã ãããã£ãŠãããã§ã¯ãLCDMODE_LYXX_OAMRAMç¶æ ã§çºçããæéã®ã·ãããè£æ£ããŸãã
LCDMODE_LYXX_HBLANK_INC ããã§ãã¬ãžã¹ã¿LYã1ã€å¢ãããŸã-ããã¯è¡ã«ãŠã³ã¿ã§ãã ãã©ã°ããªã»ããããŸããããã¯ãLCDCå²ã蟌ã¿ãæ¢ã«èŠæ±ãããŠããããšã瀺ããŠããŸãïŒæ¬¡ã®è¡ã«é²ã¿ãŸãïŒã ããã§ãã¬ãžã¹ã¿LYãšLYCã®ç䟡æ§ããã§ãã¯ããå¿ èŠããããŸãã æ¬äŒŒã³ãŒãã®äŸã次ã«ç€ºããŸãã
LY == LYC 2 STAT 2 STAT LCDC , 2 STAT
LYCã¬ãžã¹ã¿ã¯ãLYãç¹å®ã®å€ã«éãããšè¿œè·¡ããããã«ã²ãŒã ã§äœ¿çšãããŸãã 圌ã«ã¯ä»ã®äºå®ã¯ãããŸããã
ãã®ç¶æ ã¯4ã¡ãžã£ãŒç¶ããŸãã é·ç§»ãè¡ãããç¶æ ã¯ãLYã®å€ã«ãã£ãŠç°ãªããŸãã äžèšã®è¡šã«ãã¹ãŠã瀺ãããŠããŸãã
LY9X_VBLANK ãã®ç¶æ ã«ãªããLYã144ã®å ŽåãVãã©ã³ã¯ç¶æ ã«ãªã£ãããšãäœããã®æ¹æ³ã§ãã£ã³ã»ã«ããå¿ èŠããããŸãã ç¶æ ãSTAT 1ã«èšå®ããŸããå²ã蟌ã¿Vãã©ã³ã¯ãèŠæ±ããŸãã æå¹ã«ãªã£ãŠããå Žåãããã§LCDCå²ã蟌ã¿ãå床èŠæ±ããå¿ èŠããããŸãã ãããã£ãŠã2ã€ã®å²ã蟌ã¿ãããã§èŠæ±ã§ããŸãã LYã144ã«çãããªãå Žåãäœãããå¿ èŠã¯ãããŸããã ãã§ã«Vãã©ã³ã¯ã«ãªã£ãŠããŸãã
ãã®ç¶æ ã¯ãæ£ç¢ºã«452ã¡ãžã£ãŒç¶ããŸãã
LY9X_VBLANK_INC ããã§ãåã«è¡ã£ãããã«ãLYãã€ã³ã¯ãªã¡ã³ãããLYãšLYCã®ç䟡æ§ããã§ãã¯ããå¿ èŠããããŸãã ããã§ã¯ãLYã153ã®å Žåãå¥ã®ç¶æ ã«åãæ¿ããLY9X_VBLANKã§ããçŽããªãããšãèæ ®ã«å ¥ããå¿ èŠããããŸã-è¡šãåç §ããŠãã ããã
ãã®ç¶æ ã¯4ã¡ãžã£ãŒç¶ããŸãã
LY00_VBLANK ããã§ãLYããªã»ããããå¿ èŠããããŸãã
ãã®ç¶æ ã¯452ãµã€ã¯ã«ç¶ããŸãã
LCDMODE_LY00_HBLANK ããã¯ãã¬ãŒã ã®æåŸã§ãããããªãå¥åŠãªç¶æ ã§ãã 4ã¡ãžã£ãŒã®ã¿æç¶ããSTATã¬ãžã¹ã¿ã0ã«èšå®ããŸãããã®åŸããã¹ãŠãæ°ãã«å§ãŸããŸãã
ãã¹ãŠãç¶æ ãµã€ã¯ã«ãçµäºããŸããã ããŠãå°ãããéåžžã«éèŠãªè©³çŽ°ã LCDCã¬ãžã¹ã¿ã®èª¬æãèªãã å Žåãããã7ããã£ã¹ãã¬ã€ã®ãªã³/ãªãã®åãæ¿ããæ åœããŠããããšã«æ°ã¥ãããããããŸããã ãããå·ã«äœããã®åœ¢ã§åæ ãããå¿ èŠããããŸãã
ã²ãŒã ããã£ã¹ãã¬ã€ããªãã«ããå Žåã次ã«LYã¬ãžã¹ã¿ããªã»ããããSTATã¬ãžã¹ã¿ã§ç¶æ ã0ã«èšå®ããå¿ èŠããããŸãããŒããLYã¯ãŒããçŸåšã®ç¶æ ã¯2ã§ããã€ãŸãã ç¶æ ã®ãµã€ã¯ã«å šäœãæåããéå§ããŸãã å€ãã®ã²ãŒã ã¯ããããã®æäœãªãã§ã¯æ©èœããŸããã ãã®ãããªã²ãŒã ã®äŸã¯ãBomb Jackã§ãã 圌女ã¯ã¹ã¿ãŒãã¡ãã¥ãŒã«è¡ãããšããæåŠããŸãã
å¶ç¶ã²ãŒã ã®äŸãæããŸããã ãã¹ãROMã¯åªããŠããŸããããããã«åæ ŒããŠãã²ãŒã ãæ£ããåäœããããšãä¿èšŒãããã®ã§ã¯ãªãããã¹ãŠããã§ãã¯ãããããã§ã¯ãããŸããã å¯èœãªå Žåã¯ããšãã¥ã¬ãŒã¿ã§ç¢ºèªããããšãæšå¥šãããŠããã²ãŒã ã®ååãæå®ããŸãã ãã ãžã£ãã¯ããã§ãã¯ããå¿ èŠããããŸã-ç»é¢ããªãã«ãããããªããªãã¯ã¯å€ãã®ã²ãŒã ãããŸãã
LCDã³ã³ãããŒã©ãŒã å®è£
æåŸã«ãæ€èšããçè«ã®å®è£ ãéå§ã§ããŸãã å ã»ã©èšã£ãããã«ããšãã¥ã¬ãŒã¿ãŒã§ã¯ãããã»ããµãŒãšä»ã®ãã¹ãŠã®ã³ã³ããŒãã³ããåæããå¿ èŠããããŸã-LCDã³ã³ãããŒã©ãŒãäŸå€ã§ã¯ãããŸããã ãããè¡ãã«ã¯ãCookieboy :: GPUã¯ã©ã¹ã§é¢æ°ãäœæããŸããããã¯ãå ¥åãšããŠéå»ã®ãã£ãã¯ã®æ°ãåããŸãã ããã§ã¯ãç¶æ ã®å€åã«é¢é£ãããã¹ãŠãå®è¡ããŸãããã¹ãŠã®ã³ã³ããŒãã³ãã§ãåæã¯ã»ãŒåãã«èŠããŸãã ã¡ãžã£ãŒã«ãŠã³ã¿ãŒãéå§ããããã«éå»ã®ã¡ãžã£ãŒãè¿œå ããŸãã å€ãå¿ èŠãªå€ã«éãããšããã«ããã®å€ãããã®æ°å€ãæžç®ãïŒå¿ èŠä»¥äžã®ã¡ãžã£ãŒãééããå¯èœæ§ãããããããªã»ããããŸããïŒãå¿ èŠãªåŠçãè¡ããŸãã
cookieboy :: GPUåæé¢æ°ã¯æ¬¡ã®ããã«ãªããŸãã
void Cookieboy::GPU::Step(DWORD clockDelta, Interrupts &INT) { ClockCounter += clockDelta; while (ClockCounter >= ClocksToNextState) { ClockCounter -= ClocksToNextState; if (!LCD_ON()) { LY = 0; // ClocksToNextState = 70224; continue; } switch (LCDMode) { case LCDMODE_LY00_VBLANK: LY = 0; LCDMode = LCDMODE_LY00_HBLANK; ClocksToNextState = 452; break; } } }
åœç¶ãããã¯ã»ãã®äžéšã§ãããããã§ååã§ãã ãããã£ãŠãClockCounterã¯ã«ãŠã³ã¿ãŒãšããŠæ©èœããŸãã 次ã«ãã«ãŠã³ã¿ãç®çã®å€ã«å°éãããã©ããã確èªããwhileã³ã³ã¹ãã©ã¯ãããããŸãã ClocksToNextStateå€æ°ã¯ãæ°ããç¶æ ãçºçããåã«ééããå¿ èŠãããã¡ãžã£ãŒã®æ°ãæ ŒçŽããããã«äœ¿çšãããŸãã ã«ãŠã³ã¿ããããããæžç®ããŠã次ã®ç¶æ ãŸã§ã«ãŠã³ãããŠã³ãç¶ããããã«ããŸãã
ãªãããã«ããã®ïŒ ããã¯éèŠã§ãã äžéšã®æ¡ä»¶ã¯4ã¡ãžã£ãŒããç¶ããªãããããã®æ¡ä»¶ãããã«çºçããå¯èœæ§ããããŸãã ã€ãŸã ClocksToNextStateã4ã«èšå®ããã«ãŠã³ã¿ãŒã«4ã€ã®ã¡ãžã£ãŒããããŸãã åæé¢æ°ãžã®äœåãªåŒã³åºããåŸ ããªãããã«ãã«ãŒãã®æ¬¡ã®å埩ã§æ°ããã€ãã³ããããã«åŠçããŸãã ãã®ã¢ãããŒãã¯ãç¶æ ïŒã€ãã³ãïŒã®ééãå°ããããŠã1ã€ã®ããã»ããµåœä»€ã®æç¶æéãããçãå Žåããããšããã«ãŒã«ãšããŠæ¡çšããå¿ èŠããããŸãã
次ã«ããã¯ãLCD_ONïŒïŒã§æ¡ä»¶ã確èªããŸãã ããã§ã¯ããã£ã¹ãã¬ã€ããªãã«ãªã£ãŠãããã©ããã確èªããŸãã ããã§ããå Žåãç¶æ ã®ãµã€ã¯ã«å šäœãå®è¡ããŸããã ç»é¢ãã¯ãªã¢ããã ãã§ã70224ã¯ããã¯ãµã€ã¯ã«ã1åç»é¢å šäœã«æŽæ°ããããŸã§åŸ æ©ããŸãã
ãã£ã¹ãã¬ã€ããªã³ã®å Žåãã¹ã€ããã®æ§ç¯ãå©çšããŠãçŸåšã®ç¶æ ã«å¿ èŠãªã¢ã¯ã·ã§ã³ãå®è¡ããŸãã ç§ã®å®è£ ã®è©³çŽ°ã¯ã次ã®ç¶æ ã»ã©ææ°ã§ã¯ãªãLCDModeã«ä¿åãããããªãã®ã§ãã å¿ èŠãªã¢ã¯ã·ã§ã³ãå®äºããåŸãLCDModeã§æ¬¡ã®ç¶æ ãèšå®ãããã®åã®ã¯ããã¯ãµã€ã¯ã«æ°ã瀺ããŸãã ã¯ããLCDModeã¯åãªãè£å©å€æ°ã§ãããã²ãŒã ã«ã¯ååšããŸããã å®éã®ç¶æ ã¯ãSTATã¬ãžã¹ã¿ã«ä¿åãããŸãã
ã°ã©ãã£ãã¯ã¹ çè«
DMGã¯ãã¯ã»ã«ã§ã¯ãªããã¿ã€ã«ã§åäœããŸãã åœç¶ãã°ã©ãã£ãã¯ã¹ã¯ãã¯ã»ã«ããšã«è¡šç€ºãããŸãããããã°ã©ããŒã®åäœã¯ã¿ã€ã«ã§ããµã€ãºã¯8x8ãã¯ã»ã«ã§ãã ãããã£ãŠãã¡ã¢ãªã«ã¯ãã¯ã»ã«ã®è²ã¯ä¿åããããã¿ã€ã«çªå·ãä¿åãããŸãã ãããã®æ°å€ã¯ãã¿ã€ã«ã«é¢ããæ å ±ãé 眮ãããŠããå¥ã®ã¡ã¢ãªé åãè¡šããŸã-ã¿ã€ã«ãã©ã®è²ãã¯ã»ã«ã§æ§æãããŠãããã ãã®ã¢ãããŒãã®æ確ãªç®æšã¯ãã¡ã¢ãªãç¯çŽããããšã§ãã ã€ã³ããã¯ã¹ä»ãè²ã®å®è£ ã®ããã«èŠããŸããã°ã©ãã£ãã¯ã¹åºåã¯ã次ã®é åºã§3段éã§å®è¡ãããŸãã
- èæ¯
- ããããããŠã£ã³ããŠãïŒãŠã£ã³ããŠïŒ
- ã¹ãã©ã€ã
èæ¯
DMGã®èæ¯ã®ãµã€ãºã¯32x32ã¿ã€ã«ãŸãã¯256x256ãã¯ã»ã«ã§ãDMGç»é¢ãããæããã«å€§ããã§ãã SCXããã³SCYã¬ãžã¹ã¿ã䜿çšããŠã次ã®å³ã«ç€ºãããã«ã衚瀺ããããŒããæå®ã§ããŸããã芧ã®ãšãããèæ¯ã®å¢çãè¶ããå Žåãå察åŽã«ããããšãããããŸãã ããèšãããããã«ãèæ¯ã¯ãããŸãã§ãã
ã¿ã€ã«ãšãã®ã³ã³ãã³ãã«é¢ãããã¹ãŠã®æ å ±ã¯ããããªã¡ã¢ãªã«ãããŸãã ãã®æ§é ã¯æ¬¡ã®ãšããã§ãã
ã»ã¯ã·ã§ã³ | äºå® |
0x8000-0x87FF | ã¿ã€ã«ã»ãã1ïŒã¿ã€ã«[0ã127] |
0x8800-0x8FFF | ã¿ã€ã«ã»ãã1ïŒã¿ã€ã«[128ã255]
ã¿ã€ã«ã®ã»ããïŒ0ïŒã¿ã€ã«[-128ã-1] |
0x9000-0x97FF | ã¿ã€ã«ã®ã»ããïŒ0ïŒã¿ã€ã«[0ã127] |
0x9800-0x9BFF | ã¿ã€ã«ãããâ0 |
0x9C00-0x9FFF | ã¿ã€ã«ã®å°å³â1 |
ã¿ã€ã«èªäœãæåã«ä¿åãããŸãã DMGã¯ãæ倧384ã¿ã€ã«ã256ã¿ã€ã«ã®2ã»ããã«åå²ããŠä¿åã§ããããããããã®ååã¯ã»ããã§å ±éã§ãã 1ã€ã®ã»ããã¯0ã255ã®çªå·ã䜿çšããŠã¿ã€ã«ã瀺ãããã1ã€ã®ã»ããã¯-128ã127ã®çªå·ã䜿çšããŸããèæ¯èªäœã¯ãéžæããã¿ã€ã«ãããã«åŸã£ãŠæç»ãããŸãã ãããã®2ã€ããããŸãã ãµã€ãºã¯1024ãã€ã-ã¿ã€ã«çªå·ããšã«1ãã€ãã§ãã
ã¿ã€ã«ã®ã»ãããšã¿ã€ã«ãããã®éžæã¯ãLCDCã¬ãžã¹ã¿ã䜿çšããŠè¡ãããŸãã ãªã³/ãªãã§èæ¯ã衚瀺ãããã©ã°ããããŸãã ããã§ããšããã§ããã®æ§é ïŒ
ããã | äºå® |
7 | LCDã³ã³ãããŒã©ç®¡çïŒ
0ïŒãªãïŒç»é¢ã¯ç©ºçœã§ãïŒ 1ïŒãªã³ |
6 | ããŠã£ã³ããŠãã®ã¿ã€ã«ãããã®éžæïŒ
0ïŒã¿ã€ã«No. 0ã®ãããïŒ0x9800-0x9BFFïŒ 1ïŒã¿ã€ã«No. 1ã®ãããïŒ0x9C00-0x9FFFïŒ |
5 | ãŠã£ã³ããŠè¡šç€ºãã©ã°ïŒ
0ïŒãªã 1ïŒãªã³ |
4 | èæ¯ãšããŠã£ã³ããŠãçšã®ã¿ã€ã«ã®ã»ãããéžæããŸãã
0ïŒã¿ã€ã«No. 0ïŒ0x8800-0x97FFïŒã®ã»ãã 1ïŒã¿ã€ã«No. 1ã®ã»ããïŒ0x8000-0x8FFFïŒ |
3 | èæ¯ã®ã¿ã€ã«ããããéžæããïŒ
0ïŒã¿ã€ã«No. 0ã®ãããïŒ0x9800-0x9BFFïŒ 1ïŒã¿ã€ã«No. 1ã®ãããïŒ0x9C00-0x9FFFïŒ |
2 | ã¹ãã©ã€ããµã€ãºïŒ
0ïŒ8x8 1ïŒ8:16 |
1 | ãã©ã°è¡šç€ºã¹ãã©ã€ãïŒ
0ïŒãªã 1ïŒãªã³ |
0 | ããã¯ã°ã©ãŠã³ã衚瀺ãã©ã°ïŒ
0ïŒãªã 1ïŒãªã³ |
ã¿ã€ã«èªäœã¯ã¡ã¢ãªã§16ãã€ããå æããŸãã 2ãã€ãããšã«1è¡ãåŠçãããããã8x8ã®ã¿ã€ã«ãæäŸãããŸãã 以äžã«ç€ºãããã«ãã¡ã¢ãªå ã®ã¿ã€ã«ã®æ§æã¯ããªãå¥åŠã§ãã
ãã¯ã»ã«ã®è²ã¯2ãããã§æ§æãããæäžäœãããã¯æåã®ãã€ãããååŸãããæäžäœãããã¯2çªç®ã®ãã€ãããååŸãããŸãã çµæã¯ã0ã3ã®4ã€ã®å€ãæã€ããšãã§ããã«ã©ãŒã€ã³ããã¯ã¹ã«ãªããŸãããããã®ã€ã³ããã¯ã¹ã¯ãBGPã¬ãžã¹ã¿ã®ãã¬ããããè²ãéžæããããã«äœ¿çšãããŸãã ãã®æ§é ã¯æ¬¡ã®ãšããã§ãã
ããã | ã«ã©ãŒã€ã³ããã¯ã¹ |
7-6 | 3 |
5-4 | 2 |
3-2 | 1 |
1-0 | 0 |
ã€ãŸãããã¯ã»ã«ã«ã©ãŒã2ã®å ŽåãBGPã¬ãžã¹ã¿ã§ããã5ã4ã®å€ãæ€çŽ¢ããŸããããã«ããã0ã3ã®4ã€ã®å€ãæã€è²ãåŸãããŸããããã«ãããå€æçšã®å¥ã®ãã¬ãããå¿ èŠã«ãªããŸãDMGãã¬ããã®è²ããåŸã§åºåããããã«å®éã®RGBè²ã«å€æããŸãã ããã¯ãã¹ã±ãžã¥ãŒã«å šäœã«é©çšãããŸãã
çœé»ã®ãã¬ããã䜿çšããŠã次ã®è²ã䜿çšã§ããŸãã
ãã¬ããã®è² | RGBå€ |
0 | 0xFFã0xFFã0xFF |
1 | 0xAAã0xAAã0xAA |
2 | 0x55ã0x55ã0x55 |
3 | 0x00ã0x00ã0x00 |
ãŸãã¯ãå®éã®DMGã®ç»é¢äžã®è²ã«è¿ãè²ã䜿çšããŸãã
ãã¬ããã®è² | RGBå€ |
0 | 0xE1,0xF7,0xD1 |
1 | 0x87,0xC3,0x72 |
2 | 0x33,0x70,0x53 |
3 | 0x09,0x20,0x21 |
ç»é¢ã®ã¯ãªã¢ã«ã¯ã0ïŒæãæããïŒã®è²ã䜿çšãããŸãã ãããã£ãŠãç»é¢ããããã«ããå¿ èŠãããå ŽåããŸãã¯èæ¯ããªãã«ããå Žåã¯ããã¹ãŠãã€ã³ããã¯ã¹0ã®è²ã§å¡ãã€ã¶ããŠãã ããã
çª
èæ¯ã衚瀺ããåŸãããŠã£ã³ããŠãã衚瀺ããå¿ èŠããããŸãã èæ¯ãšã»ãŒåãæ¹æ³ã§è¡šç€ºãããŸã-LCDCããã䜿çšããã«ãŒããšã¿ã€ã«ã®ã»ãããåŠç¿ããŸãã ãªã³/ãªãåºåã®ãã©ã°ããããŸãã ã¬ãžã¹ã¿WYããã³WXã§æå®ããã座æšã«åŸã£ãŠè¡šç€ºãããŸãã ãã ããç»é¢ã®å·Šäžé ã«ããŠã£ã³ããŠãã衚瀺ããã«ã¯ã座æšWX = 7ããã³WY = 0ãæå®ããå¿ èŠããããŸããã€ãŸãã ããŠã£ã³ããŠãã®å·Šäžé ã®X座æšãšY座æšã¯ãããããWX-7ãšWYã§ãã次ã®å³ã¯ãWX = 87ããã³WY = 70ã®ããŠã£ã³ããŠãåºåã®äŸã瀺ããŠããŸãã
åºåã®åã«ãLCDCã®ããŠã£ã³ããŠãåºåãã©ã°ã ãã§ãªãã座æšã確èªããå¿ èŠããããŸãã
- WXã166ãã倧ããå ŽåãããŠã£ã³ããŠãã¯ç»é¢ã®å€åŽã«é ãããŸãã
- WYã143ãã倧ããå ŽåãããŠã£ã³ããŠããé衚瀺ã«ãªããŸãã
éèŠãªè©³çŽ°ã WXããã³WYã¯ãåºåããã»ã¹äžã«å€æŽã§ããŸãã WXãžã®å€æŽã¯æ¬¡ã®è¡ã衚瀺ããããšããã«æå¹ã«ãªããŸãããWYãžã®å€æŽã¯æ¬¡ã®ç»é¢æŽæ°ã§ã®ã¿æå¹ã«ãªããŸãã
åè¿°ããããã«ãå€ãã®ç¹ã§ããŠã£ã³ããŠãã®åºåã¯èæ¯ã®åºåãšåãã§ãããé倧ãªéãã1ã€ãããŸãã
ããã衚瀺ããã«ã¯ãããŠã£ã³ããŠãã®çŸåšã®è¡ãžã®é衚瀺ãã€ã³ã¿ãŒã䜿çšããã次ã®è¡ã®åºååŸã«å¢åãããŸãã WX / WY座æšã®ããã«ããŠã£ã³ããŠããç¡å¹ãŸãã¯é衚瀺ã«ãªã£ãŠããå Žåããã®ã©ã€ã³ã«ãŠã³ã¿ãŒã¯å¢å ããŸããã ãããã£ãŠãããŠã£ã³ããŠãã®åºåãéäžã§ç¡å¹ã«ãªã£ãå Žåãåºåããªã³ã«ãªããšãåºåã¯äžæãããšããããç¶ç¶ããŸãã ããã¯ã1ç»é¢ã®æŽæ°ã«åœãŠã¯ãŸããŸãã Vãã©ã³ã¯ã®çµããã«ãããŠã£ã³ããŠãã©ã€ã³ã«ãŠã³ã¿ãŒã¯ãŒãã«ãªã»ãããããŸãã
ããã«ãLCDCãå€æŽããããšãã«ãŠã³ã¿ãŒå€ãå€æŽãããŸãã ããŠã£ã³ããŠãããªãã«ãªããLCDCãä»ããŠãªã³ã«ãªã£ãŠããå Žåããã®åºåã¯æåã®è¡ããã®æ¬¡ã®ç»é¢æŽæ°ã§ã®ã¿éå§ãããŸãã
å°ãªããšã1ã€ã®ã²ãŒã ãDMGã®ãã®æ©èœã䜿çšããŠããŸã-Ant Soldiersã èµ·ååŸããã«ãã²ãŒã ã®äœæè ãç»é¢ã®äžéšã«è¡šç€ºãããŸãã ããŠã£ã³ããŠãã衚瀺ãããšãã«äžèšã®æ©èœãèæ ®ãããªãå Žåãç»é¢ã®äžéšã¯ç©ºã«ãªããŸãã ããã«æªãããšã«ãã²ãŒã ã€ã³ã¿ãŒãã§ãŒã¹ã衚瀺ãããªããããéåžžã®ã²ãŒã ã¯äžå¯èœã«ãªããŸãã
ã¹ãã©ã€ã
ä»ã§ã¯ã¹ãã©ã€ãã®çªã§ãã ãŸããã¿ã€ã«ã§æ§æãããŠããŸããããŸã£ããç°ãªãæ¹æ³ã§è¡šç€ºãããŸããã¹ãã©ã€ãã®ãµã€ãºã¯8x8ãŸãã¯8x16ãã€ãŸã LCDCã¬ãžã¹ã¿ã®ãã©ã°ã«ãã£ãŠå¶åŸ¡ããã1ã€ãŸãã¯2ã€ã®ã¿ã€ã«ã ã¹ãã©ã€ãã«é¢ããæ å ±ã¯ãOAMã¡ã¢ãªé åã«ãããŸãã ã¹ãã©ã€ãããšã«4ãã€ããããOAMã«æ倧40åã®ã¹ãã©ã€ããä¿åã§ããŸãã ãããã®ãã€ãã«ã¯ã次ã®æ å ±ãå«ãŸããŠããŸãã
ãã€ã | äºå® |
0 | Yåº§æš |
1 | Xåº§æš |
2 | ã¿ã€ã«çªå·ïŒ0-255ïŒ |
3 | ããã7ïŒåªå
床
ããã6ïŒ1ã®å ŽåãåçŽãã©ãŒãªã³ã° ããã5ïŒ1ã®å Žåãæ°Žå¹³é¡å ããã4ïŒ1ã®å ŽåãOBJ1ãã¬ããã䜿çšããã以å€ã®å Žå-OBJ0 |
ã¹ãã©ã€ãã®åº§æšã¯ãå³äžé ã§ãã å·Šäžé ã®åº§æšã¯X-8ãšY-16ã§ãã ã¹ãã©ã€ãã®ãµã€ãºã¯ããã§ã¯é¢ä¿ãããŸããã
ã¿ã€ã«çªå·ã«ã€ããŠã¯ãã¹ãã©ã€ãã®ãµã€ãºãèæ ®ããããšãéåžžã«éèŠã§ãã 8x16ã«èšå®ãããŠããå Žåãã¿ã€ã«çªå·ã®æäžäœãããããªã»ããããå¿ èŠããããŸãããªã»ããããªããšãäžéšã®ã²ãŒã ã®ã°ã©ãã£ãã¯ã¹åºåãæ£ãããªããªããŸãã
åªå 床ã1ã«èšå®ãããŠããå Žåãã¹ãã©ã€ãã¯èæ¯ãšããŠã£ã³ããŠãã®èåŸã«ãããã®ããã«æç»ãããŸãã ã¹ãã©ã€ããã¯ã»ã«ã¯ãå€ããŒãã®è²ã®äžã«ã®ã¿æç»ãããŸãã ãããè¡ãã«ã¯ãèæ¯ãšããŠã£ã³ããŠãã衚瀺ããŠãããã¹ãã©ã€ãã衚瀺ãããã¯ã»ã«ã®è²ã確èªããŸãã ã¹ãã©ã€ãã¯ãããã°ããŒãè²ã®ãã¯ã»ã«ãã貫éãããŸãã åªå 床ã0ã«èšå®ãããŠããå Žåãã¹ãã©ã€ãã¯èæ¯ãšããŠã£ã³ããŠãã®äžã«æç»ãããŸãã
ãªãã¬ã¯ã·ã§ã³ã䜿çšãããšããã¹ãŠãæ確ã«ãªããŸãã ã¹ãã©ã€ãçšã®2ã€ã®ãã¬ããïŒOBP0ããã³OBP1ïŒããããŸãããã«ã©ãŒã€ã³ããã¯ã¹0ïŒãã¬ããã®ããã0-1ïŒã¯éæãã¯ã»ã«ãæå³ãããã¬ããå ã®è²ã¯éèŠã§ã¯ãªãããšãé€ããŠãåã圹å²ãæãããŸãã
ã¹ãã©ã€ãã衚瀺ããåã«ã衚瀺ããå¿ èŠããããã®ãšé åºã確èªããå¿ èŠããããŸãã ã¹ãã©ã€ãã«ã¯ãç»é¢ã«è¡šç€ºãããé åºã決å®ããåªå é äœããããŸãã ãã®ããã«èšç®ãããŸã-ã¹ãã©ã€ãã¯ãX座æšã®é åºã§ã倧ãããã®ããå°ãããã®ãžãšè¡šç€ºãããŸãã ã€ãŸã X座æšã®å€ãå°ããã¹ãã©ã€ãã¯ãXå€ã倧ããã¹ãã©ã€ãã®äžã«è¡šç€ºãããŸããX座æšãçããå Žåãåªå é äœã¯OAMã®é åºã«åŸã£ãŠèšç®ãããŸã-OAMã®ã¢ãã¬ã¹ãäœãã¹ãã©ã€ãã¯é«ããªããŸãã
ã¹ãã©ã€ãã衚瀺ãããã©ããã決å®ããã«ã¯ãOAMã®Y座æšã確èªããå¿ èŠããããŸãã ã¹ãã©ã€ããçŸåšã®è¡ã«åãŸãããã«ããå¿ èŠããããŸãã
ããã§ãLYã¯ç»é¢ã®çŸåšã®è¡ã§ãSpriteHeightã¯ã¹ãã©ã€ãã®é«ãïŒ8ãŸãã¯16ïŒã§ãã ããã¯éåžžã«éèŠãªå ¬åŒã§ãã誀ã£ãã¹ãã©ã€ããã¥ãŒã€ã³ã°ã¯ãäžéšã®ã²ãŒã ã§åŸ®åŠãªãã°ãåŒãèµ·ãããŸãïŒå€ãã®ã²ãŒã ã¯ãç§ãæã£ãŠããããã«ããŸãåäœããŸãïŒã æåã«ãY座æšã転éããŸãããã§ã«è¿°ã¹ãããã«ãã¹ãã©ã€ãã®åº§æšã¯å³äžé ã瀺ããŸãã ç¹°ãè¿ããŸãããã¹ãã©ã€ãã®é«ãã¯ãããã®èšç®ã«ç¹ã«åœ±é¿ããŸããããçŸåšã®è¡ã®å€ãååšã§ããééã圢æããããã«ãã¹ãã©ã€ãã®é«ããèæ ®ããå¿ èŠããããŸãã
X座æšã¯ãã¹ãã©ã€ããç»é¢ã«è¡šç€ºãããªããšããäºå®ã«ã€ãªããå Žåã§ããä»»æã®å€ã«ã§ããŸããããã§ãããªã¹ãã«è¿œå ãããŸãã
ã¹ãã©ã€ãã¯åªå é äœã«åŸã£ãŠè¡šç€ºãããŸããã1è¡ã«10å以äžã§ãã ãããã£ãŠãX座æšãåå ã§äžå¯èŠã®ã¹ãã©ã€ãããªã¹ãã«å«ãŸããç»é¢ã®ç¹å®ã®è¡ã§ã¹ãã©ã€ãã®å¯èœãªæ°ãå¶éãããŸãã ãããã£ãŠãã¹ãã©ã€ããç»é¢ã«è¡šç€ºãããšãã¯ãã¹ãã©ã€ãããã®å€åŽã«ããå¯èœæ§ããããšããäºå®ã«åããå¿ èŠããããŸãã
10åã®å¶éã«ã€ããŠã¯ããã®å¶éãèæ ®ããæ¹æ³ã«é¢ããä¿¡é Œã§ããæ å ±ããŸã èŠã€ãããŸããã 次ã®2ã€ã®è«çãœãªã¥ãŒã·ã§ã³ããããŸãã
- Y座æšã«å¿ããŠè¡šç€ºããããã¹ãŠã®ã¹ãã©ã€ãããã®ãã¥ãŒã€ã³ã°ïŒOAMã³ã³ãã³ãã®ééïŒ-10ãè¶ ããå¯èœæ§ããããŸãããã®åŸããœãŒãåŸãäœåãªã¹ãã©ã€ããç Žæ£ããŸãã ããäœãåªå 床ã§ã¹ãã©ã€ããæããããšã¯è«ççã§ãã
- 10åã®ã¹ãã©ã€ããå ¥åããããšããã¥ãŒã¯åæ¢ããŸãã ãããã£ãŠãOAMã«ã¯ããã«åªå 床ã®é«ãç®ã«èŠããã¹ãã©ã€ããååšããããšãå€æããå ŽåããããŸãããå°éããŸããã§ããã
ä»ã®ãšãã¥ã¬ãŒã¿ãŒã䜿çšããããã2çªç®ã®ãªãã·ã§ã³ãéžæããŸããã ã²ãŒã ã§ã®ãã¹ãã¯è§£æ±ºã«åœ¹ç«ã¡ãŸããã§ãã-å®è£ ã®ããã€ãã¯ç®ã«èŠãããã°ã芳å¯ãããŸããã§ããã
ã°ã©ãã£ãã¯ã¹ å®è£
ããã§ããšãã¥ã¬ãŒã¿ãŒã®äœæã«ãããå¥ã®éèŠãªæ®µéã«é²ã¿ãŸãã ããã§ã®å°ããªééãã¯ãç»é¢ã«ã²ã©ãçµæãããããå¯èœæ§ããããŸãã ãããã®èšäºãæžãéçšã§ã®ã¿ããã€ãã®ãšã©ãŒãèŠã€ããŸããã ãã®åã«ãç§ã¯ããã€ãã®ã²ãŒã ã§ç»é¢äžã®å®å šãªæ··ä¹±ã芳å¯ããªããã°ãªããŸããã§ãããåé¡ã®ã»ãšãã©ã¯ãããããGameboy Wars Turboãšããã²ãŒã ããããããŸããã ãã®ã·ãªãŒãºã®èšäºãæžããŠãããšãã ããç§ã¯ãã®äžã«æ£ããæ§å³ãéæããããšãã§ããŸããã ä»ã«ãåªãããã¹ãã²ãŒã ããããŸãã ç§ããã§ã«èšåããã¢ãªã®å µå£«ãKirbys Pinball Landã¯ãã¹ãã©ã€ãåºåã®ãã¹ãã«é©ããŠããŸãã玹ä»ãããªã§ã¯ãããŸããŸãªãµã€ãºã®ã¹ãã©ã€ãã䜿çšããŠããŸãã
éåžžã©ãããå¿ èŠãªãã¹ãŠã®ã¬ãžã¹ã¿ã宣èšããå€éšããã¢ã¯ã»ã¹ã§ããããã«ããŸãïŒå ·äœçã«ã¯ãCookieboy :: Memoryã¯ã©ã¹ã®å ŽåïŒããããªã¡ã¢ãªãšOAMã§ã¯ãããå°ãè€éã§ãã
èŠããŠããããã«ã以åã¯ãã®ã¡ã¢ãªã¯åžžã«å©çšå¯èœã§ã¯ãªããSTATã¬ãžã¹ã¿ã®çŸåšã®ç¶æ ã«äŸåãããšèšãããŠããŸãããåé¡ãçºçããŸã-å¿ èŠã«å¿ããŠå®è£ ããïŒé©åãªã¿ã€ãã³ã°ã§ã¡ã¢ãªãžã®ã¢ã¯ã»ã¹ããããã¯ããïŒããã©ãã»ã©ç°¡åãïŒã¡ã¢ãªã¯åžžã«äœ¿çšå¯èœã§ãïŒãããã¯ãã¹ãŠãç¶æ ããç¶æ ãžã®é·ç§»ã®ãšãã¥ã¬ãŒã·ã§ã³ã®ç²ŸåºŠã«äŸåããŸããééã®é·ããå®ããªããšãã¡ã¢ãªãå©çšå¯èœã«ãªã£ããšãã«èªã¿æžããã§ããªããªããšããäºå®ã«ã€ãªããå¯èœæ§ããããŸããç§ã®å®è£ ã§ã¯ãã¢ã¯ã»ã¹ããããã¯ããããšãå¯èœã§ããããšãå€æããŸãã-ç§ããã¹ãããã²ãŒã ã¯ããã®ãããªæ¡ä»¶ã§æ£åžžã«åäœããŸããç§ã®ãããžã§ã¯ãã®åæ段éã§ã¯ãLCDã³ã³ãããŒã©ãŒã®ãšãã¥ã¬ãŒãã¯ãŸã°ãã§ïŒGameboy CPUããã¥ã¢ã«ã§èª¬æãããŠããããã«ãã¹ãŠãè¡ããŸããïŒãã¢ã¯ã»ã¹ããããã¯ãããšç»é¢ã«ãŽãã衚瀺ãããŸããããã¹ãŠã®ãšãã¥ã¬ãŒã¿ããããè¡ãããã§ã¯ãããŸããããããã¯ããªã次第ã§ãã
ç§ãããããã«ããã¬ãŒã ãããã¡ããŸãã¯2ã€ãå¿ èŠã§ãã 1ã€ã®ãã¬ãŒã ãããã¡ãŒã¯ã«ã©ãŒã€ã³ããã¯ã¹ã§æ§æãããŸã-åããããã¡ãŒã¯æ£ããåºåã®ããã«ãã®äžã®è²ããã§ãã¯ããå¿ èŠãããããããã®ãããã¡ãŒãå¿ èŠã§ãã 2çªç®ã®ãããã¡ãŒã«ã¯ãæåã®ãããã¡ãŒã«ãããã®ã®ã³ããŒãå«ãŸããŠããŸãããè²ã¯æ¢ã«è¡šç€ºããããã«RGBå€ã§æ¢ã«è¡šãããŠããŸãã
ã°ã©ãã£ãã¯ã衚瀺ããã«ã¯ã2ã€ã®æ©èœãå¿ èŠã§ããèæ¯ãããŠã£ã³ããŠããã¹ãã©ã€ãã§æ§æãããçŸåšã®è¡ïŒLYïŒãç»é¢ã«è¡šç€ºããããã®1ã€-void Cookieboy :: GPU :: RenderScanlineïŒïŒãåŸç¶ã®åºåã®ã¹ãã©ã€ããã¥ãŒã€ã³ã°ã®ãã1ã€ã®äŸã¯ãvoid Cookieboy :: GPU :: PrepareSpriteQueueïŒïŒã§ãã LCDã³ã³ãããŒã©ãŒã®ããžãã¯ã®ã»ã¯ã·ã§ã³ã§ããããã®é¢æ°ã®åŒã³åºãå ãæ¢ã«è¿°ã¹ãŸããã
å®éããããã®é¢æ°ã®å®è£ ã«ã€ããŠè©±ãããšã¯äœããããŸãã-ãããšãžã®ãã¹ãŠãèšãããïŒãã¡ãããããã¯èå³æ·±ããã®ã§ã¯ãããŸããïŒãäœãèšããªãããã§ããããã§ã¯ãè¡åã®èªç±ããããŸã-ããªãã®ä»äºã¯ãç»é¢äžã§æ£ããç»åãååŸããããšã§ããã©ã®æ¹æ³ã§ããã«å°éãããã¯åé¡ã§ã¯ãããŸãããããŸããŸãªãšãã¥ã¬ãŒã¿ãŒã®ãœãŒã¹ã³ãŒãã«ãããšãããã¯é¡èã§ã-ä»ã®ã³ã³ããŒãã³ãã®å®è£ ã¯ã»ãŒåãã§ãããã¢ãããŒãã¯ã©ãã§ãå®å šã«ç°ãªããŸãã
ãŸãšãããšãçŸæç¹ã§ã¯ããšãã¥ã¬ãŒã¿ãŒã¯ã³ãŒããå®è¡ããç»é¢ã«ç»åã衚瀺ããããšããã§ããŸããããã¯ãã¹ãŠè¯ãããšã§ããããã¹ãROMãå®è¡ããŠå®è¡ãããäœæ¥ãè©äŸ¡ããããšã¯ã§ããŸãããã»ãšãã©ã®ãã¹ãã¯æéãã«ãŠã³ããããããDMGã®å¥ã®ã³ã³ããŒãã³ãã§ããã¿ã€ããŒãå®è£ ããå¿ èŠããããŸãã
ã¿ã€ããŒ
ã¿ã€ããŒã¯ãç¹å®ã®åšæ³¢æ°ã§åäœãã2ã€ã®ã«ãŠã³ã¿ãŒã®åœ¢åŒã§å®è£ ãããŸããDIVãšåŒã°ããæåã®ã«ãŠã³ã¿ãŒã¯ã16384 Hzã®åšæ³¢æ°ã§åäœããŸãïŒã€ãŸããã«ãŠã³ãããŠã³ã¯256ããã»ããµãŒãµã€ã¯ã«ããšã«çºçããŸãïŒãååãšãã®å®è£ ã¯ã©ã¡ããéåžžã«ç°¡åã§ãã瀺ãããé »åºŠã§ãå€ã¯DIVã¬ãžã¹ã¿ã§å¢åãããŸãã DIVã¯0ãã255ãŸã§ã«ãŒããããŸããå€ã255ã®å Žåã次ã®ãµã³ãã«ã§ã¯0ã«èšå®ãããŸããDIVã«èªåã§äœããæžã蟌ãããšãããšããã®å€ã¯ãªã»ãããããŸãã
2çªç®ã®ã«ãŠã³ã¿TIMAã¯ããå°ãè€éã§ãããå€ãã®æ©èœããããŸããåèšã§ã3ã€ã®ã¬ãžã¹ã¿ãäºçŽãããŠããŸãã
- TIMA . , 255 , DIV. , TIMA 0, TMA.
- TMA TIMA 255.
- TAC . .
äºå® | |
2 | :
0 â 1 â |
0-1 | :
00 â 4096 01 â 262144 10 â 65536 11 â 16384 |
å®è£ ã¯ãåè¿°ã®æ©èœã®ã¿ãèæ ®ããŠãDIVãšã»ãŒåãã§ããããã§ã¯ãLCDã³ã³ãããŒã©ã§è¡ãããããã«ãwhileã®äœ¿çšãèŠããŠãã䟡å€ããããŸãïŒãšããã§ãã«ãŒãã䜿çšããã«ãããé«éã§ç²ŸåºŠã®äœãã¢ãããŒãã䜿çšã§ããŸãïŒã 262144 Hzã®åšæ³¢æ°ã§ã¯ãåšæã¯16ãµã€ã¯ã«ãããªããããäžåºŠã«è€æ°ã®ãµã³ãã«ãäœæããå¿ èŠãããå Žåã«ç¶æ³ãçºçããå¯èœæ§ããããŸããã«ãŠã³ã¿ãŒã2ã€ä»¥äžã®æéã«çããå ŽåãåçŽãªæ¡ä»¶ã¯ãšã©ãŒã®èç©ã«ã€ãªããããããã¿ã€ããŒãæ£ããæ©èœããªãçç±ã§ããæåã®æ®µéã§ã¯ãåæ§ã®åé¡ããããŸããã
ãã®ãããçŸæç¹ã§ã¯ããã¹ãROMã䜿çšããŠãšãã¥ã¬ãŒã¿ããã¹ãããæºåãã§ããŠããŸãããã®åã«ãå¥ã®ãããã¯-管çã«ã€ããŠè§ŠããŸãã
éå¶ç®¡ç
åçã§ãããããã«ãDMGã«ã¯8ã€ã®ãã¿ã³ããããŸãã4æ¹åã®ååãAãã¿ã³ãšBãã¿ã³ãéå§ãã¿ã³ãšéžæãã¿ã³ã§ããã²ãŒã ãçŸåšã©ã®ãã¿ã³ãæŒãããŠãããã確èªã§ããããã«ãDMGã¯ãŠãŒã¶ãŒå ¥åãç»é²ããŠP1ãç»é²ããŸãããã®æ§é ã¯æ¬¡ã®ãšããã§ãã
ããã | äºå® |
5 | P15 |
4 | P14 |
3 | P13 |
2 | P12 |
1 | P11 |
0 | P10 |
è¡šãèŠããšãããã®ãã¹ãŠã®ãã¿ã³ã«ååãªãããããªãããšãããããŸããå®éããã¿ã³ã®ç¶æ ã¯P13ãP12ãP11ãP10ã«ã®ã¿èšé²ãããŸãããããP15ãšP14ã¯ãã¬ãžã¹ã¿P1ãä»ããŠèªã¿åã4ã€ã®ããŒã®ç¶æ ãéžæããããã«ãã²ãŒã ã®ROMã«ãã£ãŠå€æŽãããŸãã以äžã察å¿è¡šã§ãã
P15 | P14 | P13 | P12 | P11 | P10 |
1 | 0 | ããŠã³ | äžãž | å·Šãž | å³ãž |
0 | 1 | éå§ãã | éžæããŠãã ãã | B | A |
ãã®ã¬ãžã¹ã¿ã§ã¯ãå€ã0ã®ãããã¯ããŒãæŒãããããšãæå³ããŸããããŒãæŒããããšã察å¿ããå²ã蟌ã¿ãèŠæ±ãããŸãã STOPåœä»€ã®å®è¡ã«ããDMGãåæ¢ç¶æ ãã埩垰ãããã®ã¯ããã®å²ã蟌ã¿ã§ãããã®ç¶æ ã§ã¯ãã¡ã€ã³ã³ã³ããŒãã³ãã¯æ©èœãããå²ã蟌ã¿ã¯èŠæ±ãããŸããããã¿ã³ãæŒãã ãã§ãªã¯ãšã¹ãã§ããŸããç§ã®ãšãã¥ã¬ãŒã¿ãŒã§ã¯ãSTOPåœä»€ã¯ç¡èŠãããŸã-ã²ãŒã ã¯æ£åžžã«åäœããŸããããã¹ãROMã¯ãã§ãã¯ããŸããã
å®è£ ã§ã¯ãDMGãã¿ã³ããšãã¥ã¬ãŒãããããŒã®ç¶æ ãããŒãªã³ã°ããP15ããã³P14ã®å€ã«åŸã£ãŠå¯Ÿå¿ããããããèšå®ããŸããããããããã€ãã®ãã¥ã¢ã³ã¹ããããŸãã
ç©ççãªããŒïŒããŒããŒããã²ãŒã ããããæ¯åïŒãåãåãããŠãæ©èœããªãå¯èœæ§ãæãé«ããããã©ãŒãã³ã¹ã¯ãããŸã§ã«ãªãæªåããŸããå®éãããã¯å¿ é ã§ã¯ãããŸããã枬å®ã«ãŠã³ã¿ãŒãéå§ããããŒãç¹å®ã®å€ã«éãããšãã«ã®ã¿ããŒã®ç¶æ ã確èªããããšããå§ãããŸããã©ã£ã¡ïŒèªåã§æ±ºããŠãå šç»é¢æŽæ°ã®æé-70,224ãµã€ã¯ã«ã䜿çšããŸãããããã¯å¿«é©ãªã²ãŒã ã«ååã§ããã«ãŠã³ã¿ãŒãããŒã®æ¬¡ã®ããŒãªã³ã°ãŸã§ã®æéã枬å®ããéã以åã«ååŸããããŒã®ç¶æ ã«åŸã£ãŠP1ã¬ãžã¹ã¿ã®ããããèšå®ããŸãã
ãã¹ãŠããŸãšãã
æåŸã®ä»äžãã¯ããšãã¥ã¬ãŒã¿ã®å¿ èŠãªããŒã¹ãç¶æããããšã§ãã 1ã€ã®å šç»é¢æŽæ°ã¯70,224ãµã€ã¯ã«ç¶ããããã»ããµåšæ³¢æ°ã¯4194304 Hzã§ãããããDMGã¯çŽ59.73 Hzã®åšæ³¢æ°ã§ç»é¢ãæŽæ°ããŸããããã¯60 Hzã§ãããŸãããšãã¥ã¬ãŒã¿ãŒãç»é¢ã®æŽæ°ãå®äºãããã70224ãµã€ã¯ã«ãå®äºããããšã瀺ãå¿ èŠããããŸãã次ã«ãæŽæ°ãµã€ã¯ã«ãéå§ããŸãããã®ãµã€ã¯ã«ã§ã¯ããšãã¥ã¬ãŒã¿ãŒãåç»é¢æŽæ°ãå®äºããå¿ èŠããããŸãããããšäžŠè¡ããŠãPCããã®ç»é¢æŽæ°ããšãã¥ã¬ãŒãããã®ã«ãããæéã枬å®ããå¿ èŠããããŸããã»ãšãã©ã®å Žåãããã¯éåžžã«å°ããããã°ããã®éã¢ããªã±ãŒã·ã§ã³ããå®æ¥œæ»ããããå¿ èŠããããããçµæãšããŠãµã€ã¯ã«ã®1åã®å埩ã«ã¯1000/60ããªç§ããããŸããæéå ã«ããŒããŒãã«åãåãããããšã ããå¿ããªãã§ãã ããã
ãšãã¥ã¬ãŒã¿ãå¯èœãªéãæé«é床ã§åäœãããå Žåããšãã¥ã¬ãŒã¿ã§äžè¬çãªå éãšãã¥ã¬ãŒã·ã§ã³ãå®è£ ã§ããŸãã
ãããŠãç§ãã¡ãæã£ãŠãããã®ãçŸæç¹ã§ã¯ããšãã¥ã¬ãŒã¿ã«ã¯ã²ãŒã ã®å®è¡ã«å¿ èŠãªãã¹ãŠã®æ©èœãå«ãŸããŠããŸããä»ã®ãã¹ãŠã®æ©èœã¯ãªãã·ã§ã³ã§ãããåŸã§èª¬æããŸããããã§ããã¹ãROMã䜿çšããŠãšãã¥ã¬ãŒã·ã§ã³ã®æ£ç¢ºæ§ã確èªããããšãéèŠã§ãã
ãã¹ãäž
DMGã«ã¯ãããã»ããµãã¡ã¢ãªããµãŠã³ããLCDãªã©ã®ããŸããŸãªDMGã³ã³ããŒãã³ãããã¹ãããäžé£ã®ãã¹ãROMããããŸãããã¹ãã«åæ Œããã«ã¯ããšãã¥ã¬ãŒã¿ã§ROMãå®è¡ããã ãã§ããæã䟿å©ãªåœ¢åŒã®ãã¹ãçµæãç»é¢ã«è¡šç€ºãããŸããçŸæç¹ã§ã¯ãããã»ããµåœä»€ã®æ£ããåäœã®ãã¹ããããã»ããµåœä»€ã®ç¶ç¶æéã®ãã¹ããããã»ããµãšã¡ã¢ãªã®åæãã¹ããLCDãã¹ããå®æœã§ããŸããå ã®ãã¹ããžã®ãªã³ã¯ãšãã1ã€å¿µã®ãããäœæè ã®ãµã€ãã«äœãèµ·ãããããããªãå Žåããã¹ãã¯éåžžã«äŸ¿å©ã§ãããã¹ãèªäœã«å ããŠããªã³ã¯ãããœãŒã¹ã³ãŒããèŠã€ããããšãã§ããŸããã¢ã»ã³ãã©ãŒãç解ããããšã匷ããå§ãããŸãããã¹ãã®æ¹æ³ãšå 容ãç解ããããšã¯ããã°ã®ä¿®æ£ã«å€§ãã«åœ¹ç«ã¡ãŸããããã¯ããã»ã©éèŠã§ã¯ãªããããããŸããããå¥å šãªãã¹ãã§ã¯ããœãŒã¹ã³ãŒããç解ããªããšããšã©ãŒãä¿®æ£ã§ããªãããšããããŸãã
ããã»ããµãã¹ãã¯ãååœä»€ãå®è¡ãããåŸã«çµæãšãã©ã°ããã§ãã¯ããŸãããšã©ãŒã®å Žåãäžæ£ãªåœä»€ã®ãªãã³ãŒããç»é¢ã«è¡šç€ºãããŸãããã®ãã¹ãããã±ãŒãžã¯ãããŸããŸãªåœä»€ã°ã«ãŒãã®11ã®ãã¹ãã§æ§æãããŠããŸããã©ã®ç¹å®ã®åœä»€ã誀ã£ãŠå®è£ ãããŠãããã瀺ãã®ã¯åã ã®ãã¹ãã§ããã»ãšãã©ã®å Žåããã®æ®µéã§ã¯ãäž»ã«ãã©ã°ã«é¢é£ããå€ãã®ãšã©ãŒãçºçããŸããç§ãå人çã«POP AFãDAAãHALTãæã¡èŸŒãã åé¡ã®ã»ãšãã©ã POP AFã®æ£ããå®è£ ã«ã€ããŠã¯æ¢ã«è¿°ã¹ãŸããããåãã¬ãŒãã«åã³è¶³ãèžã¿å ¥ããããšã¯æå³ããããŸãããæéãšèå³ã倱ãã ãã§ãããã®ãããªåãã«è¶³ããªãåœä»€ã«ã€ããŠã®ç§ã®digãã«ã¯éçããããŸããã§ããããFãã¬ãžã¹ã¿ã®æªäœ¿çšãããããªã»ããããã ãã§ãããHALTã«ã€ããŠã詳ãã説æããŸããã CPUããã¥ã¢ã«ãç²ç®çã«ãã©ããšãå¥ã®äžé£ã®digãã«ã€ãªãããŸãã...
åœç¶ããã¹ãã«å®å šã«äŸåããã¹ãã§ã¯ãããŸããã誀ã£ãŠå®è£ ãããåœä»€ãŸãã¯ãã®æéã®ããã«ããã¹ãROMèªäœãæ£ããåäœããªãå ŽåããããŸãã DMGã®ããããåŽé¢ã®æãæ£ç¢ºãªå®è£ ãããã«åŠçããå¿ èŠããããŸããããããããšã§ããã¹ãã®å©ããåããŠãæ°ã¥ããªãã£ããã®ã ããç¹å®ããããäœæè ãããã¥ã¡ã³ãã§ç€ºãã®ãå¿ãããããããšãã§ããŸãã
ããã¯ãã¡ãžã£ãŒã«é¢é£ããã¡ãžã£ãŒã«ãšã£ãŠç¹ã«éèŠã§ããããã»ããµåœä»€ã®æéã®ãã¹ãã§ã¯ãæ¡ä»¶ä»ãåå²åœä»€ã®æéã®éããèæ ®ã«å ¥ããŠãååœä»€ã®æéããµã€ã¯ã«ã§ãã§ãã¯ããŸãããã®ãã¹ãã®Readmeã«ã¯ãã¡ãžã£ãŒãå«ãè¡šããããŸãã
èµ·åæã®ãã¹ãã§255ã®ãšã©ãŒãçºçããå¯èœæ§ããããŸãããã®ãšã©ãŒã¯ãã¹ãã®ãœãŒã¹ã³ãŒãã«ã¯å«ãŸããŠããªããããæ¢ã«inããç¶æ ã«æ»ããŸãããããã«æž¬å®ããããã®ã¿ã€ããŒãåæ Œããªãã®ã¯ãããã®å éšãã§ãã¯ã§ãããããè¡ãã«ã¯ãReadmeã®ããŒãã«ãçšæããå¿ èŠããããŸããããã®åŸããã¹ãã¯æ£åžžã«æ©èœãããŸã ãšã©ãŒãçºçããå Žæã瀺ããŸãããæ¡ä»¶åå²åœä»€ãäºå®ã§ãããä»ã®ã»ãšãã©ãã¹ãŠãçå®ã§ããã
ã¡ã¢ãªããã»ããµåæãã¹ãã¯ãããã»ããµåœä»€ã®å®è¡äžã«ã¡ã¢ãªã¹ããŒã¿ã¹ããã§ãã¯ããŸããåœä»€ã®å®è¡åŸã«ã®ã¿åæé¢æ°ãåŒã³åºããšããã¹ãã¯å€±æããŸããæ¢ã«æ£ããæ¹æ³ã説æããã®ã§ããã®ãã¹ãã«åæ Œããããšã¯ãã¯ãé£ãããããŸãããã©ã¡ãããšããã°ããã¹ãã¯å¿ èŠãªãã¹ãŠã®ããŒã¿ãç»é¢ã«è¡šç€ºããŸãããããã©ã®ããã«æ©èœãããçåã«æããªãããã¹ãŠãåæ©çã§ãããã¹ãŠã®æäœã¯ãæ倧åšæ³¢æ°ã«èšå®ãããã¿ã€ããŒã«ãŠã³ã¿ãŒã§å®è¡ãããŸããã¿ã€ããŒãšãã¹ãåœä»€ã®å®è¡ãæ£ããåæãããšãããã»ã¹ïŒã€ãŸãããã»ã¹ïŒã§ã«ãŠã³ã¿ãŒãå¢å ããããšãããããŸãããå®è¡åŸããããã®å€ããã§ãã¯ãããŸãã
æåŸã«ãLCDãã¹ãã LCDã³ã³ãããŒã©ãŒã®ç¶æ ã®æéãã©ã®çšåºŠæ£ç¢ºã«èæ ®ãããããŸããŸãªã€ãã³ãïŒããšãã°ãã©ã€ã³ã«ãŠã³ã¿ãŒLYã®å¢å ïŒããã€çºçãããããã§ãã¯ããŸãããã®ãã¹ãã«åæ ŒããªããšãããŸããŸãªç¶æ ã§ãããªã¡ã¢ãªãšOAMã®ãããã¯ããšãã¥ã¬ãŒãããããšããèããã¹ãã§ã¯ãããŸããããŸããLCDCã¬ãžã¹ã¿ã®7ãããã䜿çšããŠãæ£ãããªã³/ãªã衚瀺ãæ€èšŒããŸãããã®ãããã䜿çšããROMæäœã«ã¯ãç¹å®ã®ã¢ã¯ã·ã§ã³ãå¿ èŠã§ããããšãæ¢ã«è¿°ã¹ãŸããã
ãããã«
ããã§ãšãããããŸã-æ¶ç©ºã®ãšãã¥ã¬ãŒã¿ãŒã®æºåãã§ããŸããããã¹ãŠã®éèŠãªæ©èœãå«ãŸããŠããŸãããæ®ãã¯å®è£ ããå¿ èŠã¯ãããŸãã-ã²ãŒã ã¯ä»ã§ã¯æ£åžžã«åäœããŸãããã¬ã€ããããšã¯ã§ããŸãããé³ãåºãªãå Žåããšãã¥ã¬ãŒã¿ã¯ãŸã å£ã£ãŠããŸãããµãŠã³ãã«ã€ããŠã¯ã次ã®èšäºã§èª¬æããŸãããã®ãããã¯ã¯å€§ãããæ¯èŒçè€éã§ãèœãšãç©ŽããããããããŸãããéåžžã«èå³æ·±ããã®ã§ãã