]> git.sur5r.net Git - cc65/blob - libsrc/gamate/joy/gamate-stdjoy.s
801b40acd5e2deafcae1cb24ad5f9eb041677b5c
[cc65] / libsrc / gamate / joy / gamate-stdjoy.s
1
2 ;
3 ; Standard joystick driver for the Gamate
4 ;
5
6         .include        "joy-kernel.inc"
7         .include        "joy-error.inc"
8         .include        "gamate.inc"
9
10         .macpack        module
11
12
13 ; ------------------------------------------------------------------------
14 ; Header. Includes jump table
15
16         module_header   _gamate_stdjoy_joy
17
18 ; Driver signature
19
20         .byte   $6A, $6F, $79           ; "joy"
21         .byte   JOY_API_VERSION         ; Driver API version number
22
23 ; Library reference
24
25         .addr   $0000
26
27 ; Jump table.
28
29         .addr   INSTALL
30         .addr   UNINSTALL
31         .addr   COUNT
32         .addr   READJOY
33         .addr   0                       ; IRQ entry unused
34
35 ; ------------------------------------------------------------------------
36 ; Constants
37
38 JOY_COUNT       = 1             ; Number of joysticks we support
39
40
41 .code
42
43 ; ------------------------------------------------------------------------
44 ; INSTALL routine. Is called after the driver is loaded into memory. If
45 ; possible, check if the hardware is present and determine the amount of
46 ; memory available.
47 ; Must return an JOY_ERR_xx code in a/x.
48 ;
49
50 INSTALL:
51         lda     #<JOY_ERR_OK
52         ldx     #>JOY_ERR_OK
53
54 ;        rts                     ; Run into UNINSTALL instead
55
56 ; ------------------------------------------------------------------------
57 ; DEINSTALL routine. Is called before the driver is removed from memory.
58 ; Can do cleanup or whatever. Must not return anything.
59 ;
60
61 UNINSTALL:
62         rts
63
64
65 ; ------------------------------------------------------------------------
66 ; COUNT: Return the total number of available joysticks in a/x.
67 ;
68 ;unsigned char __fastcall__ joy_count (void);
69
70 COUNT:
71         lda     #<JOY_COUNT
72         ldx     #>JOY_COUNT
73         rts
74
75 ; ------------------------------------------------------------------------
76 ; READ: Read a particular joystick passed in A.
77 ;
78 ;unsigned char __fastcall__ joy_read (unsigned char joystick);
79
80 READJOY:
81         lda     JOY_DATA
82         eor     #$FF
83         ldx     #0
84         rts
85