Page 1 of 1

Example Ore Programs

PostPosted: Wed Jan 05, 2011 2:40 pm
by crait
Hey, there! Here's a few simple Ore programs!

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


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


What's your name?
  Code:
# This program asks what your name is!
# December 31st, 2010
exe:3.1.n.NamePlease
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
%end
echo: Hey! Your name is:
%str n disp
exe:end


Greatest common divisor using Euclid's algorithm.
  Code:
# This program asks for two numbers. It gives outputs the greatest common divisor
# December 31st, 2010
exe:3.1.n.EuclidIsMyHomeboy
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
%end
%if a > b then
%a - b
%goto 1
%end
%if b > a then
%b - a
%goto 1
%end
%lbl 2
echo:The greatest common greatest common divisor, based
echo:on Euclid's algorithm is:
%var b out
exe:end



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