Revision 262
Added by markw almost 11 years ago
| firmware/5200/joystick.c | ||
|---|---|---|
| 
     		kbcode = 0x0;
 
   | 
||
| 
     	}
 
   | 
||
| 
     | 
||
| 
     	int controls = get_controls();
 
   | 
||
| 
     | 
||
| 
     	/**atari_consol = 4;
 
   | 
||
| 
     	*atari_potgo = 0xff;
 
   | 
||
| 
     | 
||
| ... | ... | |
| 
     	//status->fire_ = !(1&*atari_trig0);
 
   | 
||
| 
     	status->fire_ = kbcode==0x14;
 
   | 
||
| 
     | 
||
| 
     	if (controls!=0)
 
   | 
||
| 
     	{
 
   | 
||
| 
     		status->y_ = !!(controls&0x2) -((unsigned int)!!(controls&0x1));
 
   | 
||
| 
     		status->x_ = !!(controls&0x8) -((unsigned int)!!(controls&0x4));
 
   | 
||
| 
     		status->fire_ = !!(controls&0x10);
 
   | 
||
| 
     		status->escape_ = !!(controls&0x20);
 
   | 
||
| 
     	}
 
   | 
||
| 
     | 
||
| 
     	//if (porta != 0xff)
 
   | 
||
| 
     	//printf("%02x %x %x %x\n",porta,status->x_,status->y_,status->fire_);
 
   | 
||
| 
     /*
 
   | 
||
| firmware/a800/joystick.c | ||
|---|---|---|
| 
     #include "joystick.h"
 
   | 
||
| 
     | 
||
| 
     #include "regs.h"
 
   | 
||
| 
     //#include "io.h"
 
   | 
||
| 
     | 
||
| 
     //#include <stdio.h>
 
   | 
||
| 
     | 
||
| ... | ... | |
| 
     	status->x_ = 0;
 
   | 
||
| 
     	status->y_ = 0;
 
   | 
||
| 
     	status->fire_ = 0;
 
   | 
||
| 
     	status->escape_ = 0;
 
   | 
||
| 
     | 
||
| 
     	unsigned char porta = *atari_porta;
 
   | 
||
| 
     | 
||
| 
     	int controls = get_controls();
 
   | 
||
| 
     | 
||
| 
     	status->y_ = !(porta&0x2) -((unsigned int)!(porta&0x1));
 
   | 
||
| 
     	status->x_ = !(porta&0x8) -((unsigned int)!(porta&0x4));
 
   | 
||
| 
     	status->fire_ = !(1&*atari_trig0);
 
   | 
||
| 
     | 
||
| 
     	if (controls!=0)
 
   | 
||
| 
     	{
 
   | 
||
| 
     		status->y_ = !!(controls&0x2) -((unsigned int)!!(controls&0x1));
 
   | 
||
| 
     		status->x_ = !!(controls&0x8) -((unsigned int)!!(controls&0x4));
 
   | 
||
| 
     		status->fire_ = !!(controls&0x10);
 
   | 
||
| 
     		status->escape_ = !!(controls&0x20);
 
   | 
||
| 
     	}
 
   | 
||
| 
     | 
||
| 
     	//if (porta != 0xff)
 
   | 
||
| 
     	//printf("%02x %x %x %x\n",porta,status->x_,status->y_,status->fire_);
 
   | 
||
| 
     /*
 
   | 
||
| ... | ... | |
| 
     			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/a800/mainmenu.c | ||
|---|---|---|
| 
     		// move
 
   | 
||
| 
     		joystick_wait(&joy,WAIT_QUIET);
 
   | 
||
| 
     		joystick_wait(&joy,WAIT_EITHER);
 
   | 
||
| 
     		if (joy.escape_) break;
 
   | 
||
| 
     | 
||
| 
     		row+=joy.y_;
 
   | 
||
| 
     		if (row<0) row = 0;
 
   | 
||
| firmware/fileselector.c | ||
|---|---|---|
| 
     	{
 
   | 
||
| 
     		dir_of(&dir[0],file_path(file));
 
   | 
||
| 
     	}
 
   | 
||
| 
     	for (;;)
 
   | 
||
| 
     | 
||
| 
     	struct joystick_status joy;
 
   | 
||
| 
     	joy.x_ = joy.y_ = joy.fire_ = joy.escape_ = 0;
 
   | 
||
| 
     	for (;!joy.escape_;)
 
   | 
||
| 
     	{
 
   | 
||
| 
     		struct SimpleDirEntry * entry = dir_entries_filtered(dir,filter);
 
   | 
||
| 
     | 
||
| ... | ... | |
| 
     		int pos = 0;
 
   | 
||
| 
     		int prevstartpos = -1;
 
   | 
||
| 
     | 
||
| 
     		struct joystick_status joy;
 
   | 
||
| 
     		joy.x_ = joy.y_ = joy.fire_ = 0;
 
   | 
||
| 
     | 
||
| 
     		for (;;)
 
   | 
||
| 
     		{
 
   | 
||
| 
     			if (pos<0) pos = 0;
 
   | 
||
| ... | ... | |
| 
     			// move
 
   | 
||
| 
     			joystick_wait(&joy,WAIT_QUIET);
 
   | 
||
| 
     			joystick_wait(&joy,WAIT_EITHER);
 
   | 
||
| 
     			if (joy.escape_) break;
 
   | 
||
| 
     | 
||
| 
     			if (joy.fire_)
 
   | 
||
| 
     			{
 
   | 
||
| ... | ... | |
| 
     			pos += joy.y_;
 
   | 
||
| 
     		}
 
   | 
||
| 
     	}
 
   | 
||
| 
     | 
||
| 
     	joystick_wait(&joy,WAIT_QUIET);
 
   | 
||
| 
     }
 
   | 
||
| 
     | 
||
| firmware/joystick.h | ||
|---|---|---|
| 
     	int x_;
 
   | 
||
| 
     	int y_;
 
   | 
||
| 
     	int fire_;
 
   | 
||
| 
     	int escape_;
 
   | 
||
| 
     };
 
   | 
||
| 
     | 
||
| 
     enum JoyWait {WAIT_QUIET, WAIT_FIRE, WAIT_MOVE, WAIT_EITHER};
 
   | 
||
| firmware/main.h | ||
|---|---|---|
| 
     BIT_REG_RO(,0x1,10,hotkey_fileselect,zpu_in1)
 
   | 
||
| 
     BIT_REG_RO(,0x1,11,hotkey_settings,zpu_in1)
 
   | 
||
| 
     | 
||
| 
     BIT_REG_RO(,0x3f,12,controls,zpu_in1) // (esc)FLRDU
 
   | 
||
| 
     | 
||
| 
     | 
||
| 
     void
 
   | 
||
| 
     wait_us(int unsigned num)
 
   | 
||
| 
     {
 
   | 
||
key control in menu. escape to exit