Page 1 of 1

Z80 ZX Spectrum build support (and Sega Master System)

Posted: Mon Apr 20, 2020 2:14 pm
by VilleK
In a similar project as the ZX Spectrum emulator I worked on earlier, here is a feature that allows building ZX Spectrum binaries from ZGE projects.

I don't know if anyone have any use for this but once I had the idea I knew I had to try to implement it :)

It is very limited so far but I hope to improve it further later on.

- It supports a subset of the ZGE scripting language, where "int" is the only supported data type and is treated as a unsigned 16-bit integer.
- No ZGE components (except storing bitmaps in Bitmap component, and other binary data in File component)

If anyone wants to try it you can download it here: http://www.zgameeditor.org/files/ZGameEditor_beta.zip

Then open Z80Example project in Projects subfolder. Build the .z80 file (file format that is compatible with ZX Spectrum emulators) using "Build Z80" menu item in project menu.

Screenshot below shows .z80 file generated by ZGE running in zesarux emulator.

Re: Z80 ZX Spectrum build support

Posted: Sat Apr 25, 2020 6:25 pm
by VilleK
I've continued to improve this and now added another Z80-target: Sega Master System (SMS).

I found a nice tutorial for SMS here that I converted to ZGE: https://www.smspower.org/maxim/HowToPro ... lOnOnePage

Apparently Sega Game Gear almost has the same specification as Master System so that means ZGE can support that too.

Screenshot below shows MEKA Sega Master System emulator run a rom-file generated by ZGE.

Re: Z80 ZX Spectrum build support

Posted: Sat Apr 25, 2020 10:39 pm
by Imerion
Wow, I did not expect Z80 building in ZGE (or any similar tool, actually). Very cool! I'd love to make a Master System game. :D

Now if only I could compile ZGE on Free Pascal and have a native Linux version of both runtime and editor. ;) Did that ever turn out to work?

Re: Z80 ZX Spectrum build support

Posted: Sun Apr 26, 2020 10:20 am
by Kjell
Hej Ville,

Super cool & wild idea! Some notes regarding the Master System / Game Gear target.

- Non-Japanese ROMs actually require a header at the end, which includes a ROM size descriptor nibble .. so ROMs needs to be padded.
- The VDP can only handle VRAM writes every 29 cycles outside of the VBlank period, therefore your print routine only works during VBlank.

The easiest way to implement a waitVsync is to check bit 7 of "in a,($BF)" in a tight loop. The only danger is that when you call that from inside the VBlank there's no way of knowing how many cycles you have left. A alternative would be to push PC onto the stack, EI & HALT .. and then pop back from the $38 interrupt vector.

K

Re: Z80 ZX Spectrum build support (and Sega Master System)

Posted: Sun Apr 26, 2020 12:48 pm
by VilleK
Kjell wrote:
Sun Apr 26, 2020 10:20 am
- Non-Japanese ROMs actually require a header at the end, which includes a ROM size descriptor nibble .. so ROMs needs to be padded.
Thanks for the link, I'll make a note of that. I just made the minimal file that the emulator accepted at this point :)
Kjell wrote:
Sun Apr 26, 2020 10:20 am
- The VDP can only handle VRAM writes every 29 cycles outside of the VBlank period, therefore your print routine only works during VBlank.
I guess that is why the tutorial writes the text before turning on the display. I've never done any coding for SMS before so I know absolutely nothing about it. It would be cool to expand the project so it displays a sprite. Do you have any SMS experience yourself?
Imerion wrote:
Sat Apr 25, 2020 10:39 pm
Now if only I could compile ZGE on Free Pascal and have a native Linux version of both runtime and editor. ;) Did that ever turn out to work?
The editor has quite a number of Windows dependencies and I don't have the motivation to port it myself (I'm a happy Windows user ;)). So your best bet is running the editor in Wine and build the runtime for Linux usingFreepascal.

Re: Z80 ZX Spectrum build support (and Sega Master System)

Posted: Thu May 07, 2020 2:37 pm
by VilleK
Kjell helped create a sprite example for Sega Master System so I've replaced the demo project in the installer.

Re: Z80 ZX Spectrum build support (and Sega Master System)

Posted: Sun Jun 07, 2020 12:35 pm
by VilleK
Motorola 6809 CPU support with Vectrex platform mostly working now :). I noticed MAME have excellent built-in debugger for 6809 and I will probably use this for any additional retro development.