FAQ  •  Register  •  Login

zxbasic compiler for Sega Master System?

<<

nitrofurano

Posts: 349

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Wed Aug 01, 2012 11:26 am

zxbasic compiler for Sega Master System?

i knew now that someone adapted zxbasic compiler to create Sega Master System roms? did someone try it?
http://www.smspower.org/forums/viewtopic.php?t=12902

if it is working fine, or close to it, maybe it could somehow be available officially here from Boriel's website?
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Wed Aug 01, 2012 12:38 pm

Re: zxbasic compiler for Sega Master System?

nitrofurano wrote:i knew now that someone adapted zxbasic compiler to create Sega Master System roms? did someone try it?
http://www.smspower.org/forums/viewtopic.php?t=12902

if it is working fine, or close to it, maybe it could somehow be available officially here from Boriel's website?

Of course. :!:
I'm still refactoring the compiler (this is a long-term task), to enable multiple-targets (MSX, etc...).
For most Z80 architectures, I guess the fastest way is to create a /library/arch, so the compiler generates generic .z80 asm files and then the assembler assembles the final result to the target architecture. Unfortunately, I need info on how to generate binary files for MSX, Sega, etc. and emulators to test them.

Currently I'm starting with BlueMSX for MSX files.
<<

nitrofurano

Posts: 349

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Wed Aug 01, 2012 2:26 pm

Re: zxbasic compiler for Sega Master System?

boriel wrote:
nitrofurano wrote:i knew now that someone adapted zxbasic compiler to create Sega Master System roms? did someone try it?
http://www.smspower.org/forums/viewtopic.php?t=12902

if it is working fine, or close to it, maybe it could somehow be available officially here from Boriel's website?

Of course. :!:
I'm still refactoring the compiler (this is a long-term task), to enable multiple-targets (MSX, etc...).
For most Z80 architectures, I guess the fastest way is to create a /library/arch, so the compiler generates generic .z80 asm files and then the assembler assembles the final result to the target architecture. Unfortunately, I need info on how to generate binary files for MSX, Sega, etc. and emulators to test them.

Currently I'm starting with BlueMSX for MSX files.


btw, i were constantly updating the http://www.boriel.com/wiki/en/index.php ... hitectures , even if considered as a very shy help - i think msx is the less incomplete there (i tried to have some asm snippets there can help us somehow)

