home *** CD-ROM | disk | FTP | other *** search
- /*
- * only deal with letters in upper/lowercase character set.
- * a-z = 0x41 - 0x5A
- * A-Z = 0xC1 - 0xDA
- * Punctuation 0x20 - 0x3F and 0x5B - 0x5F is virtually identical.
- */
-
- void
- ascii2petscii(unsigned char *p)
- {
- while (p[0]) {
- if (p[0] >= 'A' && p[0] <= 'Z') {
- p[0] += -'A' + 0x41 + 0x80;
- } else if (p[0] >= 'a' && p[0] <= 'z') {
- p[0] += -'a' + 0x41;
- }
- p++;
- }
- }
-
- void
- petscii2ascii(unsigned char *p)
- {
- while (p[0]) {
- if (p[0] >= 0xC1 && p[0] <= 0xDA) {
- p[0] -= -'A' + 0x41 + 0x80;
- } else if (p[0] >= 0x41 && p[0] <= 0x5A) {
- p[0] -= -'a' + 0x41;
- }
- p++;
- }
- }
-