è€éãªã·ã¹ãã ã®ãšãã¥ã¬ãŒããéå§ããåã«ãããšãã°Chip-8ãªã©ã®åçŽãªãã®ããå§ããå¿
èŠããããšèããããŠããŸãã ãã®èšäºã§ã¯ãä»®æ³ãã·ã³ã§ãã®èšèªã®å®è£
ãäœæããæ¹æ³ã®ãã¹ãŠã®åŽé¢ãæ€èšããŸãã ã©ã®ããã°ã©ãã³ã°èšèªã§ãå®è¡ã§ããŸããããã®åçŽããããDelphiãéžæããŸãã
åŸ
ã£ãŠãããã«ãšãã£ã¿ãŒã«çªå
¥ããªãã§ãã ãããæåã«ãã³ãšããŒããå¿
èŠã§ããããã§ãç§ãã¡èªèº«ã®ããã«ãã¹ãŠã®éèŠãªæ
å ±ãæžãçããŸãã ããã¯ãã¹ãŠåœŒå¥³ã®æ€çŽ¢ããå§ãŸããŸãã ãŸããããã¯ãã¡ããGoogleã§ãã 30åéãªã³ã¯ããã©ããšãã©ã®ã·ã¹ãã ã«å¯ŸããŠæ¢ã«ããã€ã®å®è£
ãäœæãããŠãããã確èªã§ããŸããéžæã¯ããããããŸããããä»ã®ãœãŒã¹ã³ãŒããèŠãã®ã§ã¯ãªããç¬èªã«äœæããŸãã
æŽå²çèæ¯
CHIP-8ã¯ãRCAã®TELMAC 1800ãCOSMAC VIPãªã©ã®äžéšã®å°ååçšã³ã³ãã¥ãŒã¿ãŒããETI 660ãDREAM 6800ã®ãããªå®äŸ¡ãªãèªåã§äœæãã³ã³ãã¥ãŒã¿ãŒã§70幎代åŸåãã80幎代ååã«äœ¿çšãããèšèªã€ã³ã¿ãŒããªã¿ãŒã§ãã ...
CHIP-8ã«ãããã²ãŒã ã®ããã°ã©ãã³ã°ãç°¡åã«ãªããŸããã TELMAC 1800ããã³COSMAC VIPã¯ãRCA CDP-1802ããã»ããµã«åºã¥ããŠããŸããã ã©ã¡ãã1977幎ã®12ã²ãŒã 以äžã®ãªãŒãã£ãªã«ã»ãããä»å±ããŠããŸãã ã€ã³ã¿ãŒããªã¿ãŒã«ã¯ãæ°åŠãããŒã¿ãããŒã®å¶åŸ¡ãã°ã©ãã£ãã¯ã¹ããµãŠã³ããªã©ã40æªæºã®ã³ãã³ãããããŸããã
ãããã®ã³ã³ãã¥ãŒã¿ãŒã®ã¡ã¢ãªå¶éã®ãããã€ã³ã¿ãŒããªã¿ãŒã¯éåžžã«å°ããããå¿
èŠããããŸãããCOSMACVIPã¯2KbïŒãã ãã32Kbã«æ¡åŒµå¯èœïŒã§ãTELMACã¯4Kbã§ããã CHIP-8ã®é·ãã¯512ãã€ãã®ã¿ã§ããã
èšèªã®ã·ã³ãã«ãã«ããããããªã²ãŒã ã®æåã®æ®µéã§ãã¬ã€ããPongãBrixãInvadersãTankãäœæã§ããŸããã åªããããã°ã©ããŒã¯ããããã®ã²ãŒã ã256ãã€ãæªæºã§å
¥ããããšãã§ããŸãã
DREAM-6800ãŠãŒã¶ãŒã®1人ã®CHIP-8ã«ã€ããŠã®çãã¹ããŒãªãŒã次ã«ç€ºããŸãã
ã
... DREAMãšETI 660ã¯ããªãŒã¹ãã©ãªã¢ã®é»åéèªã«ãã«ããããžã§ã¯ããšããŠç»å ŽããŸããããããã®ã³ã³ãã¥ãŒã¿ãŒãçµã¿åãããä¿¡ããããªãã»ã©äœäŸ¡æ ŒïŒçŽ100ãã«ïŒã16é²ããŒããŒãã®äœ¿çšãéåžžã«éãããã°ã©ãã£ãã¯ã¹64 x 32ãã¯ã»ã«ïŒETI 660 64 x 48ãŸãã¯64 x 64ïŒå€æŽæïŒããã¬ãã«è»¢éããçŽ1ãããã€ãã®RAMãããã³CHIP-8ãšåŒã°ããé«ã¬ãã«ã®æ¬äŒŒèšèªãå®è¡ããæ©èœïŒCOSMACã°ã©ãã£ãã¯ããã¢ã³ã¹ãã¬ãŒã·ã§ã³ããããã«RCAãéçºããããã§ãïŒã
...
ããæ¥ãå
ãDREAM 6800ãçµã¿ç«ãŠãŸããããªããŠã³ã³ãã¥ãŒã¿ãŒãªã®ã§ãããïŒ DREAMïŒETI 660ãã«ãã®èšäºãšäžç·ã«ãCHIP-8ã®ã²ãŒã ãªã¹ããå±±ã»ã©ãããŸããã äžéšã®ã²ãŒã ã¯200ãã€ã以äžã§ãã£ããããããããå
¥åããããšã¯æ°žé ã«ããããŸããã ãããŠããããã¯çŽ æŽãããã²ãŒã ã§ããã 圌ãã¯é
ããªãã£ãã ãããã£ãŠãCHIP-8ã¯å€å
žçãªãã¬ãã²ãŒã çšã«éåžžã«ããŸãèšèšãããŠããŸããã ã
Paul HyterïŒAmigaã®CHIP-8ã€ã³ã¿ãŒããªã¿ãŒãæçš¿ïŒ
ãã®åŸã90幎代ååã«HP48èšç®æ©ã§CHIP-8ã䜿çšãããŸãããããã¯ãCHIP-8ã§ã²ãŒã ãããéãæžãæ¹æ³ããªãã£ãããã§ãã CHIP-8ã®ã»ãšãã©ãã¹ãŠã®ãªãªãžãã«ã²ãŒã ãCHIP48ã€ã³ã¿ãŒããªã¿ãŒã§åäœããŸããããå€ãã®æ°ããã²ãŒã ãäœæãããŸããã
ãã®åŸãæ°ããããŒãžã§ã³ã®èšèª-SUPER-CHIPããªãªãŒã¹ãããŸããã 圌ã¯æšæºã®ãã¹ãŠã®æ©èœãåããŠããŸãããã128x64ã®è§£å床ã§æ¢ã«åäœããããšãã§ããŸããã
建ç¯
CHIP-8ã®ãã¹ãŠã®ããã°ã©ã ã¯200æéã§å§ãŸããŸãããETI-660ã¯600æéã§å§ãŸããŸãã ããã¯ãèšèªã€ã³ã¿ãŒããªã¿ãŒèªäœã000h-1FFhã«ããããã§ãã
ãã¹ãŠã®ã¡ã¢ãªã¯å®å
šã«ã¢ãã¬ã¹å¯èœã§ã¢ã¯ã»ã¹å¯èœã§ãã åœä»€ã¯16ããããå æãããããéåžžã¯å¶æ°ã¢ãã¬ã¹ãæã¡ã8ããããã³ãŒãå
ã«æ¿å
¥ããããšãã¢ãã¬ã¹ã¯å¥æ°ã«ãªããŸãã
ã¡ã¢ãªã¢ãã¬ã¹ã«äœ¿çšããã12ãããã«åºã¥ããŠãããªãã¯ãªãã®æ倧ã¡ã¢ãªéã¯4096ãã€ãïŒ000h-FFFhïŒã§ãããšèšç®ã§ããŸãã ãã ããã¢ãã¬ã¹F00h-FFFhã¯ãããªã¡ã¢ãªã«ãã£ãŠå æãããEA0h-EFFhã¯CHIP-8ã®ã¹ã¿ãã¯ããã³å
éšå€æ°ãæ ŒçŽããããã«äœ¿çšãããŸãã
ã€ã³ã¿ãŒããªã¿ãŒã¯ã8ãããã®ããªã¥ãŒã ãæã€16åã®æ±çšã¬ãžã¹ã¿ãŒã䜿çšããŸãã V0..VFãšããŠå©çšå¯èœã§ãã ããã«ãVFã¯ã転éã®å Žåã¯ç®è¡æŒç®ã®ãã©ã°ãšããŠãã¹ãã©ã€ããæç»ãããšãã¯è¡çªæ€åºåšãšããŠäœ¿çšãããŸãã
ãµã€ãºã16ãããã®ã¢ãã¬ã¹ã¬ãžã¹ã¿ïŒIïŒã1ã€ãããŸãã ã¡ã¢ãªã¯4ãããã€ããããªããããã€ã³ã¿ãŒããªã¿ãŒã¯äžäœ12ãããã®ã¿ã䜿çšããŸããã ãã ãããã©ã³ãã8110ã«ãããããäžäœ4ãããã¯ãã©ã³ãã®ããŠã³ããŒãæ©èœã«äœ¿çšã§ããŸãã
ã¬ãžã¹ã¿ã«å ããŠã2ã€ã®ã¿ã€ããŒããããŸããã 1ã€ã¯é
延ã¿ã€ããŒããã1ã€ã¯ãªãŒãã£ãªã¿ã€ããŒã§ãã äž¡æ¹ãšã8ãããã®é·ãã§ããããã®æç¹ã§ãŒãã§ãªãå Žåã1ç§ããã60åã³ã³ãã³ããåæžããŸããã ã€ãŸããåšæ³¢æ°ã¯60ãã«ãã§ããã ãµãŠã³ãã¿ã€ããŒã®å€ããŒã以å€ã®å ŽåããµãŠã³ããåçãããŸããã
ã¹ã¿ãã¯ã®æ¬¡å
ã¯äžæã®ãŸãŸã§ãããã16ã¬ãã«ïŒ2x16ãã€ãïŒã§è¡ãã®ãäžè¬çã§ãã
ã°ã©ãã£ãã¯ã¯ããã€ãåäœã§ãšã³ã³ãŒãããã1..15ãã¯ã»ã«ã®8ã€ã®ã¹ãã©ã€ãã§ã¬ã³ããªã³ã°ãããŸãã åç¹ã¯å·Šäžé
ã«ããããã€ã³ã0ããå§ãŸããŸãããã¹ãŠã®åº§æšã¯æ£ã§ããããããã64ãŸãã¯32ã«ããé€ç®ã®æ®ããšèŠãªãããŸãã ç»é¢ãžã®åºåã¯XORã¢ãŒãã§ãã 1ã€ä»¥äžã®ãã¯ã»ã«ãã¯ãªã¢ããããšïŒè²ã1ãã0ã«å€æŽããïŒãVFã¬ãžã¹ã¿ã¯01hãš00hã«èšå®ãããŸãã Chip-8ã«ã¯ãæå0-9ããã³AFãå«ã4x5ãã¯ã»ã«ã®ãã©ã³ãããããŸãã
æ確ã«ããããã«ãã¹ãã©ã€ããšãã®ã³ãŒãã£ã³ã°ã®äŸãèããŠã¿ãŸãããã 8x5ã®ã¹ãã©ã€ããåããŸãã
次ã®ãã€ãã»ãããååŸããŸã
0 A0 0 A0 0
å®å
šã«ã¯ãªã¢ããã«ã¯ãå¥ã®1ã¹ãã©ã€ã8x8ã䜿çšããŸãã
ã¹ãã©ã€ãã¯8ãã€ããå æãã次ã®æ§é ãæã¡ãŸã
0 60 30 18 0 06 03
CHIP-8ã®ããŒããŒãã¯16çªç®ã§ã次ã®å€èŠ³ããããŸãã
ãã®ãããªããŒããŒãã®å©äŸ¿æ§ãšäŸ¿å®æ§ã¯ãè°è«ãšè°è«ããã§ããŸããã ãããããã¹ãŠããã®ãããªããŒããŒãã®ããã«ç¹å¥ã«éçºãããã®ã§ãæã
ã¯ãªãªãžãã«ããåºçºããŸããã
ã³ãã³ãã·ã¹ãã
ã¢ãã¬ã¹ãNNNãKK-8ãããå®æ°ãXããã³Y-4ãããå®æ°ãšããŠæå®ããããšãããã«èšãå¿
èŠããããŸãã
次ã«ãã³ãã³ãã®ãªã¹ããæ€èšããŸãã
0NNN Syscall nnnã³ãŒãNNNã§ããã»ããµ1802ã®æ©æ¢°åœä»€åœä»€ãåŒã³åºããŸãã
00CN * scdown nç»é¢ãNè¡äžã«ã¹ã¯ããŒã«ããŸãã
00FB *ç»é¢ãå³ã«4ãã¯ã»ã«ã¹ã¯ããŒã«ããScright
00FC *ç»é¢ãå·Šã«4ãã¯ã»ã«ã¹ã¯ããŒã«ããScleft
00FD *ãšãã¥ã¬ãŒã¿ãŒãçµäºãã
00FE *äœã°ã©ãã£ãã¯ã¢ãŒããCHIP-8ïŒ64x32ïŒã«èšå®ããŸã
00FF *é«ã°ã©ãã£ãã¯ã¢ãŒããã¹ãŒããŒãããïŒ128x64ïŒã«èšå®ããŸã
00E0 Clsã¯ãªã¢ã¹ã¯ãªãŒã³
00EE Rtsã«ãŒãã³ããã®æ»ã
1NNN jmp nnnããã°ã©ã å®è¡ãNNNã«è»¢é
2NNN jsr nnn NNNã§ã®é¢æ°åŒã³åºãã åã®ã¢ãã¬ã¹ãã¹ã¿ãã¯ã«ããã·ã¥ãããŸãã
3XKK skeq vxãkk VX = KKã®å Žåã次ã®åœä»€ïŒ2ãã€ãïŒãã¹ãããããŸã
4XKK skne vxãkk VX <> KKã®å Žåã次ã®åœä»€ïŒ2ãã€ãïŒãã¹ãããããŸã
5XY0 skeq vxãvy VX = VYã®å Žåã次ã®åœä»€ãã¹ãããããŸã
6XKK mov vxãkk VXã¬ãžã¹ã¿ã«KKãæžã蟌ã¿ãŸã
7XKKã¯vxãkkãè¿œå ããŸãVXã¬ãžã¹ã¿ã«VX + KKãæžã蟌ã¿ãŸãïŒãŠã£ãããã£ã¢ããã³ãã®ä»ã®ãœãŒã¹ããã®æ
å ±ã«ãããšããã©ã°ã«ã¯åœ±é¿ããŸããïŒ
8XY0 mov vxãvy VXã§ã¬ãžã¹ã¿VYã®å€ãæžã蟌ã
8XY1ãŸãã¯vxãvy VX = VXãŸãã¯VYã
8XY2ããã³vxãvy VX = VX AND VY
8XY3 xor vxãvy VX = VX XOR VYïŒå
ã®ææžã«ã¯ææžåãããŠããŸããïŒ
8XY4ã¯ãvxãvy VX = VX + VYãè¿œå ããŸãã VF =ãã£ãªãŒã
8XY5ãµãvxãvy VX = VX-VYã ïŒ*ïŒVF =åçšããªãã
8X06 shr vx VX = VX SHR 1ïŒVX = VX / 2ïŒãVF =ãã£ãªãŒ
8XY7 sub vyãvx VX = VY-VXãVF =åçšããªãïŒ*ïŒïŒå
ã®ææžã«ã¯èšèŒãããŠããŸããïŒ
8XYE shl vx VX = VX SHL 1ïŒVX = VX * 2ïŒãVF =ãã£ãªãŒ
9XY0 skne vxãvy VX <> VYã®å Žåã次ã®ã¹ããŒãã¡ã³ããã¹ãããããŸã
ANNN mov Iãnnn I = NNN
BNNN Jmi NNN NNN + V0ãžã®ããã°ã©ã å®è¡ã®è»¢é
CXKKã©ã³ãvxãkk VX =ïŒä¹±æ°0..255ïŒããã³KK
DXYN vxãvyãnãæç»ããŸããã¬ãžã¹ã¿Iã«å«ãŸããã¢ãã¬ã¹ã®ã¡ã¢ãªã§å§ãŸã座æšïŒVXãVYïŒã§ãé«ãNïŒN = 0ã«ãŠã³ãN = 16ïŒã§å¹
8ã®ã¹ãã©ã€ããæç»ããŸããVF=è¡çªã
EX9E Skpr vx VXããŒãæŒãããå Žåã以äžã®æ瀺ãã¹ãããããŸãã
EXA1 Skup vx VXã§æ°åããŒãæŒãããŠããªãå Žåã以äžã®æ瀺ãã¹ãããããŸãã
FX07 Gdelay vx VX =é
延ã¿ã€ããŒ
FX0A Key vxãã¿ã³ãæŒãããã®ãåŸ
ã£ãŠãVXã«è¿œå ããŸãã
FX15 Sdelay vxé
延ã¿ã€ããŒ= VX
FX18 Ssound vxãµãŠã³ãã¿ã€ããŒ= VX
FX1E Add Iãvx I = I + VX
FX29 Font vx VXã«å«ãŸãããã©ã³ãã¹ãã©ã€ã4 x 5ã®16é²æåã®Iã¢ãã¬ã¹ã«å
¥å
FX33 Bcd vx BCD VXè¡šçŸãã¡ã¢ãªã®I..I + 2ã¢ãã¬ã¹ã«é
眮ããŸãã ããšãã°ãVXã«4Fhãå«ãŸããå Žåã00h 07h 09hãã¡ã¢ãªã«æžã蟌ãŸããŸããã€ãŸãã4Fhã®10é²è¡šçŸã§ãã
FX55 Save vx Saves V0 ... VXã¬ãžã¹ã¿ãŒã¯ã¢ãã¬ã¹Iããå§ãŸãã¡ã¢ãªãŒã«ä¿åãããŸãã
FX65 Load vxã¢ãã¬ã¹Iããå§ãŸãã¡ã¢ãªããã¬ãžã¹ã¿V0 ... VXãããŒãããŸã
FX75 * Ssave vxã¯V0 ... VXïŒX <8ïŒãHP48ãã©ã°ã«ä¿åããŸã
FX85 * Sload vx HP48ãã©ã°ããV0 ... VXïŒX <8ïŒãããŒã
*-ã³ãã³ããSUPER CHIPã€ã³ã¿ãŒããªã¿ãŒã«ã®ã¿é¢é£ããããšãæå³ããŸãã
ïŒ*ïŒïŒVX-VYãçºçãããšãVFã¯ããŒã³ã®æåŠã«èšå®ãããŸãã ã€ãŸããVXãVY以äžã®å ŽåãããŒã³= 0ã§ãããããVFã¯01ã«èšå®ãããŸããVXãVYããå°ããå ŽåãããŒã³= 1ã§ãããããVFã¯00ã«èšå®ãããŸãã
åºæ¬çãªã¹ãã©ã€ãã®æºå
çŽãšãã³ã䜿çšããŠããã©ã³ãã¹ãã©ã€ãã®èŒªéãæããŸãã ãã®ã»ããã®ãããªãã®ãåŸãããŸãïŒ
ããã䜿çšããŠãåã¹ãã©ã€ãã®å€ã®ãã€ããæžã蟌ã¿ãŸãã
ãšãã¥ã¬ãŒã·ã§ã³ã®åå
ãã¹ãŠã®ãšãã¥ã¬ãŒã·ã§ã³ã¯ãã»ãŒãã®ã¿ã€ãã®ãµã€ã¯ã«ã§è¡ããããšèããããŠããŸãã
ç¹°ãè¿ã
//ãšãã¥ã¬ãŒã·ã§ã³ãè¡ããŸã
quit_pr ãŸã§
ããã§ãquit_prã¯ãšãã¥ã¬ãŒã·ã§ã³ãåæ¢ããå
åãšèŠãªãããå€éšããã ãã§ãªãããšãã¥ã¬ãŒã·ã§ã³ã®å
éšãããå€æŽã§ããŸãã
éµå®ãã¹ãæãéèŠãªãã€ã³ãã®1ã€ã¯ãæ©åšã®åäœåšæ³¢æ°ãšæé©åã®éµå®ã§ãã CHIP-8ã®ãããªåçŽãªèšèªã®ãšãã¥ã¬ãŒã·ã§ã³ãèšè¿°ããã®ãééã£ãŠããå Žåãéåžžã«äœãããã©ãŒãã³ã¹ãšéåžžã«é«ãããã»ããµæéãåŸãããšãã§ããŸãããæ£ãããšãã¥ã¬ãŒã·ã§ã³ã¯æäœã³ã¹ãã§ååãªããã©ãŒãã³ã¹ãæäŸããŸãã
Delphiã䜿çšããŠãã·ã¹ãã ãšãã¥ã¬ãŒã·ã§ã³ãã¯ã©ã¹ãšããŠéçºããããšã«ãããã®ã·ã¹ãã å
ã§äœ¿çšãããããã»ããµã®ã¢ãã«ã«åºã¥ããŠããTCpu1802ããšããååãä»ããŸããã ã¡ã€ã³ã®å®è¡æé ãæ€èšããŠãã ããã
ããã·ãŒãžã£ tcpu1802 èµ°ã
å§ãã
delaytimer ã æå¹ ïŒ = true ;
ãµãŠã³ãã¿ã€ããŒã æå¹ ïŒ = true ;
drawtimer ã æå¹ ïŒ = true ;
work ïŒ = true ;
ç¹°ãè¿ã
useopcode ;
cpumulty <> 0ã® å Žå
if ïŒ round ïŒ cycle ïŒ mod ïŒ 2 ïŒ ïŒ = 0 then sleep ïŒ cpumulty ïŒ ;
ã¢ããªã±ãŒã·ã§ã³ã ProcessMessages ;
work = false ãŸã§ ã
delaytimer ã æå¹ ïŒ = false ;
ãµãŠã³ãã¿ã€ããŒã æå¹ ïŒ = false ;
drawtimer ã æå¹ ïŒ = false ;
çµãã ;
ãŸããèµ·åæã«ãCHIP-8ã¿ã€ããŒã®2ã€ã®æšæºãšãç»é¢ãåæç»ããããã«åå¥ã«å
¥åããã1ã€ã®æšæºãã¢ã¯ãã£ãã«ããŸãã ãµã€ã¯ã«-ã³ãã³ãã®çŸåšã®ãµã€ã¯ã«ãå«ãå€æ°ãåã³ãã³ãã®åŒã³åºãã«ããããµã€ã¯ã«ã1ã€å¢å ããŸãã 2çªç®ã®ã¢ã¯ã·ã§ã³ããšã«ãcpumultyããªç§éã€ã³ã¿ãŒããªã¿ãŒãäžæåæ¢ããããšããŸãã ããã¯ãé«éåãçºçããªãããã«ããããã«å¿
èŠã§ãã
Soundtimerã¿ã€ããŒãšDrawtimerã¿ã€ããŒã®ééã¯17ããªç§ã§ããã€ãŸãã58.82ãã«ãã®åšæ³¢æ°ã§åäœããŸããããã¯ããªãªãžãã«ã«å¯èœãªéãè¿ããã®ã§ãã
ãããŒã¿ã€ããŒã®é
延ã¯10ããªç§ã«èšå®ãããŠããŸãã ã€ãŸããå¹³åããŠãã¬ã³ããªã³ã°ã¯3ã4åã®ã€ã³ã¿ãŒããªã¿ãŒã³ãã³ãããšã«å®è¡ãããŸãã ã€ã³ã¿ãŒããªã¿ãŒã®å®è¡ããã»ã¹ãè©°ãŸãããªãããã«ã¿ã€ããŒãžã®å²ãåœãŠãè¡ãããããã»ã¹ã®äžŠååãå®è¡ããããã®éåžžã®æ段ã䜿çšããããšãã§ããŸãã
ãšãã¥ã¬ãŒã·ã§ã³èªäœãå®äºããããã«å¿
èŠãªå€æ°ã®ãªã¹ããèŠãŠã¿ãŸãããã
ããŒã³ãŒãïŒ ãã€ã ; //æŒãããããŒã®ã³ãŒã
ã¡ã¢ãªïŒ ãã€ãã® é
å [ 0 .. 8191 ] ã //ãã©ã³ãã®å Žæã®ããã«å²ãåœãŠããã8ãããã€ãã®RAM
ã¹ã¿ãã¯ïŒ åèªã® é
å [ 0..255 ] ã //ã¹ã¿ãã¯
stacksize ïŒ byte ; //çŸåšã®ã¹ã¿ãã¯ã¹ã€ãŒã
videoarray ïŒ ããŒã«å€ã® é
å [ 0..2047 ] ã //ãããªé
å
ãã¹ã¯ïŒ ããŒã«å€ã® é
å [ 0..2047 ] ã //ãããªé
åã®ãã¹ã¯
Vreg ïŒ ãã€ãã® é
å [ 0 .. 15 ] ã //-V0..VFãç»é²ããŸã
Ireg ïŒ èšè ã // 2ãã€ãã®ã¢ãã¬ã¹ã¬ãžã¹ã¿
CodeSender ïŒ ã¯ãŒã ã //ã¡ã¢ãªå
ã®æ¬¡ã®ãªãã³ãŒãã®å Žæ
é³ïŒ ããŒã«å€ ; //ãµãŠã³ãã¯çŸåšåçäžã§ããïŒ
ã¢ãŒããã¯ãã£ã«ããã°ããããªã¡ã¢ãªã¯ä»ã®ãã¹ãŠãšåãéã®RAMã«é
眮ãããŸããããããžã®äžå®ã®èªã¿åããšæžã蟌ã¿ããã€ãã®æ€æ»ãšåæã¯å€ãã®ããã»ããµãªãœãŒã¹ãæ¶è²»ããããã°ã©ã ãäœããèªã¿åãããšãã§ãããšä»®å®ãããšéçŸå®çã§ãããããçŽæ¥ããã®ã¡ã¢ãªé åããã®èªã¿åããçºçããå Žåãmirrorvideomemãšããè¿œå ã®ããã·ãŒãžã£ãåŒã³åºãã ãã§ãããã«ãããªã¡ã¢ãªã®çŸåšã®å
容ãæžã蟌ãããšãã§ããŸãã ãã®ãããªãœãªã¥ãŒã·ã§ã³ã¯å¹æçã§ãããRAMã®äœ¿çšéããããã«å¢ããŸãã ãã©ãŒã¹ã¿ãã¯ã®æé ã¯äŒŒãŠããŸãã
ããã·ãŒãžã£ tcpu1802 mirrorvideomem ;
var
i ã j ïŒ æŽæ° ã
tmp ïŒ ãã€ã ;
å§ãã
if ïŒ Ireg> = $ F00 ïŒ and ïŒ Ireg < = $ FFF ïŒ then
å§ãã
for i ïŒ = 0 ãã 255 ãŸã§
å§ãã
tmp ïŒ = 0 ;
for j ïŒ = 0 ãã 7 do
å§ãã
videoarray [ i * j ] if tmp ïŒ = tmp + 1 ;
tmp ïŒ = tmp shl 1 ;
çµãã ;
ã¡ã¢ãª[ $ F00 + i ] ïŒ = tmp ;
çµãã ;
çµãã ;
çµãã ;
ããã·ãŒãžã£ tcpu1802 mirrorstack ;
var
n ã i ïŒ æŽæ° ;
å§ãã
if ïŒ Ireg> = $ EA0 ïŒ and ïŒ Ireg < = $ EFF ïŒ then
å§ãã
stacksize> 12 then n ïŒ = 11 else n ïŒ = stacksize - 1 ;
for i ïŒ = 0 ãã n
å§ãã
ã¡ã¢ãª[ $ EFF - i * 2 ] ïŒ = stack [ i ] div 256 ;
ã¡ã¢ãª[ $ EFF - i * 2 + 1 ] ïŒ = stack [ i ] mod 256 ;
çµãã ;
çµãã ;
çµãã ;
ããã»ããµãäœæããåã«ãåã³ãã³ããæ¡ä»¶ä»ãã§4ãããã®4ã€ã®ã»ã¯ã·ã§ã³ã«åå²ãããŠããããšãããããŸãã ãããã䜿çšããããã«ãopcodeããŒã¿åãå°å
¥ãããŸããïŒtype opcode = array [0..3] of byte;ïŒã
ã¡ã¢ãªãã次ã®ããŒã¿ãå€æããŠèªã¿åãããšã¯ããŸãããããšãã¥ã¬ãŒã·ã§ã³ãå®è¡ããå®è¡æé ã®æ§é ã«æ³šæãæããŸãã æé©åã®ããã«ããif then elseãã§ã¯ãªããcaseãã䜿çšããããã«å€ãã®ã³ãã³ãã䜿çšããŠã¢ã»ã³ãã©ã§äœ¿çšã§ããããããšãã¥ã¬ãŒã·ã§ã³ãããã«é«éåãããŸãã ãã®ãããªã³ãã³ãã®äŸã次ã«ç€ºããŸãã
op [ 3 ] = 1ã® å Žå
å§ãã
tmp ïŒ = Vreg [ op [ 1 ] ] ;
tmp2 ïŒ = Vreg [ op [ 2 ] ] ;
asm
mov ah ã [ tmp ]
ãŸãã¯ããã [ tmp2 ] ;
mov [ tmp ] ã ah ;
çµãã ;
Vreg [ op [ 1 ] ] ïŒ = tmp ;
䜿çšïŒ = true ;
ã³ãŒãéä¿¡è
ïŒ =ã³ãŒãéä¿¡è
+ 2 ;
çµãã ;
ããã§ããšãã¥ã¬ãŒã·ã§ã³ã®ãã¹ãŠã®ç¬éãèæ
®ããŠãç¬èªã®CHIP-8ãšãã¥ã¬ãŒã·ã§ã³ãäœæã§ããŸãã ç§ã®èšäºã楜ããã§ããã ããããã圹ã«ç«ãŠã°å¹žãã§ãã èªãã§ãããŠããããšãã
äžå€åïŒ
CHIP-8 / SCHIPãšãã¥ã¬ãŒã¿ãŒ
ãã€ãŽã£ããã»ãŠã£ã³ã¿ãŒïŒHPMANIACïŒ
ãŠã£ãããã£ã¢
ã¢ãžã¥ãŒã«ãœãŒã¹ïŒ
ãœãŒã¹ã³ãŒã
ãŠãŒã¶ãŒ
nsinrealããæåŸ
ç¶ãåãåã£ãã®ã¯åœŒå¥³ã®ãã
ã§ããã
éä¿¡ã§ããªãããããã®
èšäºã®å
¬éã®1æéåã«è¡šç€ºããã
èšäºããã³ããŒã¢ã³ãããŒã¹ãããšèŠãªããªãããã«ãšããèŠæ±ã ã¢ãžã¥ãŒã«ã®å
容ããšãã¥ã¬ãŒã·ã§ã³ãžã®ã¢ãããŒããç°ãªãããããäºãã®èšäºã衚瀺ãããªãã£ãããšãäºåã«æè¬ããŠãã ããã