Ooops
November 25, 2020, 02:02:08 PM

Author Topic: micro(A) Interpreter  (Read 7982 times)

Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 2855
  • elgol 2021
Re: o2Basic - micro(A) Interpreter
« Reply #45 on: June 07, 2020, 11:51:00 PM »
This seems like a cool project, good luck with it.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, C64, ZX Spectrum Next.


Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #47 on: June 11, 2020, 11:05:26 PM »
 here is a simple fibonacci series just 10 numbers with simple
goto/label loop

Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #48 on: June 13, 2020, 07:04:45 PM »
simple pixel plotting in microA

Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #49 on: June 14, 2020, 03:06:47 PM »
Hi
First graphic program in micro(A).
It is well known fern fractal, i made it after i tested rnd() function
in micro is rnd var without parentesis,i will ad it later.

Code: [Select]
'fern test
varnum x,y,r,n,x1,y1
x=0:y=0

label start

r = rnd 1

if r > 0
  if r < 0.01
     x = 0.0
     y = 0.16 * y
  endif
endif

if r > 0.01
   if r < 0.085
      x = 0.22 * x - 0.26 * y
      y = -0.23 * x + 0.22 * y + 1.6
   endif
endif

if r > 0.075
    if r < 0.15
       x = 0.15 * x + 0.28 * y
       y = -0.29 * x + 0.24 * y + 0.44
    endif
endif

x = 0.85 * x + 0.04 * y
y = -0.04 * x + 0.85 * y + 1.6

x1 = (x + 3.14) * 70
y1 = 760 - y * 70

pset x1,y1
n = n + 1

if n < 20000
  goto start
endif
print 300,10,"OK!"

Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #50 on: June 16, 2020, 10:47:57 PM »
Lorenz example :
Code: [Select]
'lorenz example in micro(A)
varnum x,y,z,count,xx,yy,zz,x1,y1
x=0 : y=40 : z=40 : count=0

label start

xx = x + 0.01 * (-10.0 * x + 10.0 * y)
yy = y + 0.01 * ( 28.0 * x - y - x * z)
zz = z + 0.01 * (-8.0  * z / 3.0  + x * y)
 

x1 = x*10+320
y1 = -(z)*10+500
pset x1,y1

x = xx
y = yy
z = zz
count = count + 1

if count < 10000
  goto start
endif
print 10,10,"OK!"

Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #51 on: June 18, 2020, 10:29:32 PM »
Fern fractal in micro(A)
12000 iteration in 1.7 sec ..not bad for hobby interpreter

Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: o2Basic - micro(A) Interpreter
« Reply #52 on: June 27, 2020, 11:17:55 AM »
First binary release of micro(A) Interpreter.
have fun!

Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: micro(A) Interpreter
« Reply #53 on: July 13, 2020, 04:06:16 PM »
full circle example by my bufy MGA originaly written in smallBasic
i translated to micro(A)
Code: [Select]
'full_circle by [B+=MGA]2017->micro(A) by aurel
'everything was supposed to be turning around another circle
varnum xc,yc,xx,yy,x,y,x3,y3,r,w,ww,w3,pi,i,j,k,ww,loop
xc=640/2 : yc=480/2 :pi=3.14: i=1 : j=1: k=1: loop=1
wcolor 0,0,0
while loop < 1200
  r = r + pi/180
  w = w + pi/72
   i=1 : j=1: k=1
  while i < 12
    x=xc+200*cos(w+i*pi/6)*sin(r)
    y=yc+200*sin(w+i*pi/6)*sin(r)
    fcolor 120,150,100 : circle x,y,40
    ww = ww + pi/80
     while j < 12
      xx=x+100*cos(ww + j*pi/6)*sin(r)
      yy=y+100*sin(ww + j*pi/6)*sin(r)
      fcolor 150,100,100 : circle xx,yy,20
      w3 = w3 + pi/80
       while k < 12
        x3=xx+50*cos(w3 + k*pi/6)*sin(r)
        y3=yy+50*sin(w3 + k*pi/6)*sin(r)
        fcolor 100,120,150 : circle x3,y3,10
        k = k + 1
      wend
    j = j + 1
    wend
    i = i + 1
  wend
