diff --git a/asminc/joy-kernel.inc b/asminc/joy-kernel.inc
index 6c360dd43..da22662b5 100644
--- a/asminc/joy-kernel.inc
+++ b/asminc/joy-kernel.inc
@@ -42,20 +42,21 @@
 .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
@@ -82,4 +83,3 @@ JOY_API_VERSION         = $01
         .global _joy_read
 
         .global _joy_clear_ptr
-
diff --git a/libsrc/apple2/joy/a2.stdjoy.s b/libsrc/apple2/joy/a2.stdjoy.s
index eecdd6a8a..043b7814e 100644
--- a/libsrc/apple2/joy/a2.stdjoy.s
+++ b/libsrc/apple2/joy/a2.stdjoy.s
@@ -36,6 +36,10 @@ PREAD   :=      $FB1E   ; Read paddle in X, return AD conv. value in Y
         .byte   $6A, $6F, $79   ; "joy"
         .byte   JOY_API_VERSION ; Driver API version number
 
+; Library reference
+
+        .addr   $0000
+
 ; Button state masks (8 values)
 
         .byte   $10
diff --git a/libsrc/apple2/libref.s b/libsrc/apple2/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/apple2/libref.s
+++ b/libsrc/apple2/libref.s
@@ -2,7 +2,8 @@
 ; Oliver Schmidt, 2013-05-31
 ;
 
-        .export         em_libref
+        .export         em_libref, joy_libref
         .import         _exit
 
 em_libref       := _exit
+joy_libref      := _exit
diff --git a/libsrc/atari/joy/atrmj8.s b/libsrc/atari/joy/atrmj8.s
index 777a52615..04840fc99 100644
--- a/libsrc/atari/joy/atrmj8.s
+++ b/libsrc/atari/joy/atrmj8.s
@@ -26,6 +26,10 @@
         .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
diff --git a/libsrc/atari/joy/atrstd.s b/libsrc/atari/joy/atrstd.s
index caca34cc5..34034b554 100644
--- a/libsrc/atari/joy/atrstd.s
+++ b/libsrc/atari/joy/atrstd.s
@@ -25,6 +25,10 @@
         .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
diff --git a/libsrc/atari/libref.s b/libsrc/atari/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/atari/libref.s
+++ b/libsrc/atari/libref.s
@@ -2,7 +2,8 @@
 ; Oliver Schmidt, 2013-05-31
 ;
 
-        .export         em_libref
+        .export         em_libref, joy_libref
         .import         _exit
 
 em_libref       := _exit
+joy_libref      := _exit
diff --git a/libsrc/atmos/joy/atmos-pase.s b/libsrc/atmos/joy/atmos-pase.s
index 81dba394a..c505a1b0f 100644
--- a/libsrc/atmos/joy/atmos-pase.s
+++ b/libsrc/atmos/joy/atmos-pase.s
@@ -21,6 +21,10 @@
         .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
diff --git a/libsrc/atmos/libref.s b/libsrc/atmos/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/atmos/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+        .export         joy_libref
+        .import         _exit
+
+joy_libref      := _exit
diff --git a/libsrc/c128/joy/c128-ptvjoy.s b/libsrc/c128/joy/c128-ptvjoy.s
index 5763fbe2d..d128b0ee0 100644
--- a/libsrc/c128/joy/c128-ptvjoy.s
+++ b/libsrc/c128/joy/c128-ptvjoy.s
@@ -24,6 +24,10 @@
         .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
diff --git a/libsrc/c128/joy/c128-stdjoy.s b/libsrc/c128/joy/c128-stdjoy.s
index f86853a81..860dab1ae 100644
--- a/libsrc/c128/joy/c128-stdjoy.s
+++ b/libsrc/c128/joy/c128-stdjoy.s
@@ -25,6 +25,10 @@
         .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
diff --git a/libsrc/c128/libref.s b/libsrc/c128/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/c128/libref.s
+++ b/libsrc/c128/libref.s
@@ -2,7 +2,8 @@
 ; Oliver Schmidt, 2013-05-31
 ;
 
-        .export         em_libref
+        .export         em_libref, joy_libref
         .import         _exit
 
 em_libref       := _exit
