Off Topic / Trying out ZX80 assembler on the ZX Spectrum

Author
Message
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 27th Jun 2019 11:43
Hi all. I've recently been playing about with some retro programming on the Speccy. Re-familiarising myself with BASIC on it and also trying to learn a little machine code. Over the last month I have realised why I did not get far with assembly the first time round!

I have learned more than I did all those years ago though and actually understand a little of what's going on
https://www.youtube.com/watch?v=kacdVJaCUgM
The code for the above machine code examples is pretty awful I imagine, but it was fast and was quite good with memory (could be improved I think, but have moved on to UDG stuff now).
I know most people here aren't going to give a monkeys about programming a machine from 1982, but there may be some who are and even some who did! Hopefully, I may be able to add some more examples here when I work em out!
The biggest headache I get at the moment is the lack of registers to use (I'm used to having as many variables as I want.). I haven't yet sussed push and pop as I have only used 8 bit values for loops etc and it seems push and pop need 16 bit values, so haven't worked when I'm using b or c for loops. I also have the issue that some calls use these as well, so it messes up the loops again! What registers to use is the most confusing part I find so far.
Still what I have done is so much faster than the equivalent basic routine it's not even funny!
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 28th Jun 2019 22:51
Cool
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 30th Jun 2019 12:39
Thanks Synchromesh Took some doing, had to literally program each pixel block by block. Since learned how to actually read data in, so could make it a bit easier now, still a shed load of data though
Just in case any one is interested in what the code to do the last anim looks like here it is. It's not pretty though

Game Guru scripting might start looking a bit easier to follow after trying to decipher this lot It's not great, but just trying to learn how to use the graphics and sound at the sec. Originally I had all of it coded manually, but added the call commands to reduce it down a bit.
I've since done this but really need to suss out a lot more before I can move the bat. I can move it, but not under player control as yet. Or I could cheat and use Basic for some bits
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Jul 2019 21:49 Edited at: 3rd Jul 2019 21:57
"some who did", yup that would me for one.

Fond memories of all the headaches I suffered from the Speccy architecture.

btw, just to be a pedant, it's Z80 assembler.
Been there, done that, got all the T-Shirts!
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 4th Jul 2019 13:34
Ah lol, yeah that's the Spectrum part of my Brain associating the two Not done much since the breakout picture, giving my brain a rest. Getting it to recognise key presses to move is way harder than it ought to be I think I need to go even simpler for a first game. I have a code snippet for detecting keys out of an old book I got back when the Spectrum was still current. It seems ok, but it goes further than I understand as yet, so it's not massively useful (I like to at least mostly understand what I'm using).

I find the logic commands odd and could do with a list of em all I think. Going from tutorials and such is okay for a bit, but I am always forgetting commands and there's probably lots I haven't even seen yet. Anything that uses low and high bytes are still a mystery to me as well :p I've done my best to avoid that so far. That's actually the issue I've had here; grabbing the co-ordinates of the bat and clearing the background with yellow spaces.
I've got round it by colouring the entire line with yellow spaces. But that won't help when (and if) I have a ball bouncing around.
I wrote this in AGK to speed up entering UDG data. Now I can grab the data from this (it sends it to the clipboard) and paste it directly into the assembler. I also wrote a space invaders clone minus bases the other night, to check my brain is okay lol as I was beginning to worry. Hopefully it's just the assembly routines and not an onset of early Alzheimer's.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Jul 2019 23:16 Edited at: 6th Jul 2019 10:01
I was sent on an "Introduction to Micro-Processors" course as a young airman just out of basic training (the press-ups kind not the computer language).

The course was based on the PET and the two week course ended with our instructor telling us to devise a project that used the built in Assembler to manipulate a part of the machine using machine code, like access a button to flash a box on screen or something like that.

When it came time to demonstrate our projects it probably won't come as a surprise to anyone here that mine was a space invaders clone.
Been there, done that, got all the T-Shirts!
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 6th Jul 2019 05:47
That's weird, to take a rest from assembly, I loaded AGK and decided to try making Space Invaders.

Still rough on presentation, but feeling pretty nice as far as space invaders goes. I'm going to have to pick your brains if you can do this in assembler
I just got my player flashing after being hit (last item to sort) and popped here to check in. Noticed you had responded and then read about your Space Invaders story. The last thing I think of about training in the Air Force is Commodore PET Assembler Still, weird timing or what?
I must admit, I found AGK so nice after a few weeks of wrapping my head round the Spectrum Display. I got my space invaders game up in no time! Reminds me that we have it easy these days! Thankfully
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-20 07:40:01
Your offset time is: 2024-04-20 07:40:01