rem Window Settings
set window on
set window size 550,480
 
 
a$="0"
 
 
rem Main Loop
do
 
box 140,5,440,25
 
 
sync on : sync rate 0
 
ink rgb(0,0,0),1
set cursor 150,10
print ">";a$
 
if button(150,55,"1")=1 
a$=a$+"1"
wait 100
endif
if button(250,55,"2")=1 
a$=a$+"2"
wait 100
endif
if button(350,55,"3")=1 
a$=a$+"3"
wait 100
endif
if button(150,155,"4")=1 
a$=a$+"4"
wait 100
endif
if button(250,155,"5")=1 
a$=a$+"5"
wait 100
endif
if button(350,155,"6")=1 
a$=a$+"6"
wait 100
endif
if button(150,255,"7")=1 
a$=a$+"7"
wait 100
endif
if button(250,255,"8")=1 
a$=a$+"8"
wait 100
endif
if button(350,255,"9")=1 
a$=a$+"9"
wait 100
endif
if button(250,355,"0")=1 
a$=a$+"0"
wait 100
endif
if button(150,355,"+")=1 
a$="0"
wait 100
z=1
endif
if button(450,55,"-")=1
a$="0"
z=2
wait 100
endif
if button(450,155,"/")=1
a$="0"
z=3
wait 100
endif
if button(450,255,"00")=1
a$=a$+"00"
wait 100
endif
if button(450,355,".")=1 
a$=a$+"."
wait 100
endif
if button(550,55,"AC")=1
a$="0"
endif
if button(350,355,"=")=1 and z=1
d=a+b
endif
 
 
if keystate(79)=1 
a$=a$+"1"
wait 100
endif
if keystate(80)=1 
a$=a$+"2"
wait 100
endif
if keystate(81)=1 
a$=a$+"3"
wait 100
endif
if keystate(75)=1 
a$=a$+"4"
wait 100
endif
if keystate(76)=1 
a$=a$+"5"
wait 100
endif
if keystate(77)=1 
a$=a$+"6"
wait 100
endif
if keystate(71)=1 
a$=a$+"7"
wait 100
endif
if keystate(72)=1 
a$=a$+"8"
wait 100
endif
if keystate(73)=1 
a$=a$+"9"
wait 100
endif
if keystate(82)=1 
a$=a$+"0"
wait 100
endif
 
 
sync
loop
 
 
rem Button Function
function Button(x1,y1,WORDS$)
Pressed=0
x2=Text Width(WORDS$)
y2=Text Height(WORDS$)
if mousex()>x1 and mousex()<x1+x2
if mousey()>y1-y2 and mousey()<y1+y2
Pressed=1
endif
endif
if pressed=1 then ink rgb(255,0,0),0 else ink rgb(255,255,255),0
if pressed=1
Pressed=Mouseclick()
else
pressed = 0
endif
text x1,y1,WORDS$
endfunction pressed