and so, maybe Jim Bagley (after his truly wonderful project http://www.youtube.com/watch?v=mhbXHCYATbY ) can help a bit more on this one http://www.boriel.com/wiki/en/index.php ... amcoPacMan - would be really great seeing arcade stuff made from zxbasic-compiler! :)

some people from the Aquarius community (atariage forum - http://www.atariage.com/forums/topic/20 ... -aquarius/ ) are becoming really interested on helping as well - they realized zxbasic compiler can be an awesome tool for creating new homebrew titles easily there

and yes, info about generating tape and cartridge files may vary significantly from machine to machine (specially among so similar machines like msx1, colecovision and sg1000 are)

about emulators, i'm using openmsx (for msx, also supporting turbo-r and gfx9000, which will be great seeing zxbasic compiler supporting that soon as well! :) ), and osmose (master system)

the interesting of this master system version is it can also provide some clues on how to deal with rom (cartridge) and ram areas independently, which the original zx-spectrum isn't - i think this is what i struggled at most on my humble msx version approach
<<

nitrofurano

Posts: 349

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Wed Aug 01, 2012 3:40 pm

Re: zxbasic compiler for Sega Master System?

and btw, i think this sms haroldoop version needs some cleaning, it's too based on external cross-compilers like wla, and the packages he provided were too focused on ms-windows users (for example, i'm struggling a lot using it now...)
<<

nitrofurano

Posts: 349

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Wed Aug 01, 2012 5:37 pm

Re: zxbasic compiler for Sega Master System?

compiled successfully from there - i just needed to find a binary wla-dx package for using it, and adapted that build.bat into this build.sh:

  Code:
# @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

<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Thu Aug 02, 2012 9:20 am

Re: zxbasic compiler for Sega Master System?

Nitrofurano, have you tried this on MSX?

Compile with only with zxb --org=0 (ouput format should be .bin, so don't use any other compiler flag, such as -TaB)

  Code:
ASM
ALIGN 100h
END ASM
Your basic code goes here
...
...

:?: Maybe this works as a MSX COM file?
Anyway, I'm about to start MSX support.
<<

nitrofurano

Posts: 349

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Thu Aug 09, 2012 2:08 pm

Re: zxbasic compiler for Sega Master System?

no, i didn't try yet - and i think .com is too related to msxdos (i wanted to avoid it for now...)
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Thu Aug 09, 2012 3:19 pm

Re: zxbasic compiler for Sega Master System?

nitrofurano wrote:no, i didn't try yet - and i think .com is too related to msxdos (i wanted to avoid it for now...)

I lack this info. The good news: for the amstrad platform there is already support for .tzx format cassette files. I'm almost finishing an amstrad generation prototype.
So -T flag + --arch=amstrad (??) should be the minimal flags required.
I think I could port most routines, but need amstrad info (a lot!). I've been struggling with cassette header format, but I think I got it. More on this this weekend.
Regarding to Sega Master System, I guess the author can't keep up with continuous compiler updated. :oops:
He strips some asm down, and then filters it for the WSL assembler. I think I could either produce WLA-DX asm directly, or even package for the SMS directly from ZXBasm.
<<

nitrofurano

Posts: 349

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Fri Aug 10, 2012 4:48 pm

Re: zxbasic compiler for Sega Master System?

boriel wrote:
nitrofurano wrote:no, i didn't try yet - and i think .com is too related to msxdos (i wanted to avoid it for now...)

I lack this info.


i imagine that there can be several ways on having msx binaries: as "bloadable" from basic (it has some bytes before, like address of the first byte, size and execution, but i'm not sure how many they are, maybe 7) ready to be included into a .dsk file (the same fat-12/fat-16 format used on qemu, i think, but with a limit of 720kb), this same "bloadable" inside a .cas file, this on from the msxdos i have no idea how to create it (since rarelly used msxdos, but i think demos from Bandwagon uses this format)

The good news: for the amstrad platform there is already support for .tzx format cassette files. I'm almost finishing an amstrad generation prototype.
So -T flag + --arch=amstrad (??) should be the minimal flags required.


this is awesome! i'm also curious for seeing some few snippets on it! :) (and i wonder if gx4000 will be somehow supported as well? - i imagine the difference would be the cartridge format, palette support, and etc? - i think palette wouldn't be such issue, since that "easiness" i added UlaPlus support as libraries! :) )


I think I could port most routines, but need amstrad info (a lot!). I've been struggling with cassette header format, but I think I got it. More on this this weekend.


exactly for this is why i started pasting links about it at wikipages like http://www.boriel.com/wiki/en/index.php ... mstrad_CPC ;) - everything interesting you find, please add there as well, because i'm also very interesting about! :)



Regarding to Sega Master System, I guess the author can't keep up with continuous compiler updated. :oops:


this is also why i'm tried to contact him




He strips some asm down, and then filters it for the WSL assembler.


yes, i saw that too

as it is, i were now trying this SMS version - i really wished to have more contact with Haroldo O.P. here in this forum or somewhere else - also because stuff like cleaning (avoiding/removing) all that w32 .exe binary "garbage" he left there... - and maybe some needed libraries like this (and assuming my knowledge about SMS hardware is almost nule):

  Code:
sub sms_vpoke(alv as uinteger, vlv as ubyte):
  out $BF,alv band 255
  out $BF,int(alv/256)
  out $BE,vlv
  end sub
'----- information about video memory area:
'- $0000 pattern ($2000 - $20 per character, 256 characters)
'- $C000 palette (32?)
'- $B800 text ($0800)






I think I could either produce WLA-DX asm directly, or even package for the SMS directly from ZXBasm.


i imagined that, that's why i wanted to contact you about this SMS version as soon as i found it
<<

nitrofurano

Posts: 349

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Fri Aug 10, 2012 5:07 pm

Re: zxbasic compiler for Sega Master System?

btw, some people from https://www.facebook.com/groups/mc1000/ became excited with a gem1000/mc1000 version (in some mailing list, i think) of zxbasic-compiler - these are pretty rare machines (a bit less rare in Brazil, i think), also z80, and using the same video processor as Dragon32, and also somehow similar to nec-pc6001-mk1 - and that people seem to have some knowledge to help on this version - i were collecting some information here: http://www.boriel.com/wiki/en/index.php ... C:GEM-1000
<<

haroldoop

Posts: 2

Joined: Sun Aug 12, 2012 5:27 pm

Post Sun Aug 12, 2012 5:44 pm

Re: zxbasic compiler for Sega Master System?

Hello, I'm Haroldo, I made the SMS port.

While I was originally intending to adapt ZX-Basic so that it would be able to generate Sega Master System binaries directly, I ended up implementing it, initially, as a translator from ZX-Basic's ASM format to WLA-DX format so that I could get something working quickly, and, thanks to the fantastic procrastinator that I am, it never went much beyond that... :P

If you have any questions that you would like to ask, please, do so. I'll do my best to help.
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Mon Aug 13, 2012 6:59 pm

Re: zxbasic compiler for Sega Master System?

haroldoop wrote:Hello, I'm Haroldo, I made the SMS port.

While I was originally intending to adapt ZX-Basic so that it would be able to generate Sega Master System binaries directly, I ended up implementing it, initially, as a translator from ZX-Basic's ASM format to WLA-DX format so that I could get something working quickly, and, thanks to the fantastic procrastinator that I am, it never went much beyond that... :P

If you have any questions that you would like to ask, please, do so. I'll do my best to help.

I got astounded with what you made:!:
There are several ways to accomplish this:

1) Directly generating the WLA-DX asm. This is the fastest way. In fact, almost all of us know Z80 Assembler. WLA-DX assembler is Z80, with some little changes . The problem is, as always, architecture related info. E.g. how to generate an ASM file for WLA-DX + SMS (I can check your code).

