Progressive Kempston Mouse driver.

ZXNet echo conference «code.zx»

From Kirill Frolov To All 16 September 1998

├┤i, All! The Kempston type mouse is becoming increasingly widespread, but none no progress is being seen. You can simply verify this by running the first any program that comes across where there is an arrow and it is controlled by anything, but not a mouse :-( . But that’s still half the trouble - to move the arrow to long distances you need to swing your arms well (C) Copperlegs from zx.spectrum. Well, so as not to wave your arms and the arrow does not twitch when moving a little there is a progressive mouse driver in which The amount of displacement of the mouse is multiplied by the speed of its movement. That is the faster, the farther when moving one distance. As a result you don't have to wave your arms to move the arrow to the big distance and there is no need for a long and painful attempt to move it a 1 pixel - when moving slowly, everything is smooth. Here is the driver (ts) of Mednonogov. OLDCO DEFW 0 ; COORD DEFW 0 ;coordinates (x-minor, y-major) CONTRB DEFB #FF ;three least significant bits are buttons MOUSDRV LD BC,#FBDF LD DE,(OLDCO) LD HL,(COORD) IN A,(C) ;calculation X LD (OLDCO),A SUB E JR Z,MSEx0 JP P,MSEx1 N.E.G. CALL MSElog N.E.G. ADD A,L JR C,MSExe XOR A JR MSExe MSEx1 CALL MSElog ADD A,L JR C,MSEx11 CP 254 ;max X JR C,MSExe MSEx11 LD A,254 ;max XMSExe LD L,A MSEx0 LD B,#FF ;Y calculation IN A,(C) LD(OLDCO+1),A SUB D JR Z,MSEy0 JP M,MSEy1 CALL MSElog N.E.G. ADD A,H JR C,M.S.Eye XOR A JR MSEye MSEy1 NEG CALL MSElog ADD A,H JR C,MSEy11 CP 190 ;max Y JR C,M.S.Eye MSEy11 LD A,190 ;max Y MSEye LD H,A MSEy0 LD (COORD),HL LD B,#FA ;buttons IN A,(C) LD(CONTRB),A RET ; MSElog CP 4; mouse with acceleration RET C ADD A,A JR C,MSElgC CP 8*2 RET C ADD A,8 JR C,MSElgC CP 120 RET C MSElgC LD A,120 RET How it works - I haven’t delved into it. No comments. But the principle is clear.