|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Author | Message |
---|---|
|
ZX Basic for Sega Master System
Posted: Wed Jan 26, 2011 1:26 am Last edited by haroldoop on Wed Feb 23, 2011 10:36 pm; edited 1 time in total |
Hello,
This is a frontend that allows one to compile BASIC source code into a Sega Master System ROM. It uses Boriel's ZX Basic to translate the source into Z80 assembly language, then translates it into a asm format that's compatible with WLA-Z80 and then, finally, it uses WLA to assemble and link the translated code, resulting into a ROM that can be executed by any Sega Master System emulator. In order to compile, all you need to do is to go to the command line and invoke zxb-sms.exe, passing the name of the BASIC source code as a parameter. To build the example source, simply go to the \example folder, and run build.bat (test.zxb is the BASIC source code for the example). *** Download ZXB-SMS 0.03 alpha *** . |
|
|
Alpha 0.04 released
Posted: Wed Feb 23, 2011 3:36 am Last edited by haroldoop on Wed Feb 23, 2011 10:33 pm; edited 1 time in total |
This new alpha adds the possibility of adding binary resources to the ROM;
The included example program is now also more elaborate, with joystick handling, palette/tileset loading et al; The toolset is now at a stage that it could be used for an actual game, as long as you mind those details: - Multiplication, division and strings aren't working, yet; - Array handling is currently extremely broken; - Floating point support is not working; remember to explicitly declare every variable as some integer value; *** Download ZXB-SMS 0.04 alpha *** |
|
|
Posted: Wed Feb 23, 2011 4:03 am |
Thanks for the work.
Can you use the Attachment feature to add files to the forums? Because other services such as dropbox tends to delete files after some time. |
|
|
Posted: Wed Feb 23, 2011 10:33 pm |
Okay, no problem. | |
|
Posted: Wed Mar 30, 2011 9:25 pm |
The test.zxb file really, really looks like assembly and not BASIC. What am I missing?
Do I need this other thing, the Boriel ZX Basic compiler? Can I use the same sound and graphic BASIC commands even though it's for the Spectrum? Is there a way to wrap this into a Genesis binary ROM? This could be VERY, very big if people can program SMS games in BASIC now =) |
|
|
Posted: Wed Mar 30, 2011 11:39 pm |
Well, since I still haven't made a library to acess the hardware, many low-level operations had to be implemented in assembly (about 60% test zxb is assembly). If you start reading from line 237, you'll notice that at this point, the code starts to be almost pure BASIC; the idea would be that once all of the most common low-level operations had been moved into libraries, then the programmer could make a game using only BASIC code.
Well, ZXB-SMS 0.4 already includes Boriel's ZX Basic, so you can use it right away, without needing extra setup steps. At the moment, ZXB-SMS doesn't support many of Boriel's ZX Basic features, so multiplication, division, string manipulation, sound/graphical commands, etc. simply wouldn't work, but they could be made to work in the future.
Well, it could, with some effort, be adapted for producing conde for Genesis' Z80 sub-CPU.
Yes, Boriel's ZX BASIC produces very efficient code, and allows one to easily mix-up BASIC with Z80 ASM; if ZXB-SMS could be made to support it better, it would be a nice tool for SMS ROM developers. |
|
|
Posted: Thu Mar 31, 2011 2:04 pm |
@haroldoop: Thanks for the reply! I have an Everdrive flash cart that can patch some .SMS roms to run on the Genesis. If you ever need to have someone test a binary I can do it.
Thank you for your work so far :) |
|
|
i'm Linux-only... :(
Posted: Wed Aug 01, 2012 4:24 pm
|
i think most of them can be temporarily created as library, and later added defaultly? btw, @haroldoop - since i used the original zx-spectrum version of zxbasic-compiler (submitted some games at csscgc contest made with it), i found interesting your sms version, as it can help some other architectures as well (for this i created this wikipage there: google for "boriel zxbasic other architectures" (i'm not allowed to post weblinks here yet...) ) - the problem on using your version is i'm a Linux-only user, and struggled a lot using that .exe stuff you have there... :| - but anyway, it's really interesting the way you used WLA as dependency btw, for everyone also interested on zxbasic-compiler, Nathan from Mojon Twins started this very interesting zxbasic tutorial - google for "tcyr wordpress 2012 tutorial zx basic fourspriter introduccion" (i'm not allowed to post weblinks here yet...) - maybe it will need some adaptations for sms, but i think the essential is all there. |
|
|
Posted: Wed Aug 01, 2012 5:18 pm |
working fine on Linux - tested now
the only think i needed some attention is that i have zxb.py from the zx-spectrum version in an assigned directory, for zxb.py acting as terminal command and based on build.bat i used this build.sh: # @echo off # rem ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # rem :: Do not edit anything below here unless you know what :: # rem :: you're doing! :: # rem ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # wla-z80 and wlalink found from an rpm search for wla-dx # at Debian/Ubuntu: i made a tarball from it and istalled with # sudo tar -zxvf wla-dx_9.4a-2.96_i586.tar.gz -C / # (please make sure that 'usr' folder appear when opening this .tar.gz with FileRoller, for checking) # rem Cleanup to avoid confusion # if exist object.o del object.o rm object.o # rem Compile # zxb test.zxb --asm #? python zxb-sms.py test.zxb --asm zxb.py test.zxb --asm # python zxb2wla.py test.asm python zxb2wla.py test.asm # wla\wla-z80.exe -o test.wla.asm object.o wla-z80 -o test.wla.asm object.o # rem Make linkfile # echo [objects]>linkfile # echo object.o>>linkfile echo [objects] > linkfile echo object.o >> linkfile # rem Link # wla\wlalink.exe -drvs linkfile output.sms wlalink -drvs linkfile output.sms # rem Fixup for eSMS # if exist output.sms.sym del output.sms.sym # ren output.sym output.sms.sym rm output.sms.sym mv output.sym output.sms.sym # rem Cleanup to avoid mess # if exist linkfile del linkfile # if exist object.o del object.o rm linkfile rm object.o # run Osmose emulator with the result osmose output.sms now, what i think is missing is improving zxbasic-sms with libraries for having an efficient use of it, and any help on editing the weblink you may find from "boriel wiki ZX_BASIC Other_architectures" (Master System link) for adding useful information are very welcome! :) |
|
|
Posted: Wed Aug 01, 2012 7:40 pm |
@haroldoop look for "nitrofurano altervista retrocoding zxspectrum" and see if some examples i have there for zxbasic-zxspectrum can be useful for zxbasic-sms as libraries - for now, i have special interest for snippets using palettes, patterns and text (like vpoke on msx), joystick, sound, etc. - as far you may have some interesting snippets running, please share a new version of it! thanks! :) | |
|
Posted: Wed Aug 01, 2012 10:29 pm |
Hello!
It's always nice to find a fellow retrocoder. =) I haven't updated ZX-Basic for SMS for a while, but I did make some experiments for the 2012 coding compo, before settling for making Data Storm. The attachment contains the ZX-Basic compiler with full source (most of the Python sources for the translator are in the "wip" folder), along with some extras, like a scrolling shoot-em-up prototype, a Punch-Out prototype (not much done there), and a very slightly improved version of Data Storm. http://haroldo-ok.com/downloads/zxb-sms-2012-02-23.rar |
|
|
Posted: Thu Aug 02, 2012 12:01 am |
i enjoyed Data Storm a lot, recalls me some atari2600 game looking alike it! :) - but i struggled a bit trying to understand the sources you used there, since most of the tile contents i done there (zx-spectrum version) were with defb hex value sequences, not binary inclusions - i also struggled to understand how sms deals with video memory and how is it organized, if it is shared with z80 (like zx-spectrum), or accessed by i/o (like msx) - the documentation available at smspower is not that simple to understand
thanks, i'm taking a look at it now! :) |
|
|
Posted: Thu Aug 02, 2012 1:21 am |
i think your 0.04 is much more easier to use, from 2012-02-23 i'm only getting error messages from the terminal, like guest@crunchbang:~/downloads/segamastersystem/rar/zxb-sms-2012-02-23/megamania$ bash build.sh rm: cannot remove `object.o': No such file or directory hardware.zxi:16: warning: SUB 'SetSprite' declared as FASTCALL with 4 parameters hardware.zxi:77: warning: FUNCTION 'AndW' declared as FASTCALL with 2 parameters hardware.zxi:120: warning: SUB 'LoadPalette' declared as FASTCALL with 3 parameters hardware.zxi:138: warning: SUB 'LoadTiles' declared as FASTCALL with 4 parameters hardware.zxi:157: warning: SUB 'SetBkgData' declared as FASTCALL with 5 parameters test.zxb:54: warning: SUB 'SetBufferByte' declared as FASTCALL with 2 parameters test.zxb:135: warning: Variable 'MManiaPal' declared as 'float' test.zxb:138: warning: Variable 'MManiaTil' declared as 'float' Traceback (most recent call last): File "zxb2wla.py", line 1, in <module> from version import VERSION ImportError: No module named version INCLUDE_FILE: Error opening file "test.wla.asm". LOAD_FILE_DATA: Could not open file "object.o". rm: cannot remove `output.sms.sym': No such file or directory mv: cannot stat `output.sym': No such file or directory rm: cannot remove `object.o': No such file or directory mv: cannot stat `output.sms': No such file or directory OsmOse 0.8.5 beta build on Jan 15 2009 at 19:26:31 Written by Bruno Vedder. Unable to open test.sms zip archive. guest@crunchbang:~/downloads/segamastersystem/rar/zxb-sms-2012-02-23/megamania$ |
|
|
Posted: Thu Aug 02, 2012 11:20 pm |
Well, basically, the Master System's video memory is accessed just like in the MSX; in fact, it's VDP is an improved version of the one found on the MSX. If you want to learn the basics on how to program SMS's hardware, I'd recommend Maxim's tutorial.
From the error message, it looks like Python is having problems finding version.py; this is an small include file that I used just to declare the version of the program in a convenient way. It must be put in the same directory as the other source files, so Python can find it. |
|
|
Posted: Fri Aug 10, 2012 5:01 pm |
btw, Haroldo, Boriel (the original zxbasic-compiler author) and me were talking about this SMS fork you made at http://www.boriel.com/forum/post3647.html#p3647 - be welcome talking with us there, since he is having lots of ideas on uniforming everything in just one cross-compiler, avoiding wla, etc.
and in the meanwhile i were trying to walk around from the stuff you have there, trying to create some library routines for vpoke (like on msx basic), and later cls, writing text, etc.
thanks, this is a very useful link - added it at http://www.boriel.com/wiki/en/index.php/ZX_BASIC:SegaMasterSystem (the main multiplatform wikipage reference for Boriel's zxbasic-compiler - everything interesting and useful you wish to add there, be welcome! (contact Boriel if you struggle to login there) )
thanks, i'll try it - btw, i confess the worst confusion i found from there were those .exe w32 binaries - i imagine they may be very useful for w32 users, but definitely not for Linux users like me... :| but don't forget to get in contact with Boriel as well, specially about the next versions of both of your approaches! :) |
|
|
Please continue guys!
Posted: Tue Aug 21, 2012 7:43 pm
|
If the compiler can be ported to the SMS then anything else is possible. Right now most BASIC compilers for video game consoles are dead or development is almost stalled. I *really* hope momentum continues to pick up on this!
Easy tools means more people homebrewing games! |
|
|
Posted: Fri Oct 04, 2019 1:44 am |
How do i open the program? | |
|
Posted: Fri Oct 04, 2019 2:16 am |
So, run cmd.exe, cd to where you unzipped and type zxb-sms.exe lucas_program.zxb Without wanting to be unkind, if you can't get that far, you're likely to struggle with the assembly you'll need to learn to do anything remotely advanced. Maxim's tutorial is a good introduction to Z80 assembly. You may find that by the time you've learned how to interface with the Master System that it's more worthwhile to work in assembly anyway. From what I can tell, this compiler is a stalled project. |
|
|
Posted: Sun Oct 06, 2019 1:45 pm |
Thanks! But i now need to know how to open the zxbasic-master file.
|
|
|
Posted: Sun Oct 06, 2019 3:52 pm |
Wait. You mean like you cant unzip it? |
|
|
Posted: Sun Oct 06, 2019 4:42 pm Last edited by lucasyuhyuh on Sun Oct 06, 2019 6:02 pm; edited 1 time in total |
No, i need to open the program inside the zipped file (i already unzipped it). |
|
|
Posted: Sun Oct 06, 2019 5:23 pm |
Edit: Right okay, I think I understand a bit what's going on here. You downloaded that file from here, right?
If so I'll stop you right here and tell you: that compiler is intended for the ZX Spectrum. I don't believe it supports the Master System. If it does, you'll probably have better luck seeking support in the appropriate forums. Maybe try some of the files that were posted in this thread, there's at least the outside possibility that someone here will be able to support you with those. Also: back off with your caps lock key attitude. You're the one downloading random files from other places on the internet and expecting people to help you with them. People will be more willing to help you if you make it easier for them. |
|
|
Posted: Sun Oct 06, 2019 6:50 pm |
Okay, so i downloaded this .zip file, now how can i open the program? I'm running 64-bit Windows 10. Also: Sorry for that attitude of mine. |
|
|
Posted: Sun Oct 06, 2019 7:19 pm |
If you can't get that far, then maybe this video will help you. I'll stress this again: you will need to learn Z80 assembly to make anything remotely worthwhile with this compiler. If you open example\test.zxb in a text editor, you'll see that more than half of the code is not Basic, and the code that is Basic is not doing anything particularly complicated. This simple example program doesn't take any controller input, so that's something you need to code in assembly yourself before you even get round to any game logic. You may as well follow Maxim's tutorial because whether or not you use this compiler you will still need to learn assembly if you want to work with the Master System. |
|
|
Posted: Tue Mar 24, 2020 2:47 pm |
I was just trying to see if there were results of putting ZX Spectrum on the Master System, but once I found this, it's a good project. I only have v0.04, going to download the other version. Keep up the good work. :-) |
|
|
Sorry for necro-posting...
Posted: Wed Sep 27, 2023 9:32 pm
|
I hope this project continues.
By the way, hi! My name is Chase, but you can call me Cheez. I'm glad to be here since I'm a fan of Sega and stuff. |
|