Third installment in a series on interrupt-driven Z80 machine language programming for the Timex/Sinclair 2068. Covers a BLINK routine that alternates two User Defined Graphics characters on screen using variables for timing, position, and attributes, followed by three sound-effects routines: a border-toggle BEEP, a gun/bomb effect, and a whistle-and-bang bomb effect. Full machine code listings with addresses and mnemonics are provided throughout.
We continue our discussion of interrupt driven routines with BLINK which alternates two different User Defined Graphic characters to the screen.
We need a few more variables, namely:
- TIME–to count down the 1/60th of seconds before the next change.
- WHICH–Character 1 or 2 presently on screen.
- CHAR1–Which UDG number (from o to 20, not the Basic #).
- ATTR1–Attribute of ink/paper for characterl.
- CHAR2–ZND UDG charcter #.
- ATTR2–2ND attribute.
- POSY and POSX–BASIC Type AT 0 to 20 and 0 to 31.
- ATTRA–Address of attribute…
We enter these at the start of the program together with the variables for the music program and put the Blink part in front of the Tune part which we did in our first 2 parts. We again have a new ORG and DISP which will leave our assembled code at 28000.
The interrupt routine continues with the music which we discussed in previous installments. Remember to change your jump address at 65022. You also have to write a routine to enter all the Blink variables.
There are other ways of creating sounds without using the sound generator. One of these is the toggle of the border output–register 294. This is used in Beep. It is such a short routine it fits almost anywhere you want to put it and so is given without addresses.
War games require good shooting and bomb effects. In this routine the whistle and the bang produce a bomb effect. Just doing the bang is a good gun effect by itself.
The game uses a saved variable called EFFECT to toggle on and off the bomb or gun sounds. Again, the routine can go anywhere so we give it without addresses–the XXX being dependent upon where it is assembled.
This completes the sound and interrupt driven programs. Next time we will give you a general menu routine, one that can be used on any size up to a full screen with a cursur that jumps from top to bottom automatically.
Products
Media
Image Gallery
Source Code
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.