1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/*
** testprogram for includes "atari_screen_charmap.h" and "atari_atascii_charmap.h"
**
** 19-Aug-2016, Christian Krueger
*/
#include <conio.h>
#include <atari.h>
#include <peekpoke.h>
#include <string.h>
char pcDefaultMappingString[] = "Hello Atari!";
#include <atari_screen_charmap.h>
char pcScreenMappingString[] = "Hello Atari!";
#include <atari_atascii_charmap.h>
char pcAtasciiMappingString[] = "Hello Atari!";
/* THIS WON'T work due to string merging/collection problems!
char* pcDefaultMappingString = "Hello Atari!";
#include <atari_screen_charmap.h>
char* pcScreenMappingString = "Hello Atari!";
#include <atari_atascii_charmap.h>
char* pcAtasciiMappingString = "Hello Atari!";
*/
int
main(void)
{
static unsigned char expectedAtasciiValues[] = { 40,101,108,108,111,0,33,116,97,114,105,1};
int returnValue = 0;
unsigned char* screen = (unsigned char*) PEEKW(88);
// check default (=atascii)
clrscr();
cputs(pcDefaultMappingString);
returnValue |= memcmp(screen, expectedAtasciiValues, sizeof(expectedAtasciiValues));
clrscr();
memcpy(screen, pcScreenMappingString, sizeof(expectedAtasciiValues));
returnValue |= memcmp(screen, expectedAtasciiValues, sizeof(expectedAtasciiValues));
clrscr();
cputs(pcAtasciiMappingString);
returnValue |= memcmp(screen, expectedAtasciiValues, sizeof(expectedAtasciiValues));
clrscr();
if (returnValue)
cputs("Test FAILED!");
else
cputs("Test passed.");
cputs("\n\rHit any key to exit...");
cgetc();
return returnValue;
}
|