Karoshi MSX Community

Desarrollo MSX => Development (English/Ingles) => Mensaje iniciado por: nitrofurano en 18 de Marzo de 2012, 01:48:12 pm



Título: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 18 de Marzo de 2012, 01:48:12 pm
Maybe some people here knew about Boriel's zxbasic compiler - it's a very efficient cross-compiler coded in Python (converts ansi-basic code similar to zx-spectrum, with possibility of inline-assembly code and includes), and natively supporting zx-spectrum machines.

Since the start of the development of this cross-compiler, targeting other machines else merely zx-spectrum were in mind of Boriel, and for example, he thought on start the amstrad-cpc version of it as well. Following this viewpoint, the possibility of this (awesome, imho) cross-compiler is virtually unlimited, depending on how far people can help on making it targeting different machines. I started this wikipage for helping them: http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Other_architectures

The amazing part of this cross-compiler is it is really efficient and easy to use - for example, i could submit 4 entries to csscgc2011, and one now to the csscgc2012 in a relatively short time, and i really wished to be able to do the same to the msxdev, for example - and as i saw this Boriel's zxbasic compiler is becoming really popular on the zx-spectrum side, no doubt that this can be the same on msx.

I also start to have there some technical documentation could help on the msx part: http://www.boriel.com/wiki/en/index.php/ZX_BASIC:MSX

The cross compiler can be get from here: http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive - if anyone can get interesting results on forking it to target msx, please let us know! :) thanks


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 18 de Marzo de 2012, 05:53:31 pm
i started with this now: http://www.boriel.com/forum/post3122.html#p3122 - any help is very welcome!


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: Mortimer en 18 de Marzo de 2012, 06:08:28 pm
It's a very interesting tool! Could you post the compiler's output before you add the headers for convert it in a .rom file, and the resulting rom?


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 18 de Marzo de 2012, 07:51:59 pm
the terminal doesn't provide any further information when compiling as default (i didn't try any verbose option), but the .asm stage resulted from the compiling (before the binary compiling from this .asm) is at http://pastebin.com/XCvYPC3a - i got this .asm adding a '-A' option at the zxb.py line, from that .sh script - it defaultly sets the org at 0x8000 (maybe in that case i needed to set org ('-S' option)  at 0x8004 because the first 4 bytes of the .rom file? (hex:41 42 04 80) - but i didn't see any jr or jp there, i tried that and didn't work as well ) - i don't know is if Boriel's zxbasic compiler is really putting zxspectrum-based "garbage" there, or if i did something stupidly wrong in the process... :|  - adding also the resulting code.rom from my .sh script, and the code.bin generated from the compiler


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 18 de Marzo de 2012, 08:06:41 pm
(btw, as the previous library snippets i added at http://www.boriel.com/wiki/en/index.php/ZX_BASIC:MSX which i used only two of them there - i tried to improve them a bit, and i were about to test them after this first step were successful - any more improvements and help are very welcome! :) )


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: Boriel en 18 de Marzo de 2012, 08:54:13 pm
That's right, nitro.
The default ORG is 8000h (32768) and there's no JP to that zone.
However, if you're developing a ROM, perhaps you can use ORG 0 ??
If so, try compiling with:
--org=0

 ::) And see if it works?


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 18 de Marzo de 2012, 09:22:01 pm
That's right, nitro.
The default ORG is 8000h (32768) and there's no JP to that zone.
However, if you're developing a ROM, perhaps you can use ORG 0 ??
If so, try compiling with:
--org=0

 ::) And see if it works?


hi Boriel! btw, this is probably the best and most active forum about msx retro development you may find online! be welcome here! i learned a lot here! :)

btw, i tried also with this --org=0 , and nothing

afaik, msx cartridge roms works in a bit different way than usual on other 8bit computers - msx .rom files works starting on 0x8000 or 0x4000 (i think most konami 16k games, like Antarctic Adventure and Road Fighter, starts at 0x4000?) - i think this is because the whole 64kb are sliced into 4 16kb switchable slots and subslots (and not talking yet about paged memory) - 0x0000 is where are all the bios address calls, like those for doing cls, changing screenmodes, poking/peeking video memory (z80 accesses it by i/o only), etc. - 0x0000 is the adress starting in the boot, and checks if there are any rom cartridges connected, and because of this, i think i don't know any msx cartridge that starts at 0x0000 (because bios) or 0xC000 (because system variables starting around 0xF000)



Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: Mortimer en 18 de Marzo de 2012, 10:05:32 pm
This is the official declaration of a cartridge header:

