Useful developments

ZXNet echo conference «code.zx»

From Alexey Valerievich Akatov To All 9 May 2006

Hello, All I propose to publish interesting solutions regarding Spectrum in this thread. I I will also post my old ones as soon as I have free time (since... there are no new ones and there cannot be) interesting developments. Playing a tape recording through the Spectrum beeper: ┌─- code ─── D.I. IN A, (254) RRA RRA OUT (254), A JR$ - 8 └── code ─── Compiled: ┌─- code ─── 243 219, 254 31 31 211, 254 24, 248 └── code ─── Idea: take the status bit of the tape recorder and send it to the beeper. At one time I made special loaders for his programs that executed similar code within a few seconds, and immediately after the loader on the tape it said program name. It turned out that after loading a very small bootloader Spectrum spoke (!) the name of the program with fairly high sound quality. This method also allows you to protect the program from copying using special software (copy, etc.), because if the loader instead of speech is immediately followed by next block, it will be skipped (due to a pause of several seconds).

From Alexey Valerievich Akatov To All 9 May 2006

Hello, Arigato Small driver for Sinclair joysticks It will be useful when programming in BASIC. Unlike Kempston joystick, which can be polled via port 31 (if memory serves) directly BASIC team, with the Sinclair joystick things are worse. Will make this task easier translated driver. Uses 1,2,3,4,5 format for Sinclair II and 6,7,8,9,0 for Sinclair I. The code of the driver itself (address 65129): ┌─- code ─── ORG FE69h PUSH AF PUSH BC LD B, 00011111b LD A, 239 IN A, (254) AND B XOR B LD (23670), A LD A, 247 IN A,(254) AND B XOR B LD (23671), A POP B.C. POP AF JP 56 └── code ─── Compiled version (to simplify direct input): ┌─- code ─── 245 197 6, 31 62, 239 219, 254 160 168 50, 118, 92 62, 247 219, 254 160 128 50, 119, 92 193 241 195, 56, 0 └── code ─── To activate the driver we use the following subroutine: ┌─- code ─── PUSH AF D.I. LD A, 9 LD I, A IM2 EI POP AF RET └── code ─── Compiled: 254, 243, 62, 9, 237, 71, 237, 94, 251, 241, 201 To stop the driver, perform the following procedure: ┌─- code ─── D.I. IM1 EI RET └── code ─── Compiled: 243, 237, 86, 251, 201 As a result, the state of the Sinclair I joystick will be recorded in the system variable SEED (address: 23670), and Sinclair II in SEED+1 (23671). About the condition The joystick says individual bits: shooting - D0, up - D1, down - D2, right- D3, left - D4. If the bit is set, the key is pressed, if cleared, the key is not pressed. pressed. Because The SEED system variable is used by the random generator numbers, it may be necessary to change the state recording address joysticks (if this disrupts the normal generation of pseudo-random numbers).

From Wladimir Bulchukey To All 9 May 2006

Hello, Arigato Ari> Idea: take the status bit of the tape recorder and send it to the beeper. To your Ari> time I made special loaders for my programs, which Ari> executed similar code within a few seconds, and immediately after Ari> of the loader, the name of the program was pronounced on the tape. It turned out Ari> that after loading a very small bootloader Spectrum said (!) Ari> name of a program with fairly high sound quality. Also this one The Ari> method allows you to protect the program from copying using special Ari> software (copy, etc.), because if after the loader instead of speech there will immediately be Ari> follow the next block, it will be skipped (due to the pause in Ari> a few seconds). Question: when a program is normally loaded for execution, its loader somehow tries to recognize a fragment of speech or simply pauses for a few seconds?

From Alexey Valerievich Akatov To All 9 May 2006

Hello, Wlodek Wlo> Question: when loading a program for execution normally, its loader Wlo> somehow tries to recognize a speech fragment or simply pauses Wlo> for a few seconds? In the example I gave, the looping is infinite, i.e. it will be through the beeper play everything that comes from the tape recorder. For the bootloader you need to do no an endless loop, but choose such a number of iterations to complete it in time speak the recorded speech. P.S. No one is trying to recognize anything (it’s not within the Speccy’s power), it’s just that what is on the tape is reproduced...

From Robus To All 10 May 2006

Hello, Arigato I also have a fun procedure, I wonder if anyone will know what it is what sound will it make? ┌─- CODE ─── LD HL,0 LD A,L M1 RRCA RRCA AND 15 LD E,A LD D,0 PUSH HL LD L,(HL) CALL 949 POP HL DEC L JR NZ,M1 RET └── CODE ─── And here's this one: ┌─- CODE ─── LD HL,0 LD DE,1 M1 PUSH HL LD L,(HL) PUSH DE CALL 949 POP DE POP HL DEC L JR NZ,M1 RET └── CODE ───

From TomCaT To All 10 May 2006

Hello, Arigato Ari> It turned out that after loading a very small Spectrum bootloader Ari> spoke (!) the name of the program with fairly high sound quality. Ari> This method also allows you to protect the program from copying using Ari> special software (copy, etc.), because if behind the loader instead of speech immediately Ari> will be followed by the next block, it will be skipped (due to Ari> pauses of several seconds). That's why I was wondering why the disc "Armageddon Man" says something... beautiful, of course, but this is former tape protection... I see :)

From Alexey Valerievich Akatov To All 10 May 2006

Hello Robus Rob> I also have a fun procedure, I wonder if anyone will know Rob> what is that sound that it makes? If it’s not difficult, provide a compiled version in the decimal system, so that enter using POKE. Just for the sake of such a small program, even assembler I don’t want to launch it, but I’m too lazy to translate it manually...

From Robus To All 11 May 2006

Hello, Arigato Ari> If it’s not difficult, provide the compiled version in decimal Ari> system to enter using POKE. Just for the sake of such a small Ari> I don’t even want to run the assembler program, but translate it manually Ari> laziness... Well, why not, let’s just make a bootloader, in my software it only takes 3 minutes. =) File: Less-003.zip http://zx.pk.ru/attachment.php?attachmentid=3186

From Valery Grigoriev To All 14 May 2006

Hello, Arigato Ari> Playing a tape recording through the Spectrum beeper: Ari> Code: Ari> DI Ari> IN A, (254) Ari> RRA Ari> RRA Ari> OUT (254), A Ari> JR $ - 8 And I'm faster, much faster 1) The option without any twists is yours 2) option with twists - in D we fill in #40, after which if we add after in a,(254) add a,d then the carry flag will contain the value of the required bit (who doesn’t believe let him check) Then D.I. IN A, (254) ADD A,D OUT (254), A JR$ - 7 3) And this is not the limit The transition is always carried out to the same address... which means it can be program and speed up Even if you just blatantly replace JR with JP, then each cycle will be 2 clock cycles long faster (10 bars for JP and 12 bars for JR) D.I. LD HL,METKA METKA:IN A, (254) ADD A,D OUT (254), A JP(HL) 4) And this is not the limit, you can further reduce costs (how?). Just! Let's expand D.I. LD HL,METKA METKA:IN A, (254) ADD A,D OUT (254), A IN A, (254) ADD A,D OUT (254), A IN A, (254) ADD A,D OUT (254), A JP(HL) In this case, the overhead costs associated with the transition JP (HL) will be minimal, and there will be nothing faster to lose the EAR condition (at least at least directly).But if you work through memory (first digitize and then play) there you can do it very quickly (in 21 bars), but it won’t be very short procedure (((-; But if you simply output (pre-digitized sound) there, you can output up to 12 clock cycles grow up (((-; If you are interested, read my article, 3-Bit was the first part, and the second part has not yet been published.