Going back in time…

I’ve been ask by a few people to write about my experiences with programming the ZX81, and with the grounding of using Z80 on the ZX Spectrum now largely covered it would seem the right time to step back a little in time to the Speccy’s predecessor…

With the Zeddy being based upon the ’81 most of the concepts are actually very similar, if not identical, between the two machines.  Obviously, out of the box, it lacks sounds and colour (so that’s two less things to worry about straight off) but the main differences are really only how the display works, it’s relative lack of memory, and that it’s slower than it’s big brother.  But if, like me, you stick to using the low-res ‘chunky pixel’ graphics that it’s known for then you actually need much less memory to store graphics, and because the screen takes less memory you can fill it faster, so it’s very much swings and roundabouts.

I could cover these various aspects in the same way I did for the Speccy, but I was recently given a challenge – would I show how to convert a simple BASIC game from a magazine listing to machine code?  It sounded an interesting task, so over the next few posts I’ll try just that.

As a starter, here’s that magazine listing we’re going to convert…

gunner

It’s a basic (pun intended) game where you use the cursor keys to align your cross-hairs with a randomly-positioned enemy, then shoot them, only for another to appear at another random location.  It’s very short and sweet – perfect as a type-in magazine listing – and the type of game you could experiment with programming on by changing the code.  I used to type in a lot of BASIC games back in the day from magazines and books, as I could never actually get my ZX81 to load anything from tape! (EVER!)

So that’s the plan – to convert 21 lines of BASIC to machine code…

 

P.S.  If you’re a die-hard ZX Spectrum fan then you might not be interested in any of this, but the concepts and methods I’ll use to convert the game will be of equal use on either machine.  Only the methods for drawing the graphics will be notably different, so you might still find it educational.

Advertisements

2 thoughts on “Going back in time…

  1. Fantastic idea Bob. I’ve decided to give a try at a translation by myself, and see how it compares with your solution (no doubt yours will be much more efficient, given what I’ve seen from you and what I’ve been able to do in machine language up until now…).

    Liked by 1 person

    1. Have fun Bruno! You’ll probably get there before I publish my posts, as I not only have to write it, but also write it all down & document it, and then rewrite everything about 10 times over until I’m even remotely happy with it! ;D

      I don’t think efficiency is going to be a problem with this game though – I’m certainly not going to be writing the most optimal code, but hopefully readable instead. I still think it’ll fly…!

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s