ポケコン PC-G850 シリーズの LCD は、横1ドット縦8ドット単位で構成されています。そのため、1x8 ドット単位であれば、比較的簡単な処理で描画することが出来ます。
PC-G850 は、他の 8bit パソコンに比べると CPU クロックも描画速度も速いため、そこは自分で仮想 VRAM を構築などして毎フレーム全転送をしても、それなりのアクションゲームが作れると思います。
#include <stdlib.h>
#include
#define LEFT 40 // 描画開始座標X(1ドット単位)
#define TOP 0 // 描画開始座標Y(8ドット単位)
#define WIDTH 64 // 横幅(1ドット単位)
#define HEIGHT 6 // 縦幅(8ドット単位)
// 画像イメージ
unsigned char img[] = {
0x15,0x00,0x55,0x00,0x51,0x00,0x55,0x00,0x15,0x00,0x55,0x00,0x11,0x00,0x55,0x00,
0x15,0x00,0x55,0x00,0x11,0x00,0x15,0x00,0x15,0x00,0x55,0x00,0x51,0x00,0x55,0x00,
0x15,0x00,0x55,0x00,0x11,0x00,0x55,0x00,0x11,0x00,0x55,0x00,0x11,0x00,0x55,0x00,
0x15,0x00,0x55,0x00,0x51,0x00,0x55,0x00,0x15,0x00,0x55,0x00,0x11,0x00,0x55,0x00,
0x55,0x22,0x55,0x00,0x51,0x00,0x55,0x00,0x11,0x00,0x15,0x00,0x11,0x00,0x01,0x00,
0x51,0xe0,0x54,0xe8,0x55,0xf0,0x54,0xf0,0x55,0xf8,0x55,0xe8,0x55,0xa0,0x55,0x00,
0x55,0x22,0x45,0x00,0x51,0x20,0x55,0x00,0x11,0x00,0x44,0x00,0x11,0x00,0x40,0x00,
0x11,0x00,0x44,0x00,0x11,0x00,0x54,0x00,0x15,0x00,0x55,0x00,0x51,0x00,0x55,0x00,
0x15,0x0a,0x45,0x02,0x51,0x00,0x41,0xe0,0x51,0x80,0x54,0x00,0x51,0x00,0x50,0x00,
0x51,0x81,0x55,0xcb,0x15,0x07,0x55,0x8f,0x55,0xbf,0x55,0xab,0x55,0x23,0x55,0x80,
0x55,0x22,0x55,0x80,0x51,0x22,0x55,0x80,0x55,0x20,0x55,0x80,0x51,0x20,0x54,0x80,
0x55,0x20,0x55,0x80,0x55,0x20,0x55,0x80,0x55,0x22,0x55,0x80,0x55,0x20,0x55,0x80,
0x55,0x02,0x55,0x02,0x15,0x1a,0x55,0xbe,0x55,0x2b,0x55,0xe8,0x55,0xfa,0x54,0xf8,
0x55,0xa2,0x55,0x2f,0x15,0x1b,0x05,0x06,0x15,0x0b,0x1d,0x0e,0x15,0x32,0x55,0xea,
0x55,0xa2,0x55,0xaa,0x55,0xa2,0x55,0xe8,0x55,0xaa,0x55,0xaa,0x55,0x22,0x55,0xa8,
0x55,0xaa,0x55,0xaa,0x55,0xa2,0x55,0xe8,0x55,0xaa,0x55,0x2a,0x55,0x3a,0x55,0x80,
0x11,0x03,0x45,0x0f,0x55,0x0b,0x45,0x82,0x55,0x02,0x05,0x02,0x15,0x02,0x55,0x00,
0x11,0x00,0x04,0x08,0x11,0x00,0x14,0x00,0x15,0x20,0x54,0xa0,0x51,0x20,0x54,0x80,
0x55,0x21,0x55,0x03,0x57,0xef,0x55,0xeb,0x57,0x8b,0x55,0x1c,0x55,0x08,0x55,0x09,
0x17,0x0f,0x45,0x83,0x15,0x03,0x55,0x89,0x51,0xa8,0x55,0x88,0x55,0x22,0x55,0x2a,
0x11,0x78,0x55,0xb6,0x55,0xba,0x55,0xee,0x55,0xa2,0x55,0xba,0x55,0xba,0x55,0xa0,
0x15,0x82,0x45,0xa8,0x55,0x02,0x45,0x28,0x15,0x3a,0x55,0x68,0x51,0x83,0x45,0x8e,
0x55,0x3a,0x55,0x2e,0x55,0x22,0x55,0x6b,0x57,0x63,0x55,0x26,0x55,0x26,0x55,0xaa,
0x17,0x02,0x55,0x0e,0x55,0x2b,0x55,0xa6,0x55,0x23,0x55,0xa8,0x51,0x3a,0x55,0x8a,
};
void main()
{
unsigned char* p = img;
for( unsigned char y = 0; y < HEIGHT; y++ ){
outp( 0x40, LEFT & 15 ); // 横アドレス指定(L)
outp( 0x40, LEFT >> 4 | 0x10 ); // 横アドレス指定(H)
outp( 0x40, 0xb0 + TOP + y ); // 縦アドレス指定
for( unsigned char x = WIDTH; x > 0; x-- ){
outp( 0x41, *p ); // ドットパターン書き込み
p++;
}
}
while( 1 ){}
}
I/Oポート 0x40 へ LCD コマンドを送信後、0x41 へ値を書き込むことによって描画されます。
X 座標は、下位 4bit、上位 4bit に分けて出力します。また、0x41 へ書き込み後は、自動的に X 座標が加算されますので、横に連続したデータを出力できます。
【参考】PC-G850の回路図とLCDの低レベル制御(外部サイト)