Programme de Musique sur TV
This is a proof-of-concept for playing 1-bit sounds with an unmodified ZX81 (or with emulator such as EightyOne). Although the article is tagged "Music Program" ("Programme Music"), the text clarifies that it only "generates sounds on your television" (Son sur TV), and is intended to be developed further
Listing1.p matches the Figure 1 listing in the article, but ... because this program may not work first time, I enhanced it with directions on the screen (D_FILE contents only, BASIC is unmodified)
* The program must not be used in SLOW mode, so enter FAST first
* On first use, use GOTO 100 per the instructions in the magazine article
SON.P from telecharger matches the Figure 2 listing
What I found most interesting about this how they approached a type-in that has machine code:
- the machine code loader is built-in, so the listing is compatible with pure ASCII
- Listing B1 appears to be a table of some kind, but is actually a list of hex-digits in two columns, to be used as a check for comparing the digits entered into A$
from Echos Sinclair magazine N. 1 pages 12-13
[edit: update Listing1.p (accidently posted Listing2.p)]Music Program
A program in machine language, it will allow you to generate sounds on your television by pressing certain keys on the keyboard.
This program is in reality only a draft that we hope to be able to develop thanks to all your ideas in this same section during future publications. You will discover: two major drawbacks:
-- the first being the use of the <<port>> output of the television. We will therefore not be able to view a screen display while using the program.
-- the second can be easily resolved, it is a return to Basic during execution. Once the program is started, it is impossible to end use. All you have to do is unplug your machine. You will only have to insert the test of a key in your loop so that the program returns to Basic.
Programming :
Programming in machine language requires some explanation.
The three listings, attached, show you the evolution of this programming. The 1st step is the entry as proposed by listing no. 1 by comparing the characters of the variable A$ (line 200) to those of the table. (listing B1)
Listing B1Line 10 : reserve memory space (77 bytes, after the REM). Line 100 : 100 LET A$ = <<9B89...>> storage of hexadecimal codes corresponding to the mnemonics of the microprocessor Z 80 A.Code: Select all
9B 20 89 FD 73 C9 69 CD 00 BB 93 02 7E 44 00 4D 5E 51 00 14 3B 28 31 F7 26 CD 24 BD 00 07 00 11 36 04 2C 40 00 19 00 46 00 AF OF B8 16 28 1E EB 00 DB 0A FF OC CD 12 A9 1A 40 00 D3 00 FF 00 CD 41 A9 4C 40 00 18 38 EO 3C 46 53 78 3D
Lines 300 to 800 character : decoding and hexadecimal calculation, transfer by line 600 POKE to address Q (1st address 16514).
Listing 1Code: Select all
10 REM 11111111111111111111111 11111111111111111111111111111111 11111111111111111111111 20 RAND USR 16558 100 LET Q=16514 200 LET A$="9B89736900937E005E0 03B3126240000362C0000000F161E000 A0C121A000000414C00383C4653783D2 0FDC9CDBB02444D511428F7CDBD07110 4401946AFB828EBDBFFCDA940D3FFCDA 94018E0" 300 FOR P=1 TO LEN A$-1 STEP 2 400 LET X=CODE A$(P)-28 500 LET Y=CODE A$(P+1)-28 600 POKE Q,16*X+Y 700 LET Q=Q+1 800 NEXT P
Execution:
The first execution is done by a GO TO 100. The program will extract two by two the characters of the variable A$ and transfer the character corresponding to the Hex code (listing 2).
Listing 2Code: Select all
10 REM ÓÁsi ËA8 QG ?-2 ½£>, INKEY$ ? SW??xX4CLEAR TAN LN ø¢???=CRUN LN ú¹)¤RND;?ëôC FOR <=COPY LN åRNDPEEK COPY LN åRND / STEP 20 RAND USR 16558 100 LET Q=16514 200 LET A$="9B89736900937E005E0 03B3126240000362C0000000F161E000 A0C121A000000414C00383C4653783D2 0FDC9CDBB02444D511428F7CDBD07110 4401946AFB828EBDBFFCDA940D3FFCDA 94018E0" 300 FOR P=1 TO LEN A$-1 STEP 2 400 LET X=CODE A$(P)-28 500 LET Y=CODE A$(P+1)-28 600 POKE Q,16*X+Y 700 LET Q=Q+1 800 NEXT P
All we have to do is:
- delete lines 100 to 800 (listing no. 3),
- put the machine in FAST mode,
- save the program <<object>> on magnetic tape,
- execute the program by RUN,
- increase the volume of the television
and << play the piano >>.
Listing 3Code: Select all
10 REM ÓÁsi ËA8 QG ?-2 ½£>, INKEY$ ? SW??xX4CLEAR TAN LN ø¢???=CRUN LN ú¹)¤RND;?ëôC FOR <=COPY LN åRNDPEEK COPY LN åRND / STEP 1 20 RAND USR 16558
The program runs on 1 K RAM but will give you a better sound by executing it with your additional memory 16 K RAM.