static void ascii_dump(void) { bool done = false; short i; uint8 mem[ASCIIDUMP_BPL + 2]; uint8 byte; mem[ASCIIDUMP_BPL] = 0; if (!range_args(16 * ASCIIDUMP_BPL - 1)) // 16 lines unless end address specified return; do { fprintf(fout, "%04lx:", address); for (i=0; i<ASCIIDUMP_BPL; i++, address++) { if (address == end_address) done = true; byte = SAMReadByte(address); if ((byte >= ' ') && (byte <= '~')) mem[i] = conv_from_64(byte); else mem[i] = '.'; } fprintf(fout, " '%s'\n", mem); } while (!done && !aborted()); }
void FSDrive::convert_filename(char *srcname, char *destname, int *filemode, int *filetype, bool *wildflag) { char *p, *q; int i; // Search for ':', p points to first character after ':' if ((p = strchr(srcname, ':')) != NULL) p++; else p = srcname; // Convert char set of the remaining string -> destname q = destname; for (i=0; i<NAMEBUF_LENGTH && (*q++ = conv_from_64(*p++, true)); i++) ; // Look for mode parameters seperated by ',' p = destname; while ((p = strchr(p, ',')) != NULL) { // Cut string after the first ',' *p++ = 0; switch (*p) { case 'p': *filetype = FTYPE_PRG; break; case 's': *filetype = FTYPE_SEQ; break; case 'r': *filemode = FMODE_READ; break; case 'w': *filemode = FMODE_WRITE; break; case 'a': *filemode = FMODE_APPEND; break; } } // Search for wildcards *wildflag = (strchr(destname, '?') != NULL) || (strchr(destname, '*') != NULL); }