Author Topic: MY-BASIC  (Read 118107 times)

wangrenxin

  • Guest
Re: MY-BASIC
« Reply #75 on: April 26, 2015, 07:52:29 PM »
Sounds great. I'll add a wiki page on linking with MY-BASIC as a lib later.

It seems guys at BP have made a lot of dedication with MB these days.

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #76 on: April 26, 2015, 07:56:49 PM »
Markus is a smart guy and great programmer. I'm sure he will make you proud with his accomplishments.

wangrenxin

  • Guest
Re: MY-BASIC
« Reply #77 on: April 27, 2015, 12:11:59 AM »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #78 on: April 30, 2015, 03:08:27 PM »
Here is an MY-BASIC / AllegroBASIC example from Markus (Cybermonkey) on the BP.org forum.



Code: Text
  1. screen (800,600,"CircleTrap")
  2. KEY_ESC          = 59  
  3.  
  4. h = screenheight/2
  5. w = screenwidth/2
  6. paper (0,0,0)
  7. do
  8. cls
  9. t = tickcount/1000
  10. for i=1 to 360
  11.     ink (255-i,255,255)
  12.     circle (w+sin(i*90+t)*200,h+cos(i*90+t)*200,20+i)
  13. next
  14. sync
  15. sleep (12)
  16. until keystate (KEY_ESC) = true
  17. end
  18.  

Offline Cybermonkey342

  • BASIC Developer
  • Posts: 34
Re: MY-BASIC
« Reply #79 on: May 01, 2015, 10:30:09 AM »
Hi, I just registered ar Allbasic.info.
I think I can offer you a download of AllegroBASIC soon ... just have a little patience.
I just implemented loading and displaying bitmaps and sprites. (In Allegro4 a sprite is also a bitmap but the colour 255,0,255 isn't drawn).

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #80 on: May 01, 2015, 10:36:24 AM »
Welcome Markus!

I'm glad you decided to join the rest of the BASIC developer that hang out here. I added you to the BASIC Developer's group so we are now a band of 13.

Looking forward to seeing the extension code you added to MY-BASIC. I'm hoping to pickup some tips for the SB SDL_gfx extension module.

John
« Last Edit: May 01, 2015, 03:08:31 PM by John »

wangrenxin

  • Guest
Re: MY-BASIC
« Reply #81 on: May 04, 2015, 01:40:08 AM »
Welcome Markus!

Nice to hear that!

WRX.

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #82 on: May 17, 2015, 01:58:09 PM »
Markus,

How are things going with AllegroBASIC? How about some news?  :)

wangrenxin

  • Guest
Re: MY-BASIC
« Reply #83 on: September 17, 2015, 12:46:52 AM »
After several spare weekends passed, I'd be happy to tell you that MY-BASIC supports user defined sub routine now. A more elegant hello-world in MB is something like this:

Code: PHP
  1. def foo(a, b)
  2.     print a + " " + b;
  3. enddef
  4.  
  5. foo("Hello", "world!")
  6.  

Definitely you can return value in a sub routine as:
Code: PHP
  1. def bar(a, b)
  2.     return a + b
  3. enddef
  4.  
  5. c = bar(1, 2)
  6. print c
  7.  
« Last Edit: September 17, 2015, 12:48:59 AM by wangrenxin »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #84 on: September 17, 2015, 09:48:08 AM »
Great news!

I would call them SUBs / FUNCTIONs rather than subroutines which in BASIC refers to a GOSUB routines.

Offline Cybermonkey342

  • BASIC Developer
  • Posts: 34
Re: MY-BASIC
« Reply #85 on: September 17, 2015, 11:24:34 AM »
Wow, that's great. i just made a new compile of AllegroBASIC and that works fine. I had not much time to code on that project since I am at the moment finalizing Pulsar2D. After that I might start over with AllegroBASIC again.

Oh, I found one issue: you can't assign real numbers to variables anymore. Is that intended? The following code fails e.g.:
Code: [Select]
pi = 3.141
The error tells something about an invalid character ...

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #86 on: September 17, 2015, 06:35:33 PM »
I'm glad you haven't given up on AllegroBASIC. I plan to update the Script BASIC extension module of My-BASIC when you guys feel it's stable.


wangrenxin

  • Guest
Re: MY-BASIC
« Reply #87 on: September 17, 2015, 07:22:08 PM »
Oh, I found one issue: you can't assign real numbers to variables anymore.
Quite a bug... Fixed in latest revision. Thanks for telling me.

I'm glad you haven't given up on AllegroBASIC. I plan to update the Script BASIC extension module of My-BASIC when you guys feel it's stable.
I believe it needs some time to test it and make this new feature robust. I plan to implement an OOP paradigm also, but won't start until exist mechanism stable, considering it takes about two years to decide to make sub routine (or function) from an idea... Keep going guys.

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #88 on: September 17, 2015, 09:53:43 PM »
Thanks for the fix Tony and I'll generate a new set of share objects (SB ext. mod) of My-BASIC for folks to try.


Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #89 on: September 18, 2015, 12:14:25 AM »
Tony,

Your latest code seems to work for me. (Ubuntu 64 bit)

Code: ScriptBasic
  1. DECLARE SUB mb_init ALIAS "mbas_init" LIB "mb"
  2. DECLARE SUB mb_dispose ALIAS "mbas_dispose" LIB "mb"
  3. DECLARE SUB mb_open ALIAS "mbas_open" LIB "mb"
  4. DECLARE SUB mb_close ALIAS "mbas_close" LIB "mb"
  5. DECLARE SUB mb_load_str ALIAS "mbas_load_str" LIB "mb"
  6. DECLARE SUB mb_run ALIAS "mbas_run" LIB "mb"
  7.  
  8. mb_code = """
  9. def bar(a, b)
  10.    return a + b
  11. enddef
  12.  
  13. c = bar(1, 2.5)
  14. print c,"\n"
  15. """
  16. mb_init()
  17. mb_open()
  18. mb_load_str(mb_code)
  19. mb_run()
  20. mb_close()
  21. mb_dispose()
  22.  


jrs@laptop:~/sb/sb22/mybasic$ scriba testmb.sb
3.5
jrs@laptop:~/sb/sb22/mybasic$


Does your new subs & functions support recursive use?
« Last Edit: September 18, 2015, 12:19:05 AM by John »