nxtBasic language and compiler topic

All aspects of programming on the Commander X16.
Post Reply
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

nxtBasic language and compiler topic

Post by unartic »

nxtBasic 1.0 is now released and ready to download.

What is nxtBasic?
With nxtBasic, you can write familiar BASIC code and compile it into lightning-fast machine code, allowing you to create more sophisticated programs and compelling games. nxtBasic offers an extensive and ever-growing library of commands and built-in functions, empowering you to push the boundaries of your coding projects.

Whats new?

- Bug fixes
  • LCASE/UCASE now also change the case of extended chars in an ISO charset
  • Automatic run command wasn't working correctly without the -startin x16emu param.
- New:
  • OVAL-function to draw circles and ovals.
- Improved:
  • All sprite function have a performance improvement of up to 10%
  • 9% performance increase in handling integer arrays with one dimension
  • 23% performance increase with FOR-NEXT loops
  • 20% performance increase in retrieving an integer variable
  • Example charsets.bas is now showing ISO charsets correctly and Katakana charset is added
Docs and download:
https://github.com/unartic/nxtBasic/ or https://nxtbasic.com/
Last edited by unartic on Sun Sep 29, 2024 8:16 am, edited 3 times in total.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: nxtBasic 0.6b has just been released

Post by funkheld »

hello...great...

If you keep going like this, you'll soon reach ASM speed..... :D

thanks.
greetings
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic 1.0 has just been released

Post by unartic »

nxtBasic 1.0 has just been released.

Whats new?

- Bug fixes
  • LCASE/UCASE now also change the case of extended chars in an ISO charset
  • Automatic run command wasn't working correctly without the -startin x16emu param.
- New:
  • OVAL-function to draw circles and ovals.
- Improved:
  • All sprite function have a performance improvement of up to 10%
  • 9% performance increase in handling integer arrays with one dimension
  • 23% performance increase with FOR-NEXT loops
  • 20% performance increase in retrieving an integer variable
  • Example charsets.bas is now showing ISO charsets correctly and Katakana charset is added
Docs and download: https://github.com/unartic/nxtBasic
Martin Schmalenbach
Posts: 140
Joined: Tue Jul 21, 2020 10:08 pm

Re: nxtBasic language and compiler topic

Post by Martin Schmalenbach »

Fantastic!

I'm very excited by this project.

My first project with it is to convert (and refactor!) my Tiny Pascal pCode interpreter with it, so that it runs as a native machine code program on the CX16.

I imagine some time is needed for the documentation to catchup to the latest version?
Is there anything I can do to help with that, as I work on my conversion project?

One question - are multiple statements per line supported, such as

Code: Select all

A=1: B=2: C=3: GOSUB SomeLabel: Z=Q: PRINT "WOW!"
And is this also supported:

Code: Select all

IF SomeExpression = True THEN PRINT "YAY!!"
Or does it have to be altered to this...?

Code: Select all

IF SomeExpression = True THEN
  PRINT "YAY!!"
END IF
Cheers

Martin
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic language and compiler topic

Post by unartic »

The documentation is up to date. If you're missing something or something seems wrong, please let me know ;-)

All of the above is supported in nxtBasic. So these will all work:

A=1: B=2: C=3: GOSUB SomeLabel: Z=Q: PRINT "WOW!"

IF SomeExpression = True THEN PRINT "YAY!!"

IF SomeExpression = True THEN PRINT "YAY!!" END IF
Martin Schmalenbach
Posts: 140
Joined: Tue Jul 21, 2020 10:08 pm

Re: nxtBasic language and compiler topic

Post by Martin Schmalenbach »

Great stuff - much appreciated.

I'm half way through editing my source code to have 1 statement per line and the multi-line IF-THEN-END IF structure everywhere, so I'll continue.

I think it will make for more readable and maintainable code as I plan to add multi data type support to the pCode instruction set and interpreter, as well as multidimensional arrays, RECORDS, SETS, ENUM types and so on... at the moment there are only signed 16 bit integers and single dimension arrays, no string support, no floats...

Thanks again for such rapid response. :D
Martin Schmalenbach
Posts: 140
Joined: Tue Jul 21, 2020 10:08 pm

Re: nxtBasic language and compiler topic

Post by Martin Schmalenbach »

I may have missed it, but some basic conditional compilation features would be handy, with access perhaps to the command line so that

Code: Select all

nxtBasic yourprogram.bas -debug true
can be accessed via something like

Code: Select all

#IF CLI_DEBUG
... conditional source code
#ELSE
... some other conditional source code
#ENDIF
and also providing

Code: Select all

#IFNDEF FLAG
#DEF FLAG
#ENDIF
and so on.
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic language and compiler topic

Post by unartic »

Thanks for your suggestion. I've put it on the list :-)
Post Reply