SlideShare ist ein Scribd-Unternehmen logo
1 von 74
Downloaden Sie, um offline zu lesen
Reading
php-terminal-gameboy-emulator
Digital Circus, Inc.
HASEGAWA Tomki
HASEGAWA Tomoki
@tomzoh
Web / iOS App Development,
Rental Kart Race, Beer, IoT crafting, …
hasegawa

tomoki
Digital Circus, Inc. Vice-master CTO
Tokyo, Japan
Interests
・ Web Development
・ Mobile Apps Development
・ Service
( )
(iOS, Android)
(http://appbuilder.jp)
Twitter: @tomzoh
Twitter: @tomzoh
Today’s theme
Reading
php-terminal-gameboy-emulator
Today’s theme
Reading
php-terminal-gameboy-emulator
By Transfrom JPEG version and remove white background. Original by Evan-Amos. - Media:Game-Boy-FL.jpg,
Public Domain, https://commons.wikimedia.org/w/index.php?curid=37808150
23, February
😮
😮
😮
Awesome!!
😮
Awesome!!
Waste of talent!!
😮
Awesome!!
Waste of talent!! Cool!!
Source Files
Source Files
It’s PHP !
Source Files
It’s PHP !
We can read it.
Source Files
It’s PHP !
Yes, We can!
We can read it.
Source Files
It’s PHP !
Yes, We can!
Yes, We can!
We can read it.
Today’s theme
Reading
php-terminal-gameboy-emulator
Components of GAMEBOY
• CPU / Memory
• Display
• Sound
• Buttons
• Communication Port
Components of GAMEBOY
• CPU / Memory
• Display
• Sound
• Buttons
• Communication Port
Buttons
Buttons - Keyboard.php
<?php
namespace GameBoy;
class Keyboard
{
public $core;
public $file;
public $keyPressing = null;
public $started = false;
public function __construct(Core $core)
{
$this->core = $core;
exec('stty -icanon');
$this->file = fopen('php://stdin', 'r');
stream_set_blocking($this->file, false);
}
public function check()
{
Buttons - Keyboard.php
<?php
namespace GameBoy;
class Keyboard
{
public $core;
public $file;
public $keyPressing = null;
public $started = false;
public function __construct(Core $core)
{
$this->core = $core;
exec('stty -icanon');
$this->file = fopen('php://stdin', 'r');
stream_set_blocking($this->file, false);
}
public function check()
{
How to sense buttons
How to sense buttons
$this->file = fopen('php://stdin', 'r');
How to sense buttons
$this->file = fopen('php://stdin', 'r');
$key = fread($this->file, 1);
Simple
CPU / Memory
CPU
SHARP LR35902 instruction set
http://www.pastraiser.com/cpu/gameboy/gameboy_opcodes.html
1byte instructions Prefix CB instructions
144 instructions 256 instructions+
= 400 instructions
SHARP LR35902 resistors
http://www.pastraiser.com/cpu/gameboy/gameboy_opcodes.html
15 … 8 7 … 0
A F
B C
H L
15 … 8 7 … 0
SP (Stack Pointer)
PC (Program Counter)
8bit / 16bit resistors
16bit resistors
Flag registor
7 6 5 4 3 2 1 0
Z N H C 0 0 0 0
•Z - Zero Flag
•N - Subtract Flag
•H - Half Carry Flag
•C - Carry Flag
•0 - Not uses, always zero
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Address
LD A, d8
2 8
- - - -
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Length in bytes
Address
LD A, d8
2 8
- - - -
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Duration in cyclesLength in bytes
Address
LD A, d8
2 8
- - - -
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Duration in cycles
Flags affected
Length in bytes
Address
LD A, d8
2 8
- - - -
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Address
LD A, d8
2 8
- - - -
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Address
LD A, d8
2 8
- - - -
PC (Program Counter)
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
Load 0x0301 into BC resistor
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Address
LD A, d8
2 8
- - - -
PC (Program Counter)
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Address
LD A, d8
2 8
- - - -
PC (Program Counter)
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Address
LD A, d8
2 8
- - - -
Load 0x99 into A resistor
PC (Program Counter)
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Address
LD A, d8
2 8
- - - -
PC (Program Counter)
Instruction in memory
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
Load A resistor’s value into memory
indicates with BC resistor
x0 x1 x2 xE
0x 3x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Address
LD A, d8
2 8
- - - -
PC (Program Counter)
CPU - Opcode.php
<?php
namespace GameBoy;
class Opcode
{
public $functionsArray = [];
public function __construct()
{
//NOP
//#0x00:
$this->functionsArray[] = function ($parentObj) {
//Do Nothing...
};
//LD BC, nn
//#0x01:
$this->functionsArray[] = function ($parentObj) {
CPU - Opcode.php
<?php
namespace GameBoy;
class Opcode
{
public $functionsArray = [];
public function __construct()
{
//NOP
//#0x00:
$this->functionsArray[] = function ($parentObj) {
//Do Nothing...
};
//LD BC, nn
//#0x01:
$this->functionsArray[] = function ($parentObj) {
x0 x1 x2
0x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
CPU - Opcode.php
<?php
namespace GameBoy;
class Opcode
{
public $functionsArray = [];
public function __construct()
{
//NOP
//#0x00:
$this->functionsArray[] = function ($parentObj) {
//Do Nothing...
};
//LD BC, nn
//#0x01:
$this->functionsArray[] = function ($parentObj) {
Implementation of 0x00 NOP
x0 x1 x2
0x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
CPU - Opcode.php
<?php
namespace GameBoy;
class Opcode
{
public $functionsArray = [];
public function __construct()
{
//NOP
//#0x00:
$this->functionsArray[] = function ($parentObj) {
//Do Nothing...
};
//LD BC, nn
//#0x01:
$this->functionsArray[] = function ($parentObj) {
x0 x1 x2
0x
LD BC, d16
3 12
- - - -
NOP
1 4
- - - -
LD (BC), A
1 8
- - - -
Implementation of 0x01 LD BC, d16
//LD BC, nn
//#0x01:
$this->functionsArray[] = function ($parentObj) {
$parentObj->registerC =
$parentObj->memoryReader[$parentObj->programCounter]($parentObj, $parentObj->programCounter);
$parentObj->registerB =
$parentObj->memoryRead(($parentObj->programCounter + 1) & 0xFFFF);
$parentObj->programCounter = ($parentObj->programCounter + 2) & 0xFFFF;
};
Implementation of LD BC, d16
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
Address
PC (Program Counter)
//LD BC, nn
//#0x01:
$this->functionsArray[] = function ($parentObj) {
$parentObj->registerC =
$parentObj->memoryReader[$parentObj->programCounter]($parentObj, $parentObj->programCounter);
$parentObj->registerB =
$parentObj->memoryRead(($parentObj->programCounter + 1) & 0xFFFF);
$parentObj->programCounter = ($parentObj->programCounter + 2) & 0xFFFF;
};
Implementation of LD BC, d16
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
Address
PC (Program Counter)
C
//LD BC, nn
//#0x01:
$this->functionsArray[] = function ($parentObj) {
$parentObj->registerC =
$parentObj->memoryReader[$parentObj->programCounter]($parentObj, $parentObj->programCounter);
$parentObj->registerB =
$parentObj->memoryRead(($parentObj->programCounter + 1) & 0xFFFF);
$parentObj->programCounter = ($parentObj->programCounter + 2) & 0xFFFF;
};
Implementation of LD BC, d16
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
Address
PC (Program Counter)
B
//LD BC, nn
//#0x01:
$this->functionsArray[] = function ($parentObj) {
$parentObj->registerC =
$parentObj->memoryReader[$parentObj->programCounter]($parentObj, $parentObj->programCounter);
$parentObj->registerB =
$parentObj->memoryRead(($parentObj->programCounter + 1) & 0xFFFF);
$parentObj->programCounter = ($parentObj->programCounter + 2) & 0xFFFF;
};
Implementation of LD BC, d16
0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301
0x01 0x01 0x03 0x3e 0x99 0x02 0x99
LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A
Data
Instruction
Address
PC (Program Counter)
Implementation of JP a16
x3
cx
JP a16
3 16
- - - -
Implementation of JP a16
x3
cx
JP a16
3 16
- - - -
Jump to address a16
Implementation of JP a16
x3
cx
JP a16
3 16
- - - -
Jump to address a16
0x0000 0x0001 0x0002
0xc3 0x29 0x03
JP a16 0x0329
Data
Instruction
Address
Implementation of JP a16
x3
cx
JP a16
3 16
- - - -
Jump to address a16
0x0000 0x0001 0x0002
0xc3 0x29 0x03
JP a16 0x0329
Data
Instruction
Address
Jump to address 0x0329
Implementation of JP a16
x3
cx
JP a16
3 16
- - - -
Jump to address a16
//JP nn
//#0xC3:
$this->functionsArray[] = function ($parentObj) {
$parentObj->programCounter =
($parentObj->memoryRead(($parentObj->programCounter + 1) & 0xFFFF) << 8) +
$parentObj->memoryReader[$parentObj->programCounter]($parentObj, $parentObj->programCounter);
};
0x0000 0x0001 0x0002
0xc3 0x29 0x03
JP a16 0x0329
Data
Instruction
Address
Jump to address 0x0329
Run loop
public function executeIteration()
{
$op = 0;
while ($this->stopEmulator == 0) {
$op = $this->memoryRead($this->programCounter);
$this->programCounter = ($this->programCounter + 1) & 0xFFFF;
$this->CPUTicks = $this->TICKTable[$op];
$this->OPCODE[$op]($this);
$this->updateCore();
}
}
Not difficult
Simple, Easy
Let’s read
php-terminal-gameboy-emulator
Thanks
@tomzoh
WE ARE HIRING
Drupal / Mobile App Engineer

Digital Circus, Inc. Tokyo, Japan
@tomzoh
Links
• https://en.wikipedia.org/wiki/Game_Boy
• http://www.pastraiser.com/cpu/gameboy/gameboy_opcodes.html
• http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
• http://gameboy.mongenel.com/dmg/asmmemmap.html
More FPS?
PHP5.5.30 OSX Native
FPS: 4
PHP7.0.1 VirtualBox
FPS: 14
Duration in cycles table
<?php
namespace GameBoy;
class TickTables
{
public static $primary = [
//Number of machine cycles for each instruction:
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F*/
1, 3, 2, 2, 1, 1, 2, 1, 5, 2, 2, 2, 1, 1, 2, 1, //0
1, 3, 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 1, //1
2, 3, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, //2
2, 3, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 1, 1, 2, 1, //3
Duration in cycles table
<?php
namespace GameBoy;
class TickTables
{
public static $primary = [
//Number of machine cycles for each instruction:
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F*/
1, 3, 2, 2, 1, 1, 2, 1, 5, 2, 2, 2, 1, 1, 2, 1, //0
1, 3, 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 1, //1
2, 3, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, //2
2, 3, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 1, 1, 2, 1, //3
1 machine cycle = 4 clocks
Duration in cycles table
<?php
namespace GameBoy;
class TickTables
{
public static $primary = [
//Number of machine cycles for each instruction:
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F*/
1, 3, 2, 2, 1, 1, 2, 1, 5, 2, 2, 2, 1, 1, 2, 1, //0
1, 3, 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 1, //1
2, 3, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, //2
2, 3, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 1, 1, 2, 1, //3
1 machine cycle = 4 clocks
x4
cx
CALL NZ,a16
3 24/12
- - - -
Duration in cycles table
<?php
namespace GameBoy;
class TickTables
{
public static $primary = [
//Number of machine cycles for each instruction:
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F*/
1, 3, 2, 2, 1, 1, 2, 1, 5, 2, 2, 2, 1, 1, 2, 1, //0
1, 3, 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 1, //1
2, 3, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, //2
2, 3, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 1, 1, 2, 1, //3
1 machine cycle = 4 clocks
x4
cx
CALL NZ,a16
3 24/12
- - - -Call address a16 if A resistor
is zero. It takes 24 clocks.
5月 チケット販売開始 /トーク募集開始

6月上旬 トーク募集〆切

6月下旬 タイムテーブル決定
iOS Developers Conference Japan 2016
2016.08.20 https://iosdc.jp
スポンサー企業さま、大絶賛募集中

Weitere ähnliche Inhalte

Ähnlich wie Reading php terminal-gameboy-emulator

Basic computer organization design
Basic computer organization designBasic computer organization design
Basic computer organization design
ndasharath
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)
bolovv
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
jemimajerome
 

Ähnlich wie Reading php terminal-gameboy-emulator (20)

amba.ppt
amba.pptamba.ppt
amba.ppt
 
Basic computer organization design
Basic computer organization designBasic computer organization design
Basic computer organization design
 
Ecet 330 final exam new 2016
Ecet 330 final exam new 2016Ecet 330 final exam new 2016
Ecet 330 final exam new 2016
 
Section 1 8051 microcontroller instruction set
Section 1 8051 microcontroller instruction setSection 1 8051 microcontroller instruction set
Section 1 8051 microcontroller instruction set
 
Unit iv introduction to 8051 microcontroller ppts
Unit iv introduction to 8051 microcontroller pptsUnit iv introduction to 8051 microcontroller ppts
Unit iv introduction to 8051 microcontroller ppts
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)
 
amba.ppt
amba.pptamba.ppt
amba.ppt
 
amba.ppt
amba.pptamba.ppt
amba.ppt
 
amba (1).ppt
amba (1).pptamba (1).ppt
amba (1).ppt
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Displaying Animated Images on GLCD display with LPC2148 Microcontroller
Displaying Animated Images on GLCD display with LPC2148 MicrocontrollerDisplaying Animated Images on GLCD display with LPC2148 Microcontroller
Displaying Animated Images on GLCD display with LPC2148 Microcontroller
 
Microprocessor system - summarize
Microprocessor system - summarizeMicroprocessor system - summarize
Microprocessor system - summarize
 
Computer Organisation Part 4
Computer Organisation Part 4Computer Organisation Part 4
Computer Organisation Part 4
 
Assemblers
AssemblersAssemblers
Assemblers
 
Lil endian.ppt
Lil endian.pptLil endian.ppt
Lil endian.ppt
 
Memory Reference instruction
Memory Reference instructionMemory Reference instruction
Memory Reference instruction
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
How old consoles work!
How old consoles work!How old consoles work!
How old consoles work!
 
Kernel Recipes 2013 - Deciphering Oopsies
Kernel Recipes 2013 - Deciphering OopsiesKernel Recipes 2013 - Deciphering Oopsies
Kernel Recipes 2013 - Deciphering Oopsies
 
unit 5.ppt
unit 5.pptunit 5.ppt
unit 5.ppt
 

Mehr von Tomoki Hasegawa

Mehr von Tomoki Hasegawa (20)

Drupal8 〜 モダンなアーキテクチャのPHPベース OSS CMS
Drupal8 〜 モダンなアーキテクチャのPHPベース OSS CMSDrupal8 〜 モダンなアーキテクチャのPHPベース OSS CMS
Drupal8 〜 モダンなアーキテクチャのPHPベース OSS CMS
 
とある受託ベンダの開発環境
とある受託ベンダの開発環境とある受託ベンダの開発環境
とある受託ベンダの開発環境
 
iOS Developers Conference Japan 2016
iOS Developers Conference Japan 2016iOS Developers Conference Japan 2016
iOS Developers Conference Japan 2016
 
エンジニアのお祭り
エンジニアのお祭りエンジニアのお祭り
エンジニアのお祭り
 
勉強会のこちら側とあちら側
勉強会のこちら側とあちら側勉強会のこちら側とあちら側
勉強会のこちら側とあちら側
 
tvOSでWebSocketを使う
tvOSでWebSocketを使うtvOSでWebSocketを使う
tvOSでWebSocketを使う
 
「これを買っている人はこれも買っています」実装してみた PHP side
「これを買っている人はこれも買っています」実装してみた PHP side「これを買っている人はこれも買っています」実装してみた PHP side
「これを買っている人はこれも買っています」実装してみた PHP side
 
tvOSネイティブアプリを作る
tvOSネイティブアプリを作るtvOSネイティブアプリを作る
tvOSネイティブアプリを作る
 
「これを買っている人はこれも買っています」実装してみた
「これを買っている人はこれも買っています」実装してみた「これを買っている人はこれも買っています」実装してみた
「これを買っている人はこれも買っています」実装してみた
 
Drupal 8 - モダンなアーキテクチャのPHPベースOSS CMS
Drupal 8 - モダンなアーキテクチャのPHPベースOSS CMSDrupal 8 - モダンなアーキテクチャのPHPベースOSS CMS
Drupal 8 - モダンなアーキテクチャのPHPベースOSS CMS
 
TestFlightみたいなのを自作する
TestFlightみたいなのを自作するTestFlightみたいなのを自作する
TestFlightみたいなのを自作する
 
PHPでスマホアプリにプッシュ通知する
PHPでスマホアプリにプッシュ通知するPHPでスマホアプリにプッシュ通知する
PHPでスマホアプリにプッシュ通知する
 
Stargazer Meetup #1
Stargazer Meetup #1Stargazer Meetup #1
Stargazer Meetup #1
 
PUSH通知証明書作成ツールを作った
PUSH通知証明書作成ツールを作ったPUSH通知証明書作成ツールを作った
PUSH通知証明書作成ツールを作った
 
PHPカンファレンス福岡に 行ってきた
PHPカンファレンス福岡に 行ってきたPHPカンファレンス福岡に 行ってきた
PHPカンファレンス福岡に 行ってきた
 
CakePHP3ウォークスルー
CakePHP3ウォークスルーCakePHP3ウォークスルー
CakePHP3ウォークスルー
 
はじめてのiOSアプリ開発 Swift対応版
はじめてのiOSアプリ開発 Swift対応版はじめてのiOSアプリ開発 Swift対応版
はじめてのiOSアプリ開発 Swift対応版
 
AppStore申請を一式まるっと自動化する
AppStore申請を一式まるっと自動化するAppStore申請を一式まるっと自動化する
AppStore申請を一式まるっと自動化する
 
PHPerのためのSwift入門
PHPerのためのSwift入門PHPerのためのSwift入門
PHPerのためのSwift入門
 
オプショナル型。〜なんとなく付ける ! ? 撲滅〜 改訂版
オプショナル型。〜なんとなく付ける ! ? 撲滅〜 改訂版オプショナル型。〜なんとなく付ける ! ? 撲滅〜 改訂版
オプショナル型。〜なんとなく付ける ! ? 撲滅〜 改訂版
 

Kürzlich hochgeladen

Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Kürzlich hochgeladen (20)

Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

Reading php terminal-gameboy-emulator

  • 2. HASEGAWA Tomoki @tomzoh Web / iOS App Development, Rental Kart Race, Beer, IoT crafting, … hasegawa
 tomoki Digital Circus, Inc. Vice-master CTO Tokyo, Japan Interests
  • 3. ・ Web Development ・ Mobile Apps Development ・ Service ( ) (iOS, Android) (http://appbuilder.jp) Twitter: @tomzoh
  • 7. By Transfrom JPEG version and remove white background. Original by Evan-Amos. - Media:Game-Boy-FL.jpg, Public Domain, https://commons.wikimedia.org/w/index.php?curid=37808150
  • 9.
  • 10.
  • 11.
  • 12. 😮
  • 13. 😮
  • 19. Source Files It’s PHP ! We can read it.
  • 20. Source Files It’s PHP ! Yes, We can! We can read it.
  • 21. Source Files It’s PHP ! Yes, We can! Yes, We can! We can read it.
  • 23. Components of GAMEBOY • CPU / Memory • Display • Sound • Buttons • Communication Port
  • 24. Components of GAMEBOY • CPU / Memory • Display • Sound • Buttons • Communication Port
  • 26.
  • 27.
  • 28. Buttons - Keyboard.php <?php namespace GameBoy; class Keyboard { public $core; public $file; public $keyPressing = null; public $started = false; public function __construct(Core $core) { $this->core = $core; exec('stty -icanon'); $this->file = fopen('php://stdin', 'r'); stream_set_blocking($this->file, false); } public function check() {
  • 29. Buttons - Keyboard.php <?php namespace GameBoy; class Keyboard { public $core; public $file; public $keyPressing = null; public $started = false; public function __construct(Core $core) { $this->core = $core; exec('stty -icanon'); $this->file = fopen('php://stdin', 'r'); stream_set_blocking($this->file, false); } public function check() {
  • 30. How to sense buttons
  • 31. How to sense buttons $this->file = fopen('php://stdin', 'r');
  • 32. How to sense buttons $this->file = fopen('php://stdin', 'r'); $key = fread($this->file, 1);
  • 35. CPU
  • 36. SHARP LR35902 instruction set http://www.pastraiser.com/cpu/gameboy/gameboy_opcodes.html 1byte instructions Prefix CB instructions 144 instructions 256 instructions+ = 400 instructions
  • 37. SHARP LR35902 resistors http://www.pastraiser.com/cpu/gameboy/gameboy_opcodes.html 15 … 8 7 … 0 A F B C H L 15 … 8 7 … 0 SP (Stack Pointer) PC (Program Counter) 8bit / 16bit resistors 16bit resistors Flag registor 7 6 5 4 3 2 1 0 Z N H C 0 0 0 0 •Z - Zero Flag •N - Subtract Flag •H - Half Carry Flag •C - Carry Flag •0 - Not uses, always zero
  • 38. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Address LD A, d8 2 8 - - - -
  • 39. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Length in bytes Address LD A, d8 2 8 - - - -
  • 40. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Duration in cyclesLength in bytes Address LD A, d8 2 8 - - - -
  • 41. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Duration in cycles Flags affected Length in bytes Address LD A, d8 2 8 - - - -
  • 42. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Address LD A, d8 2 8 - - - -
  • 43. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Address LD A, d8 2 8 - - - - PC (Program Counter)
  • 44. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction Load 0x0301 into BC resistor x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Address LD A, d8 2 8 - - - - PC (Program Counter)
  • 45. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Address LD A, d8 2 8 - - - - PC (Program Counter)
  • 46. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Address LD A, d8 2 8 - - - - Load 0x99 into A resistor PC (Program Counter)
  • 47. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Address LD A, d8 2 8 - - - - PC (Program Counter)
  • 48. Instruction in memory 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction Load A resistor’s value into memory indicates with BC resistor x0 x1 x2 xE 0x 3x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Address LD A, d8 2 8 - - - - PC (Program Counter)
  • 49.
  • 50.
  • 51. CPU - Opcode.php <?php namespace GameBoy; class Opcode { public $functionsArray = []; public function __construct() { //NOP //#0x00: $this->functionsArray[] = function ($parentObj) { //Do Nothing... }; //LD BC, nn //#0x01: $this->functionsArray[] = function ($parentObj) {
  • 52. CPU - Opcode.php <?php namespace GameBoy; class Opcode { public $functionsArray = []; public function __construct() { //NOP //#0x00: $this->functionsArray[] = function ($parentObj) { //Do Nothing... }; //LD BC, nn //#0x01: $this->functionsArray[] = function ($parentObj) { x0 x1 x2 0x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - -
  • 53. CPU - Opcode.php <?php namespace GameBoy; class Opcode { public $functionsArray = []; public function __construct() { //NOP //#0x00: $this->functionsArray[] = function ($parentObj) { //Do Nothing... }; //LD BC, nn //#0x01: $this->functionsArray[] = function ($parentObj) { Implementation of 0x00 NOP x0 x1 x2 0x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - -
  • 54. CPU - Opcode.php <?php namespace GameBoy; class Opcode { public $functionsArray = []; public function __construct() { //NOP //#0x00: $this->functionsArray[] = function ($parentObj) { //Do Nothing... }; //LD BC, nn //#0x01: $this->functionsArray[] = function ($parentObj) { x0 x1 x2 0x LD BC, d16 3 12 - - - - NOP 1 4 - - - - LD (BC), A 1 8 - - - - Implementation of 0x01 LD BC, d16
  • 55. //LD BC, nn //#0x01: $this->functionsArray[] = function ($parentObj) { $parentObj->registerC = $parentObj->memoryReader[$parentObj->programCounter]($parentObj, $parentObj->programCounter); $parentObj->registerB = $parentObj->memoryRead(($parentObj->programCounter + 1) & 0xFFFF); $parentObj->programCounter = ($parentObj->programCounter + 2) & 0xFFFF; }; Implementation of LD BC, d16 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction Address PC (Program Counter)
  • 56. //LD BC, nn //#0x01: $this->functionsArray[] = function ($parentObj) { $parentObj->registerC = $parentObj->memoryReader[$parentObj->programCounter]($parentObj, $parentObj->programCounter); $parentObj->registerB = $parentObj->memoryRead(($parentObj->programCounter + 1) & 0xFFFF); $parentObj->programCounter = ($parentObj->programCounter + 2) & 0xFFFF; }; Implementation of LD BC, d16 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction Address PC (Program Counter) C
  • 57. //LD BC, nn //#0x01: $this->functionsArray[] = function ($parentObj) { $parentObj->registerC = $parentObj->memoryReader[$parentObj->programCounter]($parentObj, $parentObj->programCounter); $parentObj->registerB = $parentObj->memoryRead(($parentObj->programCounter + 1) & 0xFFFF); $parentObj->programCounter = ($parentObj->programCounter + 2) & 0xFFFF; }; Implementation of LD BC, d16 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction Address PC (Program Counter) B
  • 58. //LD BC, nn //#0x01: $this->functionsArray[] = function ($parentObj) { $parentObj->registerC = $parentObj->memoryReader[$parentObj->programCounter]($parentObj, $parentObj->programCounter); $parentObj->registerB = $parentObj->memoryRead(($parentObj->programCounter + 1) & 0xFFFF); $parentObj->programCounter = ($parentObj->programCounter + 2) & 0xFFFF; }; Implementation of LD BC, d16 0x0000 0x0001 0x0002 0x003 0x004 0x005 0x0301 0x01 0x01 0x03 0x3e 0x99 0x02 0x99 LD BC, d16 0x0301 LD A, d8 0x99 LD (BC), A Data Instruction Address PC (Program Counter)
  • 59. Implementation of JP a16 x3 cx JP a16 3 16 - - - -
  • 60. Implementation of JP a16 x3 cx JP a16 3 16 - - - - Jump to address a16
  • 61. Implementation of JP a16 x3 cx JP a16 3 16 - - - - Jump to address a16 0x0000 0x0001 0x0002 0xc3 0x29 0x03 JP a16 0x0329 Data Instruction Address
  • 62. Implementation of JP a16 x3 cx JP a16 3 16 - - - - Jump to address a16 0x0000 0x0001 0x0002 0xc3 0x29 0x03 JP a16 0x0329 Data Instruction Address Jump to address 0x0329
  • 63. Implementation of JP a16 x3 cx JP a16 3 16 - - - - Jump to address a16 //JP nn //#0xC3: $this->functionsArray[] = function ($parentObj) { $parentObj->programCounter = ($parentObj->memoryRead(($parentObj->programCounter + 1) & 0xFFFF) << 8) + $parentObj->memoryReader[$parentObj->programCounter]($parentObj, $parentObj->programCounter); }; 0x0000 0x0001 0x0002 0xc3 0x29 0x03 JP a16 0x0329 Data Instruction Address Jump to address 0x0329
  • 64. Run loop public function executeIteration() { $op = 0; while ($this->stopEmulator == 0) { $op = $this->memoryRead($this->programCounter); $this->programCounter = ($this->programCounter + 1) & 0xFFFF; $this->CPUTicks = $this->TICKTable[$op]; $this->OPCODE[$op]($this); $this->updateCore(); } }
  • 67. Thanks @tomzoh WE ARE HIRING Drupal / Mobile App Engineer
 Digital Circus, Inc. Tokyo, Japan @tomzoh
  • 68. Links • https://en.wikipedia.org/wiki/Game_Boy • http://www.pastraiser.com/cpu/gameboy/gameboy_opcodes.html • http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header • http://gameboy.mongenel.com/dmg/asmmemmap.html
  • 69. More FPS? PHP5.5.30 OSX Native FPS: 4 PHP7.0.1 VirtualBox FPS: 14
  • 70. Duration in cycles table <?php namespace GameBoy; class TickTables { public static $primary = [ //Number of machine cycles for each instruction: /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F*/ 1, 3, 2, 2, 1, 1, 2, 1, 5, 2, 2, 2, 1, 1, 2, 1, //0 1, 3, 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 1, //1 2, 3, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, //2 2, 3, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 1, 1, 2, 1, //3
  • 71. Duration in cycles table <?php namespace GameBoy; class TickTables { public static $primary = [ //Number of machine cycles for each instruction: /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F*/ 1, 3, 2, 2, 1, 1, 2, 1, 5, 2, 2, 2, 1, 1, 2, 1, //0 1, 3, 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 1, //1 2, 3, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, //2 2, 3, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 1, 1, 2, 1, //3 1 machine cycle = 4 clocks
  • 72. Duration in cycles table <?php namespace GameBoy; class TickTables { public static $primary = [ //Number of machine cycles for each instruction: /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F*/ 1, 3, 2, 2, 1, 1, 2, 1, 5, 2, 2, 2, 1, 1, 2, 1, //0 1, 3, 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 1, //1 2, 3, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, //2 2, 3, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 1, 1, 2, 1, //3 1 machine cycle = 4 clocks x4 cx CALL NZ,a16 3 24/12 - - - -
  • 73. Duration in cycles table <?php namespace GameBoy; class TickTables { public static $primary = [ //Number of machine cycles for each instruction: /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F*/ 1, 3, 2, 2, 1, 1, 2, 1, 5, 2, 2, 2, 1, 1, 2, 1, //0 1, 3, 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 1, //1 2, 3, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, //2 2, 3, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 1, 1, 2, 1, //3 1 machine cycle = 4 clocks x4 cx CALL NZ,a16 3 24/12 - - - -Call address a16 if A resistor is zero. It takes 24 clocks.
  • 74. 5月 チケット販売開始 /トーク募集開始
 6月上旬 トーク募集〆切
 6月下旬 タイムテーブル決定 iOS Developers Conference Japan 2016 2016.08.20 https://iosdc.jp スポンサー企業さま、大絶賛募集中