OK, making good progress now but I have a question...
I've been using the "battle zone" type example in Amiga Format C tutorial where they draw directly to a custom screen, bypassing the OS as it suits my needs fine for the hacking I want to do.
After a bit of head scratching I managed to rework the example to work with a double-buffered, custom Multiscan screen and it seems OK. All movement seems to leave a trail and I don't know yet if that's my code, the VGA screen or my monitor but I don't really care for the moment.
So, in their example they have a bit of code that hits the CIA directly to read the state of the joystick like so:
Any idea where they are getting the values, like 0x0080 from? I've looked in custom.h and via.h and I can't really see anything obvious unless I'm looking in the wrong place.
The code there is OK but it's a button short for me. They exit the program when fire is pressed. I want to use fire in my code so I need some other way to exit the program. Ideally a key, but all the key handling code I see is through intuition messages and as I'm not using a Window, I'm just hitting a custom bitmap directly on the screen, I've not got anywhere to register for the intuition messages that would allow me to use the keyboard as OpenScreenTagList doesn't accept IDCMP event registration.
Or am I barking up the wrong tree here and missing something obvious??
I've been using the "battle zone" type example in Amiga Format C tutorial where they draw directly to a custom screen, bypassing the OS as it suits my needs fine for the hacking I want to do.
After a bit of head scratching I managed to rework the example to work with a double-buffered, custom Multiscan screen and it seems OK. All movement seems to leave a trail and I don't know yet if that's my code, the VGA screen or my monitor but I don't really care for the moment.
So, in their example they have a bit of code that hits the CIA directly to read the state of the joystick like so:
Code:
int joystick()
{
// Scan the joystick and
// Return a code value
int code=0;
UWORD dir,fire;
dir = custom.joy1dat;
fire = !( cia->ciapra & 0x0080 );
if (fire) code=1;
if (dir&2) code+=2; // Right
if (dir&512) code+=4; // Left
if ((dir >> 1 ^ dir)& 1) code+=8; // Down
if ((dir >> 1 ^ dir)& 256) code+=16; // Up
return code;
}
Any idea where they are getting the values, like 0x0080 from? I've looked in custom.h and via.h and I can't really see anything obvious unless I'm looking in the wrong place.
The code there is OK but it's a button short for me. They exit the program when fire is pressed. I want to use fire in my code so I need some other way to exit the program. Ideally a key, but all the key handling code I see is through intuition messages and as I'm not using a Window, I'm just hitting a custom bitmap directly on the screen, I've not got anywhere to register for the intuition messages that would allow me to use the keyboard as OpenScreenTagList doesn't accept IDCMP event registration.
Or am I barking up the wrong tree here and missing something obvious??