1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-18 00:07:21 +00:00
cc65/test/ref/charset.c

94 lines
3.4 KiB
C
Raw Normal View History

2014-09-24 14:45:10 +00:00
/*
!!DESCRIPTION!! basic ASCII character test
!!ORIGIN!! testsuite
!!LICENCE!! Public Domain
!!AUTHOR!! Groepaz/Hitmen
*/
#include <stdio.h>
#if 0
/* this kind of line-continuation for strings doesnt work properly for cc65 */
const unsigned char characters[]={
2019-02-12 21:50:49 +00:00
/*0123456789abcdef0123456789abcdef*/
/* iso646-us control-characters */
" " /* 00-1f */
/* iso646-us printable characters */
" !\"#$%&'()*+,-./" /* 20-2f !"#$%&'()*+,-./ */
"0123456789" /* 30-39 0123456789 */
":;<=>?@" /* 3a-40 :;<=>?@ */
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* 41-5a A-Z */
"[\\]^_`" /* 5b-60 [\]^_` */
"abcdefghijklmnopqrstuvwxyz" /* 61-7a a-z */
"{|}~ " /* 7b-7f {|}~ */
/* iso8859-15 extended characters */
2014-09-24 14:45:10 +00:00
};
#endif
const unsigned char characters[]={
2019-02-12 21:50:49 +00:00
/*0123456789abcdef0123456789abcdef*/
/* iso646-us control-characters */
/* 00-1f */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* iso646-us printable characters */
/* 20-2f !"#$%&'()*+,-./ */
' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',
/* 30-39 0123456789 */
'0','1','2','3','4','5','6','7','8','9',
/* 3a-40 :;<=>?@ */
':',';','<','=','>','?','@',
/* 41-5a A-Z */
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
/* 5b-60 [\]^_` */
'[','\\',']','^','_','`',
/* 61-7a a-z */
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
/* 7b-7f {|}~ */
'{','|','}','~',' '
/* iso8859-15 extended characters */
2014-09-24 14:45:10 +00:00
};
void printchars(unsigned char a,unsigned char b){
2019-02-12 21:50:49 +00:00
for(b++;a!=b;a++)
2014-09-24 14:45:10 +00:00
/* printf("%02x ",a); */
/* printf("%02x ",characters[a]); */
2019-02-12 21:50:49 +00:00
printf("%c",characters[a]);
printf("\n");
2014-09-24 14:45:10 +00:00
}
int main(void) {
2019-02-12 21:50:49 +00:00
printf("characters:\n\n");
printchars(0x61,0x7a);
printchars(0x41,0x5a);
printf("numbers:\n\n");
printchars(0x30,0x39);
printf("other:\n\n");
printchars(0x20,0x2f);
/*printchars(0x3a,0x40);*/
printchars(0x3a,0x3f);
/*printchars(0x5b,0x60);*/
/*printchars(0x7b,0x7f);*/
printf("\n\n");
printf("slash: '%c'\n",'/');
printf("backslash: '%c'\n",'\\');
printf("curly braces open: '%c'\n",'{');
printf("curly braces close: '%c'\n",'}');
printf("square braces open: '%c'\n",'[');
printf("square braces close: '%c'\n",']');
printf("underscore: '%c'\n",'_');
printf("tilde: '%c'\n",'~');
printf("pipe: '%c'\n",'|');
printf("apostroph: '%c'\n",'\'');
printf("single quote '%c'\n",'`');
printf("xor '%c'\n",'^');
printf("at '%c'\n",'@');
2014-09-24 14:45:10 +00:00
2019-02-12 21:50:49 +00:00
return 0;
2014-09-24 14:45:10 +00:00
}