Pick a key, any key…

Finally!  The mythical keyboard post!!  Sorry it’s taken so long, but SokoBAArn was taking it’s time (along with a large & overgrown garden back in the real world). Anyway, we’re here now, woohoo!!

Back in the depths of time I did a short piece on how to detect if a key is pressed, which used the following code:

WAITFORKEY:
ld a, 0
in a, (254)
cpl
and %00011111
jp z, WAITFORKEY

That’s actually the basis for all keyboard reading, and as complicated as it gets, just that we were doing a particular and simple case – testing for any key being pressed.

Continue reading

Fully functioning

Quick post today, just covering a single concept, but it’s such a big concept.  Even already our programs are becoming a bit big and monolithic, and so could do with a bit of structure.  Most languages have the concept of ‘functions’ or ‘sub-routines’, and Z80 is no different. Continue reading

Pause on tap

There’s two things which I don’t like about that colours program – firstly that the screen wasn’t clear before we coloured it, and secondly that it immediately returns to BASIC afterwards, and so you lose the bottom two rows of the screen before you even had a chance to see them.

We’ll get onto the screen shortly (I promise!), but first, that other issue… Continue reading