Código:
DEFB "AB" ; expansion ROM header
DEFW initcode ; start of the init code, 0 if no initcode
DEFW callstat; pointer to CALL statement handler, 0 if no such handler
DEFW device; pointer to expansion device handler, 0 if no such handler
DEFW basic ; pointer to the start of a tokenized basicprogram, 0 if no basicprogram
DEFS 6,0 ; room reserved for future extensions

If your header is hex 41 42 04 80, setting the .org code at 0x0804 should works because BIOS transfers control to initcode and ignores other fields. (Although to complain standard de header must be 16 bytes long)


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 18 de Marzo de 2012, 11:46:34 pm
This is the official declaration of a cartridge header:

Código:
DEFB "AB" ; expansion ROM header
DEFW initcode ; start of the init code, 0 if no initcode
DEFW callstat; pointer to CALL statement handler, 0 if no such handler
DEFW device; pointer to expansion device handler, 0 if no such handler
DEFW basic ; pointer to the start of a tokenized basicprogram, 0 if no basicprogram
DEFS 6,0 ; room reserved for future extensions

If your header is hex 41 42 04 80, setting the .org code at 0x0804 should works because BIOS transfers control to initcode and ignores other fields. (Although to complain standard de header must be 16 bytes long)

i confess that i couldn't find easily information about rom headers - long time i don't access them, and forgot about - what i did were opening some .rom from msxdev entries (maybe mostly compiled from asmsx from Robsy?), and i think i found no '00 00 00' after the first 4 bytes, even those 6 bytes later as '00', only text information about name game and (random?) id code - so, i assumed the code could start on 0x8004 without further problems, but your idea on following '41 42 10 80  00 00 00 00  00 00 00 00  00 00 00 00' for following compatibility norms seems to be not bad at all... (unless the game, demo, or whatever is so shrinked that each byte counts...)


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 20 de Marzo de 2012, 03:50:29 pm
btw, Boriel, i'm seeing one situation about compiling to rom files - variables and constants must be allocated in different memory areas - contants for rom, and variables for ram - but i don't know how to do it, or if is this possible on zxbasic compiler


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: Konamito en 20 de Marzo de 2012, 04:53:59 pm
boriel, welcome ;)


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: Boriel en 20 de Marzo de 2012, 11:55:12 pm
btw, Boriel, i'm seeing one situation about compiling to rom files - variables and constants must be allocated in different memory areas - contants for rom, and variables for ram - but i don't know how to do it, or if is this possible on zxbasic compiler
You can use DIM..AT <address> to specify a variable to be allocated at a given address. Hope that is what you're looking for.


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 10 de Agosto de 2012, 01:14:17 pm
awesome! i didn't know that! thanks! :)


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 10 de Agosto de 2012, 01:18:04 pm
btw, everyone, Haroldo O.P., somehow active on the sega-mastersystem retro development community, started to fork successfully zxbasic-compiler to sms ( http://www.smspower.org/forums/viewtopic.php?p=72146 ) - i hope this information and initiative can be helpful on the msx version - any help on the msx version is very welcome and considerable!


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 10 de Junio de 2013, 05:46:34 pm
some progress! \o/ - http://www.boriel.com/forum/wishlist/started-msx-version-help-needed-as-well-t811.html - the attachment example04c_msx_zxbasic.zip has some vpokes, but i'm still struggling on sprites, palettes, keyboard, sound, etc. - any help is really welcome! :)


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: kabish en 11 de Junio de 2013, 01:27:40 pm
Nice work !!

I think you should focus on first generation before trying something more complex. I will try this new example.


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 13 de Junio de 2013, 12:18:45 am
first generation?


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 16 de Junio de 2013, 02:24:10 pm
updated example05b_msxzxbasic_sound.zip - trying to do something with sound, nothing happens yet... (i think i'm using the correct i/o ports?)


Título: Re: Boriel's zxbasic compiler: creating msx binaries on it (call for help)
Publicado por: nitrofurano en 21 de Junio de 2013, 09:25:50 pm
another progress:
http://www.boriel.com/forum/post4574.html#p4574
using hexcolours on screen12 (testing with some palettes from colourlovers.com/palettes/random )