Technic Pack Wiki
Advertisement
Redpower-logo1 Basic Forth Programming contains information about the RedPower mod.

Welcome to FORTH, the basic computer language of Redpower Computers. In order to do any of the commands I will list, you must have a computer set up. This means a Monitor (RedPower) connected by Ribbon Cable to a Central Processing Unit and a Disk Drive (RedPower) with the FORTH Boot Disk inserted. In order to do the IOX commands, you will need anIO Expander connected also with ribbon cable. For the IO Expander you will also need bundled cable and colored insulated cable. All that is written in parentheses is what you type in the monitor. (Note: Caps does matter.)


The first command you need to know is a command to show all other commands. That command would be "WORDS". When you type that in and press enter, a list of all the commands on the FORTH Boot Disk will appear.

Hooray, you've learned your first command. Now you need to learn how to make your own commands.

In order to make your own commands, you need to put a colon ":", then a space then what you want to call the command (I recommend using all caps when writing programs.) First let's make a command that will say HELLO WORLD! First put a colon then a space, as described above. Lets call the program "HELLOWORLD". This means what you should have typed is ": HELLOWORLD". If this is what you typed, press enter. Next what should show up is "compile:" below what you wrote. Now we will tell it to write on the screen "HELLO WORLD!". This is done by putting a "." in front of your word. So, what you should now have written in this line is ". HELLO WORLD!". If that is what you wrote, press enter. Now we will tell it that is all we want this command to be. We end the editing of the command by putting a semicolon ";" then pressing enter. Now what you should have on the screen is:

HELLOWORLD

compile: ." HELLO WORLD!"

compile: ;


Now you can use your command by typing "HELLOWORLD". The computer should say back to you "HELLO WORLD!". Congratulations, you just wrote your first FORTH command.

FORTH control[]

Colour Swatch Numerical value (2n) n
White
    
1 0
Orange
    
2 1
Magenta
    
4 2
Light Blue
    
8 3
Yellow
    
16 4
Lime
    
32 5
Pink
    
64 6
Gray
    
128 7
Light Gray
    
256 8
Cyan
    
512 9
Purple
    
1024 10
Blue
    
2048 11
Brown
    
4096 12
Green
    
8192 13
Red
    
16384 14
Black
    
32768 15

Now we will learn how to use the IO Expander.

The basic IOX commands are IOXSET and IOXRST. IOXSET turns on a specific color of wire. IOXRST turns the signal off. If we want to turn on the white cable, we write "1 IOXSET". If we want to turn on the orange wire, we write "2 IOXSET". If we want to turn both the white and orange wires on, we write "3 IOXSET". Yes, add the numbers of the cables to each other to get the number for turning both of them on. A good way to pulse a redstone signal is to write "(number) IOXSET 5 TICKS (number) IOXRST". The "TICKS" command specifies the number of ticks to have as a delay between commands. 20 ticks = 1 second. (Note that if you want to pulse a signal multiple times you must have a tick delay at the end of the command for it to work.)

The numbers for redstone signals are as follows: (Note that I put things that have EMC values of the same number next to them so you can see all the similar numbers and maybe have a good way to remember them)



White-1 (Cobblestone)

Orange-2 (Button)

Magenta-4 (Stick)

Light Blue-8 (Wooden Planks)

Yellow-16 (Wooden Pressure Plate)

Lime-32 (Sugar Cane)

Pink-64 (Redstone)

Gray-128 (Nikolite)

Light Gray-256 (Iron)

Cyan-512 (Silver)

Purple-1024 (Gems, Enderpearls)

Blue-2048 (Gold)

Brown-4096 (Uranium)

Green-8192 (Diamond)

Red-16384 (Tungsten)

Black-32768



Congratulations, you now know how to use your computer to talk to you and use redstone signals.

For more Advanced Fourth Programming check out Forth language.


Advertisement