How the JOYSTIK editor (BASIC front-end) works

← Voltmace Delta 14B Driver

The JOYSTIK editor (BASIC front-end)

This describes the BBC BASIC program in voltmace-delta-14b-driver-joystik.bas — the user-facing half of the Voltmace Delta 14B JOYSTIK software. Line numbers below refer to that program.

What it is for

The Delta 14B handset has a two-axis analogue joystick, two fire buttons, and (via the Delta 14B/1 adaptor) a keypad. Games written for the keyboard can't use it directly. This program lets you map joystick directions, fire buttons and keypad keys onto keyboard keys, then installs a small machine-code resident driver that makes those inputs look like key presses to any game that reads the keyboard with INKEY(-key) (lines 500–510 explain that convention to the user).

You pick a joystick configuration, choose a ready-made mapping for an Acornsoft game (or define your own), optionally test and tune it, and finish. The resident driver then stays at &A00–&AFF while your game is loaded and run.

The companion machine code — the two resident driver variants this program installs — is covered by the disassemblies in driver-a.asm and driver-b.asm.

Shape of the program

Lines Role
10–170 Startup, protection clean-up, OS check, array DIMs
190–240 Main flow: intro, init, game select, edit, build, menu
250–272 Error handling
280–520 PROCINTRO — copyright, joystick-configuration choice, help
530–600 Screen furniture (PROCCONT, PROCWARN, PROCSCREEN, PROCFUNCTION)
610–990 PROCGAME — pick a preset game mapping or user-define; the DATA tables
1000–1240 Key display/entry (PROCEDIT, PROCKEY, PROCDEFAULTPRINT)
1080–1190 PROCINIT — key-name, INKEY-value, sensitivity and channel tables
1250–1370 PROCFINI — how to save the resident driver and load your game
1380–1460 PROCTERM — the Edit / Test / Sensitivity / Finish menu
1470–1710 PROCTEST — live display of joystick, buttons and keypad
1720–1870 PROCASSEM — build and install the resident driver
1880–1930 PROCJOY — adjust joystick sensitivity
1960–2010 Finish: wipe the program, leave the resident driver running

Startup and protection (10–170)

Line 10 is a REM whose length byte is stored as 0 and repaired to &17 by the loader before the program runs. Line 50 selects MODE 7, clears Z%, and saves the current BYTEV (OVL%=?&20A:OVH%=?&20B) — the previous OSBYTE vector, which the resident driver will chain to. As in the KEYPAD editor, Z% is a resident integer (at &468) that selects protected behaviour (Z%=0) over an unprotected/developer mode (Z%=1); it is 0 here and nothing changes it, so the protected path always runs. Lines 60–80 accordingly reprogram the BREAK key: a BBC Micro has no f10 key, so soft key 10 (*KEY10) is the "break string" a soft (single) BREAK types into the input. They set it to a self-destruct — empty the program at PAGE, zero &1902&5000, and print "PROGRAM PROTECTED" — arming the trap rather than firing it now. Line 90 reads the OS version (?&F0C7/?&F0C8); line 130's *FX200,2 additionally clears user memory on the next BREAK (OSBYTE 200 bit 1) while leaving ESCAPE (bit 0) working as the handled "restart" path; and lines 140–150 dimension the working arrays.

Intro and joystick configuration (280–520)

PROCINTRO shows the copyright, then (lines 350–400) asks which configuration is in use:

Lines 420–510 explain that the resident driver simulates up to J% keyboard keys and is compatible with games that read the keyboard via INKEY(-key).

Choosing a mapping (610–990)

PROCGAME lists eight choices (line 610): user-defined plus seven Acornsoft games (named in the T$ table, line 1150). Selecting one (line 640) RESTOREs to the matching DATA line (810–960 for single joystick, 890–960 for the adaptor configurations) and reads a preset list of INKEY key numbers into V%() — the key each joystick input should emulate for that game.

Initialisation tables (1080–1190)

PROCINIT sets the sensitivity (SEN%, and the thresholds SL%/SH%, line 1080), then reads:

Defining and displaying keys (1000–1240)

For user-defined mappings, PROCEDIT (line 1020) restores the saved BYTEV so the keyboard reads normally, then PROCKEY (line 1200) waits for you to hold a key, identifies it by scanning INKEY(-N%(n)) for every key, and records its INKEY value in V%(). PROCDEFAULTPRINT (line 1040) shows the current mapping.

Building the resident driver (1720–1870)

PROCASSEM turns the mapping into a working resident driver:

Test, tune and finish (1380–2010)

PROCTERM (line 1380) offers Edit / Test / Alter sensitivity / Finish. PROCTEST (line 1470) shows a live grid: PROCDISAD/PROCDISLOW/PROCDISHIGH threshold the analogue axes (ADVAL), PROCDISFIRE reads the fire buttons (ADVAL(0)), and PROCDISUP reads the keypad matrix through the User VIA. PROCJOY (line 1880) re-computes SL%/SH% from a 1–9 sensitivity and re-pokes &AFD/&AFE live. PROCFINI (line 1250) tells you how to *SAVE the resident driver (*SAVE <name> A00 +100) and re-install it later (*KEY10 CALL &A00). The finish code (lines 1960–2010) blanks and detaches the program, leaving only the configured resident driver.