nxtBasic: A New Compiler for Basic Code on the X16

Talk about your programs in progress. Discuss how to implement features, etc.
Forum rules
This section is for testing Commander X16 programs and programs related to the CX16 for other platforms (compilers, data conversion tools, etc.)

Feel free to post works in progress, test builds, prototypes, and tech demos.

Finished works go in the Downloads category. Don't forget to add a hashtag (#) and the version number your program was meant to run on. (ie: #R41).
mgkaiser
Posts: 54
Joined: Sat Dec 02, 2023 6:49 pm

Re: nxtBasic: A New Compiler for Basic Code on the X16

Post by mgkaiser »

What's runtime ERROR2? That one isn't documented.
mgkaiser
Posts: 54
Joined: Sat Dec 02, 2023 6:49 pm

Re: nxtBasic: A New Compiler for Basic Code on the X16

Post by mgkaiser »

In the attached file if the "BVLOAD" statements are present, it fails with runtime ERROR2. If I remove them it works as expected.
Attachments
pacman.bas
(1 KiB) Downloaded 74 times
unartic
Posts: 136
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic: A New Compiler for Basic Code on the X16

Post by unartic »

It is a out of string space error, but given what you're doing that is not the case. Can you include de bin files? Then I'll have a look asap
unartic
Posts: 136
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic: A New Compiler for Basic Code on the X16

Post by unartic »

mgkaiser wrote: Fri Jul 19, 2024 12:52 pm In the attached file if the "BVLOAD" statements are present, it fails with runtime ERROR2. If I remove them it works as expected.
I did a test replacing the sprites with a different sprite. I did not get the error. I was testing with the to-be-released version, so it might be workingn now because of something i've changed. Allthough I can't relate it to what I did change. Or its something with your bin-files. Feel free to send them, then I'll have a look.

Looking at the code there are a few things to consider:
- You are loading the sprites in a memory area which overlaps with the screen 128 bitmap layer (in case you plan to use it)
- You are loading the screen.bin sprite into text mode tilemap area. This might be deliberate, just let you know
- ADDSPRITE expects an existing filename. By supplying an empty tring the BVLOAD (that is called in the background) will fail and will make the led be lit constantly.

I do not know what your endgoal is, but I think its worth considering having nxtBasic handle the memorylocation by using ADDSPRITE to add them all.
mgkaiser
Posts: 54
Joined: Sat Dec 02, 2023 6:49 pm

Re: nxtBasic: A New Compiler for Basic Code on the X16

Post by mgkaiser »

unartic wrote: Fri Jul 19, 2024 5:20 pm
mgkaiser wrote: Fri Jul 19, 2024 12:52 pm In the attached file if the "BVLOAD" statements are present, it fails with runtime ERROR2. If I remove them it works as expected.
I did a test replacing the sprites with a different sprite. I did not get the error. I was testing with the to-be-released version, so it might be workingn now because of something i've changed. Allthough I can't relate it to what I did change. Or its something with your bin-files. Feel free to send them, then I'll have a look.

Looking at the code there are a few things to consider:
- You are loading the sprites in a memory area which overlaps with the screen 128 bitmap layer (in case you plan to use it)
- You are loading the screen.bin sprite into text mode tilemap area. This might be deliberate, just let you know
- ADDSPRITE expects an existing filename. By supplying an empty tring the BVLOAD (that is called in the background) will fail and will make the led be lit constantly.

I do not know what your endgoal is, but I think its worth considering having nxtBasic handle the memorylocation by using ADDSPRITE to add them all.
I moved the sprites to $13000 instead of $11300. That was always my intent and I just made a mistake. I am, in fact, loading "screen.bin" into the text screen tilemap because that is what that file contains and "char.bin" contains a redefined character set so I am loading that at $1f000.

I was purposely using empty string to avoid loading the tile in ADSPRITE, but I also tried to load "newtiles.bin" with the same result. The intent is to cycle through frames of an animation by changing the image the sprite points to.

What is error 2? It's the only one you don't document.
unartic
Posts: 136
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic: A New Compiler for Basic Code on the X16

Post by unartic »

Its out of string space error. There must be something else going on as you are hardley doing any string manipulation. If you can post the other files I'm happy to take a look :-)
unartic
Posts: 136
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic: A New Compiler for Basic Code on the X16

Post by unartic »

nxtBasic 0.3b is now released and ready to download.

Whats new?

Bug fixes:
  • Fixed several double used labels on the assembly side of nxtBasic
  • Fixed incorrect compile time error when using array as function param
  • Fixed bug with INPUT# returning a null-byte when eof was reached
  • Fixed bug with 4bpp color depth in ADDSPRITE method
  • Fixed bug in LEN-function
  • Fixed bug where there are comments on the same line on a CONST definition

Added:
  • Support for MacOS
  • CURSCREENMODE: returns the current screen-mode
  • GETROWS: returns number of text mode rows
  • GETCOLS: returns number of text mode columns
  • OPENFILE: an easier way to open files for reading and writing: handle=OPENFILE("Filename",READ)
  • SETDEVICE {devicenr}: sets the device all file i/o related function should use (only needed if device is not 8)
  • SETCOL: locate for column only
  • SETINDENT: sets a default indentation for the PRINT command
  • CURDIR$ - returns the current directory
  • DIRLIST/DIRITEM: to retrieve directoy listing
  • New example programs:
  • - tetris.bas - a text mode tetris clone
  • - browse-dir.bas - browse through your directory structure using DIRLIST/DIRITEm functions

Improved:
  • Changed the internal True and False statements to True=-1 and False=0, altered the AND OR and NOT operators. They now (also) function as bitwise operators
  • Changed all (but OPEN)-statements to use the SETDEVICE or device 8.
  • PLAYZCM and PLAYZSM do not longer require a filehandle, that'll be automaticly arranged by nxtBasic
  • Changed the Modulus operator from % to MOD, because it was interfering with binary assignment: a=%00110110
Docs and download:
https://github.com/unartic/nxtBasic/
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: nxtBasic: A New Compiler for Basic Code on the X16

Post by funkheld »

hello, good day.
in Germany, at 76, I can only play with the x16 emulator.

the emulator is great...great, thank you.
and this nxtbasic (compiler) is great...great, thank you.

I've just discovered this nxtbasic.
I took a break from the x16 emulator because I'm not really into the speed of this basic.
a new era is beginning now...(kamala harris......) for the x16/emulator.
is this nxtbasic for the x16 always free to use?

thanks.

greeting
unartic
Posts: 136
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtBasic: A New Compiler for Basic Code on the X16

Post by unartic »

funkheld wrote: Wed Jul 24, 2024 2:03 pm hello, good day.
in Germany, at 76, I can only play with the x16 emulator.

the emulator is great...great, thank you.
and this nxtbasic (compiler) is great...great, thank you.

I've just discovered this nxtbasic.
I took a break from the x16 emulator because I'm not really into the speed of this basic.
a new era is beginning now...(kamala harris......) for the x16/emulator.
is this nxtbasic for the x16 always free to use?

thanks.

greeting
Guten tag!

Yes, nxtBasic will be open source when it is 'finished' and will be property of the community. So it will always be free to use.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: nxtBasic: A New Compiler for Basic Code on the X16

Post by funkheld »

thanks for the answer.

thank you for your work on this.

thanks.
greetings
Post Reply