+joy_libref      := _exit
diff --git a/libsrc/c16/libref.s b/libsrc/c16/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/c16/libref.s
+++ b/libsrc/c16/libref.s
@@ -2,7 +2,8 @@
 ; Oliver Schmidt, 2013-05-31
 ;
 
-        .export         em_libref
+        .export         em_libref, joy_libref
         .import         _exit
 
 em_libref       := _exit
+joy_libref      := _exit
diff --git a/libsrc/c64/joy/c64-hitjoy.s b/libsrc/c64/joy/c64-hitjoy.s
index 637244b87..28495ee11 100644
--- a/libsrc/c64/joy/c64-hitjoy.s
+++ b/libsrc/c64/joy/c64-hitjoy.s
@@ -23,6 +23,10 @@
         .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
diff --git a/libsrc/c64/joy/c64-numpad.s b/libsrc/c64/joy/c64-numpad.s
index 28fd7e2b0..6eeebcc74 100644
--- a/libsrc/c64/joy/c64-numpad.s
+++ b/libsrc/c64/joy/c64-numpad.s
@@ -25,6 +25,10 @@
         .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"
diff --git a/libsrc/c64/joy/c64-ptvjoy.s b/libsrc/c64/joy/c64-ptvjoy.s
index 0b0e80e62..bb1ba0982 100644
--- a/libsrc/c64/joy/c64-ptvjoy.s
+++ b/libsrc/c64/joy/c64-ptvjoy.s
@@ -23,6 +23,10 @@
         .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
diff --git a/libsrc/c64/joy/c64-stdjoy.s b/libsrc/c64/joy/c64-stdjoy.s
index dc9434f4c..18722032a 100644
--- a/libsrc/c64/joy/c64-stdjoy.s
+++ b/libsrc/c64/joy/c64-stdjoy.s
@@ -24,6 +24,10 @@
         .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
diff --git a/libsrc/c64/libref.s b/libsrc/c64/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/c64/libref.s
+++ b/libsrc/c64/libref.s
@@ -2,7 +2,8 @@
 ; Oliver Schmidt, 2013-05-31
 ;
 
-        .export         em_libref
+        .export         em_libref, joy_libref
         .import         _exit
 
 em_libref       := _exit
+joy_libref      := _exit
diff --git a/libsrc/cbm510/joy/cbm510-std.s b/libsrc/cbm510/joy/cbm510-std.s
index 8a24dcbbb..1d8b242a6 100644
--- a/libsrc/cbm510/joy/cbm510-std.s
+++ b/libsrc/cbm510/joy/cbm510-std.s
@@ -25,6 +25,10 @@
         .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
diff --git a/libsrc/cbm510/libref.s b/libsrc/cbm510/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/cbm510/libref.s
+++ b/libsrc/cbm510/libref.s
@@ -2,7 +2,8 @@
 ; Oliver Schmidt, 2013-05-31
 ;
 
-        .export         em_libref
+        .export         em_libref, joy_libref
         .import         _exit
 
 em_libref       := _exit
+joy_libref      := _exit
diff --git a/libsrc/geos-cbm/joy/geos-stdjoy.s b/libsrc/geos-cbm/joy/geos-stdjoy.s
index 7cfd0ad08..9fb5461bb 100644
--- a/libsrc/geos-cbm/joy/geos-stdjoy.s
+++ b/libsrc/geos-cbm/joy/geos-stdjoy.s
@@ -22,6 +22,10 @@
         .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
diff --git a/libsrc/geos-cbm/system/libref.s b/libsrc/geos-cbm/system/libref.s
index 507c9887b..933eb5911 100644
--- a/libsrc/geos-cbm/system/libref.s
+++ b/libsrc/geos-cbm/system/libref.s
@@ -2,7 +2,8 @@
 ; Oliver Schmidt, 2013-05-31
 ;
 
-        .export         em_libref
+        .export         em_libref, joy_libref
         .import         _exit
 
 em_libref       := _exit
+joy_libref      := _exit
diff --git a/libsrc/joystick/joy-kernel.s b/libsrc/joystick/joy-kernel.s
index 71f94133a..d21727089 100644
--- a/libsrc/joystick/joy-kernel.s
+++ b/libsrc/joystick/joy-kernel.s
@@ -4,6 +4,7 @@
 ; Common functions of the joystick API.
 ;
 
