-
Notifications
You must be signed in to change notification settings - Fork 0
/
asm.s
67 lines (55 loc) · 860 Bytes
/
asm.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
;fonctions asm qui permettent de communiquer avec les manettes de jeu.
.importzp _joypad1, _joypad1old, _joypad1test, _joypad2, _joypad2old, _joypad2test
.export _Get_Input
.segment "CODE"
_Get_Input:
lda _joypad1
sta _joypad1old
lda _joypad2
sta _joypad2old
ldx #$01 ;strobe controller 1
stx $4016
dex
stx $4016
ldy #$08
Get_Input2:
lda $4016
and #$03
cmp #$01
rol _joypad1test
lda $4017
and #$03
cmp #$01
rol _joypad2test
dey
bne Get_Input2
GetInputFixBug:
ldx #$01
stx $4016
dex
stx $4016
ldy #$08
Get_Input3:
lda $4016
and #$03
cmp #$01
rol _joypad1
lda $4017
and #$03
cmp #$01
rol _joypad2
dey
bne Get_Input3
CompareInput:
lda _joypad1
cmp _joypad1test
bne :+
lda _joypad2
cmp _joypad2test
bne :+
rts
: lda _joypad1
sta _joypad1test
lda _joypad2
sta _joypad2test
jmp GetInputFixBug