Agon Light Joystick Test 1

I’m working on getting a joystick port working on my Agon Light. They don’t come with joystick ports, but there is a set of GPIO pins that can be read through assembly.

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;
}Code language: JavaScript (javascript)

It kind of works, sort of…

2 responses to “Agon Light Joystick Test 1”