FAQ  •  Register  •  Login

zxbasic for dos?

<<

slenkar

Posts: 282

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Wed May 29, 2013 6:00 pm

zxbasic for dos?

Would it be easier to create a script to translate zxbasic to C, or to write a compiler target for x86 asm?
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Wed May 29, 2013 7:16 pm

Re: zxbasic for dos?

I'm currently working on all of this.
"Theoretically" ZX BASIC is ready for that. But in practice it needs a lot of refactoring.
Please, be patient.
It's not about "translate to C", but to any target, and make it really extensible.

There are other concerns when porting to other architectures. Eg. I/O, graphics, etc.
You probably will drop most of screen comands. ATTR will be nonsense. POINT could be changed, etc. etc.
<<

slenkar

Posts: 282

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Wed May 29, 2013 7:41 pm

Re: zxbasic for dos?

When the refactored version is ready the gamesprogrammer can do IFDEF for different platforms?
So graphic commands can be changed per platform.
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Wed May 29, 2013 8:10 pm

Re: zxbasic for dos?

slenkar wrote:When the refactored version is ready the gamesprogrammer can do IFDEF for different platforms?
So graphic commands can be changed per platform.

Yes.
At the moment the compiler is *broken* :oops: I'm just trying to refact, while recover the previous state. :roll: (that is, ZXBASIC 2.x, apparently doing exactly what it already does by now).
<<

Felix

Posts: 10

Joined: Fri Jun 28, 2013 8:22 am

Location: Bucharest, Romania

Post Thu Jul 11, 2013 8:56 am

Re: zxbasic for dos?

This may come as an odd thing to suggest, but there already is an excellent Basic compiler for DOS, namely FreeBasic. It has a disadvantage, however, namely that it requires HDPMI, which is tricky to come by nowadays, and so do the executables it generates. If ZXBasic for DOS was completely stand-alone, that would make it more appealing to e.g. people who use DOSbox, even though it would limit the amount of available memory. Or precisely because of that?
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Thu Jul 11, 2013 9:15 am

Re: zxbasic for dos?

ZX Basic tries to follow FreeBASIC syntax, but at the same time tries to keep some backward compatibility with Sinclair BASIC.
You are right with DOSBox, hdpmi and the like. One solution could be to make ZXBASIC a translator (not exactly a compiler), and use DJGPP (C) as a backend, so it translates from BASIC to C which will be later compiled with djgpp :)
But until vacation, I'm afraid I could not make much improvements...
<<

britlion

Posts: 766

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Thu Jul 18, 2013 6:36 pm

Re: zxbasic for dos?

I wonder about a setup where it introduces a screen simulation, so you can stay in spectrum mode, but send a windows exe.

Or change up to a more native resolution on command. Hmm.
<<

Felix

Posts: 10

Joined: Fri Jun 28, 2013 8:22 am

Location: Bucharest, Romania

Post Fri Jul 19, 2013 3:20 pm

Re: zxbasic for dos?

That makes a lot of sense, britlion. A 320x200 VGA screen is just enough to fit a Spectrum's 256x192 pixels plus a bit of a border. That could allow Spectrum games to be rebuilt for DOS without any changes -- potentially a killer feature for ZXBasic, as people have worked hard to make such ports (I seem to remember that the Warajevo emulator could package a copy of itself along with a game snapshot in a single .exe). And then you could provide extensions for e.g. changing the color palette, accessing the filesystem...
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Fri Jul 19, 2013 10:39 pm

Re: zxbasic for dos?

Ha! Nice ideas!
I wish you were here having beers with me at the TLP event! :mrgreen:
It's been very inspirational.
Back to the topic: I've already though about these. In fact, C is much portable because all IO functions are done through user defined functions (e.g. no PRINT, but printf()) and the like.
So the programmer can always define a library to implement input / output (screen, keyboard, etc).
The idea on screen modes is also very interesting! :)
<<

nitrofurano

Posts: 349

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Tue Jul 23, 2013 1:58 pm

Re: zxbasic for dos?

boriel wrote:ZX Basic tries to follow FreeBASIC syntax, but at the same time tries to keep some backward compatibility with Sinclair BASIC.
You are right with DOSBox, hdpmi and the like. One solution could be to make ZXBASIC a translator (not exactly a compiler), and use DJGPP (C) as a backend, so it translates from BASIC to C which will be later compiled with djgpp :)
But until vacation, I'm afraid I could not make much improvements...

FreeBasic is very good (i loved coding http://www.dosgames.com/forum/about18131.html there, for example), but it's not that excellent yet: i think that is quite painful to compile some stuff there that would run decently on CGA display boards on IBM-PCXT machines (CGA modes seems to be simulated from VGA modes... :S ), unless some wise 8088/8086-assembly trick is used (that i didn't find yet...) - maybe Boriel's ZX-Basic Compiler can set goals where FreeBasic fails! ;)
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Fri Jan 31, 2014 10:12 am

Re: zxbasic for dos?

As posted in the announcement, It's time to add the compiler features we all were expecting.
ZX Basic 1.4 is out, and now it can be converted to a more generic compiler.
I't also opened the Issue Tracker to add proposals (wish list) and bugs. At the moment is open to the public (an experiment).

Return to Wishlist

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO