47 lines
838 B
C
47 lines
838 B
C
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
// Print actual int results so the host can check them independently of CMOC.
|
|
#include <cmoc.h>
|
|
|
|
static unsigned char ready = 1;
|
|
static unsigned word;
|
|
|
|
static int getReady(void)
|
|
{
|
|
return ready;
|
|
}
|
|
|
|
static int failure(void)
|
|
{
|
|
return !getReady();
|
|
}
|
|
|
|
static unsigned getWord(void)
|
|
{
|
|
return word;
|
|
}
|
|
|
|
static int wordIsZero(void)
|
|
{
|
|
return !getWord();
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
printf("NOT %d", failure());
|
|
ready = 0;
|
|
printf("%d", failure());
|
|
ready = 255;
|
|
printf("%d ", failure());
|
|
|
|
// Exercise zero, only B set, only A set, and both halves set.
|
|
word = 0;
|
|
printf("%d", wordIsZero());
|
|
word = 0x0080;
|
|
printf("%d", wordIsZero());
|
|
word = 0x8000;
|
|
printf("%d", wordIsZero());
|
|
word = 0xFFFF;
|
|
printf("%d END\n", wordIsZero());
|
|
return 0;
|
|
}
|