ZX Curiosities
- Birth of the Spectrum
- Enlarged PRINT from BASIC
- Digital Sound Recording
Birth of the Spectrum
April 1982 is a month many of us will remember: the month Clive Sinclair, with a smile on his face, presented a piece of plastic with rubber keys and a RAINBOW across the top-right corner. The Spectrum 48K brought him fame, money and a name. For many of us, it opened the way into the world of technology and computing, the way into the 20th century.
The RAINBOW is our most widespread computer, but also the cheapest. Clive received a knighthood for his inventions. The story of the Spectrum began way back in 1980, when the ZX80 and ZX81 appeared.
They were cheap computers, had 8K of ROM and could calculate with decimal numbers. A pile of chips was replaced by a ULA, a few other minor modifications were made, and the real Spectrum was born.
If the function of the ULA had been made using vacuum tubes, all those tubes would not have fit in even a fairly large room (and that’s without even mentioning the breakdowns). For the RAINBOW, Sir Clive made the microdrive (the first microdrive in the history of computing), whose cartridge was smaller than a matchbox. Compared with the disk systems of the ATARI or C64 (the RAINBOW’s main rival), or the disk drive of any other computer, it would have been much faster. Although Clive never imagined the Spectrum would be used for games, to this day there are officially around 8,000 programs, and unofficially more than 12,000 (both games and utilities).
Clive made full use of the Spectrum; there is nothing superfluous in it, only the most essential parts of a computer. The only problem with the Spectrum is the membrane—that is, the board with contacts, which works on the principle that when you press a key (rubber button), you connect the contacts carrying the current, and the computer types a command. The membrane can last two to three years, four at most.
The rubber keys are good for games, but not so good for prolonged typing, so you should either get a Spectrum + or a professional keyboard. The locally made ones are TREND and INES.
INES is the best professional keyboard for the RAINBOW. There is a general-purpose interface for the Spectrum to which you can connect anything you can think of. When connecting additional devices that consume a lot of power (e.g. a printer), it is recommended that you make an additional power supply for that peripheral; otherwise the 7805 regulator may fail (read: explode), since it is already operating at the limits of its capabilities. In short, you need to add a +5V power supply. Starting with the next issue of ZX Revija, I’ll describe Sinclair’s computers, as well as Amstrad’s Spectrums, and the reasons why Sir Clive Sinclair sold his company to Amstrad.
I know many people already know this, but it is still worth returning to the golden age of the RAINBOW.
CONTRIBUTED BY:
Čanović Srđan
XII vojvođa.ud.brig. 59
25000 Sombor
tel.025/27-446
Enlarged PRINT from BASIC
This article can be a continuation of the piece in issue 1 of ZX REVIJA, whose author was DADO. Here, too, the LPRINT command is used to write on the screen. I’d like to explain in a little more detail how this is possible.
To start, type in the following program:
5 BORDER 1:PAPER 1:INK 7 :BRIGHT 1:CLS
10 LET a=64
20 LET a$= ZX REVIJA
30 FOR i=0TO7
40 POKE 23681,a+i:
LPRINT a$
50 NEXT i
60 LET a=72
70 LET a$=
80 FOR i=0TO7
90 POKE 23681,a+i:
LPRINT a$
100 NEXT i
110 LET a=80
120 LET a$= SUBOTA
130 FOR i=0TO7
140 POKE 23681,a+i:
ZX Curiosities
Printer Buffer on the Screen
LPRINT a$ 150 NEXT i 160 GO TO 160
You probably noticed straight away that the core of the program consists of two commands. They are POKE 23681,x and LPRINT a$. If you look in the Spectrum manual, in the chapter on system variables, it says that this location is unused (NOT USED), which is not true! Another strange thing is that the LPRINT command writes to the screen, even though that is not its function.
The answer is very simple. When the computer is initialized, the value at location 23681 is set to 91. To make this clearer, look at the location before 23681. At 23680 is the low byte of the address of the character in the printer buffer. This value is zero if you are not currently using the printer.
Now, if you still haven’t understood, start thinking logically. You surely know this formula: low byte + 256 × high byte = address value/code 280/that is, 0 + 256 × 91 = 23296. This is the beginning of the printer buffer.
If you change the value at location 23681, that means you have moved that space in memory.
If you enter numbers from 64 to 71 at 23681, you will have turned the first third of the screen into a printer buffer. Likewise, if you use numbers from 72 to 79, or from 80 to 87, the beginning of the printer buffer will be in the second or third third of the screen, respectively. That is the secret of why we can use the printer command to write to the screen.
But it is still unclear where the enlargement comes from, since nothing in the program indicates it. The answer is that bytes in the printer buffer are stored in a different format.
Just remember that no fewer than 256 bytes of memory are reserved in that buffer for 32 characters. And that is the whole secret!!! One more thing: if you add STEP 2 after the command in lines 30, 80 and 130, you will get an even more interesting pattern on the screen.
B.J.
Digital Sound Recording
Using the routine below, you can record any sound into the computer’s memory. To do this, you first need to record onto a cassette the sound you want to digitize. Start the tape, and when it reaches the part you want, press ENTER and wait for the computer to finish its task. When it is done, the message OK will appear. The machine-code routine can be used on its own, without BASIC (even separately, since it contains two routines: one for recording and one for playback).
BASIC demonstration:
1 CLEAR 32767:REM reserves space for the sound file
2 PRINT digital sound recording
3 PRINT start the cassette recorder
4 PRINT press ENTER at the selected part
5 RANDOMIZE USR 65290:
REM digital recording
6 REM for playback, enter
7 REM RANDOMIZE USR 65318
The routine itself is very short and is stored starting at address 65290. Before using the routine, be sure to lower RAMTOP to 32767.
Start digital recording with:
RANDOMIZE USR 65290
and playback with:
RANDOMIZE USR 65318
65290 243 DI
91 33,0,128 LD HL,32768
94 6,8 LD B,8
96 219,254 IN A,(254)
98 203,119 BIT 6,A
300 32,2 JR NZ,65304
302 203,254 SET 7,(HL)
304 203,62 SRL (HL)
306 16,244 DJNZ 65296
308 203,14 RRC (HL)
310 35 INC HL
311 124 LD A,H
312 254,254 CP 254
314 32,234 JR NZ,65294
316 251 EI
317 201 RET
65318 243 DI
319 33,0,128 LD HL,32768
322 6,8 LD B,8
324 203,70 BIT 0,(HL)
326 40,4 JR NZ,65332
328 62,0 LD A,0
330 211,254 OUT (254),A
332 62,255 LD A,255
334 211,254 OUT (254),A
336 203,6 RLC (HL)
338 16,240 DJNZ 65324
340 203,6 RLC (HL)
342 35 INC HL
343 124 LD A,H
344 254,254 CP 254
346 32,230 JR NZ,65322
348 251 EI
349 201 RET
You can put this routine into memory using a DATA statement or an assembler.
APPENDIX PREPARED BY:
Brada Jožef
Bajmočka 18
24220 Čantivar
Share your thoughts about the article