2 ; Ullrich von Bassewitz, 2002-12-20
4 ; Common functions of the joystick API.
10 .include "joy-kernel.inc"
11 .include "joy-error.inc"
14 ;----------------------------------------------------------------------------
19 _joy_drv: .res 2 ; Pointer to driver
21 ; Jump table for the driver functions.
24 joy_install: jmp $0000
25 joy_uninstall: jmp $0000
29 ; Driver header signature
31 joy_sig: .byte $6A, $6F, $79, JOY_API_VERSION ; "joy", version
35 ;----------------------------------------------------------------------------
36 ; unsigned char __fastcall__ joy_install (void* driver);
37 ; /* Install the driver once it is loaded */
46 ; Check the driver signature
48 ldy #.sizeof(joy_sig)-1
55 ; Set the library reference
64 ; Copy the jump vectors
68 @L1: inx ; Skip the JMP opcode
69 jsr copy ; Copy one byte
70 jsr copy ; Copy one byte
71 cpy #(JOY_HDR::JUMPTAB + .sizeof(JOY_HDR::JUMPTAB))
74 jmp joy_install ; Call driver install routine
76 ; Driver signature invalid
79 lda #JOY_ERR_INV_DRIVER
83 ; Copy one byte from the jump vectors
91 ;----------------------------------------------------------------------------
92 ; unsigned char joy_uninstall (void);
93 ; /* Uninstall the currently loaded driver. Note: This call does not free
94 ; ** allocated memory.
98 jsr joy_uninstall ; Call the driver routine
100 _joy_clear_ptr: ; External entry point
103 sta _joy_drv+1 ; Clear the driver pointer