source: avrstuff/PIC/amips2/firmware/ps2mouse.lst@ 0010058

main
Last change on this file since 0010058 was 0010058, checked in by Adrien Destugues <pulkomandy@…>, 10 years ago

AmiPS2: add firmware

git-svn-id: svn://pulkomandy.tk/avrstuff@115 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe

  • Property mode set to 100644
File size: 34.7 KB
Line 
1gplink-0.13.6 alpha
2Copyright (c) 1998-2005 gputils project
3Listing File Generated: 6-27-2008 15:24:01
4
5
6Address Value Disassembly Source
7------- ----- ----------- ------
8 ; -------------------------------------
9 ; PS/2 Mouse to Amiga Mouse Converter
10 ; -------------------------------------
11 ;
12 ; Version: V1.0 (30-Jun-2001) Author : N. Baricevic <nogoth@yahoo.com>
13 ; Version: V1.1 (26-mai-2006) modified by sundance
14 ; version v1.2 (28/06/2006) modified by sundance
15 ; V1.3 19/06/08 by PulkoMandy
16 ;-------------------------------------------
17 ;
18 ;modif : standard mplab project
19 ; configuration pic
20 ; support wheel mouse
21 ; sync xa/xb and ya/yb
22 ; compatibility with atari st
23 ; auto-detect amiga/atari
24 ;V1.3
25 ; Some more optimisations/reorganisation
26 ; New parity code (smaller)
27 ; 16f628 compatibility
28 ;-------------------------------------------
29
30 ; ------------------------------------------
31 ; includes
32 ; ------------------------------------------;
33 list f=inhx8m ;Enter device name
34 LIST p=16F628
35 IFDEF __16F628
36 include p16f628.inc
37 LIST
38 ; P16F628.INC Standard Header File, Version 1.01 Microchip Technology, Inc.
39 NOLIST
40 __config _PWRTE_ON & _WDT_OFF & _CP_OFF & _BODEN_OFF & _DATA_CP_OFF & _INTRC_OSC_NOCLKOUT & _MCLRE_ON & _LVP_OFF
41 #define VAR_BEGIN 0x20
42 MESSG "Compiling for 16f628"
43 ELSE
44 include p16f84a.inc
45 #define VAR_BEGIN 0x0C
46 MESSG "Compiling for 16f84"
47 ENDIF
48 ; ------------------------------------------
49
50 ; ---------- registers definition -----------
51
52 byte equ VAR_BEGIN ; byte to receive or send
53 parity equ VAR_BEGIN+1 ; parity bit is held here
54 parcnt equ VAR_BEGIN+2 ; counter for calculating parity
55 roller equ VAR_BEGIN+3 ; help for 8 data bits to byte conversion
56 pack1 equ VAR_BEGIN+4 ; 1st byte of mouse data packet
57 pack2 equ VAR_BEGIN+5 ; 2nd byte of mouse data packet
58 pack3 equ VAR_BEGIN+6 ; 3rd byte of mouse data packet
59 togglex equ VAR_BEGIN+7
60 toggley equ VAR_BEGIN+8
61 delcnt equ VAR_BEGIN+9 ; delay counter
62 tempxa equ VAR_BEGIN+0xA ; temp to sync xa and xb
63 tempxb equ VAR_BEGIN+0xB
64 tempya equ VAR_BEGIN+0xC ; temp to sync ya and yb
65 tempyb equ VAR_BEGIN+0xD
66 temp equ VAR_BEGIN+0xE
67 maskx equ VAR_BEGIN+0xF
68 masky equ VAR_BEGIN+0x10
69 delay equ VAR_BEGIN+0x11
70 savb equ VAR_BEGIN+0x12
71 bitya equ VAR_BEGIN+0x13
72 bityb equ VAR_BEGIN+0x14
73 bitxa equ VAR_BEGIN+0x15
74 bitxb equ VAR_BEGIN+0x16
75
76 ; --------- main routine -----------
77 org 0x0
78000000 2805 goto 0x5 goto main
79
80 ;EN 0x04 il y a les vecteurs d'interruption !
81 ORG 0x04
82000004 2961 goto 0x161 goto inter ;interrupt handler
83
84 ORG 0x05
85 main:
86 ;set port direction
87000005 1683 bsf 0x3, 0x5 bsf STATUS,RP0 ; page 1
88
89000006 30fb movlw 0xfb movlw 0xFB ; OUT ON RA2 FOR ERROR LED
90000007 0085 movwf 0x5 movwf TRISA ; port A, bit 0 and 1 is input
91
92000008 3002 movlw 0x2 movlw b'00000010'
93000009 0086 movwf 0x6 movwf TRISB ; port B is all outputs
94
95 ; Set port values
9600000a 1283 bcf 0x3, 0x5 bcf STATUS,RP0 ; page 0
97
98 ;Pour désactiver le CNA du 16f628
99 IFDEF __16F628
10000000b 3007 movlw 0x7 movlw 0x07
10100000c 009f movwf 0x1f movwf CMCON
102 ENDIF
103
10400000d 30ff movlw 0xff movlw b'11111111'
10500000e 0086 movwf 0x6 movwf PORTB
10600000f 0185 clrf 0x5 clrf PORTA ; port A out pins to 0
107000010 307f movlw 0x7f movlw b'01111111' ;PULL UP ON on portb for detect amiga or atari
108000011 0081 movwf 0x1 movwf OPTION_REG
109
110 ; set port out level
111
112000012 01a0 clrf 0x20 clrf byte
113000013 01a1 clrf 0x21 clrf parity
114000014 01a2 clrf 0x22 clrf parcnt
115000015 01a3 clrf 0x23 clrf roller
116000016 01a7 clrf 0x27 clrf togglex
117000017 01a8 clrf 0x28 clrf toggley
118000018 01a4 clrf 0x24 clrf pack1
119000019 01a5 clrf 0x25 clrf pack2
12000001a 01a6 clrf 0x26 clrf pack3
121
122 check_mouse_init
12300001b 2087 call 0x87 call REC ; receive byte from mouse
12400001c 20a8 call 0xa8 call INHIB ; pull CLK low to inhibit furhter sending
12500001d 0820 movf 0x20, w movf byte,W
12600001e 3aaa xorlw 0xaa xorlw 0xaa ; if it's $AA mouse self test passed
12700001f 1d03 btfss 0x3, 0x2 btfss STATUS,Z
128000020 281b goto 0x1b goto check_mouse_init ;If error, restart the init
129
130 ;check mouse id =00
131000021 20ab call 0xab call REL ; release CLK (allow mouse to send)
132000022 2087 call 0x87 call REC ; receive byte from mouse
133000023 20a8 call 0xa8 call INHIB
134000024 0820 movf 0x20, w movf byte,W
135000025 3a00 xorlw 0 xorlw 0x00 ; mouse ID code should be $00
136000026 1d03 btfss 0x3, 0x2 btfss STATUS,Z
137000027 281b goto 0x1b goto check_mouse_init ; restart the init
138
139 ;allow mouse to send the data
140000028 30f4 movlw 0xf4 movlw 0xf4 ; "Enable Data Reporting" command to mouse
141000029 00a0 movwf 0x20 movwf byte
14200002a 20e3 call 0xe3 call NEWPAR ; calculate parity for $F4
14300002b 20ab call 0xab call REL ; release CLK (allow mouse to send)
144
145 ;wait
14600002c 207d call 0x7d call DEL200 ;wait 200µs
147
148 ;receive ack = fa
14900002d 20c8 call 0xc8 call SEND ; send command to mouse
15000002e 2087 call 0x87 call REC ; receive acknowledge ($FA) from mouse)
15100002f 20a8 call 0xa8 call INHIB
152000030 0820 movf 0x20, w movf byte,W
153000031 3afa xorlw 0xfa xorlw 0xfa
154000032 1d03 btfss 0x3, 0x2 btfss STATUS,Z
155000033 281b goto 0x1b goto check_mouse_init ;restart init if wrong
156
157000034 3040 movlw 0x40 movlw 0x40
158000035 00b0 movwf 0x30 movwf masky
159000036 01ae clrf 0x2e clrf temp
160 megatempo
161000037 207d call 0x7d call DEL200 ; WAIT INSERTION
162000038 0bae decfsz 0x2e, f decfsz temp,f
163000039 2837 goto 0x37 goto megatempo
164
16500003a 1886 btfsc 0x6, 0x1 btfsc PORTB,1 ;MIDDLE BUTTON CONNECTED ?
16600003b 2853 goto 0x53 goto amiga_pattern
167
168 ;atari_pattern
16900003c 307c movlw 0x7c movlw 0x7C
17000003d 00b1 movwf 0x31 movwf delay
171 ; pattern atari xa b'00100000'
172 ; pattern atari xb b'00010000'
17300003e 3010 movlw 0x10 movlw b'00010000'
17400003f 00aa movwf 0x2a movwf tempxa
175000040 3020 movlw 0x20 movlw b'00100000'
176000041 00ab movwf 0x2b movwf tempxb
177 ; pattern atari ya b'00001000'
178 ; pattern atari yb b'00000100'
179000042 3008 movlw 0x8 movlw b'00001000'
180000043 00ad movwf 0x2d movwf tempyb
181000044 3004 movlw 0x4 movlw b'00000100'
182000045 00ac movwf 0x2c movwf tempya
183 ;mask atari x/y
184000046 30cf movlw 0xcf movlw b'11001111'
185000047 00af movwf 0x2f movwf maskx
186000048 30f3 movlw 0xf3 movlw b'11110011'
187000049 00b0 movwf 0x30 movwf masky
18800004a 3010 movlw 0x10 movlw b'00010000'
18900004b 00b5 movwf 0x35 movwf bitxa
19000004c 3020 movlw 0x20 movlw b'00100000'
19100004d 00b6 movwf 0x36 movwf bitxb
19200004e 3004 movlw 0x4 movlw b'00000100'
19300004f 00b3 movwf 0x33 movwf bitya
194000050 3008 movlw 0x8 movlw b'00001000'
195000051 00b4 movwf 0x34 movwf bityb
196
197000052 2869 goto 0x69 goto start
198
199 amiga_pattern
200000053 303b movlw 0x3b movlw 0x3B
201000054 00b1 movwf 0x31 movwf delay
202 ; pattern amiga xa b'00000100'
203 ; pattern amiga xb b'00010000'
204000055 3004 movlw 0x4 movlw b'00000100'
205000056 00ab movwf 0x2b movwf tempxb
206000057 3010 movlw 0x10 movlw b'00010000'
207000058 00aa movwf 0x2a movwf tempxa
208 ; pattern amiga ya b'00001000'
209 ; pattern amiga yb b'00100000'
210000059 3008 movlw 0x8 movlw b'00001000'
21100005a 00ad movwf 0x2d movwf tempyb
21200005b 3020 movlw 0x20 movlw b'00100000'
21300005c 00ac movwf 0x2c movwf tempya
214 ;mask amiga x/y
21500005d 30eb movlw 0xeb movlw b'11101011'
21600005e 00af movwf 0x2f movwf maskx
21700005f 30d7 movlw 0xd7 movlw b'11010111'
218000060 00b0 movwf 0x30 movwf masky
219000061 3010 movlw 0x10 movlw b'00010000'
220000062 00b5 movwf 0x35 movwf bitxa
221000063 3004 movlw 0x4 movlw b'00000100'
222000064 00b6 movwf 0x36 movwf bitxb
223000065 3020 movlw 0x20 movlw b'00100000'
224000066 00b3 movwf 0x33 movwf bitya
225000067 3008 movlw 0x8 movlw b'00001000'
226000068 00b4 movwf 0x34 movwf bityb
227 start
228000069 1683 bsf 0x3, 0x5 bsf STATUS,RP0 ; page 1
22900006a 0186 clrf 0x6 clrf TRISB ; port B is all outputs
23000006b 1283 bcf 0x3, 0x5 bcf STATUS,RP0 ; page 0
231 ;main loop
232 CHK:
233 ; lecture trame de 3 octets
23400006c 20ab call 0xab call REL
23500006d 2087 call 0x87 call REC ; receive byte1 from mouse packet
23600006e 20a8 call 0xa8 call INHIB
23700006f 0820 movf 0x20, w movf byte,W
238000070 00a4 movwf 0x24 movwf pack1
239000071 20ab call 0xab call REL
240000072 2087 call 0x87 call REC ; receive byte2 from mouse packet
241000073 20a8 call 0xa8 call INHIB
242000074 0820 movf 0x20, w movf byte,W
243000075 00a5 movwf 0x25 movwf pack2
244000076 20ab call 0xab call REL
245000077 2087 call 0x87 call REC ; receive byte3 from mouse packet
246000078 20a8 call 0xa8 call INHIB
247000079 0820 movf 0x20, w movf byte,W
24800007a 00a6 movwf 0x26 movwf pack3
249 ;convertion ps2 > amiga
25000007b 20f8 call 0xf8 call CONV
25100007c 286c goto 0x6c goto CHK ; receive another packet
252
253
254 ; --------------------------------------------------------
255
256
25700007d 0831 movf 0x31, w DEL200: movfw delay
25800007e 00a9 movwf 0x29 movwf delcnt
25900007f 0ba9 decfsz 0x29, f DEL2: decfsz delcnt,f
260000080 287f goto 0x7f goto DEL2
261000081 0000 nop DEL10: nop ; delay 10us
262000082 0000 nop nop
263000083 0000 nop nop
264000084 0000 nop nop
265000085 0000 nop nop
266000086 0008 return return
267
268 ; --------- byte receiving subroutine -------------
269000087 1805 btfsc 0x5, 0 REC: btfsc PORTA,0 ; wait clock (start bit)
270000088 2887 goto 0x87 goto REC
271000089 1c05 btfss 0x5, 0 RL1: btfss PORTA,0
27200008a 2889 goto 0x89 goto RL1
27300008b 209e call 0x9e call RECBIT ; receive 8 data bits
27400008c 209e call 0x9e call RECBIT
27500008d 209e call 0x9e call RECBIT
27600008e 209e call 0x9e call RECBIT
27700008f 209e call 0x9e call RECBIT
278000090 209e call 0x9e call RECBIT
279000091 209e call 0x9e call RECBIT
280000092 209e call 0x9e call RECBIT
281000093 1805 btfsc 0x5, 0 RL2: btfsc PORTA,0 ; receive parity bit
282000094 2893 goto 0x93 goto RL2
283000095 1885 btfsc 0x5, 0x1 btfsc PORTA,1
284000096 289c goto 0x9c goto RL3
285000097 1021 bcf 0x21, 0 bcf parity,0
286 RL4:
287000098 20c3 call 0xc3 call wait_h
288000099 1c05 btfss 0x5, 0 RL8: btfss PORTA,0
28900009a 2899 goto 0x99 goto RL8
29000009b 0008 return return
291
29200009c 1421 bsf 0x21, 0 RL3: bsf parity,0
29300009d 2898 goto 0x98 goto RL4
294
295 ; ---------- bit receiving subroutine ------------
296
29700009e 1805 btfsc 0x5, 0 RECBIT: btfsc PORTA,0 ;Attend que l'horloge passe à 0
29800009f 289e goto 0x9e goto RECBIT
2990000a0 0805 movf 0x5, w movf PORTA,W ;Lit le port A
3000000a1 00a3 movwf 0x23 movwf roller ;Ne garde que le bit intéressant
3010000a2 0ca3 rrf 0x23, f rrf roller,f
3020000a3 0ca3 rrf 0x23, f rrf roller,f
3030000a4 0ca0 rrf 0x20, f rrf byte,f
3040000a5 1c05 btfss 0x5, 0 RL5: btfss PORTA,0 ;Attend que l'horloge repasse à 1
3050000a6 28a5 goto 0xa5 goto RL5
3060000a7 0008 return return
307
308 ; ---------- subroutines -----------------
309
3100000a8 20af call 0xaf INHIB: call CLKLO ; inhibit mouse sending (CLK low)
3110000a9 207d call 0x7d call DEL200
3120000aa 0008 return return
313
314 REL: ; allow mouse to send data
3150000ab 1683 bsf 0x3, 0x5 CLKHI: bsf STATUS,RP0 ; CLK high
3160000ac 1405 bsf 0x5, 0 bsf TRISA,0
3170000ad 1283 bcf 0x3, 0x5 bcf STATUS,RP0
3180000ae 0008 return return
319
3200000af 1683 bsf 0x3, 0x5 CLKLO: bsf STATUS,RP0 ; CLK low
3210000b0 1005 bcf 0x5, 0 bcf TRISA,0
3220000b1 1283 bcf 0x3, 0x5 bcf STATUS,RP0
3230000b2 1005 bcf 0x5, 0 bcf PORTA,0
3240000b3 0008 return return
325
3260000b4 1683 bsf 0x3, 0x5 DATLO: bsf STATUS,RP0 ; DATA low
3270000b5 1085 bcf 0x5, 0x1 bcf TRISA,1
3280000b6 1283 bcf 0x3, 0x5 bcf STATUS,RP0
3290000b7 1085 bcf 0x5, 0x1 bcf PORTA,1
3300000b8 0008 return return
331
3320000b9 1683 bsf 0x3, 0x5 DATHI: bsf STATUS,RP0 ; DATA high
3330000ba 1485 bsf 0x5, 0x1 bsf TRISA,1
3340000bb 1283 bcf 0x3, 0x5 bcf STATUS,RP0
3350000bc 0008 return return
336
337 send_bit
3380000bd 0ca0 rrf 0x20, f rrf byte,f ; send data bit
3390000be 1803 btfsc 0x3, 0 btfsc STATUS,C
3400000bf 28c2 goto 0xc2 goto DHIGH
3410000c0 20b4 call 0xb4 call DATLO
3420000c1 28c3 goto 0xc3 goto wait_h
3430000c2 20b9 call 0xb9 DHIGH: call DATHI
3440000c3 1c05 btfss 0x5, 0 wait_h: btfss PORTA,0
3450000c4 28c3 goto 0xc3 goto wait_h
3460000c5 1805 btfsc 0x5, 0 wait_l: btfsc PORTA,0
3470000c6 28c5 goto 0xc5 goto wait_l
3480000c7 0008 return return
349 ; ------------- send to mouse --------------
350
3510000c8 20a8 call 0xa8 SEND: call INHIB ; CLK low
3520000c9 2081 call 0x81 call DEL10
3530000ca 20b4 call 0xb4 call DATLO ; DATA low
3540000cb 2081 call 0x81 call DEL10
3550000cc 20ab call 0xab call REL ; CLK high
3560000cd 1805 btfsc 0x5, 0 SL1: btfsc PORTA,0 ; wait for CLK
3570000ce 28cd goto 0xcd goto SL1
3580000cf 20bd call 0xbd call send_bit
3590000d0 20bd call 0xbd call send_bit
3600000d1 20bd call 0xbd call send_bit
3610000d2 20bd call 0xbd call send_bit
3620000d3 20bd call 0xbd call send_bit
3630000d4 20bd call 0xbd call send_bit
3640000d5 20bd call 0xbd call send_bit
3650000d6 20bd call 0xbd call send_bit
3660000d7 20e0 call 0xe0 call SNDPAR ; send parity bit
3670000d8 20c3 call 0xc3 call wait_h
3680000d9 20b9 call 0xb9 call DATHI ; release bus
3690000da 20c3 call 0xc3 call wait_h
3700000db 1c05 btfss 0x5, 0 SL7: btfss PORTA,0
3710000dc 28db goto 0xdb goto SL7
3720000dd 1c85 btfss 0x5, 0x1 SL8: btfss PORTA,1
3730000de 28dd goto 0xdd goto SL8
3740000df 0008 return return
375
376 ; -------------- subroutines --------------
377
378
3790000e0 1821 btfsc 0x21, 0 SNDPAR: btfsc parity,0 ; send parity bit
3800000e1 28b9 goto 0xb9 goto DATHI
3810000e2 28b4 goto 0xb4 goto DATLO
382
383 NEWPAR: ; calculate parity bit
3840000e3 01a2 clrf 0x22 clrf parcnt
3850000e4 1820 btfsc 0x20, 0 btfsc byte,0
3860000e5 0aa2 incf 0x22, f incf parcnt,f
3870000e6 18a0 btfsc 0x20, 0x1 btfsc byte,1
3880000e7 0aa2 incf 0x22, f incf parcnt,f
3890000e8 1920 btfsc 0x20, 0x2 btfsc byte,2
3900000e9 0aa2 incf 0x22, f incf parcnt,f
3910000ea 19a0 btfsc 0x20, 0x3 btfsc byte,3
3920000eb 0aa2 incf 0x22, f incf parcnt,f
3930000ec 1a20 btfsc 0x20, 0x4 btfsc byte,4
3940000ed 0aa2 incf 0x22, f incf parcnt,f
3950000ee 1aa0 btfsc 0x20, 0x5 btfsc byte,5
3960000ef 0aa2 incf 0x22, f incf parcnt,f
3970000f0 1b20 btfsc 0x20, 0x6 btfsc byte,6
3980000f1 0aa2 incf 0x22, f incf parcnt,f
3990000f2 1ba0 btfsc 0x20, 0x7 btfsc byte,7
4000000f3 0aa2 incf 0x22, f incf parcnt,f
4010000f4 1021 bcf 0x21, 0 bcf parity,0
4020000f5 1c22 btfss 0x22, 0 btfss parcnt,0
4030000f6 1421 bsf 0x21, 0 bsf parity,0
4040000f7 0008 return return
405
406 ; --------------- conversion to Amiga format --------------
407
408 CONV:
4090000f8 1332 bcf 0x32, 0x6 bcf savb,6
4100000f9 1c24 btfss 0x24, 0 btfss pack1,0 ; left button
4110000fa 1732 bsf 0x32, 0x6 bsf savb,6
4120000fb 1032 bcf 0x32, 0 bcf savb,0
4130000fc 1ca4 btfss 0x24, 0x1 btfss pack1,1 ; right button
4140000fd 1432 bsf 0x32, 0 bsf savb,0
4150000fe 10b2 bcf 0x32, 0x1 bcf savb,1
4160000ff 1d24 btfss 0x24, 0x2 btfss pack1,2 ; middle button
417000100 14b2 bsf 0x32, 0x1 bsf savb,1
418
419000101 0806 movf 0x6, w movf PORTB,w ;read port b
420000102 39bc andlw 0xbc andlw b'10111100' ;keep button state
421000103 0432 iorwf 0x32, w iorwf savb,w ;merge with new x and y patterns
422000104 0086 movwf 0x6 movwf PORTB ;ouput patterns
423
424000105 0825 movf 0x25, w movf pack2,W ; mouvement conversion
425000106 39ff andlw 0xff andlw 0xff
426000107 1d03 btfss 0x3, 0x2 btfss STATUS,Z
427000108 2137 call 0x137 call MOVEX
428000109 0826 movf 0x26, w movf pack3,W
42900010a 39ff andlw 0xff andlw 0xff
43000010b 1903 btfsc 0x3, 0x2 btfsc STATUS,Z
43100010c 0008 return return
432
43300010d 1ea4 btfss 0x24, 0x5 MOVEY: btfss pack1,5
43400010e 2923 goto 0x123 goto DOWN
435
43600010f 207d call 0x7d UP: call DEL200 ; send V and VQ for up movement
437000110 0aa8 incf 0x28, f incf toggley,f
438000111 1828 btfsc 0x28, 0 btfsc toggley,0
439000112 0eac swapf 0x2c, f swapf tempya,f
440000113 082c movf 0x2c, w movfw tempya
441000114 0533 andwf 0x33, w andwf bitya,w
442000115 00ae movwf 0x2e movwf temp
443000116 1c28 btfss 0x28, 0 btfss toggley,0
444000117 0ead swapf 0x2d, f swapf tempyb,f
445000118 082d movf 0x2d, w movfw tempyb
446000119 0534 andwf 0x34, w andwf bityb,w
44700011a 07ae addwf 0x2e, f addwf temp,f
44800011b 0832 movf 0x32, w movfw savb
44900011c 0530 andwf 0x30, w andwf masky,w ;b'11001111'
45000011d 072e addwf 0x2e, w addwf temp,w
45100011e 0086 movwf 0x6 movwf PORTB ;ouput patterns
45200011f 00b2 movwf 0x32 movwf savb
453000120 0fa6 incfsz 0x26, f incfsz pack3,f
454000121 290f goto 0x10f goto UP
455000122 0008 return return
456
457000123 207d call 0x7d DOWN: call DEL200 ; send V and VQ for down movement
458000124 0aa8 incf 0x28, f incf toggley,f
459000125 1c28 btfss 0x28, 0 btfss toggley,0
460000126 0eac swapf 0x2c, f swapf tempya,f
461000127 082c movf 0x2c, w movfw tempya
462000128 0533 andwf 0x33, w andwf bitya,w
463000129 00ae movwf 0x2e movwf temp
46400012a 1828 btfsc 0x28, 0 btfsc toggley,0
46500012b 0ead swapf 0x2d, f swapf tempyb,f
46600012c 082d movf 0x2d, w movfw tempyb
46700012d 0534 andwf 0x34, w andwf bityb,w
46800012e 07ae addwf 0x2e, f addwf temp,f
46900012f 0832 movf 0x32, w movfw savb
470000130 0530 andwf 0x30, w andwf masky,w ;b'11001111'
471000131 072e addwf 0x2e, w addwf temp,w
472000132 0086 movwf 0x6 movwf PORTB ;ouput patterns
473000133 00b2 movwf 0x32 movwf savb
474000134 0ba6 decfsz 0x26, f decfsz pack3,f
475000135 2923 goto 0x123 goto DOWN
476000136 0008 return return
477
478000137 1e24 btfss 0x24, 0x4 MOVEX: btfss pack1,4
479000138 294d goto 0x14d goto LEFT
480
481000139 207d call 0x7d RIGHT: call DEL200 ; send H and HQ for right movement
48200013a 0aa7 incf 0x27, f incf togglex,f ; bon la c'est bobo la tete !
48300013b 1c27 btfss 0x27, 0 btfss togglex,0 ; le pattern est sur un nibble
48400013c 0eaa swapf 0x2a, f swapf tempxa,f ; nibble = 4 bits
48500013d 082a movf 0x2a, w movfw tempxa ; seul un bit est urilisé dans le pattern
48600013e 0535 andwf 0x35, w andwf bitxa,w
48700013f 00ae movwf 0x2e movwf temp ; donc on swap les nibble un fois sur deux avec un decalage
488000140 1827 btfsc 0x27, 0 btfsc togglex,0 ; entre x et y (c'est la le bobo la tete)
489000141 0eab swapf 0x2b, f swapf tempxb,f ; de facon a se retouvé avec le pattern suivant
490000142 082b movf 0x2b, w movfw tempxb ; 00 , 01, 11 puis 10 aye!
491000143 0536 andwf 0x36, w andwf bitxb,w
492000144 07ae addwf 0x2e, f addwf temp,f ; pourquoi ? > marche quelque soit le pattern!!(amiga / atari)
493000145 0832 movf 0x32, w movfw savb
494000146 052f andwf 0x2f, w andwf maskx,w ;b'11001111'
495000147 072e addwf 0x2e, w addwf temp,w
496000148 0086 movwf 0x6 movwf PORTB ;ouput patterns
497000149 00b2 movwf 0x32 movwf savb
49800014a 0fa5 incfsz 0x25, f incfsz pack2,f
49900014b 2939 goto 0x139 goto RIGHT
50000014c 0008 return return
501 LEFT:
50200014d 207d call 0x7d call DEL200 ; send H and HQ for left movement
50300014e 0aa7 incf 0x27, f incf togglex,f
50400014f 1827 btfsc 0x27, 0 btfsc togglex,0
505000150 0eaa swapf 0x2a, f swapf tempxa,f
506000151 082a movf 0x2a, w movfw tempxa
507000152 0535 andwf 0x35, w andwf bitxa,w
508000153 00ae movwf 0x2e movwf temp
509000154 1c27 btfss 0x27, 0 btfss togglex,0
510000155 0eab swapf 0x2b, f swapf tempxb,f
511000156 082b movf 0x2b, w movfw tempxb
512000157 0536 andwf 0x36, w andwf bitxb,w
513000158 07ae addwf 0x2e, f addwf temp,f
514000159 0832 movf 0x32, w movfw savb
51500015a 052f andwf 0x2f, w andwf maskx,w ;b'11001111'
51600015b 072e addwf 0x2e, w addwf temp,w
51700015c 0086 movwf 0x6 movwf PORTB ;ouput patterns
51800015d 00b2 movwf 0x32 movwf savb
51900015e 0ba5 decfsz 0x25, f decfsz pack2,f
52000015f 294d goto 0x14d goto LEFT
521000160 0008 return return
522
523 inter: ;Gestion des interruptions
524000161 0009 retfie retfie ;ne fait rien
525 end
526
Note: See TracBrowser for help on using the repository browser.