Where to start?

Discuss game and other programming topics not specifically covered in another forum

Moderator: Programming Moderators

SpeccyGaz
Posts: 3
Joined: Fri Dec 29, 2017 3:52 pm

Where to start?

Postby SpeccyGaz » Fri Dec 29, 2017 8:15 pm

Hi All,

As per my Intro post: viewtopic.php?f=5&t=923 I don't have a ZX Spectrum Next at the moment. But I am considering it.

I have some great memories of the Spectrum from my childhood. I have revived these lately by using emulation on a Raspberry Pi. but still find it somewhat lacking. I know things have obviously moved on and you cannot recreate the same feelings from all those years ago. But I do think having a piece of hardware like the Next with a good keyboard and accompanying joystick will make the experience so much better.

I do want a Next, but it is a lot of money to spend just to play retro games from my youth. (No disrespect either guys, the price tag reflects the effect). So I'm looking for additional reasons to purchase one. Which will be:
  • Have a go at coding some simple games
  • Hopefully encourage my son to start coding some simple games

My Son (9yrs) is into Scratch, I've tried him on Python but he isn't ready yet.

Myself I used to (20+yrs ago) program for a living COBOL ( :lol: ) Informix 4GL and Visual Basic. More recently I've coded in XSLT and started on a bit of Python. So... I've got a background in programming but not programming games.

So to get me to a purchase (when available) I would like to know, for a novice, where would I start when it comes to coding on a Next?

I assume BASIC is the best place to start? What other languages are available?
I also assume most people will not directly input code into the Next itself and that you would write your code in a text editor on a PC, and then transfer it (how?) to the Next to run.

I guess what I am after is a beginners guide to the Next, is such a thing available and if not does anyone have the time/passion to put one together?

I think it would be a great hobby to have, starting with some easy to write programs, looking and learning from other peoples work in BASIC and then eventually moving on to create something of my own that I can share with my son to hopefully get his interest.

TIA

SpeccyGaz

User avatar
KevB
Posts: 57
Joined: Tue Dec 19, 2017 6:34 pm
Location: Yorkshire, United Kingdom
Contact:

Re: Where to start?

Postby KevB » Fri Dec 29, 2017 11:31 pm

Hi Gaz, I read your post and also share many happy memories of the ZX Spectrum. I liked the part about changing the artwork :) I can relate to a lot of what your wrote.

I was once a novice...

Playing games wasn't enough. The magazines around at the time, Crash, Your Sinclair and Sinclair User covered programming and development of games. Magazine features such as "Hewson's Helpline", "Code Talk" and "Cecco's Log" were big influences for me. There were also books such as "Input" and "The Complete Spectrum". Ocean and many other companies placed adverts for programmers and artists. All this fueled my desire to program games from the age of 14 :)

I played with BASIC but it wasn't capable of delivering the performance needed so I turned to Z-80 assembler and I was HOOKED! A friend of mine was into graphic art so he introduced me to the O.C.P Art Studio. He also gave me his copy of the O.C.P Full Screen Editor/Assembler written by the same author as programming wasn't for him. Somebody had recommended a book titled "8080 And Z-80 Assembly Language Programming" by Kathe Spracklen which I would use for many years and still refer to now. Christmas 1987 gave us the 128K Spectrum +3 at a cut down price of £199 (RRP £249) so I was able to upgrade from the original 48K to something more practical. The price of the Next is quite fair when comparing the prices of Sinclair hardware back in the 80s. In fact, the price of the Next was not going to be an issue because of the amount of enjoyment is was going to bring me!!! I also got my hands on a Multiface 3 (£49) which made life easier. I spent a lot of hours programming, hacking games and drawing graphics with only books, magazines and my thirst to learn, create and progress!!!

