Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
first attempt on trying to make an msx1 .rom from zxbasic
#1
hi again!

Finally, i tried my first attempt, unsuccessfully, on trying to create a .rom msx file with Boriel's zxbasic compiler, based on what i started at <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:MSX">http://www.boriel.com/wiki/en/index.php/ZX_BASIC:MSX</a><!-- m --> . The idea for this test is only trying a simple thing like having a grey background and a red border, and clean the screen, nothing more, only for testing.

This can be frustrating at first, but maybe approaches like this can help on extending the target hardware, and how can help it being more flexible, as Boriel also wanted.

i tried with this:

code.bas
Code:
# include "lib/msx_color.bas"
# include "lib/msx1_cls.bas"
msxcolor(3,14,8)
msx1cls()
lp1:
  goto lp1

lib/msx_color.bas
Code:
sub msxcolor(vink,vpaper,vborder as ubyte)
  poke 0F3E9h,vink      :rem- forclr
  poke 0F3EAh,vpaper    :rem- bakclr
  poke 0F3EBh,vborder   :rem- borclr
  end sub

lib/msx1_cls.bas
Code:
sub msx1cls():
  asm
    call 00c3h   ;-cls
    end asm
  end sub

compileandcreaterom.sh (a bash script for creating the .rom file - sorry, i'm linux-only...)
Code:
#!/bin/bash
#- compiles a Boriel's zxbasic code to a 8kb msx .rom file
zxb.py code.bas
echo -e '\x41\x42\x04\x80\c' > _tmp.bin
cat code.bin >> _tmp.bin
echo -e 'somedescriptionoftheromfilehere' >> _tmp.bin
for i in {1..8192}; do echo -e '\x00\c' >> _tmp.bin; done
split -b 8k _tmp.bin
mv xaa code.rom
rm xab xac code.bin _tmp.bin
openmsx code.rom

maybe the .rom doesn't run because zxbasic-compiler puts some zxspectrum-based "garbage", that lacks this .rom can be executed, which i don't know how to optimize or walk around on this?

if someone here also have experience on coding on msx, any help is welcome.

btw, Boriel, how far were successful your attempts on creating amstrad-cpc with a similar method?
Reply
#2
i'm talking about this at <!-- m --><a class="postlink" href="http://karoshi.auic.es/index.php?topic=2290.0">http://karoshi.auic.es/index.php?topic=2290.0</a><!-- m --> and <!-- m --><a class="postlink" href="https://www.facebook.com/mojontwins/posts/412528745440580">https://www.facebook.com/mojontwins/pos ... 8745440580</a><!-- m --> as well
Reply
#3
I found a little Cross compiler for CPC: <!-- m --><a class="postlink" href="http://www.cpcbasic.tk/">http://www.cpcbasic.tk/</a><!-- m -->
It is not that good as ZX Basic, but it may help to understand how to compile to this machine.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#4
Hey, didn't know this one! This would be really helpful.
Also I've finally arrived to a conclusion (while trying to port the compiler to the 2.x branch).
  • It's not easy (or even impossible) to port some Sinclair BASIC instruction to other machines (ej. INK, PAPER, BEEP)
  • Users on other platforms will want ZX Basic to be more closer to their platform original BASIC (e.g. Locomotive BASIC on Amstrad, or MSX BASIC for MSX, etc).
ZX BASIC is modularized (to some extent). It's divided in 4 main layers: The preprocessor, the frontend (BASIC parser), the middle-end, and the backend (ASM). Any of these 4 layers can be changed without affecting the others.

Instead of trying to heavily refactor the frontend (as I'm currently doing), it's better to start a new one (derived from ZX BASIC) which parses a MSX BASIC dialect, another for Locomotive BASIC (Amstrad), etc. These (python) modules could be loaded on the fly, when the user issues something like zxb --arch=msx or the like. Otherwise, it would be more likely ZX Basic will be forked in 3 (or more) separated proyects (ZX, MSX, Amstrad).
Reply
#5
It will be too much work to replicate each machines BASIC??
Wouldnt sticking with the language as it is now save a lot of time?
Reply
#6
slenkar Wrote:It will be too much work to replicate each machines BASIC??
Wouldnt sticking with the language as it is now save a lot of time?
Yes, and yes. But users of other platforms will demand it to be as closest as possible to their platform originals (In fact some people demanded ZX BASIC to be much closer to Sinclair BASIC). My idea is to clone the actual BASIC parser module, and remove INK, PAPER, BEEP, etc.... An add LOCATE, and some others. It shouldn't be a hard task, and also hope other people to finally help in the compiler development.
Reply
#7
My 5 cent:
You expanded the Sinclair BASIC with many commands and replaced some functions like INPUT with different librarys, END IF (which makes it anyway impossible to compile original programs without changes) and other, and I love the result. I myself would prefer that other architectures will use the same commands IF POSSIBLE (It could optionally use original syntax with LOCATE instead of AT and so). This will make cross development to multiple machines much easier if even possible. If some commands cannot be used on certain plattforms, the compiler could report a "Unsupported command" ("BEEP is not supported for Amstrad CPC"). If some special commands available only on other plattforms are not supported on Spectrum too, nobody will complain. But using String$(x TO y) is much better than using MID$. Using TI99/4A BASIC and some other not standartised languages is something for masochists. This is now a chance to make a standartized BASIC Language. At least, you told us that ZXBC syntax is based mainly on FreeBasic, so why not keeping FreeBasic standards for other plattforms too?
BTW: The compiler could accept both syntaxes: LOCATE and AT.
But it is just my opinion.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#8
Hmm. Thanks, LCD.
Now I'm a bit confused :roll:

E.g. PLOT & DRAW are Sinclair Basic primitives, but MSX has its ones, etc... I could standarize them (e.g. implementing SUBs for plotting & drawing), leave them as they are (they can be implemented in other platforms), or implement MSX PSET and other drawing primitives... :?:
What do you think?
Reply
#9
boriel Wrote:Hmm. Thanks, LCD.
Now I'm a bit confused :roll:

E.g. PLOT & DRAW are Sinclair Basic primitives, but MSX has its ones, etc... I could standarize them (e.g. implementing SUBs for plotting & drawing), leave them as they are (they can be implemented in other platforms), or implement MSX PSET and other drawing primitives... :?:
What do you think?
As for graphics commands, I know there are some differences like the ability to draw elypses. So you could implement this so: CIRCLE x,y,r = Standard circle, CIRCLE x,y,r1,r2 = Elypse. The Compiler would choose the library automaticaly, even if both methods are used.
Ploting:
PLOT x,y = Standard Spectrum way of plotting (y counting upward)
PSET(x,y) or PSET(x,y,color) = Other one with y counting from top downward.
Draw:
DRAW x,y (Standard ROM Spectrum DRAW command), FDRAW x,y (Fast Draw that you use now)
LINE(X,Y), LINE(X1,Y1 TO X2,Y2) other methods used on other machines.
BTW: Some machines like Jupiter Ace or Sprinter 2000 do not have own BASIC. Others like C64 have that crappy BASIC, that everyone is forced to use Assembler, so using same syntax and keywords as in original BASIC is a step back in my opinion.
But in my opinion they are perfect as they are, and could be extended in future to support other Plattforms abilitys:
PLOT x,y,color
DRAW x,y TO x2,x2
CIRCLE x,y,r1,r2
But if you start with standard ZXBC commands for other plattforms (whenever possible), this would be perfect. The language will be extended in the future, so adding more commands later could be the solution for users who miss their belowed commands. You could make a poll asking if the users want this, and also ask in other multiplattform forums like Emuzone.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)