zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Discuss ZX Spectrum Next Games, Tools and more.
User avatar
dbolli
Posts: 6
Joined: Wed Feb 05, 2020 11:48 am

zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Postby dbolli » Tue Apr 21, 2020 7:56 am

zmakebas converts Sinclair BASIC text .bas files to ZX Spectrum .tap files and ZX81 .p files

zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords including %$nnnn hex and %@bbbb binary notation

Please see https://derekbolli.wordpress.com/2012/1 ... -zmakebas/ for more information.

Regards,
Derek.
mac geek

chris
Posts: 93
Joined: Tue May 30, 2017 9:28 am
Contact:

Re: zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Postby chris » Tue Apr 21, 2020 4:05 pm

Thanks for this. I've used zmakebas for years, so nice to see the update.

I've just updated it myself with a -3 option which generates a +3DOS header. This means you can copy the output onto the Next's SD card and run it directly. If you want to merge the changes back in, the code is here: https://github.com/chris-y/zmakebas (I've bumped ver to 1.6 to differentiate it)

However, I have noticed a bug in the BASIC file generation when dot commands are in the source. What happens is all the spaces are removed which results in the Next not having a clue what you're trying to do if the command has some parameters. I can't figure out how to fix this, I think it possibly needs to use the same path as REM and leave the sequence alone if it starts with a dot.

eg, this silly example:

Code: Select all

10 LET F$="C:/NextZXOS"
20 .$ LS F$
30 PAUSE 0
40 .LS "C:/dot"
results in this on the Next:

Code: Select all

10 LET F$="C:/NextZXOS"
20 .$LSF$
30 PAUSE 0
40 .LS"C:/dot"
Line 40 works because the double-quotes are enough for the Next to understand what it is supposed to do. Line 20 has no chance!

Any ideas?

User avatar
SevenFFF
Posts: 565
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Postby SevenFFF » Tue Apr 21, 2020 7:03 pm

Cheers Derek!

REM statements extend until the end of the line, whereas dot command statements can be terminated by colon (unless the colon is inside double quotes) and followed by another statement, but in general that should work Chris.

I'm afraid NextBASIC programs are going to have rather a lot of dot commands in them, as there's an active community writing helpers for things that aren't easy to achieve in BASIC :D

Dot commands are responsible for parsing their own args rather than have the OS pass them an array of strings and a count, so there's all manner of fun getting the parsing working sensibly! But all we're concerned with here is following the same rules the NextBASIC editor does, so it's not so bad.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins

User avatar
dbolli
Posts: 6
Joined: Wed Feb 05, 2020 11:48 am

Re: zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Postby dbolli » Tue Apr 21, 2020 7:29 pm

chris wrote:
Tue Apr 21, 2020 4:05 pm
I've just updated it myself with a -3 option which generates a +3DOS header. This means you can copy the output onto the Next's SD card and run it directly. If you want to merge the changes back in, the code is here: https://github.com/chris-y/zmakebas (I've bumped ver to 1.6 to differentiate it)
Yes I saw that in github and was planning to have a look at it with a view to incorporating it as it would be very useful. Great work.
chris wrote:
Tue Apr 21, 2020 4:05 pm
However, I have noticed a bug in the BASIC file generation when dot commands are in the source. What happens is all the spaces are removed which results in the Next not having a clue what you're trying to do if the command has some parameters.
Yes, this is a longstanding "feature" of zmakebas that it deletes all whitespace between tokens. It does currently have the capacity to suppress this when in REM statements or in quotes so there needs to be an additional similar indotcmd condition added to take account of dot commands. I will have a look.

I have had similar issues with some ZX Spectrum dev programs that extend ZX BASIC and found that inserting \{0x20} works so e.g.

Code: Select all

10 LET F$="C:/NextZXOS"
20 .$\{0x20}LS\{0x20}F$
30 PAUSE 0
40 .LS\{0x20}"C:/dot"
would work as a slightly messy workaround.

Regards,
Derek.
mac geek

chris
Posts: 93
Joined: Tue May 30, 2017 9:28 am
Contact:

Re: zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Postby chris » Wed Apr 22, 2020 9:11 am

dbolli wrote:
Tue Apr 21, 2020 7:29 pm
I have had similar issues with some ZX Spectrum dev programs that extend ZX BASIC and found that inserting \{0x20} works so e.g.

Code: Select all

10 LET F$="C:/NextZXOS"
20 .$\{0x20}LS\{0x20}F$
30 PAUSE 0
40 .LS\{0x20}"C:/dot"
would work as a slightly messy workaround.
Nice workaround, that works fine pending a proper fix.

