-
Notifications
You must be signed in to change notification settings - Fork 26
/
joybuzz.pla
65 lines (65 loc) · 1.43 KB
/
joybuzz.pla
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
include "inc/cmdsys.plh"
asm asmdefs
!SOURCE "vmsrc/plvmzp.inc"
SPEAKER = $C030
GCSTRB = $C070
GC0 = $C064
GC1 = $C065
GCPB1 = $C061
GCPB2 = $C062
GCMAX = 79 ; MAX VALUE FOR GAME CONTROLLER
end
//
// Read both game controllers in parallel
//
export asm joypos(buzz)#4
LDY ESTKL,X ; BUZZ TONE
STY TMPH
DEX
DEX
DEX
LDA #$00
STA ESTKL+2,X
STA ESTKH+2,X
STA ESTKL+3,X
STA ESTKH+3,X
LDA #GCMAX
SEC
BIT GCSTRB
BUZZ DEY
BNE BUZZDLY
BIT SPEAKER
LDY TMPH ; BUZZ TONE
GC0READ BIT GC0
BPL GC0DLY
INC ESTKL+3,X
GC1READ BIT GC1
BPL GC1DLY
INC ESTKL+2,X
JOYLP SBC #$01
BNE BUZZ
TAY ; LDY #$00
BIT GCPB1 ; READ GC BUTTONS
BPL +
DEY
+ STY ESTKL+1,X
STY ESTKH+1,X
TAY ; LDY #$00
BIT GCPB2
BPL +
DEY
+ STY ESTKL,X
STY ESTKH,X
RTS
GC0DLY NOP ; TIMING
BPL GC1READ
GC1DLY NOP ; TIMING
BPL JOYLP
BUZZDLY BNE + ; TIMING
+ BNE GC0READ
end
//
// Keep module in memory
//
return modkeep
done