ACD and Acode vs Text File #48
-
@thoni56, lately I've been studying the ARun C source code again, for a project which I have in mind. But there are a few obscure points I wanted to ask you about. ACD?In the source variables and functions names, as well as in the comments, there are many references to the "ACD file" and the "ACD code". I'm not quite sure what this terms exactly refers to, i.e. compared to the Is this a legacy term, i.e. from ALAN 2? IRC, ALAN2 storyfiles had the Acode vs Text FileIn
But both file operations seems to point to the same file (i.e. the What does the "adventure text data file" refers to, exactly, in the code below? static void openFiles(void)
{
char str[256];
/* Open Acode file */
strcpy(codfnm, adventureFileName);
if ((codfil = fopen(codfnm, READ_MODE)) == NULL) {
strcpy(str, "Can't open adventure code file '");
strcat(str, codfnm);
strcat(str, "'.");
playererr(str);
}
/* Open Text file */
strcpy(txtfnm, adventureFileName);
if ((textFile = fopen(txtfnm, READ_MODE)) == NULL) {
strcpy(str, "Can't open adventure text data file '");
strcat(str, txtfnm);
strcat(str, "'.");
apperr(str);
}
/* If logging open transcript and/or log file */
if (transcriptOption) {
startTranscript();
}
if (commandLogOption) {
startCommandLog();
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
A historical data point that might help is to remember that in Alan v2 there actually were two separate files, one containing the generated instructions and data, the other containing the texts/strings. At some point, probably early experimenting with Alan v3, the files was merged, which simply meant that the Alan compiler as a final step bolted the text data onto the end of the Acode file. Thus making it easier to distribute a game it being a single file. (Although we now might have media files which are not, at least not yet, merged into the The v3 Acode header then contains the offset into the file where the strings are, and there are some arithmetic to read a string from the "text file" because of this. So, yes the code and text files are actually the same "physical" file, but opened twice to keep reading them separate, e.g. with this it is possible to just advance in the text file without affecting the code file position. (Not that this actually matters since complete "code" part of the file is loaded into memory... And no, with modern hardware, software and OS architectures, this will not prohibit huge games to be run ;-), but it might be preventing Alan running on PalmPilots and similar restricted devices. This was a concious decision.) As a side note, the text/string portion is not read into memory but read from the file on disc when needed. Does this answer your question? |
Beta Was this translation helpful? Give feedback.
A historical data point that might help is to remember that in Alan v2 there actually were two separate files, one containing the generated instructions and data, the other containing the texts/strings.
At some point, probably early experimenting with Alan v3, the files was merged, which simply meant that the Alan compiler as a final step bolted the text data onto the end of the Acode file. Thus making it easier to distribute a game it being a single file. (Although we now might have media files which are not, at least not yet, merged into the
.a3c
file.)The v3 Acode header then contains the offset into the file where the strings are, and there are some arithmetic to read a string from t…