Traditional computer programs are written like a short story. It looks like this:
With computer programs, you need to set things up, let them chug along for a while, and then see what you get in the end. But then again, that's traditional computer programs, and in today's busy world we also have interactive programs, and these programs are happy to wait around all day checking to see if you want them to do anything.
PICO-8 is very happy, and if you write a function called _update(), PICO-8 will try to run that function 30 times a second, which turns out to be very practical. So a very basic PICO-8 program can consist of an _update() function that does something interesting 30 times a second.
This leads to the question "what is a function?". A function can be thought of as a sequence of steps that have a name. If you write the steps well, you can have the computer run through them and do work for you.
To write a function in PICO-8, the first step is to just start up PICO-8. It creates a small black window and writes out some messages followed by a '>' prompt. The 'greater than' sign is pointing to where you can type commands, and a cursor blinks there to let you know PICO-8 is ready. The command for starting the program editor is a little tricky -- you press the Esc key on the keyboard. When you do this, the screen changes to the editor screen which looks like this
The brown area in the middle is where you can type a program, like this one
X=1
FUNCTION _UPDATE()
CLS()
X=X+1
CIRCFILL(20+X%100,64,7,4)
END
This program consists mostly of the _update() function, which has three steps.
Step 1: Clear the screen
Step 2: Increase value X by 1
Step 3: Draw a circle at a certain position on the screen
If you type in this program, you will see a few quirks of PICO-8.
To run this program, you press the Esc key again and then type RUN at the command prompt. If all is good, then you end up with a circle that slowly drifts from left to right across the screen over and over.