Re: [cc65] Joystick Example Code

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2004-10-08 16:30:19
On Fri, Oct 08, 2004 at 02:53:36PM +0200, Holger Bothmer wrote:
> Can anyone provide me with example code for joystick
> access on a C64? Do I have to link the driver or load
> it at runtime?

    unsigned char Err;
    unsigned char J;

    /* Room for expression */
    clrscr ();

    /* Load and install the standard driver */
    Err = joy_load_driver (joy_stddrv);
    if (Err != JOY_ERR_OK) {
        Fail (Err);
    }

    /* Display joystick actions until 'q' was pressed */
    while (!kbhit () || cgetc () != 'q') {

        J = joy_read (JOY_1);
        gotoxy (0, 0);
        cprintf ("%s ", JOY_BTN_UP (J)?    "UP   ": "     ");
        cprintf ("%s ", JOY_BTN_DOWN (J)?  "DOWN ": "     ");
        cprintf ("%s ", JOY_BTN_LEFT (J)?  "LEFT ": "     ");
        cprintf ("%s ", JOY_BTN_RIGHT (J)? "RIGHT": "     ");
        cprintf ("%s ", JOY_BTN_FIRE (J)?  "FIRE ": "     ");

    }

    /* Unload the loaded driver */
    Err = joy_unload ();
    if (Err != JOY_ERR_OK) {
        Fail (Err);
    }

> BTW: I coudn't find the _cia.h in my installation (win
> and c64) though the doc says so. Is it my error or are
> the docs wrong?

The _cia.h file mentioned in the docs is actually named _6526.h. At some point
I decided to use the "official" naming conventions where possible.

> Same goes for the .bat file that is
> supposed to come with the win software.

Sorry, I'm very bad at guessing today:-) Does this batch file have a name?

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Oct 8 16:30:24 2004

This archive was generated by hypermail 2.1.8 : 2004-10-08 16:30:33 CEST