Jump to content
rensoup

Unicorns season: Prince of Persia for the A8!

Recommended Posts

18 hours ago, rensoup said:

I'm going with a conversion to C# first so I'll be hopefully able to carry out higher level optimizations later. I gradually convert Z80-> C# subroutines then I do simple interception calls to bypass the Z80 code and call the new C# code. It's not perfect though and it's pretty horrible to convert code that does all sorts of bit manipulation too.

 

I'm curious how the ZX spectrum Z80 @3.5Mhz compares with the the A8's 6502. I don't have much experience with the Z80 but its instruction set seems way more efficient than the 6502 perhaps at the expense of taking many more cycles per instruction ?

That sounds like an interesting approach and probably a way to save your sanity during the conversion process ;)

 

Based on my experience, you do things differently on those two processors. 6502 has like more bandwidth towards memory when you work with lookuptables or doing simple operations between kind of two arrays in memory etc.
Z80 is king of registers. You got like dozen 8bit/16bit registers that you can mix for all different kinds of purposes. Problems arise when you need to do complex things through accumulator (A register). It's a bottleneck when everything has to go through it towards memory and back. So you try to avoid it, load as much data possibly into registers and work on them directly without touching memory. Then it's crazy fast. 3d stuff on z80 is visibly faster compared to similar 6502 machine.

And then comes z80 specialty which is stack. 16bit counter registers give you nice way to do large loops, then you do stuff like pull 16bit from stack, pull another 16bit from stack (once), now you have 4 bytes of screen data inside processor. Then you do loop of unrolled push 16bit, push 16bit and you get things like scrolling Cobra, Sidewize, R-type etc games on spectrum. For a machine that has no hardware scroll at all, not even raster interrupts, it's crazy imho :)

 

Nice read on that topic is series of articles over here about Sidewize:

https://blog.stevewetherill.com/2022/02/more-sidewize-and-some-cool-cspect-stuff.html

 

So you're on the right track with that z80->c# conversion imho. Once you isolate smaller functions that do one thing, you convert them to 6502 code in some other optimized way (not a straight forward conversion of z80 instructions one  by one) and you may have a chance :)

Wish you all the best in development process !

Have fun :)


 

  • Like 3

Share this post


Link to post
Share on other sites
On 5/7/2022 at 4:35 PM, popmilo said:

For a machine that has no hardware scroll at all, not even raster interrupts, it's crazy imho :)

 

Nice read on that topic is series of articles over here about Sidewize:

https://blog.stevewetherill.com/2022/02/more-sidewize-and-some-cool-cspect-stuff.html

Interesting, seems like they took the ZX architecture and built the AtariST around it 😀 (with bitplanes, just to make it even worse!)

 

 

  • Haha 4

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...