Ninja Tap BASIC driver
This page was last modified 00:48, 1 November 2022 by Aoineko. Based on work by Mars2000you.

This driver allow to use Ninja Tap device in BASIC programs.

It transparently manages joysticks whether they are connected directly to the MSX or via a Ninja Tap so it works even if no Ninja Tap is connected to the MSX.

Driver can be download at: https://github.com/aoineko-fr/MSXgl/raw/main/projects/samples/emul/bin/s_usr.bin (678 bytes in size).

It will be loaded at C000h address and must be connected using:

BLOAD "s_usr.bin"
DEF USR=&HC007 ' +7 bytes to skip the binary header

Once loaded, you have 3 functions available to manage the device:

1) To detect a Ninja Tap:

A=USR(0)
Return:
  7   6   5   4   3   2   1   0
  │   │   │   │   └───┴───┴───┴── Number of joystick ports available (2, 5 or 8)
  │   │   └───┴────────────────── Tap type pluged in port 1 (0=No Tap, 1=Ninja Tap, 2=Shinobi Tap)
  └───┴────────────────────────── Tap type pluged in port 2 (0=No Tap, 1=Ninja Tap, 2=Shinobi Tap)

2) To update all joystick data (Ninja Tap and normal joystick):

A=USR(-1) ' Should be call each frame (or every two frame)

3) To get data from a specified joystick (from 1 to the number of joystick given in first function):

A=USR(N) ' Where N can be from 1 to 8
Return:
  7    6   5   4   3   2   1   0
  │    │   │   │   │   │   │   └── Right direction
  │    │   │   │   │   │   └────── Left direction
  │    │   │   │   │   └────────── Down direction
  │    │   │   │   └────────────── Up direction
  │    │   │   └────────────────── Start bouton (for NES pad)
  │    │   └────────────────────── Select bouton (for NES pad)
  │    └────────────────────────── A bouton
  └─────────────────────────────── B bouton