coobird.net icon

projects.coobird.net

projects.coobird.net - Pitacalc

Pitacalc - Part 4: Documentation

Command line options

There are a few command line options available for Pitacalc. Running Pitacalc by typing pitacalc from the command line will default to accepting input from the keyboard and sending the output to the console. It is possible to change this behavior using the command line options.

-i file
Open file and uses that as the input. The file should be a plain text file that contains the instructions to execute on each line.
-o file
Writes the input and output of Pitacalc to specified file.
-license
Displays the license.
-html
In conjunction with the -o option, the output will be in HTML format.
-m
Sets the console output to monochrome mode.
-c
Sets the console output to color mode.

Pitacalc Instructions

Pitacalc instructions are case-sensitive. add and ADD is not the same, therefore, Pitacalc will not recognize the addition instruction when ADD 100 is entered.

Caution!
Each line of input, whether from the console or file, must not exceed 80 characters per line. Having the line longer than this length will cause Pitacalc to crash.

add value1 [value2 ...]
Adds the values value1 through valuen to the accumulator. The values can be either numerical or register value referred to by the register name.
sub value1 [value2 ...]
Subtracts the values value1 through valuen from the accumulator. The values can be either numerical or register value referred to by the register name.
mul value1 [value2 ...]
Multiplies the values value1 through valuen by the accumulator. The values can be either numerical or register value referred to by the register name.
div value1 [value2 ...]
Divides the value in the accumulator by values value1 through valuen. The values can be either numerical or register value referred to by the register name. When a division-by-zero occurs, the accumulator will hold a not-a-number (NaN) which will render the accumulator useless until it is reset by using the set instruction.
set [register] value
When register is omitted, sets the accumulator to value. If the register is named in register, that register is set to value. The values can be either numerical or register value referred to by the register name.
ren register name
Renames register to name. If a register by the name of name exists, then the rename will fail.
rrb number
Resizes the register bank to have number registers.
srb number
Sets all registers in the register bank to the value number.
reg
Displays all registers and its values.

< Previous (Pitacalc Part 3)
Next (Pitacalc Part 5) >
Back to Pitacalc index