The Applesoft Compiler (TASC): We have the source code, in a sense
devblogs.microsoft.com
devblogs.microsoft.com
In the summer of 1982 I had a job working at Bell & Howell's headquarters. At the time, B&H was Apple's "in" to schools. The B&H flavor of the Apple II (1) had a black case and (2) had some extra A/V jacks on the back. No school had a budget for computers, but most had a budget for A/V equipment. B&H also had a nationwide service organization that frequented schools, due to B&H selling lots of projectors to them.
Anyway, I used a B&H Apple II to automate some accounting tasks for one department. At lunch I would eat quickly then work on the Apple II exploring it's capabilities -- simple graphics programs, etc. I ended up writing a sector editor, then used TASC to compile it to make it useful. I recall uploading the program to a BBS when I was done, as I had no personal use for it.
My pay was $5/hour, but I burned up $5/day in gas money and $5/day for food, so really I was making $30/day.
I graduated HS and went off to college, and a few times I got calls asking me to debug something or add a feature. I had the listings with me, but it would result in a painful process verbally telling a non-programmer how to edit the program. There was no ability to dial in, so it was a purely verbal process.
> As the author added features, he kept hitting the Apple ][‘s 48KB RAM limit
There was a language card that could replace the upper 16KB of ROM with RAM, but of course, you’d still need to have the interpreter somewhere.
I’ve never heard of TASC before, but Beagle Bros also had an AppleSoft compiler (released in 1986):
https://archive.org/details/Beagle_Bros-Beagle_Compiler
Beagle Bros had an bevy of amazing software in general:
https://en.wikipedia.org/wiki/Beagle_Bros
I feel bad now that I pirated so much of it as a teenager.
It was awesome. They were super nice and I got to visit Sophie: the Beagle Bros beagle!
Wouldn't this explain it?
But it seems odd that they wouldn't at least save a LUT relating the shortened and expanded variable name.
There was no special version for machines with more ram or with a floppy disk.
BASIC implementations based on Microsoft BASIC store tokenized program lines. A keyword takes 1 byte. Comments, variable names, spaces between tokens, etc take up memory on a character-by-character basis.
I didn't use Apple BASIC, but I spent too much time on various flavors of Commodore BASIC which shared this heritage. Changing a variable from "ACCUMULATOR" to "AC" to "A" saved memory and made the program run faster. The problem of not being able to make sense of your own program after was very real.
The article doesn't ever explicitly say so but, yes, Chen expects the reader to understand from his words that TASC was written in Applesoft BASIC. Crazy, indeed!
Maybe it didn’t matter as much since it was a compiler and not a runtime environment.
Back in the early 2000s, I worked at EA on Madden Football. I was working on a project to replace the old system Madden used for the game's UI (HUD, menu screens, etc.) with a new one based on Flash. A very smart engineer out of EAC in Vancouver wrote a custom ActionScript bytecode VM that could run on consoles and I was integrating it into Madden's game engine.
I was a lowly tools and UI engineer. In EA's culture back then, that placed me near the bottom just above QA on the prestige totem pole. One of the lead engineers on Madden wanted to talk to me about how much memory the new UI system was using.
I explained that part of it was that we needed RAM for all the variable names. He looked at me like I was an absolute idiot and condescendingly explained that compilers for programming languages don't keep the name of the variable around. The name is just used to identify a storage location and you only need memory at runtime for the value. He may or may not have hinted that this was something I was expected to understand if I ever wanted to become a senior engineer like he was.
So I sat down at his computer and tapped out this bit of ActionScript and ran it in our VM:
var someVariable = "its value";
var some = "some";
var variable = "Variable";
trace(eval(some + variable)); // Prints "its value".
Here, it's dynamically computing a string, which is then used used to look up the value of a local variable by that computed string name. In order for this to work, every variable name must be kept around in memory.The look of confusion and anger on his face was priceless.
(You might rightly wonder why in the hell EA picked a dynamically-typed scripting language with eval() that required keeping variable names around in memory for consoles that were incredibly resource constrained. The answer was that they struggled to hire UI artists who were willing to use the previous weird proprietary tools. They figured if they moved to Flash, they could hire Flash artists. Also, it meant they didn't have to maintain a custom UI editing tool.)
[0] Microsoft's own source control product that it replaced was Microsoft Delta. Believe it or not, Source Safe was a major improvement over Delta.
https://archive.org/details/101_TASC_Compiler
To get you started, Apple II DOS commands include CATALOG and LOAD (reference: https://www.landsnail.com/a2ref3.htm)
I suppose that a compiler wouldn't do much to make something like the original BASIC The Oregon Trail feel much faster; I think the sailing-on-a-raft part wasn't added until the 1985 version, which likely was not written in Applesoft.
>What rarely popped up, however, were show-stopper errors — programs would compile & run. That was nice.
Beyond being itself written in Applesoft BASIC as I noted elsewhere, TASC's coverage of BASIC keywords is almost entirely complete, going by chapter 7 of the manual. Any given Applesoft program has a very high chance of successfully compiling out of the box, and the very few differences with the interpreted language can be easily worked around (if the `DIM` command is any indication). As one used to aftermarket compilers that only support subsets of the language, TASC's comprehensiveness is very, very impressive.
Further, TASC's coverage of BASIC keywords is almost entirely complete, going by chapter 7 of the manual. Any given Applesoft program has a very high chance of successfully compiling out of the box, and the very few differences with the interpreted language can be easily worked around (if the `DIM` command is any indication). As one used to aftermarket compilers that only support subsets of the language, TASC's comprehensiveness is very, very impressive.
> Even if you hadn’t made it that deep into the manual, you could have figured out that TASC was used to compile itself because TASC used its own runtime library.It's part of the manual quote at the top of the article, 2nd paragraph of the quote (5th of the article):
> All three passes were written largely in Applesoft, and TASC was used to compile itself.