Szukam najszybszej możliwej procedury odsługującej myszkę (od amigi/atari ST) podłączaną do ATARI XL/XE?
W grze nie ma zbyt wiele czasu na nią....więc musi być maksymalnie zoptymalizowana:)
Ja znalazłem w necie taką, ale być może da się jeszcze szybciej?:
FastMouseRoutine
General Information
Author: John Maris (prepared by Mathy v. Nisselroy)
Assembler: Mac65
Published: MegaMagazine 7
Code
1000 ;MOUSE ROUTINE IN A DLI
1010 ; MAKE YOUR OWN DL WITH
1020 ;INTERUPT ENABLE, ETC.
1030 ;OR YSE THE INTERUPT IN
1040 ;POKEY TIME INTERUPT!
1050 ;
1060 ;PUBLIC DOMAIN 1994
1070 ;PUBLISHED ON MEGAMAGAZINE
1080 ; POKEY MAGZINE
1090 ; THE BEST OF
1100 ;
1110 ;WRITTEN BY THE MISSING LINK
1120 ;
1130 ;OLDX = OLD X-VALUE MOUSE
1140 ;OLDY = OLD Y-VALUE MOUSE
1150 ;MXAS = X POSITION FOR CURSOR
1160 ;MMAXX=MAXIMUM X-SCREEN-POS
1170 ;MMAXY=MAXIMUM Y-SCREEN-POS
1180 ;MMINX=MINIMUM X-SCREEN-POS
1190 ;MMINY=MINIMUM Y-SCREEN-POS
1191 ;
1200 ;SET INTERRUPTPOINTER
1210 LDA # <MOUSE
1220 STA 512
1230 LDA # >MOUSE
1240 STA 513
1250 ;INIT MOUSE ROUTINE
1260 JSR MOUSEON
1270 ;INIT VBI ROUTINE FOR CURSOR
1280 LDA #6
1290 LDX # >VBI
1300 LDY # <VBI
1310 JSR $E45C
1320 ;ENDLESS LOOP
1330 DO JMP DO
1340 ;
1350 ;
1360 ;THE MOUSEROUTINE
1370 MOUSE
1380 PHA
1390 TXA
1400 PHA
1410 TYA
1420 PHA
1430 MOUSEA
1440 LDA $D300 ;
1450 LSR A ;MOUSE ON
1460 LSR A ;PORT 1
1470 LSR A ;
1480 LSR A ;
1490 PHA ;SAVE VALUE
1500 AND #3 ;GET X-VALUE
1510 ORA OLDX ;
1520 TAX ;
1530 AND #3 ;MAKE X-INDEX
1540 ASL A ;
1550 ASL A ;
1560 STA OLDX ;SAVE AS OLD
1570 LDY MXAS ;
1580 LDA MOUSETAB,X ;GET TABLE
1590 BMI MOUSY ;ACTION? NO!
1600 BNE MOUSE1 ;YES! DECREASE
1610 MOUSE0
1620 INY ;INCREASE
1630 CPY MMAXX ;MAXIMUM XAS?
1640 BCC MOUSY ;NO, EXIT
1650 MOUSE1
1660 DEY ;DECREASE
1670 CPY MMINX ;MINIMUM XAS?
1680 BCC MOUSE0 ;YES! INCREASE
1690 MOUSY
1700 STY MXAS ;STORE XPOINTER
1710 PLA ;GET MOUSEVALUE
1720 LSR A
1730 LSR A ;SEE THE ROUTINE
1740 AND #3 ;ON THE XAS. IT
1750 ORA OLDY ;IS THE SAME!
1760 TAX
1770 AND #3
1780 ASL A
1790 ASL A
1800 STA OLDY
1810 LDY MYAS
1820 LDA MOUSETAB,X
1830 BMI MOUSEX
1840 BNE MOUSE2
1850 MOUSE1.1
1860 INY
1870 JMP MOUSE3
1880 MOUSE2
1890 DEY
1900 MOUSE3
1910 CPY MMINY
1920 BCC MOUSE1.1
1930 CPY MMAXY
1940 BCS MOUSE2
1950 MOUSEX ; END OF
1960 STY MYAS ;Y-ROUTINE
1970 PLA ;RESTORE
1980 TAY ;A, X & Y
1990 PLA
2000 TAX
2010 PLA
2020 RTI
2030 ;
2040 ;THE Indextable 0=no action
2050 MOUSETAB
2060 .BYTE 255,1,0,255,0,255,255,1,1,255,255,0,255,0,1,255
2070 ;
2080 ;ENABLE DLI
2090 MOUSEON
2100 LDA #192
2110 STA $D40E
2120 RTS
2130 ;DISABLE DLI
2140 MOUSEOFF
2150 LDA #64
2160 STA $D40E
2170 RTS
2180 ;
2190 VBI
2200 ;PUT CURSOR ON SCREEN
2210 JMP $E45F
2220 ;
2230 ;