text stringlengths 0 897 |
|---|
Try selecting the top option, "Unmount /usr". Now use the `dir` command in the REPL. Mini Micro will reply "Invalid path". The "/usr" path references a disk file or folder mounted in the top disk slot, but we just unmounted (removed) that, so there are no files there to view. |
{i:"mount folder"} |
Click the top slot again, and this time pick "Mount Folder..." A folder selection dialog appears, this time showing real files on your host (Windows, Mac, or Linux) computer. Choose some folder in your home directory, perhaps something with some text or picture files in it. Now use the `cd` command to make sure your... |
Moreover, if you used the `file` module (from Chapter 13) to create, delete, or alter files here in Mini Micro, you would see those changes reflected in File Explorer or Finder on your host operating system. (So please be careful!) |
{i:"mount disk file"} |
Assuming that your previous user disk was a minidisk file, you can click the slot again and choose "Mount Disk File..." to remount it. (If you have trouble finding it, just search your system for a file called `user.minidisk`, which is what Mini Micro calls it by default.) Or you can use the "New Disk File..." comman... |
A minidisk file is, in fact, nothing more than a zip file — a standard way of bundling a bunch of files and folders up into a single file, usually smaller than the original files thanks to compression. If you have a .minidisk file and want to convert it to into regular files, you can do so with this procedure: |
1. Rename the file so that it ends in .zip rather than .minidisk. |
2. Unzip it. Exactly how you do this depends on your system; in Windows you would use the "Extract All" button, on Mac you would just double-click it, etc. |
Now you have an ordinary folder, which you could use with Mini Micro via that "Mount Folder..." command. What if you want to go the other way — take a folder and turn it into a minidisk file? That's easy too: |
1. Zip the folder. On Mac, you right-click it and choose "Archive..."; on Windows you might need a third-party zip program. |
2. Rename the zip file so that it ends in .minidisk rather than .zip. |
And that's it. Now you can mount this as a disk in Mini Micro using the "Mount Disk File..." command. |
Each way of representing files has its pros and cons. A minidisk file is a nice way of keeping all the MiniScript files for a particular program or task together. If you want to send somebody a copy of your program, along with all the images and sounds and other data it might need, a minidisk file is the most conveni... |
But mounting a folder is nice if you frequently want to access files both from Mini Micro and from the host OS. For example, you might want to use a paint program like PhotoShop to edit the artwork for a game, or use powerful audio software for editing the sound files for a music program. That's easier to do when Min... |
Now that you know about these two formats, you can choose how you prefer to store your files. Not sure? Don't worry about it — you can always convert from one to the other later. |
{i:"`/usr2`"} |
Finally, it's worth pointing out that Mini Micro has *two* disk slots. Any folder or disk file you mount in the second slot becomes available in Mini Micro as `/usr2/`. You probably won't need this at first, but someday you may have the need to load a second disk (or folder) of programs and data so that y... |
A> **Chapter Review** |
A> - You experimented with the `key` module for reading the keyboard. |
A> - You practiced editing and saving programs in Mini Micro. |
A> - You learned about the two ways Mini Micro stores files on the host disk: as a disk file, and as a folder hierarchy, and how to convert between them. |
{chapterHead: "Day 17: Colors and Text", startingPageNum:201} |
{width: "50%"} |
 |
Q> Life is a series of building, testing, changing and iterating. |
Q>— Lauren Mosenthal (designer, researcher, & entrepreneur) |
A> **Chapter Objectives** |
A> - Learn how to specify and work with colors in Mini Micro. |
A> - Explore the `text` module and various ways of placing text on the screen. |
When you boot up Mini Micro, it looks a lot like a terminal window at first. There is monospaced text and a blinking cursor. Yesterday you learned some ways to go beyond standard terminal input/output, on the input side: ways to get a single character input or detect the state of all keys and buttons. Today we're go... |
## Color in Mini Micro |
{i:"color;Mini Micro,colors in"} |
Colors in Mini Micro are represented as standard HTML (that is, web page) color strings, which look like this: |
{width:"50%"} |
 |
The first character must be a hash (`#`), followed by two characters each for red, green, and blue. The last two characters represent alpha (transparency), and are optional. If not specified, the alpha will be assumed to be FF, which is fully opaque. |
Each pair of characters is a *hexadecimal* value from 00 to FF. |
{i:"hexadecimal"} |
D> The ordinary numbers everybody knows about are *decimal* numbers, with digits that go from 0 to 9. The second digit from the right is the "tens place" and digits there are multiplied by 10, so that 42 really means 4 \* 10 + 2. *Hexadecimal* numbers are similar, but instead of ten different digits, there are 16: 0 ... |
PRINT>If all that about hexadecimal numbers seems confusing, don't worry about it; you don't really need to understand them to work with colors. Mini Micro comes with a `color` module that has 20 standard colors defined, so you can just refer to them by name. The table at the top of the next page lists them all. |
EBOOK>If all that about hexadecimal numbers seems confusing, don't worry about it; you don't really need to understand them to work with colors. Mini Micro comes with a `color` module that has 20 standard colors defined, so you can just refer to them by name. The table below lists them all. |
{colWidths:"50,100,50,100", caption:"Colors defined in the `color` module."} |
|Name|Value|Name|Value| |
|----|-----|----|-----| |
|aqua|#00FFFF|navy|#000080| |
|black|#000000|olive|#808000| |
|blue|#0000FF|orange|#FF8000| |
|brown|#996633|pink|#FF8080| |
|clear|#00000000|purple|#800080| |
|fuchsia|#FF00FF|red|#FF0000| |
|gray|#808080|silver|#C0C0C0| |
|green|#008000|teal|#008080| |
|lime|#00FF00|white|#FFFFFF| |
|maroon|#800000|yellow|#FFFF00| |
{gap:30} |
D> Want to see those colors in color? Check the *Mini Micro Cheat Sheet*! They are shown at the bottom of page 2. |
There are many uses for colors in Mini Micro, but for today, we're just going to use them to color text. When you launch Mini Micro, it comes up with the color set to orange text on a black background, though you probably noticed that the welcome message used several other colors. Time for you to learn how to do such... |
```terminal |
]text.color = color.lime |
``` |
As soon as you hit return, the `]` prompt and the blinking cursor appear a bright green. Enter `dir` just to get a bit more text to display in your current color settings. |
Now perhaps that bright green is a bit too garish. Let's tone it down: |
```terminal |
]text.color = color.green |
]dir |
``` |
If you consult the color chart, you'll note that `color.lime` is `"#00FF00"`, while `color.green` is `"#008000"`. Both of these have red and blue equal to zero, but different amounts of green; lime uses FF, while green uses 80. Because FF is a bigger (hexadecimal) number than 80, it's a lot more green, and so a brigh... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.