llvm-mos-sdk
zaplib.h
Go to the documentation of this file.
1 #ifndef _ZAPLIB_H_
2 #define _ZAPLIB_H_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 // written by Doug Fraker 2019-2020
9 // NES zapper gun code
10 
11 // pass it 0 or 1, which port
12 // returns 0 or 1 if trigger pulled
13 __attribute__((leaf)) char zap_shoot(char pad);
14 
15 // pass it 0 or 1, which port
16 // returns 0 or 1 if detects light this frame
17 __attribute__((leaf)) char zap_read(char pad);
18 
19 // alt. version from "Falling Tiles" game.
20 // always reads from port 2
21 // pass it 1-224, NOT zero
22 // = approximately how many scanlines to keep reading
23 // note, PAL will need a little more than NTSC
24 // allows you to avoid lag frames on misses.
25 // "Falling Tiles" used 196 for shooting low objects
26 // and 176 for shooting objects that are higher
27 // and should exit this loop before the end of the frame.
28 
29 // returns 0 or 1 if detects light this frame
30 __attribute__((leaf)) char zap_read2(char pad);
31 
32 #ifdef __cplusplus
33 }
34 #endif
35 
36 #endif // _ZAPLIB_H_