Revision 385
Added by markw almost 10 years ago
firmware/5200/freeze.c | ||
---|---|---|
*atari_dmactl = 0x22;
|
||
*atari_skctl = 0x2;
|
||
*atari_chactl = 0x2;
|
||
*atari_consol = 4;
|
||
*atari_potgo = 0xff;
|
||
}
|
||
|
||
void restore()
|
firmware/5200/joystick.c | ||
---|---|---|
#include "regs.h"
|
||
|
||
//#include <stdio.h>
|
||
//#include <printf.h>
|
||
//extern int debug_pos;
|
||
|
||
#ifdef USB
|
||
#include "usb.h"
|
||
... | ... | |
extern struct usb_host usb_portb;
|
||
#endif
|
||
|
||
unsigned char pot0;
|
||
unsigned char pot1;
|
||
unsigned char pot2;
|
||
unsigned char pot3;
|
||
void joystick_poll(struct joystick_status * status)
|
||
{
|
||
status->x_ = 0;
|
||
... | ... | |
usb_poll(&usb_portb);
|
||
#endif
|
||
|
||
int controls = get_controls();
|
||
|
||
int read = 0;
|
||
if (0==*atari_allpot)
|
||
{
|
||
pot0 = *atari_pot0;
|
||
pot1 = *atari_pot1;
|
||
pot2 = *atari_pot2;
|
||
pot3 = *atari_pot3;
|
||
*atari_potgo = 0xff;
|
||
read = 1;
|
||
}
|
||
|
||
unsigned char kbcode = *atari_kbcode;
|
||
kbcode &= 0x1e;
|
||
|
||
... | ... | |
kbcode = 0x0;
|
||
}
|
||
|
||
int controls = get_controls();
|
||
//debug_pos = 400;
|
||
//printf("%02x %02x %02x %02x\n",pot0,pot1,*atari_allpot,read);
|
||
|
||
/**atari_consol = 4;
|
||
*atari_potgo = 0xff;
|
||
|
||
wait_us(1000000/50);
|
||
|
||
unsigned char pot0 = *atari_pot0;
|
||
unsigned char pot1 = *atari_pot1;*/
|
||
|
||
status->y_ = (0x8==(kbcode&0x18)) -((unsigned int)(0x18==(kbcode&0x18)));
|
||
status->x_ = (0x2==(kbcode&0x6)) -((unsigned int)(0x6==(kbcode&0x6)));
|
||
// Not sure why, but reading these is not working here - what am I doing wrong?
|
||
/*if (pot0>170) status->x_ =1;
|
||
|
||
if (pot0>170) status->x_ =1;
|
||
if (pot0<60) status->x_ =-1;
|
||
if (pot1>170) status->y_ =1;
|
||
if (pot1<60) status->y_ =-1;*/
|
||
if (pot1<60) status->y_ =-1;
|
||
if (pot2>170) status->x_ =1;
|
||
if (pot2<60) status->x_ =-1;
|
||
if (pot3>170) status->y_ =1;
|
||
if (pot3<60) status->y_ =-1;
|
||
|
||
//status->fire_ = !(1&*atari_trig0);
|
||
status->fire_ = kbcode==0x14;
|
||
status->fire_ = (kbcode==0x14) || (!(1&*atari_trig0&*atari_trig1&*atari_trig2&*atari_trig3));
|
||
|
||
if (controls!=0)
|
||
{
|
||
... | ... | |
if (status->x_ == 0 && status->y_ == 0 && status->fire_ == 0) return;
|
||
break;
|
||
case WAIT_FIRE:
|
||
if (status->fire_ == 1) return;
|
||
if (status->fire_ == 1 || status->escape_==1) return;
|
||
break;
|
||
case WAIT_EITHER:
|
||
if (status->fire_ == 1) return;
|
||
// fall through
|
||
case WAIT_MOVE:
|
||
if (status->x_ !=0 || status->y_ != 0) return;
|
||
if (status->x_ !=0 || status->y_ != 0 || status->escape_==1) return;
|
||
break;
|
||
}
|
||
}
|
firmware/5200/mainmenu.c | ||
---|---|---|
if (size == 16384) // uff!
|
||
{
|
||
struct joystick_status joy;
|
||
joy.x_ = joy.y_ = joy.fire_ = 0;
|
||
joy.x_ = joy.y_ = joy.fire_ = joy.escape_ = 0;
|
||
|
||
clearscreen();
|
||
debug_pos = 0;
|
||
... | ... | |
int settings()
|
||
{
|
||
struct joystick_status joy;
|
||
joy.x_ = joy.y_ = joy.fire_ = 0;
|
||
joy.x_ = joy.y_ = joy.fire_ = joy.escape_ = 0;
|
||
|
||
int row = 0;
|
||
|
||
... | ... | |
// move
|
||
joystick_wait(&joy,WAIT_QUIET);
|
||
joystick_wait(&joy,WAIT_EITHER);
|
||
if (joy.escape_) break;
|
||
|
||
row+=joy.y_;
|
||
if (row<0) row = 0;
|
firmware/regs.h | ||
---|---|---|
|
||
#define atari_porta ((unsigned char volatile *)(0xd300 + atari_regbase))
|
||
#define atari_portb ((unsigned char volatile *)(0xd301 + atari_regbase))
|
||
#define atari_trig0 ((unsigned char volatile *)(0xd010 + atari_regbase))
|
||
#define atari_trig1 ((unsigned char volatile *)(0xd011 + atari_regbase))
|
||
#define atari_chbase ((unsigned char volatile *)(0xd409 + atari_regbase))
|
||
#define atari_chactl ((unsigned char volatile *)(0xd401 + atari_regbase))
|
||
#define atari_dmactl ((unsigned char volatile *)(0xd400 + atari_regbase))
|
||
... | ... | |
#define atari_colpf0 ((unsigned char volatile *)(0xc016 + atari_regbase))
|
||
#define atari_prior ((unsigned char volatile *)(0xc01b + atari_regbase))
|
||
#define atari_consol ((unsigned char volatile *)(0xc01f + atari_regbase))
|
||
#define atari_trig0 ((unsigned char volatile *)(0xc010 + atari_regbase))
|
||
#define atari_trig1 ((unsigned char volatile *)(0xc011 + atari_regbase))
|
||
#define atari_trig2 ((unsigned char volatile *)(0xc012 + atari_regbase))
|
||
#define atari_trig3 ((unsigned char volatile *)(0xc013 + atari_regbase))
|
||
|
||
#define atari_skctl ((unsigned char volatile *)(0xe80f + atari_regbase))
|
||
#define atari_kbcode ((unsigned char volatile *)(0xe809 + atari_regbase))
|
||
#define atari_random ((unsigned char volatile *)(0xe80a + atari_regbase))
|
||
#define atari_pot0 ((unsigned char volatile *)(0xe800 + atari_regbase))
|
||
#define atari_pot1 ((unsigned char volatile *)(0xe801 + atari_regbase))
|
||
#define atari_pot2 ((unsigned char volatile *)(0xe802 + atari_regbase))
|
||
#define atari_pot3 ((unsigned char volatile *)(0xe803 + atari_regbase))
|
||
#define atari_potgo ((unsigned char volatile *)(0xe80b + atari_regbase))
|
||
#define atari_allpot ((unsigned char volatile *)(0xe808 + atari_regbase))
|
||
|
||
#else
|
||
|
||
... | ... | |
#define atari_kbcode ((unsigned char volatile *)(0xd209 + atari_regbase))
|
||
#define atari_random ((unsigned char volatile *)(0xd20a + atari_regbase))
|
||
|
||
#define atari_trig0 ((unsigned char volatile *)(0xd010 + atari_regbase))
|
||
#define atari_trig1 ((unsigned char volatile *)(0xd011 + atari_regbase))
|
||
|
||
#endif
|
||
|
||
#endif // regs_h
|
firmware/usb/hid.c | ||
---|---|---|
{ 10, 10, 0x41, 0 }, /* l2 -> f8 */
|
||
{ 11, 11, 0x41, 0 }, /* r2 -> f8 */
|
||
{ 7, 7, 0x41, 0 }, /* 4 -> f8 */
|
||
{ 10, 11, 0x43, 0 }, /* l2&r2 -> f10 */
|
||
{ 8, 11, 0x42, 0 }, /* l1&r2 -> f9 */
|
||
#endif
|
||
#ifdef FIRMWARE_5200
|
||
{ 13, 13, 0x3a, 0 }, /* start -> f1 (start) */
|
||
{ 12, 12, 0x3b, 0 }, /* select -> f2 (pause) */
|
||
{ 10, 10, 0x00, 8 }, /* l2 -> fire2 */
|
||
{ 11, 11, 0x00, 8 }, /* r2 -> fire2 */
|
||
{ 7, 7, 0x00, 8 }, /* 4 -> fire2 */
|
||
{ 10, 10, 0x00, 5 }, /* l2 -> fire2 */
|
||
{ 11, 11, 0x00, 5 }, /* r2 -> fire2 */
|
||
{ 7, 7, 0x00, 5 }, /* 4 -> fire2 */
|
||
#endif
|
||
{ 10, 11, 0x43, 0 }, /* l2&r2 -> f10 */
|
||
{ 8, 11, 0x42, 0 }, /* l1&r2 -> f9 */
|
||
{ 4, 4, 0x45, 0 }, /* 1 -> f12 */
|
||
{ 5, 5, 0x44, 0 }, /* 2 -> f11 */
|
||
{ 14, 15, 0x29, 0 }, /* both sticks -> esc */
|
||
{ 6, 6, 0x00, 4 }, /* 3 -> fire */
|
||
{ 8, 8, 0x00, 4 }, /* l1 -> fire */
|
||
{ 9, 9, 0x00, 4 }, /* r1 -> fire */
|
||
{ 8, 15, 0x43, 0 }, /* l2& rstick click -> f10 */
|
||
{ 9, 15, 0x42, 0 }, /* l1& rstick click -> f9 */
|
||
{ 0, 0, 0x00, 0 } /* ---- end ---- */
|
||
};
|
||
|
Also available in: Unified diff
Fix menu control with stick on 5200. Add escape support by pressing both stick triggers. Make accidental reboot harder on 5200. Now reboot is on right stick + trigger on both platforms. Still on trig2 for a800 which only has one fire button.