Looking back, I lacked a proper development system which made it difficult to develop using the Spectrum alone. I didn't realize this until I entered the UK games industry. I was introduced to a cross-development system called PDS (Programmers Development System). This blew me away as it used a special interface to connect to a PC ISA card allowing me to download my code from the host. I bought a 386 PC with a 40MB hard drive and hooked it up to the Spectrum and was able to develop larger scale projects with ease and also use Deluxe Paint PC for graphics. My ZX Spectrum demos were enough to get me a job but I quickly progressed to Amiga which used PDS v2 (P2) connected to the parallel port and Mega-Drive which used SNASM development tools (the CPU was replaced by a black box connected to a SCSI card). I'd studied Motorola MC68000 and found it really easy to pick it up as assembly programming is very similar across different microprocessors. The hardware on those platforms was far more complex than the humble Speccy and I would spend hours on a night and weekend studying. I pretty much lived at the office during that period.

I have to admit that I had picked up some bad habits from the days of being a "bedroom coder" and these would get addressed one by one lol. For starters, self modifying code was now BANNED because of caching and ROM cartridges!!! The Spectrum relied on a lot of crazy methods to gain performance. I started using terms such as 'Game Engine" and started to keep my hardware access completely separate from my game logic. I also wrote a lot of library code that I would reuse. I had an empty project known as a "Shell" that I could lay the foundations of each new project on. It contained a set of input/output routines for that particular platform. I also wrote a lot of my own tools on both Amiga and PC and PC is where I settled in recent years.

Sadly, I never got anything published on the Speccy so now the Next has arrived, it's a great opportunity to use those skills I acquired many years ago and be there during the beginning.

That's my story.

So, where to begin with the Next... tbh, I find this a difficult question to answer because there are so many choices and it's down to personal preference and how far you want to stray from your comfort zone... it can be a difficult process getting to grips with a system at such low level if you've never programmed hardware before. I've always done software development when I've had plenty of time on my hands. Learning Next BASIC should be easy as you have programmed high level languages in the past. It really depends on the the level you wish to progress. I would say learn Z-80 but then that's because I am biased. I would also recommend learning the hardware. You could keep things simple and just program the original 48K system to begin with and progress to the more advanced areas of the Next's hardware over time. A mixture of both BASIC and Z-80 wouldn't hurt either.

As for games... knowing Z-80 or the Spectrum's hardware does not make you a games coder and that's something I realized when I read my first assembly language programming book! Game algorithms and methods are something that come over time. There are plenty of tutorials on the web. Back in the day, there were tips and examples in the magazines but nothing to the level of the modern day. You had to think for yourself most of the time. I do admit that a good storming session with other coders can be very rewarding. Studying the work of others did help me initially and I can never deny that.

For Next development, I'm taking advantage of the UART with a serial link wired into the ESP8266 socket to send code to the TBBlue 2A from a PC but this has required my own R&D: viewtopic.php?f=6&t=895

I'm sure other members can share their knowledge of Next development tools and directions to take. Everyone has a story to tell :)
128K+, +2, +3, MF3, TBBlue 2A (2MB). ZX Spectrum fan since 1985. Next developer https://twitter.com/9bitcolor :: http://www.9bitcolor.com/

philipstephens
Posts: 33
Joined: Mon May 29, 2017 8:38 pm

Re: Where to start?

Postby philipstephens » Sat Dec 30, 2017 2:11 am

The new Next BASIC supports the new graphic and sound features of the Next, so it would be a good place to start in learning how to program the Next. In fact, I would go as far as to say you could write BASIC programs on the Next itself and save them directly onto an SD card, so there would be no need to use a development environment on a separate PC, unless you were truly adverse to typing in BASIC programs line by line rather than using a full-screen editor. Given that BASIC programs still need line numbers, I don't see a full-screen editor being a particularly useful tool, and you won't get the immediate feedback of running the program.

If you ever decide to take the plunge and do some Z80 assembly language programming, then using a separate PC for development would likely be the easiest approach, at least until there is a good set of native tools available. I'm not sure if such tools currently exist. If not, I may decide to work on some myself, because I would really like to be able to develop assembly language programs directly on the Next itself than have to assemble on a separate PC, then download and run on the Next.

SpeccyGaz
Posts: 3
Joined: Fri Dec 29, 2017 3:52 pm

Re: Where to start?

Postby SpeccyGaz » Sat Dec 30, 2017 11:35 am

Thank you both for your comments.

