Z80 ZX Spectrum build support (and Sega Master System)

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
VilleK
Site Admin
Posts: 2072
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Z80 ZX Spectrum build support (and Sega Master System)

Post by VilleK » Mon Apr 20, 2020 2:14 pm

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.
Attachments
zge_z80.PNG
zge_z80.PNG (221.54 KiB) Viewed 1858 times

User avatar
VilleK
Site Admin
Posts: 2072
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Z80 ZX Spectrum build support

Post by VilleK » Sat Apr 25, 2020 6:25 pm

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.
Attachments
zge_sms.png
zge_sms.png (1.27 MiB) Viewed 1834 times

Imerion
Posts: 198
Joined: Sun Feb 09, 2014 4:42 pm

Re: Z80 ZX Spectrum build support

Post by Imerion » Sat Apr 25, 2020 10:39 pm

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?

User avatar
Kjell
Posts: 1726
Joined: Sat Feb 23, 2008 11:15 pm

Re: Z80 ZX Spectrum build support

Post by Kjell » Sun Apr 26, 2020 10:20 am

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

User avatar
VilleK
Site Admin
Posts: 2072
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

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

Post by VilleK » Sun Apr 26, 2020 12:48 pm

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.

User avatar
VilleK
Site Admin
Posts: 2072
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

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

Post by VilleK » Thu May 07, 2020 2:37 pm

Kjell helped create a sprite example for Sega Master System so I've replaced the demo project in the installer.
Attachments
zge_sms.png
zge_sms.png (1.24 MiB) Viewed 1117 times

User avatar
VilleK
Site Admin
Posts: 2072
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

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

Post by VilleK » Sun Jun 07, 2020 12:35 pm

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.
Attachments
zge_vectrex.png
zge_vectrex.png (636.9 KiB) Viewed 764 times

Post Reply