Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
zxbasic compiler for Sega Master System?
#1
i knew now that someone adapted zxbasic compiler to create Sega Master System roms? did someone try it?
<!-- m --><a class="postlink" href="http://www.smspower.org/forums/viewtopic.php?t=12902">http://www.smspower.org/forums/viewtopic.php?t=12902</a><!-- m -->

if it is working fine, or close to it, maybe it could somehow be available officially here from Boriel's website?
Reply
#2
nitrofurano Wrote:i knew now that someone adapted zxbasic compiler to create Sega Master System roms? did someone try it?
<!-- m --><a class="postlink" href="http://www.smspower.org/forums/viewtopic.php?t=12902">http://www.smspower.org/forums/viewtopic.php?t=12902</a><!-- m -->

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.
Reply
#3
boriel Wrote:
nitrofurano Wrote:i knew now that someone adapted zxbasic compiler to create Sega Master System roms? did someone try it?
<!-- m --><a class="postlink" href="http://www.smspower.org/forums/viewtopic.php?t=12902">http://www.smspower.org/forums/viewtopic.php?t=12902</a><!-- m -->

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 <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Other_architectures">http://www.boriel.com/wiki/en/index.php ... hitectures</a><!-- m --> , 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 <!-- m --><a class="postlink" href="http://www.youtube.com/watch?v=mhbXHCYATbY">http://www.youtube.com/watch?v=mhbXHCYATbY</a><!-- m --> ) can help a bit more on this one <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:NamcoPacMan">http://www.boriel.com/wiki/en/index.php ... amcoPacMan</a><!-- m --> - would be really great seeing arcade stuff made from zxbasic-compiler! Smile

some people from the Aquarius community (atariage forum - <!-- m --><a class="postlink" href="http://www.atariage.com/forums/topic/200929-aquarius-adapting-boriels-zxbasic-compiler-to-mattel-aquarius/">http://www.atariage.com/forums/topic/20 ... -aquarius/</a><!-- m --> ) 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! Smile ), 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
Reply
#4
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...)
Reply
#5
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
Reply
#6
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.
Reply
#7
no, i didn't try yet - and i think .com is too related to msxdos (i wanted to avoid it for now...)
Reply
#8
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.
Reply
#9
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)

Quote: 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! Smile (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! Smile )


Quote: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 <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Amstrad_CPC">http://www.boriel.com/wiki/en/index.php ... mstrad_CPC</a><!-- m --> Wink - everything interesting you find, please add there as well, because i'm also very interesting about! Smile



Quote: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




Quote: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)





Quote: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
Reply
#10
btw, some people from <!-- m --><a class="postlink" href="https://www.facebook.com/groups/mc1000/">https://www.facebook.com/groups/mc1000/</a><!-- m --> 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: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:GEM-1000">http://www.boriel.com/wiki/en/index.php ... C:GEM-1000</a><!-- m -->
Reply
#11
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... Tongue

If you have any questions that you would like to ask, please, do so. I'll do my best to help.
Reply
#12
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... Tongue

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.
Reply
#13
Thanks for the compliment, but you did the hardest part, that was making such a great compiler. Smile

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. Tongue

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.
Reply
#14
btw, all these links i were sending to <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:SegaMasterSystem">http://www.boriel.com/wiki/en/index.php ... sterSystem</a><!-- m --> (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


Attached Files
.zip   test6_sms_zxbasic.zip (Size: 30.47 KB / Downloads: 676)
Reply
#15
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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)