User avatar
emook
Posts: 95
Joined: Mon May 29, 2017 6:55 pm

Re: zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Postby emook » Thu May 07, 2020 9:29 pm

Great program. Thanks!
---------
ZXorDIE
http://zxbasic.uk/nextbuild/ NextBuild
http://zxbasic.uk ZXBD Snapshot uploader
http://zxbasic.uk/db/0 ZXBasic Online Database

User avatar
programandala.net
Posts: 45
Joined: Thu Nov 02, 2017 11:55 am
Location: Spain
Contact:

Re: zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Postby programandala.net » Fri May 15, 2020 7:37 pm

Thank you for updating this tool!

I have used zmakebas and bas2tap a lot in many projects.

Some time ago I wrote a Sinclair BASIC preprocessor called Vimclair BASIC, in order to implement simulated control structures (converted to `goto` in the target format) and other features to make the cross-development easier. Recently I was about to write a similar but simpler tool for NextBASIC (no need to simulate control structures or procedure calls anymore), but making the final conversion in the Next, using `.txt2bas`. Thanks to the new versions of zmakebas, my project is unnecessary :D

One feature I always missed in zmakebas is splitted code lines. I supported them in all my BASIC preprocessors, because splitted lines allow to represent the logic of the code and make it more legible without creating several code lines, therefore saving memory and speed in the final program. Anyway, this can be achieved with a simple sed or Vim filter before processing the source with zmakebas. But maybe you find this feature interesting for a future version of zmakebas.
Marcos Cruz (programandala.net)

User avatar
dbolli
Posts: 6
Joined: Wed Feb 05, 2020 11:48 am

Re: zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Postby dbolli » Mon Feb 15, 2021 11:40 pm

I've found another issue with using NextBASIC in zmakebas 1.5.2 that I will need to look at

It has to do with numeric literals after % (integer token) where the 5 byte FP $OE data should not be generated.

For now the workaround is to assign numeric literals to % vars and use those. Sorry :(

e.g.

Code: Select all

PRINT % 2 << 2
Will generate a "C Nonsense in BASIC" error as it fails because of the presence of 5 byte FP $OE data after the numeric literals (the 2s in this case)

Code: Select all

LOCAL %a,%b
LET %a = 2: LET %b = 2: PRINT % a << b
Will work. Using LOCAL is optional (e.g. if % vars have not been used elsewhere) but is handy in a PROC for example

I found a more complicated example in the spriteFeatures.bas demo in the Next 1.3.2 Distro

Code: Select all

250 IF % SGN {((x(c)+m)<0) OR ((x(c)+m)>304)} THEN ENDPROC
The SGN { } is used for signed integers i.e. -32768 to 32767 (see manual p74).
But the workaround is similar.

Code: Select all

245 LOCAL %l, %h
#250 IF % SGN {((x(c)+m)<0) OR ((x(c)+m)>304)} THEN ENDPROC 
250 LET %l = 0: LET %h = 304: IF % SGN {((x(c)+m)<l) OR ((x(c)+m)>h)} THEN ENDPROC
Hope this helps and I will let you know when a fix is available.

Regards,
Derek.
mac geek

chris
Posts: 93
Joined: Tue May 30, 2017 9:28 am
Contact:

Re: zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Postby chris » Fri Feb 19, 2021 10:24 am

dbolli wrote:
Mon Feb 15, 2021 11:40 pm
I've found another issue with using NextBASIC in zmakebas 1.5.2 that I will need to look at

It has to do with numeric literals after % (integer token) where the 5 byte FP $OE data should not be generated.

For now the workaround is to assign numeric literals to % vars and use those. Sorry :(
As a point of interest, I notice my update of zmakebas has been forked here: https://github.com/flatduckrecords/zmakebas
They've added Spectranet commands (or fixed them), so you might want to merge in their updates (and mine) if you're doing a new version.

User avatar
dbolli
Posts: 6
Joined: Wed Feb 05, 2020 11:48 am

Re: zmakebas 1.5.2 now supports ZX Spectrum Next NextBASIC keywords

Postby dbolli » Fri Feb 19, 2021 10:37 am

chris wrote:
Fri Feb 19, 2021 10:24 am
They've added Spectranet commands (or fixed them), so you might want to merge in their updates (and mine) if you're doing a new version.
Noted. Thanks :)

Regards,
Derek.
mac geek


Who is online

Users browsing this forum: No registered users and 3 guests