Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,55 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include <cmoc.h>
|
||||
|
||||
// Distinct in-range sentinels make a stale loaded value used as a second
|
||||
// subscript visibly wrong, without depending on neighboring globals' layout.
|
||||
static unsigned char joystick_axes[64];
|
||||
static struct { unsigned char centers[64]; } preferences;
|
||||
static unsigned char chosen;
|
||||
|
||||
static void capture(unsigned char x, unsigned char y, unsigned char cx, unsigned char cy)
|
||||
{
|
||||
// Print actual bytes; the host owns all comparisons and expected results.
|
||||
printf("%02x%02x%02x%02x", (unsigned)x, (unsigned)y, (unsigned)cx, (unsigned)cy);
|
||||
}
|
||||
|
||||
static void sampleByte(unsigned char index)
|
||||
{
|
||||
capture(joystick_axes[index], joystick_axes[index + 1],
|
||||
preferences.centers[index], preferences.centers[index + 1]);
|
||||
}
|
||||
|
||||
static void sampleWord(unsigned index)
|
||||
{
|
||||
capture(joystick_axes[index], joystick_axes[index + 1],
|
||||
preferences.centers[index], preferences.centers[index + 1]);
|
||||
}
|
||||
|
||||
static void samplePointer(unsigned char index, const unsigned char *axes, const unsigned char *centers)
|
||||
{
|
||||
capture(axes[index], axes[index + 1], centers[index], centers[index + 1]);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < sizeof(joystick_axes); ++i)
|
||||
{
|
||||
joystick_axes[i] = 0x35;
|
||||
preferences.centers[i] = 0x3a;
|
||||
}
|
||||
joystick_axes[0] = 4; joystick_axes[1] = 12;
|
||||
joystick_axes[2] = 20; joystick_axes[3] = 28;
|
||||
preferences.centers[0] = 8; preferences.centers[1] = 16;
|
||||
preferences.centers[2] = 24; preferences.centers[3] = 32;
|
||||
printf("ARGS ");
|
||||
// Runtime parameters preserve the original indexed argument expressions.
|
||||
chosen = 0; sampleByte(chosen);
|
||||
chosen = 2; sampleByte(chosen);
|
||||
chosen = 0; sampleWord(chosen);
|
||||
chosen = 2; sampleWord(chosen);
|
||||
chosen = 0; samplePointer(chosen, joystick_axes, preferences.centers);
|
||||
chosen = 2; samplePointer(chosen, joystick_axes, preferences.centers);
|
||||
printf(" END\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user