Z80 ZX Spectrum build support (+ Sega Master System and Vectrex)

All topics about ZGameEditor goes here.

Moderator: Moderators

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

Z80 ZX Spectrum build support (+ Sega Master System and Vectrex)

Post 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.
Attachments
zge_z80.PNG
zge_z80.PNG (220.9 KiB) Viewed 11803 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Z80 ZX Spectrum build support

Post 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.
Attachments
zge_sms.png
zge_sms.png (1.27 MiB) Viewed 11779 times
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Re: Z80 ZX Spectrum build support

Post 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?
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: Z80 ZX Spectrum build support

Post 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
User avatar
VilleK
Site Admin
Posts: 2274
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 »

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: 2274
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 »

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.23 MiB) Viewed 11062 times
User avatar
VilleK
Site Admin
Posts: 2274
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 »

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 (635.18 KiB) Viewed 10709 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

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

Post by VilleK »

Small update: Functions defined in ZLibrary does no longer need to be defined as "inline" to work. This will be translated to the native function calls using "call/jsr" in the binary. Not sure what to implement next, have anyone any suggestions? It would be cool if someone tried to make a small game for one of these platforms to test this better, maybe a "Snake" game or similar :).
Post Reply