Can Of Code

Tag Archives: spectrum assembly language

Hello World in Spectrum assembly

I started this post originally in November 2013 but it ended up in the drafts pile. The idea then came back to me when I heard of the Spectrum ZA Vega IndieGoGo.

After a voyage into the roof I discovered a box of old electronics. Getting completely distracted from what I was supposed to be finding I took a peek inside the box to find a collection of Spectrum consoles and related accessories.

After digging around in the box I found this book:

Spectrum & Spectrum+ Assembly Language Course

Spectrum & Spectrum+ Assembly Language Course

 

I should explain that seeing such a book didn’t instil some sort of nostalgia. If i’m honest, it was before my time. The book did however spike my interest, perhaps I could see what life was like without the comfy luxuries of IDEs and managed languages.

 

Getting Started

It makes sense that the first step is to get the hardware setup. This gifted me with my first two issues:

– I have been reliable informed that none of the Spectrums in the roof actually work. Made in England!

– Even if they did work, I don’t have a TV that has a coax connector.

So my best bet was to try and find a Spectrum emulator. The search was both long and tiresome but I finally found an emulator that both worked and included a code editor.

Enter ZX Spin

ZX Spin

ZX Spin

You can get ZX Spin here. Unlike most emulators I found, this one works on Windows 8 and it runs straight out of its folder, no need to install anything.

 

Time for Hello World

So to print “Hello World” to the screen is a pretty simple command:

PRINT “Hello World”

The first gotcha here is that you would be inclined to type out “PRINT”  however the Spectrum keyboard worked in such a way that the “p” key would write “PRINT”

 

Spectrum Keyboard

Spectrum Keyboard

 

To type a string you need to surrond the string in quotation marks, nothing new there.  So to print out “Hello World” we would have to type:

P key  –  (Right Alt + P)  –   hello world – (Right Alt + P)

Hit enter and you should see:

 

hello-spectrum

 

Next time…

Next time I hope to create a reusable program using the tape emulation. I’m also intrigued by why they chose to use single key presses for commands? I assume it was a technical limitation?  Let me know in the comments if you have an insight.

Posted in Books, Software | Tagged , , , | 15 Comments