That is an interesting read KevB :) I can see you moved onto the Amiga, that was another fave of mine also. I'm about an hour into the "Bedroom to Billionaires - The Amiga Years" fascinating stuff and amazing to see just how touch and go it was in terms of getting that machine off of the ground.

Philip, yes you are right.... I'm running before walking here. After my reality check, I will now install ZEsarUX and look through a book I bought a year back "ZX Spectrum Games Code Club - Gary Plowman".

I'll see where that takes me first :)

User avatar
KevB
Posts: 57
Joined: Tue Dec 19, 2017 6:34 pm
Location: Yorkshire, United Kingdom
Contact:

Re: Where to start?

Postby KevB » Sat Dec 30, 2017 4:10 pm

You are welcome Gaz.

For me, the Spectrum and the Amiga are two completely different worlds. I went as far as I could with the Amiga development wise and was very satisfied with my achievements (also true for Mega-Drive). I hung on as long as I could but eventually moved on to the PC which in my opinion is a 'Big Amiga'. It was the first machine I had programmed with graphic and sound hardware and I look back with fond memories. The games were awesome too!!! I really liked The Bitmap Brothers work.

The idea of programming the Amiga seemed daunting at first. I had messed around with MC68000 on the Atari ST which in my opinion is a 'Big Spectrum' lol. An Amiga developer lent me a copy of the "Amiga Hardware Reference Manual" and let me use his Amiga Shell so I could cold start the machine. It all fell into place quite quickly and I was writing my own BLIT and Copper routines in no time. I eventually replaced his Shell with my own routines.

The Mega-Drive was difficult at first because the documentation was just a long list of hardware registers. There where no examples and it was clear that it was very different to the Amiga. The Next may seem difficult when reading through the Wiki as a beginner. You need to have some idea of how to use this information. Knowing the Mega-Drive system made life easier when it came to learning GameBoy as they worked in similar ways. The Next is interesting because it has extended the Spectrum in a way that shares some of the common elements found in the Amiga, Mega-Drive and GameBoy.

There became a point where it was no longer practical to access hardware directly. That rule does not apply to the Next ;)

As for the Spectrum, it was my first computer and something I keep coming back to.

I first started learning Z-80 with a small piece of code from a book tutorial that drew a sprite on the screen and scanned the keyboard so I could move it around and quit back to the assembler. On school nights, I had to turn the computer off and go to bed but I would stay up late reading books and scribbling down Z-80 on paper ready to type in the next day. I remember adding clipping to the X and Y co-ordinates as the Spectrum crashed when the sprite left the screen memory. The game loop was synchronized to the 50Hz vertical blank interrupt using the Halt instruction. This allowed me to change the border colour to create stable bars on the screen for displaying code execution times. Things evolved from there when I think back...

Good luck.
128K+, +2, +3, MF3, TBBlue 2A (2MB). ZX Spectrum fan since 1985. Next developer https://twitter.com/9bitcolor :: http://www.9bitcolor.com/

Alcoholics Anonymous
Posts: 463
Joined: Mon May 29, 2017 7:00 pm

Re: Where to start?

Postby Alcoholics Anonymous » Sun Dec 31, 2017 12:40 am

SpeccyGaz wrote:
Fri Dec 29, 2017 8:15 pm
I assume BASIC is the best place to start? What other languages are available?
There is Next Basic as already mentioned which extends traditional +3 basic to access some of the Next's new features. There's also Boriel basic which is a basic compiler running on a pc; it compiles a somewhat extended version of 48k basic and has some libraries you can use for basic text and graphics.

Then there's z88dk which is a modern cross-dev environment for c and asm. It has two c compilers, an assembler, linker, librarian and a large z80 library that can be used. For the Next, it can place code and data into any memory bank, defines most constants for the Next hw and has specialized libraries that are still being developed. It's able to generate any kind of output file, including raw binaries covering the entire memory space, three variations of dot commands, tap files and sna snapshots (which is what most devs are using atm). A new type will come that will contain an entire program (1MB or more if there are resources attached).


Who is online

Users browsing this forum: No registered users and 1 guest