ZX Pilot #39
11 октября 2000 |
|
Coding - driver mouse Kempston mouse.
C O D I N G (C) SERGIUS PUZZLER Again, the driver kempston mouse. How many times asserted the world coders but in any unwilling to believe that there are controllers with two ways to connect buttons, and do not account for writing software both. Is it so difficult? It turns out that, yes. Perhaps it will be easier to persuade all owners of mice to put the switch that changes the left button on the right. But that is not enough to all switches. So where is the exit? A He has long been known, but for some reason many of his hitherto ignored. It turns out, and experiments confirm this, we can write a program that very artful way manages to define and does not make a mistake, which button your mouse is connected to the 0-th bit of the Comptroller kempston mouse. But the difficulty is that this program takes about 16K, and time for ee install takes almost as much as much as you want to install Windows. : ( But the result is worth it to wait an hour or two. : (First press the mouse button after a successful installation, but should notice, this happens quite often did compared with Windows, will be responsible for the function of Fire. Okay, the last two paragraphs are overt joke. But in every joke there is some truth. And you'll have to find yourself. :] If you are too lazy to write new or modify my old driver, then for God's sake, use pre-written, much less that they have long walk in the country, tested and used more benevolent programmers. We have already published a similar prog Andrew Rachkina, but it was a small glitch, and that imperfection is not called. Namely - the inability to changes to limit the minimum window coordinates (in, skazanul a), within which may move the arrow on the screen (with a maximum there all okay). I address this shortcoming, and added the code snippets that have turned this driver from easy-to-turbo, so has become fashionable in recent years. If such an opportunity you do not need it, simply remove the listing from the line marked in the comment box with `* ' or change the old value for RANGE # FF. Others may be to your taste configure the following drivers: - RANGE - odnointovoe maximum displacement generalization mice, within which the effect The turbo does not work; - ACCEL - offset to add to the solution exponentially, exceeding the parameter RAN GE, for more rapid movement arrows on the screen. We assume that other parameters the explanations are not needed. And so you do not it was boring, I suggest themselves to understand how to interview the driver of the cell, keeping current values of the mouse buttons out of it, it damn hard. :) Just want to draw your attention to "Variable" DIRECT, bits of which correspond to bits in the port kempston joystick (# 1F) and interface II (# EFFE, sinclair joystick right). This is the case, if you need to know in which direction she ran mouse, then to make it easier to find. :) Instead of NOP can put the command RET, Then CALL M_BUTT will only work with buttons, and CALL M_MOVE - only the coordinates of the mouse, such a separation is useful. -----------------------------------------; Kempstone Mouse Turbo Driver With Button ; Autoconfig ; (C) Dictator ; (I) Sergius Puzzler MIN_X EQU 0 MAX_X EQU # B8 MIN_Y EQU 0 MAX_Y EQU # F8 RANGE EQU 8; * ACCEL EQU # 10; * MOUSE M_BUTT JR INI_KMD BUTTON DB 0; fire button DB 0; cansel ~ DB 0; middle ~ DIRECT DB 0; 76,543,210 bits ; MCLRDUF directs A_COOR DW 0; arrow coord M_PORT DW 0; mouse coord NO_DEF AND 3; fire not def JR Z, NO_PUSH; not press CP 1 JR Z, PUSH_ON XOR A LD (BIT_1), A INC A LD (BIT_0), A PUSH_ON LD HL, 0 LD (BLANK), HL POP IX INI_KMD PUSH IX LD HL, BUTTON PUSH HL POP IX XOR A DUP 3 LD (HL), A; clearing INC HL; of direct buffer EDUP LD (HL), A LD BC, # FADF; button control IN A, (C); port of buttond CPL BLANK JR NO_DEF; until not def RRA BIT_0 EQU $ +2 RL (IX +0) RRA BIT_1 EQU $ +2 RL (IX +1) RRA RL (IX +2); BIT_2 NO_PUSH POP IX NOP M_MOVE LD HL, (A_COOR); last a_coord LD DE, (M_PORT); last m_coord LD BC, # FBDF IN A, (C); port X (0 - # FF) LD (M_PORT), A SUB E JR Z, READ_Y; no move JP P, MOVE_RT CP-RANGE; * JR NC, TURB_LT; * ADD A,-ACCEL; * TURB_LT; * SET 4, (IX +3); move left ADD A, L JR NC, SET_MIN_X CP MIN_X; minimum X-coord JR NC, NO_SET_X SET_MIN_X LD A, MIN_X; minimum X-coord JR NO_SET_X MOVE_RT CP RANGE; * JR C, TURB_RT; * ADD A, ACCEL; * TURB_RT; * SET 3, (IX +3); move right ADD A, L JR C, SET_MAX_X CP MAX_X; maximum X-coord JR C, NO_SET_X SET_MAX_X LD A, MAX_X; maximum X-coord NO_SET_X LD L, A READ_Y LD B, # FF IN A, (C); port Y (0 - # FF) LD (M_PORT +1), A SUB D JR Z, ALL_READ; no move NEG JP P, MOVE_DN CP-RANGE; * JR NC, TURB_UP; * ADD A,-ACCEL; * TURB_UP; * SET 1, (IX +3); move up ADD A, H JR NC, SET_MIN_Y CP MIN_Y; minimum Y-coord JR NC, NO_SET_Y SET_MIN_Y LD A, MIN_Y; minimum Y-coord JR NO_SET_Y MOVE_DN CP RANGE; * JR C, TURB_DN; * ADD A, ACCEL; * TURB_DN; * SET 2, (IX +3); move down ADD A, H JR C, SET_MAX_Y CP MAX_Y; maximum Y-coord JR C, NO_SET_Y SET_MAX_Y LD A, MAX_Y; maximum Y-coord NO_SET_Y LD H, A ALL_READ LD (A_COOR), HL; new a_coord RET ----------------------------------------- That's all.
Other articles:
Similar articles:
В этот день... 23 November