"PadCalc"
1983 September.
From B.R. Law.
ZX81.NL Archives:
[Zx81:Type-Ins] "Your Computer" campaign...
Re: [Zx81:Type-Ins] "Your Computer" campaign...
Last edited by XavSnap on Wed Aug 10, 2022 1:15 am, edited 1 time in total.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Re: [Zx81:Type-Ins] "Your Computer" campaign...
"Death Worm" 1983 September.
"Intelligent Animal" 1983 September.
"Intelligent Animal" 1983 September.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Re: [Zx81:Type-Ins] "Your Computer" campaign...
"Death Duel"
1983 August.
From Igor Tavcar.
ZX81.NL Archives:
1983 August.
From Igor Tavcar.
ZX81.NL Archives:
Last edited by XavSnap on Wed Aug 10, 2022 1:16 am, edited 1 time in total.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Re: [Zx81:Type-Ins] "Your Computer" campaign...
"Tank Attack"
1983 August.
From R. Coombs.
ZX81.NL Archives:
1983 August.
From R. Coombs.
ZX81.NL Archives:
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Re: [Zx81:Type-Ins] "Your Computer" ZX-81 MUSIC by John Sylvester
ZX-81 MUSIC John Sylvester Mar'82 34 8203
One-sentence review: This is quite the 1-bit sound program, sound is quite good
* Plays a tune
* Lets you enter Keyboard mode (input "K"), where the keys ABCDEFG play notes
* Or a mode to practice-entering notes, which plays a single note of the specified duration
What it does not have is a song editor. Change the strings in Lines 190-195 to edit the tune:
Challenge! Can you write some lines of BASIC code to edit the tune interactively?
from "Your Computer" 03/82 table of contents:
Your Computer magazine March 1982 Vol.2 No. 3 pages 34-35
One-sentence review: This is quite the 1-bit sound program, sound is quite good
* Plays a tune
* Lets you enter Keyboard mode (input "K"), where the keys ABCDEFG play notes
* Or a mode to practice-entering notes, which plays a single note of the specified duration
What it does not have is a song editor. Change the strings in Lines 190-195 to edit the tune:
Code: Select all
190 LET X$="333333343 3333333"
191 LET N$="CEGGGGGCG EFGGFDC"
195 LET D$="11333371111144448"
Challenge! Can you write some lines of BASIC code to edit the tune interactively?
from "Your Computer" 03/82 table of contents:
ZX-81 MUSIC: [page] 34
A program devised by John Sylvester which
allows the ZX-81 to play notes covering an
eight-octave range.
Your Computer magazine March 1982 Vol.2 No. 3 pages 34-35
SOFTWARE
ZX-81 MUSIC
The ZX-81 may not be
renowned for its dulcet tones,
but passable music is well
within its capabilities without
hardware modifications. John
Sylvester shows how.
THE ZX-81 HAS one major failing when it comes 10 creating music — it cannot use the video and create sound at the same time. Nevertheless, you can obtain pleasing results with the notes which cover an eight-octave range complete with semitones. The notes are at first estimated, and then fine-tuned with the aid of an electric organ. This is, of course, no guarantee that the final result is correct.
To hear the music generated, you can use a cassette recorder in record mode and, if available, use the monitor facility or feed the cassette output through a suitable amplifier.
The easiest wave-form to produce on a computer is that of a square wave, since this is a simple switching pattern. The number of times the wave-form is switched in one second denotes the frequency of the output. Figure 1 shows a square wave.
The time taken to complete one cycle is called the periodic time and in figure 1 is shown by tl. t2 and t3 are the times during which the wave-form is switched on and off. The periodic time is the reciprocal of the frequency in hertz or cycles per second.
If the frequency is 50Hz, the periodic time is 20ms., so t2 and t3 equal 10ms. each. If the periodic time is increased, the frequency decreases and conversely, if the periodic time is decreased, the frequency increases.
Now that we have seen how to produce a frequency by switching on and off, the question arises as to how to use the ZX-81 to achieve the same effect. J Chalmers, in Software File, December issue, suggested a simple circuit which would allow you to do this. However, the capability is built into the ZX-81 and there is no need for extra circuits.
Listening to a recording of a saved program you will notice that there is a definite variation in frequency. So, if we can discover how this is done, we can use the cassette port to produce our frequencies.
Without describing in detail the exact working of the cassette circuitry, it is sufficient to know that the output to the cassette is via port FF. This alone will not produce any response. After extensive experimenting I found that port FE was also involved, so that the instructionsturned the cassette port on andCode: Select all
OUT (FF),A
turned it off. We now have the necessary data to produce the switching required.Code: Select all
IN A,(FE)
Listing 1 contains machine code to control the cassette output. From the listing you will see that after output and input, there is a delay which produces the time required for t2 and t3. The length of note is determined by Time and this is decremented by the half-cycle count after one complete cycle. This means for a given value in Time, the duration of all notes is constant.
The machine code is placed in the Rem statement of Basic at line 1. Listing 2 gives a Basic program to be used in conjunction with the machine code. Lines 10 to 180 calculate the frequency of a given note in a specific octave; Lines 300 to 330 calculate the counts to give the half-cycle delays necessary to produce the required frequencies. To raise or lower the pitch of all octaves the value of 17E-6 in line 300 may be altered. All the counts calculated are stored as characters in the array O$.
Lines 190 to 196 play an introductory tune after the initialisation of the array. The user can specify notes, octaves and duration of the notes in lines 200 to 260. Notes are entered using A to G; semitones are indicated by inverse A,B,D,E and G; a pause by entering a space at the required point is performed in lines 1200 to 1220.
Octaves are indicated by 1 to 8, and the duration by to F. Lines 1000 to 1110 constitute the subroutine which scans the input data. They also retrieve the correct counts from the array and Poke them into the locations in the machine code. The machine-code program is then entered.
Lines 1500 to 1620 calculate the values of the semitones and Poke them into the correct locations. Lines 2000 to 2065 allow the user to play direct from the keyboard. The octave is selected by pressing the keys 1 to 8, and the notes by keys A to G. If a semitone is required, the S key is pressed before the note. The duration in this mode is set to 1 — line 2050. Press K to return to the normal mode.
You can use the machine-code routine to produce sound effects by Poking the locations with the counts to achieve the correct frequency and duration.Listing 1. Machine code.Code: Select all
Variable Use O$ Array for holding the counts for the relevant frequencies J Octave pointer for array O$ N Note pointer for array O$ X$ Octave string N$ Note string D$ Duration string F Calculation of frequency and MSD of count for frequency X String pointer used with X$, N$ and D$ F1 LSD of count for frequency T Pause count SF Semitone flag for direct-keyboard operation Glossary
NOTES:Code: Select all
4082 FF 00 TIME 00FF ;DURATION COUNT 4084 00 00 FREQ 0000 ;NOTE COUNT 4086 2A 82 40 LD HL,(TIME) 4089 ED 5B 84 40 LD DE,(FREQ) 408D 01 00 00 LD BC,0 4090 E5 CYCLE PUSH HL ;SAVE DURATION ON STACK 4091 D3 FF OUT (FF),A ;TURN ON CASSETTE PORT 4093 CD A2 40 CALL DELAY 4096 DB FE IN A,(FE) ;TURN OFF CASSETTE PORT 4098 CD A2 40 CALL DELAY 409B E1 POP HL ;GET DURATION FROM STACK 409C B7 OR A ;CLEAR CARRY FLAG 409D ED 52 SBC HL,DE ;DECREMENT DURATION BY ONE HALF CYCLE 409F 30 EF JR NC,CYCLE ;DO ANOTHER CYCLE 40A1 C9 RET 40A2 2A 84 40 DELAY LD HL,(FREQ) ;GET DELAY FOR ONE HALF CYCLE 40A5 37 LOOP SCF ;SET CARRY FLAG 40A6 ED 42 SBC HL,BC ;DECREMENT DELAY BY ONE 40A8 30 FB JR NC,LOOP ;DELAY NOT DONE 40AA C9 RET
1. VALUE IN FREQ MUST NEVER BE 0, OR PROGRAM WILL LOOP INDEFINITELY.
2. DURATION IS DETERMINED BY LOC 4083, LOC 4082 ALWAYS FF.
3. COUNT FOR A GIVEN FREQUENCY IS FOUND BY, 1/(F*17E-6).
Listing 2. The Basic program.■Code: Select all
1 REM ** THIS LINE WILL HOLD THE MACHINE CODE ** 9 REM ** INITIALISE VARIABLES ** 10 DIM O$(8,7,2) 15 FAST 20 FOR J=1 TO 8 30 LET N=1 39 REM ** CALCULATES NOTE A ** 40 LET F=INT ((26*2**(J-1)+2**(J-1)*(2/3))+.5) 50 GOSUB 300 59 REM ** CALCULATES NOTE B ** 60 LET F=INT (30*2**(J-1)+.5) 70 GOSUB 300 79 REM ** CALCULATES NOTE C ** 80 LET F=INT (32*2**(J-1)+.5) 90 GOSUB 300 99 REM ** CALCULATES NOTE D ** 100 LET F=INT (36*2**(J-1)+.5) 110 GOSUB 300 119 REM ** CALCULATES NOTE E ** 120 LET F=INT (40*2**(J-1)+.5) 130 GOSUB 300 139 REM ** CALCULATES NOTE F ** 140 LET F=INT ((42*2**(J-1)+2**(J-1)*(2/3))+.5) 150 GOSUB 300 159 REM ** CALCULATES NOTE G ** 160 LET F=INT (48*2**(J-1)+.5) 170 GOSUB 300 180 NEXT J 189 REM ** PLAY INTRODUCTORY TUNE ** 190 LET X$="333333343 3333333" 191 LET N$="CEGGGGGCG EFGGFDC" 195 LET D$="11333371111144448" 196 GOTO 270 199 REM ** INPUT DATA - K TRANSFERS CONTROL DIRECT TO KEYS ** 200 PRINT "NOTES A-G" 204 INPUT N$ 205 IF N$(1)="K" THEN GOTO 2000 210 PRINT "OCTAVES 1-8" 230 INPUT X$ 250 PRINT "DURATION 0-F" 260 INPUT D$ 270 GOSUB 1000 275 CLS 280 GOTO 200 299 REM ** CONVERT NOTES TO FREQUENCY COUNT ** 300 LET F=INT ((1/(F*17E-6))+.5) 305 LET O$(J,N,2)=CHR$ (F-(INT (F/256)*256)) 310 LET O$(J,N,1)=CHR$ (INT (F/256)) 320 LET N=N+1 330 RETURN 999 REM ** START PLAYING TUNE ** 1000 FOR X=1 TO LEN N$ 1010 LET N=CODE N$(X)-37 1020 LET J=CODE X$(X)-28 1030 LET D=(CODE D$(X)-28)*16 1039 REM ** TEST FOR SEMITONE ** 1040 IF N>128 THEN GOTO 1500 1044 REM ** TEST FOR PAUSE ** 1045 IF N<0 THEN GOTO 1200 1050 POKE 16516,CODE O$(J,N,2) 1060 POKE 16517,CODE O$(J,N,1) 1070 POKE 16515,D 1080 LET C=USR 16518 1090 NEXT X 1110 RETURN 1199 REM *# PAUSE ROUTINE ** 1200 FOR T=1 TO D*8 1210 NEXT T 1220 GOTO 1090 1499 REM ** SEMITONE GENERATOR ** 1500 LET N=N-128 1505 IF N=1 OR N=2 OR N=4 OR N=5 OR N=7 THEN GOTO 1510 1506 STOP 1510 IF N=1 THEN GOTO 1600 1520 LET F=256*CODE O$(J,N-1,1)+CODE O$(J,N-1,2) 1530 LET F1=256*CODE O$(J,N,1)+CODE O$(J,N,2) 1540 LET F=INT ((F1+F)/2+.5) 1550 LET F1=F-(INT (F/256)*256) 1560 LET F=INT (F/256) 1570 POKE 16516,F1 1580 POKE 16517,F 1590 GOTO 1070 1600 LET F=256*CODE O$(J,N,1)+CODE O$(J,N,2) 1610 LET F1=256*CODE O$(J-1,7,1)+CODE O$(J-1,7,2) 1620 GOTO 1540 2000 LET SF=0 2002 IF INKEY$ ="" THEN GOTO 2002 2010 LET N$=INKEY$ 2015 IF N$="K" THEN GOTO 200 2020 IF N$="S" THEN LET SF=1 2030 IF N$>"0" AND N$<"9" THEN LET X$=N$ 2040 IF N$<"A" OR N$>"G" THEN GOTO 2002 2045 IF SF=1 THEN LET N$=CHR$ (CODE N$+128) 2050 LET D$="1" 2055 LET SF=0 2060 GOSUB 1000 2065 GOTO 2002