LoginSignup
1
0

More than 5 years have passed since last update.

MSX stick

Posted at
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);
    }
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0