.struct JOY_HDR
ID .byte 3 ; $6A, $6F, $79 ("joy")
VERSION .byte 1 ; Interface version
+ LIBREF .addr ; Library reference
MASKS .byte 8 ; Joystick state mask array
JUMPTAB .struct
- INSTALL .word ; INSTALL routine
- UNINSTALL .word ; UNINSTALL routine
- COUNT .word ; COUNT routine
- READ .word ; READ routine
- IRQ .word ; IRQ routine
+ INSTALL .addr ; INSTALL routine
+ UNINSTALL .addr ; UNINSTALL routine
+ COUNT .addr ; COUNT routine
+ READ .addr ; READ routine
+ IRQ .addr ; IRQ routine
.endstruct
.endstruct
;------------------------------------------------------------------------------
; The JOY API version, stored in JOY_HDR::VERSION
-JOY_API_VERSION = $01
+JOY_API_VERSION = $02
;------------------------------------------------------------------------------
; Variables
.global _joy_read
.global _joy_clear_ptr
-
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $10
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $02 ; JOY_UP
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $10 ; JOY_UP
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $02 ; JOY_UP "8"
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
; Oliver Schmidt, 2013-05-31
;
- .export em_libref
+ .export em_libref, joy_libref
.import _exit
em_libref := _exit
+joy_libref := _exit
; Common functions of the joystick API.
;
+ .import joy_libref
.importzp ptr1
.interruptor joy_irq ; Export as IRQ handler
dey
bpl @L0
+; Set the library reference
+
+ ldy #JOY_HDR::LIBREF
+ lda #<joy_libref
+ sta (ptr1),y
+ iny
+ lda #>joy_libref
+ sta (ptr1),y
+
; Copy the mask array
ldy #JOY_HDR::MASKS + .sizeof(JOY_HDR::MASKS) - 1
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
joy_mask:
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $10 ; JOY_UP
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $01 ; JOY_UP
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
+; Library reference
+
+ .addr $0000
+
; Button state masks (8 values)
.byte $02 ; JOY_UP
--- /dev/null
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+ .export joy_libref
+ .import _exit
+
+joy_libref := _exit