+        .import         joy_libref
         .importzp       ptr1
         .interruptor    joy_irq         ; Export as IRQ handler
 
@@ -55,6 +56,15 @@ _joy_install:
         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
diff --git a/libsrc/lynx/joy/lynx-stdjoy.s b/libsrc/lynx/joy/lynx-stdjoy.s
index 9c5165a77..da7b4612c 100644
--- a/libsrc/lynx/joy/lynx-stdjoy.s
+++ b/libsrc/lynx/joy/lynx-stdjoy.s
@@ -26,6 +26,10 @@
         .byte   $6A, $6F, $79           ; "joy"
         .byte   JOY_API_VERSION         ; Driver API version number
 
+; Library reference
+
+        .addr   $0000
+
 ; Button state masks (8 values)
 
 joy_mask:
diff --git a/libsrc/lynx/libref.s b/libsrc/lynx/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/lynx/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+        .export         joy_libref
+        .import         _exit
+
+joy_libref      := _exit
diff --git a/libsrc/nes/joy/nes-stdjoy.s b/libsrc/nes/joy/nes-stdjoy.s
index 76ca96005..1ff8395c9 100644
--- a/libsrc/nes/joy/nes-stdjoy.s
+++ b/libsrc/nes/joy/nes-stdjoy.s
@@ -23,6 +23,10 @@
         .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
diff --git a/libsrc/nes/libref.s b/libsrc/nes/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/nes/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+        .export         joy_libref
+        .import         _exit
+
+joy_libref      := _exit
diff --git a/libsrc/pet/joy/pet-ptvjoy.s b/libsrc/pet/joy/pet-ptvjoy.s
index 997352f06..19c2ca876 100644
--- a/libsrc/pet/joy/pet-ptvjoy.s
+++ b/libsrc/pet/joy/pet-ptvjoy.s
@@ -24,6 +24,10 @@ VIA_DDRA        := $E843                ; Data direction register A
         .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
diff --git a/libsrc/pet/joy/pet-stdjoy.s b/libsrc/pet/joy/pet-stdjoy.s
index 155dbbdf7..3377c8f81 100644
--- a/libsrc/pet/joy/pet-stdjoy.s
+++ b/libsrc/pet/joy/pet-stdjoy.s
@@ -21,6 +21,10 @@
         .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
diff --git a/libsrc/pet/libref.s b/libsrc/pet/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/pet/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+        .export         joy_libref
+        .import         _exit
+
+joy_libref      := _exit
diff --git a/libsrc/plus4/joy/plus4-stdjoy.s b/libsrc/plus4/joy/plus4-stdjoy.s
index 74dbc52e4..f67487781 100644
--- a/libsrc/plus4/joy/plus4-stdjoy.s
+++ b/libsrc/plus4/joy/plus4-stdjoy.s
@@ -24,6 +24,10 @@
         .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
diff --git a/libsrc/plus4/libref.s b/libsrc/plus4/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/plus4/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+        .export         joy_libref
+        .import         _exit
+
+joy_libref      := _exit
diff --git a/libsrc/vic20/joy/vic20-ptvjoy.s b/libsrc/vic20/joy/vic20-ptvjoy.s
index fabb802f6..533726c7b 100644
--- a/libsrc/vic20/joy/vic20-ptvjoy.s
+++ b/libsrc/vic20/joy/vic20-ptvjoy.s
@@ -23,6 +23,10 @@
         .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
diff --git a/libsrc/vic20/joy/vic20-stdjoy.s b/libsrc/vic20/joy/vic20-stdjoy.s
index e49cd38f4..722aa8ea5 100644
--- a/libsrc/vic20/joy/vic20-stdjoy.s
+++ b/libsrc/vic20/joy/vic20-stdjoy.s
@@ -25,6 +25,10 @@
         .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
diff --git a/libsrc/vic20/libref.s b/libsrc/vic20/libref.s
new file mode 100644
index 000000000..e4afa7eb1
--- /dev/null
+++ b/libsrc/vic20/libref.s
@@ -0,0 +1,8 @@
+;
+; Oliver Schmidt, 2013-05-31
+;
+
+        .export         joy_libref
+        .import         _exit
+
+joy_libref      := _exit