Joshua Spann

The Almighty Dollar: Parsing with the Dollar-$ign in TempleOS

TempleOS $ Examples

Nov 12, 2019

Everything’s a document in TempleOS: the documentation, source code, text files, etc. This makes it very powerful. You can have sprites (2D images and 3D models) in a document as well as songs and special formatting.

The only way to do this is with the venerable dollar sign: $. If you’ve ever tried typing a $ you’ve probably noticed that it doesn’t show up and it’s like nothing types. That’s not a bug, that’s supposed to happen. Typing a $ puts you into what’s essentially a special insert or metadata entry mode.

Special data is essentially a string of text enclosed in dollar signs. Virtually all terminal coloration is made by inserting a color constant in the dollar signs.

Links are simple. You have the text to display, then the path. You can also format text alignment too.

Text example

Songs are the same way, though they have a bit more to them. Songs have parts delimited by commas. To declare a song, the first part is SO. Then you have text that represents what’s displayed when it’s inserted into the terminal. Finally you have the audio string parameter after A=.

A song in raw format

What about images? You declare a pointer to the image file. Like the song, there’s parameters to set. Add the bitmap index of the sprite in the file. Finalize it with the path to the image. What’s interesting is that images are prefixed with // in the source files.

Sprites in raw format

The best way to check your syntax, especially if you get errors, is with ctrl+t. You can learn more about how things are formatted with ctrl+t. Use it to your advantage and you could write, draw and make your own interactive book in TempleOS! Don’t doubt the power of the dollar sign!

P.S. If you want a regular dollar sign, just type $$