Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
Sinclair Basic is 100% compatible with ZX Boriel BASIC compiler? I mean can Boriel compiler be used as a replacement for zmakebas or bas2tap?
If I send any working Sinclair Basic program to ZX Boriel compiler will it work ?
I remember I read somewhere that it wasn't 100% compatible.
If I send any working Sinclair Basic program to ZX Boriel compiler will it work ?
I remember I read somewhere that it wasn't 100% compatible.
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
@firelord,
Whilst not perfect, the Wiki is very good and highlights where there are differences to Sinclair BASIC.
https://zxbasic.readthedocs.io/en/docs/syntax/
Whilst not perfect, the Wiki is very good and highlights where there are differences to Sinclair BASIC.
https://zxbasic.readthedocs.io/en/docs/syntax/
- 1024MAK
- Bugaboo
- Posts: 3130
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
No compiler can ever be 100% compatible with an interpreted language. With an interpreted language like ZX Spectrum BASIC, the interpreter has information available at run time (when the instructions are processed) that is not available at compile time (when a compiler processes the instructions and converts to machine language/code).
Mark
PS although the term “SInclair BASIC” is spoken about, it’s not really a thing. Sinclair did not write it, and the BASIC on the ZX80, ZX81 and QL are all different to that on the ZX Spectrum. Yes, there are some parts that are similar or the same, but then that applies to most BASICs.
Mark
PS although the term “SInclair BASIC” is spoken about, it’s not really a thing. Sinclair did not write it, and the BASIC on the ZX80, ZX81 and QL are all different to that on the ZX Spectrum. Yes, there are some parts that are similar or the same, but then that applies to most BASICs.
Last edited by 1024MAK on Wed Dec 06, 2023 9:06 am, edited 1 time in total.
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
In short: no. Boriel BASIC syntax is more like QBASIC.
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
The QL's SuperBASIC is highly different, but the ZX80, ZX81 and etc. are almost the same, I think. Here is a short description of all the ZX's BASICs: https://en.wikipedia.org/wiki/Sinclair_BASIC
- 1024MAK
- Bugaboo
- Posts: 3130
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
Almost the same, no. With similarities, yes. But like I said, also with similarities to say the various Microsoft 8 bit BASICs that were available at the time. And yes, I’m aware of that Wikipedia article (complete with numerous errors).+3code wrote: ↑Wed Dec 06, 2023 9:32 am The QL's SuperBASIC is highly different, but the ZX80, ZX81 and etc. are almost the same, I think. Here is a short description of all the ZX's BASICs: https://en.wikipedia.org/wiki/Sinclair_BASIC
ZX80 BASIC is only 4K bytes in size, it doesn’t have floating point numbers and has lots of limitations. This BASIC uses it’s own unique character set.
ZX81 BASIC is an evolution of ZX80 BASIC, but with a lot of rewriting of the code. It’s 8K bytes in size, so double in size compared to ZX80 BASIC. Not all the commands and functions are the same. The syntax may be different for example. The number of functions were expanded and there was changes to string handling. This BASIC uses it’s own unique character set.
ZX Spectrum (16K/48K/+) BASIC is 16K bytes is size, so double that of a ZX81. Again, it’s an evolution of ZX81 BASIC with almost all the ZX81 code having been altered or rewritten. Again, many of the commands and functions may have different syntax. Plus there are many more commands and functions that did not previously exist. This BASIC uses the ASCII character set and has character control codes.
With all these versions, when just using a standard machine with no extra software, you can’t LOAD BASIC programs written and SAVEd from a different machine, as the tape format is different for each of them.
Mark
Last edited by 1024MAK on Wed Dec 06, 2023 10:28 am, edited 1 time in total.
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
I mean can Boriel compiler be used as a replacement for zmakebas or bas2tap? I want the exact functionaluty of zmakebas. textfile input (with basic commands), TZX/TAP output1024MAK wrote: ↑Wed Dec 06, 2023 9:01 am No compiler can ever be 100% compatible with an interpreted language. With an interpreted language like ZX Spectrum BASIC, the interpreter has information available at run time (when the instructions are processed) that is not available at compile time (when a compiler processes the instructions and converts to machine language/code).
I use the term Sinclair Basic because I mean the Basic that supports color commands like PAPER,FLASH and BRIGHT. Also, ZX Basic and spectrum Basic returned results for Boriel ZX Basic. I haven't found any other term that can separate ZX Spectrum Sinclair basic from other Basic's.1024MAK wrote: ↑Wed Dec 06, 2023 9:01 am PS although the term “SInclair BASIC” is spoken about, it’s not really a thing. Sinclair did not write it, and the BASIC on the ZX80, ZX81 and QL are all different to that on the ZX Spectrum. Yes, there are some parts that are similar or the same, but then that applies to most BASICs.
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
It's worth noting that a compiler is never going to be able to deal with things like calculated line numbers.
This is a favourite of mine for level data.
This is a favourite of mine for level data.
Code: Select all
10 LET Level=1
20 GOSUB 2000:REM draw the level
30 ...
2000 RESTORE (8000+Level*100)
2010 FOR A=1 TO 4
2020 READ A$:PRINT A$
2030 NEXT A
2040 RETURN
8100 REM level 1
8101 DATA "this","is","level","one"
8200 REM level 2
8201 DATA "level","two","is","this"
CLEAR 23855
- 1024MAK
- Bugaboo
- Posts: 3130
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
But there are no colour or attribute commands (such as INK, PAPER, FLASH and BRIGHT) in ZX80 or ZX81 BASIC.
The term “Sinclair BASIC” or “ZX BASIC” is hence vague. Because the ZX Spectrum was the better known machine in most countries, often when people use “Sinclair BASIC” what they actually mean is “ZX Spectrum BASIC”.
Mark
The term “Sinclair BASIC” or “ZX BASIC” is hence vague. Because the ZX Spectrum was the better known machine in most countries, often when people use “Sinclair BASIC” what they actually mean is “ZX Spectrum BASIC”.
Mark
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
I see your point(s).
Thanks all for the information.
The correct term for my searches would be "Basic that ZX Spectrum + 48k uses".
You can try googleing it .
I know that Boriel is not compatible with "Sinclair Basic". For some reason I saw some posts these days that made me think that It had backward compatibility.
Thanks all for the information.
The correct term for my searches would be "Basic that ZX Spectrum + 48k uses".
You can try googleing it .
I know that Boriel is not compatible with "Sinclair Basic". For some reason I saw some posts these days that made me think that It had backward compatibility.
Spoiler
I'm using zmakebas to convert text files that contain Basic code to TAP files that contain the Basic of the text file. I do that server-side on a php script.
The most appealing commands of "Sinclair ZX Spectrum 48k Basic " for kids are PAPER,INK,FLASH and similar "pretty looking" commands. So my searches are always for this particular variation of Basic. If I don't have those then I could use python.
The most appealing commands of "Sinclair ZX Spectrum 48k Basic " for kids are PAPER,INK,FLASH and similar "pretty looking" commands. So my searches are always for this particular variation of Basic. If I don't have those then I could use python.
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
Hisoft BASIC Compiler seems to handle some calculated jumps. Maybe others compilers too, no idea. Reading the manual:
REM: GOTO
REM: GOSUB
These two directives are completely equivalent. If you use either of them, then GOTO and GOSUB
expression (e.g. GOTO 100 *N) will be supported and the compiled code will include a list of line numbers and the corresponding addresses in the compiled code. There are two forms: If the GOTO or GOSUB is followed by: (e.g. REM: GOTO:) then all of the program's line numbers within the region being compiled will be included in the list. If the GOTO or GOSUB is followed by a sequence of line numbers (e.g. REM: GOTO 100,200,300) then only those line numbers will be included in the list. In either case, if a line number not in the list is needed, the compiled code will generate a run time error Statement lost.
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
Yes it can be done and basically you could end with something that is in between straight to assembly compilation and transpilation to a bytecode that could cover all constructs available in Basic, including expressions in DATA statements and computed GOTO, RESTORE. But it is harder to do.
Proud owner of Didaktik M
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
In some cases, you can compile a program with only few changes, like https://zxbasic.readthedocs.io/en/docs/ ... narow.bas/
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
Doesn't look like Spectrum Basic, there is END IF.+3code wrote: ↑Wed Dec 06, 2023 4:38 pm In some cases, you can compile a program with only few changes, like https://zxbasic.readthedocs.io/en/docs/ ... narow.bas/
Proud owner of Didaktik M
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
Yes, and FLOAT (and one CONTINUE FOR, I see), these are the "few changes" I said.
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
It is sort of possible to do this with zmakebas, though not quite as cleanly (so it won't be as fast):uglifruit wrote: ↑Wed Dec 06, 2023 10:32 am It's worth noting that a compiler is never going to be able to deal with things like calculated line numbers.
This is a favourite of mine for level data.
Code: Select all
10 LET Level=1 20 GOSUB 2000:REM draw the level 30 ... 2000 RESTORE (8000+Level*100) 2010 FOR A=1 TO 4 2020 READ A$:PRINT A$ 2030 NEXT A 2040 RETURN 8100 REM level 1 8101 DATA "this","is","level","one" 8200 REM level 2 8201 DATA "level","two","is","this"
https://github.com/ohnosec/zmakebas/issues/4
Re: Is Sinclair Basic 100% compatible with ZX Boriel BASIC compiler?
No. You can't compile any basic code with zx basic. But I think the website has a guide for the key changes you need to make.firelord wrote: ↑Wed Dec 06, 2023 8:23 am Sinclair Basic is 100% compatible with ZX Boriel BASIC compiler? I mean can Boriel compiler be used as a replacement for zmakebas or bas2tap?
If I send any working Sinclair Basic program to ZX Boriel compiler will it work ?
I remember I read somewhere that it wasn't 100% compatible.
Once you get going zx basic is easier than Sinclair basic imho