Applesoft BASIC file formats
Applesoft has SAVE and LOAD in the language, so the Apple II Plus has a program file of its own: the cassette record the program goes out as. The IDE exports that record as .bin, exports the same program modulated as cassette .wav audio, and takes either back. The listing also exports as plain-text .bas, which is how a program moves between this IDE and anything that is not an Apple II. For the shared editor .txt, the project bundle, escape notation and the cross-machine machine-code overview, see the file formats overview.
No Apple II Plus export carries memory blocks. SAVE writes the program workspace and nothing else, and a block sits on page 3, outside it — widening the file would make something the machine could not read back. Use the .zip project bundle to keep a program and its blocks together. The Transfer dialog names the blocks an export would leave behind before it writes the file.
Apple II Plus cassette record .bin
The file is the program: the tokenized linked list exactly as it sits at 2049, with no header in front of it.
[ program text : link, line number, tokens, 0x00 … then a zero link ]That is the whole of it, and it is the same shape the machine holds in memory, because Applesoft's linked list describes itself — each line carries the absolute address of the next, and a zero link ends the program. The sibling Apple II's .bin needs a two-byte length in front because its interpreter grows the program down from HIMEM: and has to be told how far; this one always starts at 2049, so there is nothing to say.
That fixed base is what makes the format portable in a way the sibling's is not. A program does not remember the HIMEM: and LOMEM: it was written under and does not need to: it lands at 2049 on any Apple II Plus, whatever memory the machine has. There is still no name in the file, and none on the tape either.
Cassette audio
The Apple II Plus exposes a .wav export (and "play through speakers") and a cassette-audio import — listening on the mic / line-in, or decoding a .wav recording, back into editable source. The encoder emits mono 44.1 kHz.
The modulation is the monitor's rather than the interpreter's: SAVE and LOAD call WRITE at $FECD and READ at $FEFD, and those two routines are byte for byte the same code in this machine's ROM as in the Apple II's. So an Apple II Plus tape sounds exactly like an Apple II tape, and a recorder that reads one reads the other.
The signal is therefore the one described under the Apple II's cassette audio: a bit's length carries its value, each record sits behind a leader ending in a sync bit, and a checksum byte closes it. Two things are this machine's own.
Where a tape differs from the .bin file is that SAVE writes two records, each behind a leader of its own:
- a three-byte header record — the program's length, little-endian, and then a third byte that
LOADstores in location 214. Its value hardly matters but its top bit does: set it, andLOADskips the relink it otherwise does on a loaded program, which leaves the interpreter describing the program that was there before. On a real machine the byte is whatever the string-temporary pointer happened to hold, which at the]prompt has that bit clear. - the program record, which runs one byte past the program's own end.
SAVEwrites as far as the first byte of the variables, andREADreads the same range back, so a record trimmed to the program alone leaves a real machine hunting for a byte that is not there and answeringERR.
Where the two machines differ audibly is how much leader they spend. The Apple II's Integer BASIC re-enters WRITE past its own leader count for the second record and gives it a shorter one, so its two leaders run about ten and a half seconds and then about four. Applesoft calls WRITE from the top both times, so both leaders are the long one: about ten and a half seconds each, and an Applesoft tape spends some twenty-one seconds on leader tone before it has finished writing a program of any size. Neither leader could be trimmed much anyway — READ spends its first four seconds letting the tape speed settle before it starts hunting for a sync bit, so a leader shorter than that is never heard at all.
Robust mode doubles both leaders and changes nothing else, and decoding measures its thresholds against the leader it has just heard rather than against absolute durations — as on the Apple II, and for the same reasons.
On a real Apple II Plus, save with SAVE at the ] prompt once the recorder is running, and load by starting playback and typing LOAD — there is no need to wait for the leader tone to finish. It beeps once for the header record and once for the program; LIST or RUN it when the second beep comes. ERR before a beep is the checksum failing: rewind and try again with the volume a little lower. Unlike the Apple II next door, nothing needs typing before the LOAD: the program's address is fixed, so the tape carries everything the machine needs.
See also the Applesoft BASIC reference, its escape codes and the hardware page.