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