fb:porticula NoPaste
EasyBasic V2 (verbessert, nicht fertig)
Uploader: | AndT |
Datum/Zeit: | 28.11.2007 16:30:20 |
' EasyScriptEngine V2 beta
' _____ Programmintern(erforderlich)_____
Print "EasyScriptEngine V 0.0.01 beta"
Print "Initalizing Programm.."
#define debug 0
#define noblock 0
#if(debug=1)
print "it works"
sleep
end
#endif
' Declarationen
dim as double maxv1,maxv2,maxv3,maxv4,dbgmd
dim as integer x,y,gfxcol
dim as double v1,v2,v3,v4
dim as integer runs,dummy
dim as string prgfile = "prog.txt" ' Datei zum Ausführen
#if (noblock = 0)
prgfile = command
open command for input as #1
if command = "" then print "Keine Datei angegeben":sleep:end
if lof(1) = 0 then print "Fehler beim oeffen von"; command;".":sleep:end
close #1
#endif
' Function für ConsolenPrint
sub consprint (byval Text as string)
dim as integer ff = freefile
open cons for output as #ff
print #ff,Text
close #ff
end sub
' _____ Anzahl der Zeilen scannen ____
Print "Zeilen :";
open prgfile for input as #1
do
input #1,dummy
runs+=1
loop until eof (1)
close #1
print runs
Print "Code Laden.."
open prgfile for input as #1
dim shared as string cfgcode(runs) ' Programmcodespeicher Declarieren
' ____ Programm Laden ____
open prgfile for input as #1
for i as integer = 1 to runs
input #1,cfgcode(i)
next
close #1
Print "Fertig."
' ____ Programm Ausführen ____
dim as ubyte char,cmpbol
dim as string cmd
for i as integer = 1 to runs
cmd = lcase(cfgcode(i))
select case cmd
' Ab hier können Befehle eingetragen werden
' Syntax Befehl = CMD, cfgcode(nr) = Zeile in prog.txt
' Komplexere Befehle sind auch rein Theroetisch auch möglich.
' ====== Grafiksystemteil ======
case "screen"
screen val(cfgcode(i+1))
case "full_circle"
circle (val(cfgcode(i+1)),val(cfgcode(i+2))),val(cfgcode(i+3)),val(cfgcode(i+4)),,,,F
case "circle"
circle (val(cfgcode(i+1)),val(cfgcode(i+2))),val(cfgcode(i+3)),val(cfgcode(i+4))
case "full_line"
line(val(cfgcode(i+1)),val(cfgcode(i+2)))-(val(cfgcode(i+3)),val(cfgcode(i+4))),val(cfgcode(i+5)),bf
case "line"
line(val(cfgcode(i+1)),val(cfgcode(i+2)))-(val(cfgcode(i+3)),val(cfgcode(i+4))),val(cfgcode(i+5))
' ------ Ausgebauter Teil ------
case "smv"
select case val(cfgcode(i+1))
case 1
maxv1=val(cfgcode(i+2))
case 2
maxv2=val(cfgcode(i+2))
case 3
maxv3=val(cfgcode(i+2))
case 4
maxv4=val(cfgcode(i+2))
end select
case "col"
select case cfgcode(i+1)
case "v1"
color v1
case "v2"
color v2
case "v3"
color v3
case "v4"
color v4
case else
color val(cfgcode(i+1))
end select
case "pset"
select case cfgcode(i+1)
case "v1"
x=v1
case "v2"
x=v2
case "v3"
x=v3
case "v4"
x=v4
case else
x = val(cfgcode(i+1))
end select
select case cfgcode(i+2)
case "v1"
y=v1
case "v2"
y=v2
case "v3"
y=v3
case "v4"
y=v4
case else
y = val(cfgcode(i+2))
end select
select case cfgcode(i+3)
case "v1"
gfxcol=v1
case "v2"
gfxcol=v2
case "v3"
gfxcol=v3
case "v4"
gfxcol=v4
case else
gfxcol=val(cfgcode(i+3))
end select
' ====== Dateisystemteil ======
case "load"
open cfgcode(i+1) for binary as #1
case "close"
close #1
case "comp"
if char = val(cfgcode(i+1)) then cmpbol = 1 else cmpbol = 0
case "get"
get #1,val(cfgcode(i+1)),char
case "put"
char = val(cfgcode(i+2))
put #1,val(cfgcode(i+1)),char
' ====== Main base ======
case "res"
screenres val(cfgcode(i+1)),val(cfgcode(i+2))
case "beep"
beep
case "echo"
print cfgcode(i+1)
case "exit"
exit for
case "goto"
i=val(cfgcode(i+1))
case "escrout"
if inkey = chr(27) then exit for
' ====== Mathengine (beta) ======
case "add"
select case cfgcode(i+1)
case "v1"
v1+=val(cfgcode(i+2))
case "v2"
v2+=val(cfgcode(i+2))
case "v3"
v3+=val(cfgcode(i+2))
case "v4
v4+=val(cfgcode(i+2))
end select
case "sub"
select case cfgcode(i+1)
case "v1"
v1-=val(cfgcode(i+2))
case "v2"
v2-=val(cfgcode(i+2))
case "v3"
v3-=val(cfgcode(i+2))
case "v4
v4-=val(cfgcode(i+2))
end select
case "mult"
select case cfgcode(i+1)
case "v1"
v1*=val(cfgcode(i+2))
case "v2"
v2*=val(cfgcode(i+2))
case "v3"
v3*=val(cfgcode(i+2))
case "v4"
v4*=val(cfgcode(i+2))
end select
case "div"
select case cfgcode(i+1)
case "v1"
v1/=val(cfgcode(i+2))
case "v2"
v2/=val(cfgcode(i+2))
case "v3"
v3/=val(cfgcode(i+2))
case "v4"
v4/=val(cfgcode(i+2))
end select
' ==== Main Run ====
end select
next
' ==== End of Program ====
color 15
consprint "Programm beendet"
Print "--- END OF PROGRAM ---"
sleep