1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00
cc65/testcode/lib/atari/charmapping.c
2016-08-19 17:27:41 +02:00

64 lines
1.5 KiB
C

/*
** 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;
}