Post Wed Jan 05, 2011 2:40 pm

Example Ore Programs

Hey, there! Here's a few simple Ore programs!

Hello World! :D
# This is an example Ore program! ;)
# December 18th, 2010
echo:Hello, world!
# More code here if you'd like to try it out!

The default bootstrap for both the PC and PSP runtime enviornment.
# crait's custom bootstrapper for Ore OS
# December 18th, 2010
echo:Running bootstrap...
echo:Loading environment...
env:text 1
env:bg 1
env:fore 1
# More code here
echo:Done loading bootstrap!
echo:Welcome to crait's Ore OS!

What's your name?
# This program asks what your name is!
# December 31st, 2010
echo:Hello! What's your name?
%lbl 1
%str n inp
%if n = nil then
echo:Do you not have a name?
echo:What's your name?
%goto 1
echo: Hey! Your name is:
%str n disp

Greatest common divisor using Euclid's algorithm.
# This program asks for two numbers. It gives outputs the greatest common divisor
# December 31st, 2010
echo:What is the first number?
%var a inp
echo:What is the second number?
%var b inp
%lbl 1
%if a = 0 then
%goto 2
%if a > b then
%a - b
%goto 1
%if b > a then
%b - a
%goto 1
%lbl 2
echo:The greatest common greatest common divisor, based
echo:on Euclid's algorithm is:
%var b out

If you'd like, you can make some requests! :D