2) How to generate an SMS file directly. I prefer this solution, but will take much more time. I think I can rip some code from wla-dx or the like. Anyway, I need info about SMS architecture.

Other aspects:
  • Need info on how to write on the screen
  • Need info on Input (Joystick, any keyboard?)
  • Desirable info on Sound generator
  • I'm also working on a generic FP routines, but always try to use ROM ones where available. Anyway, you can already use Fixed type for a limited decimal-like variables.

I'm open to contribution. Even to develop modules for the compiler, if you like. You can also contribute with info, and routines. I consider the community (Britlion, LCD, slenkar, etc. etc.) co-authors of the compiler in some way or another.
<<

haroldoop

Posts: 2

Joined: Sun Aug 12, 2012 5:27 pm

Post Tue Aug 14, 2012 2:52 am

Re: zxbasic compiler for Sega Master System?

Thanks for the compliment, but you did the hardest part, that was making such a great compiler. :)

Anyway, about the options, the only reasons I ended up targeting WLA-DX were:

1. Good support for automating the job of separating the code into ROM banks;
2. Automatic support for the standard Sega Master System ROM header;
3. Automatic support for the SDSC ROM header;
4. Automatically generates a .SYM file with symbolic information that can be used for improved debugging on Weka;
5. Lazyness in my part. :P

Basically, all of the above are good to have, but optional, except for number 2: you don't need ROM banks if your ROM is less than 32k, and the SDSC ROM is not required by the real hardware. It won't be able to run on a real SMS without the standard header, though.

About the hardware info, I'd recommend:
- Maxim's tutorial, has a very nice, simple and easy to understand overview of SMS's hardware but ; on the other hand, it doesn't cover neither joypad input nor sound.
- Richard T.W.'s documentation also gives a very complete and detailed overview of the hardware, joypad and sound included;
- Also, SMSPower's documentation section has very nice documents; the two above should cover almost everything relevant, though.

As far as I know, the only keyboard available for the Master System was an addon for the Japanese Sega Mark III; it's probably pretty rare.
<<

nitrofurano

Posts: 349

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Tue Aug 14, 2012 3:45 pm

Re: zxbasic compiler for Sega Master System?

btw, all these links i were sending to http://www.boriel.com/wiki/en/index.php ... sterSystem (i imagine that Haroldo may want to add some important information there as well) - and in the attachment i were trying to create some libraries specific to sms (they have some misuses or bugs, i'm struggling on being accuraced on poking in the video memory, horizontal scroll, etc.), and using some from Haroldo there - and the sources from Haroldo (DataStorm, PunchOut and Megamania) are very useful source of applied documentation as well
Attachments
test6_sms_zxbasic.zip
(30.47 KiB) Downloaded 154 times
<<

nitrofurano

Posts: 349

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Tue Aug 14, 2012 7:40 pm

Re: zxbasic compiler for Sega Master System?

and about the sound, since sms, msx, zx-spectrum-128k, sg1000, etc., uses the same sound processor, maybe would be a good idea they using the same or similar commands? i remember that the 'sound' command from msx-basic is very similar to the i/o port outputs - what do you all think?
Next

Return to Wishlist

Who is online

Users browsing this forum: No registered users and 2 guests

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

phpBB SEO