stick.c
/*
z88dk / WebMSX
zcc +msx -lndos -create-app stick.c
bload"cas:",r
*/
#include <msx/gfx.h>
#include <stdio.h>
const int dx[] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
const int dy[] = { 0, -1, -1, 0, 1, 1, 1, 0, -1 };
void main()
{
int px = 0;
int py = 0;
printf("\xc");
while (! get_trigger(0)) {
int st = get_stick(0);
px += dx[st];
py += dy[st];
printf("\xbST:%d X:%d Y:%d", st, px, py);
}
}