Future Driver

Virtua Roaching

About Virtua Roaching

I made a peripheral of Megadrive and it is a photodetector.
Virtua Roaching is a software for the photodetector.
The photodetector connect to controller port 2.
Play with roaches all you want by Virtua Roaching.

How to play Virtua Roaching

Darken up the photodetector when roaches flock to the screen.

Light up the photodetector when roaches away from the screen.

Total 32 roaches under the TV.
The roaches away from the screen or flock to the screen in response to brightness.
You can only enjoy the response.

Circuit detail

This controller contain three main devices. LDR, op-amp and A/D converter.
I used a breadboard for simplicity.

How to control the photodetector

ADC0804 have 8bits resolution but this circuit is using higher 4bits only.
Sample code is as follows.

/* 初期化 */
void initAD(){
	/* ポート2の入出力方向を設定する */
	*(uchar *)0xA1000B = 0xE0;	/* photodetector is connected to port 2 */
/* ADコンバータアクセス時のウェイト */
void waitAD{
/* ADデータの読み取り */
uint readAD(){
	register d;

	/* A/D変換を開始する */
	*(uchar *)0xA10005 = 0x20;	/* write enable = start the A/D convertion */
	*(uchar *)0xA10005 = 0x60;	/* write disable */

	/* A/D変換が完了するまで待つ */
	}while(*(uchar *)0xA10005 & 0x10);	/* if complete, this bit is zero. */

	/* 変換結果を読む */
	*(uchar *)0xA10005 = 0x40;	/* read enable */
	d = *(uchar *)0xA10005 & 0x0F;	/* read value */
	*(uchar *)0xA10005 = 0x60;	/* read disable */

	return d;	/* d = 0 to 15 */

inserted by FC2 system