
Here’s my setup, the Agon Light is in the white box, my trusty PowerPlay Cruiser joystick from the 90s is plugged into a quickly bodged together adapter.
This code lets me read the state of the GPIO pins to detect which ones are set by the joystick
unsigned char get_port(uint8_t port) {
unsigned char output;
__asm__ volatile (
"ld b, 0 \n"
"ld c, %1 \n"
"in a, (c) \n"
"ld %0, a"
: "=d"(output)
: "d"(port)
: "cc", "memory", "b", "c", "a"
);
return output;
}
It kind of works, sort of…