'wcolor 0,0,0
'swap
  loop = loop + 1
wend

Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: micro(A) Interpreter
« Reply #54 on: July 17, 2020, 04:26:00 PM »
here is mandelbrot fractal in micro(A):
Code: [Select]
'mandelbrot_test - micro(A)
varnum px, py, i, sx, sy, xx, xy,cb
varnum vy, pyy , w , h , hh , x, y , max     
max=12 : w = 480 : h = 340 : hh = h/2
py=0 : px=0 : wcolor 0,0,0 : fcolor 200,150,100
while py < h
px=0
  while px < w
      sy = (py-170)/150
      sx = (px-340)/150
     
i = 0 : x = 0.1 : y =0.1
xy = x*x + y*y
while i < max & xy < 4.0     
        xx = x*x - y*y + sx
        y = 2 * x * y + sy
        x = xx : cb = 1+y
       fcolor x,y,cb
       pset px,py 
 i=i+1
wend     
    px = px + 2
  wend
print 500,60,py
py = py + 2
wend

Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: micro(A) Interpreter
« Reply #55 on: July 17, 2020, 08:29:48 PM »
effect example from specbas
Code: [Select]
'specBas effect in micro(A)-by Aurel
varnum a,b,x,y,u,v,t,w,n,r,px,py
varnum rr,gg,bb,i,j, cx,cy,cr
wcolor 0,0,0 
w=540 : n=200 : r = 6.28/254
t=0
while t < 100

wcolor 0,0,0
i=0
while i < n
j=0
       while j < n
u = sin(i+y) + sin(r*i+x)
v = cos(i+y) + cos(r*i+x)
x = u + t
y = v
rr= rand(254)
gg= rand(254)
bb= rand(254)
            px=u*n/2+w/2 : py=y*n/2+w/2
            fcolor rr,gg,bb
pset px,py 
         'circle px,py,5
      j=j+1
wend
i=i+1
swap
wend
t=t+10 : print 10,10,t
'wcolor 0,0,0
wend

Offline round157

  • Sr. Member
  • ****
  • Posts: 388
Re: o2Basic - micro(A) Interpreter
« Reply #56 on: July 24, 2020, 10:07:50 AM »
First binary release of micro(A) Interpreter.
have fun!

I tried the file microedit.exe today. Each .BAS file was not run properly and a grey window was displayed each time. (on Win XP and Win 7 computers.)

8 persons downloaded microA.zip before I downloaded microA.zip. Only I report. ???

Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: micro(A) Interpreter
« Reply #57 on: July 24, 2020, 07:54:23 PM »
Hello round157
I don't know how you get that it work on my win7 machine and probably should work on XP too.
In attachment is latest version with while/wend with logic operator with symbol "&" as and and with
symbol "|" as or.
In fact it is easy ..look on given image ,
your unpacked folder should look like this one ...
so run microEdit.exe , when is up click first toolbar button to open one of examples as i do.
then click Run...button with gear-image..and that is .

Offline round157

  • Sr. Member
  • ****
  • Posts: 388
Re: micro(A) Interpreter
« Reply #58 on: July 26, 2020, 09:31:59 AM »
Hello

This version is better than the previous version. Window showed result for each running. However, three dialog boxes appeared before window showed result.

Is this normal or not?

Offline Aurel

  • Full Member
  • ***
  • Posts: 190
    • AurelSoft
Re: micro(A) Interpreter
« Reply #59 on: July 26, 2020, 10:30:28 PM »
Yes it is normal because it is still in experimental stage ..
For example try use undefined variable and you will see...
of course i can remove it .
In fact this info should be part of let say simple debugger or something.
I am glad that work  :)

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal