Well, I did have a blog on MySpace, but no one reads it and I've neglected it, so I posted some items on FaceBook using the 'notes' thingy which was okay but only people on my friends list could read it or something, so I thought I'd start a blog here. All the best writers have them apparently, so why not me? Well, maybe because my writing is generally the best aspects of mediocrity, and probably because I'll again neglect this, but never mind.
Anyway, a bit about myself: I'm a part-time freelance writer for the magazine Micro Mart (http://www.micromart.co.uk/) published weekly in the United Kingdom and available every Thursday for a partly £2 from your local news agents. I've just finished the first year of my Foundation Degree in Computer Enterprise and work part-time in social care. I have a young daughter, called Ruby Mae, who is fast approaching her second birthday. It's good now she's growing up a bit because it means that we can have a laugh.
But the important thing to know, as this is a gaming blog, is what games I'm playing at the moment... and to be honest, I've not had chance to indulge myself in any binary worlds lately, so here is some Z80 machine code which will happily work on the Sinclair ZX Spectrum for you to look at:
SCR EQU 16384 ; Screen Ram location
ORG $6000 ; This is where we want our program to start in RAM (6*4096)
LD BC,STRING ; Right, let's get the location of where the text is that'll be written
; the screen
LD DE,SCR ; and let's get the locator for the screen and put it into a register
; DE (or in otherwords LET DE=SCR)
LOOP ; Here is our first label, called LOOP
LD A,(BC) ; Let's put the first byte at BC into A, or in otherwords
; LET A=PEEK (BC)
CP 0 ; Compare this to zero, which is the marker for the end of
; the data which we're writing to the screen
JR Z,EXIT ; If A does equal zero then let's go to the label EXIT
RST $10 ; Print A to the screen
INC BC ; Let's increase BC by one so to get the next byte from our
; DATA string
INC DE ; We'll increase DE as well to put the next char one step to the
; right of the previous outputted character
JR LOOP ; This simply jumps back to the label LOOP to repeat the process
EXIT ; Here's our EXIT label
LD BC,0 ; Let's clear the register BC to zero
RET ; RET simply returns to BASIC
STRING ; Here's our STRING label (or in other words, where out text is)
DEFB "Hello World!"
DEFB 13,0 ; 13 is a new line or carriage return, and zero says "end of data"
Good, innit? When assembled, load it into your favourite Speccy emulator and PRINT USR 24576 - amazing eh? But why do you get the zero displayed on the next line after Hello World! is drawn to the screen? Well, you could also try RANDOMIZE USR 24576, but you won't see anything. So, try INK 0: RANDOMIZE USR 24576 - there, it works without the zero being printed... so if you're going to execute the code using the latter method then you need to tell the Speccy to set a colour for what it's going to output first, whic of course you can do in the code itself. But how do you do that? Answers on a post-card.