JoyMod was originally provided to allow Joysticks on the Parallel port. Here's the source for the first version provided with Manchester United:
Code: Select all
REM>JoymodSrc
MODE 0
PRINT "Click on !!MUFC!! to start the game"
PRINT
PRINT "For Acorn computer experts only:"
PRINT "This is the source code for the joystick module on the disk (inside !!MUFC!!)"
PRINT "It works with two 1 of 8 input selectors connected to the parallel printer port"
PRINT "{Cost of parts about £8 ish}."
PRINT "Experienced users can change this to suit any hardware they may have."
PRINT "The bit patterns for each joystick are active set. {%000FUDLR}"
PRINT "We cannot supply the hardware,and cannot accept any responsiblity for any use"
PRINT "of the joystick module it's use or advise modifications."
PRINT "You will have to enable the joystick module on the define keys screen of the"
PRINT "Manchester United Management Section."
PRINT "We intend to {and hope others will} support this module and SWI number &CFFC0"
PRINT "in the future. Note that this SWI number is a USER number and was NOT allocated"
PRINT "by Acorn."
PRINT "This program also supports the Voltmace analogue mouse joystick.Enable as for Joystick module."
PRINT
JOYSWI=&CFFC0
sp=13 :REM Stack pointer
link=14 :REM Link register
DIM CODE 10000 :REM Where to stick the code
FOR PASS=0 TO 2 STEP 2
P%=CODE
[OPT PASS
.CODESTART
EQUD 0
EQUD INITIALISE-CODE
EQUD FINALISE-CODE
EQUD 0
EQUD MTITLE-CODE
EQUD HELPSTRING-CODE
EQUD 0 ;HELPTABLE
EQUD JOYSWI
EQUD SWI_ENTRY-CODE
EQUD SWI_DECODE_TABLE-CODE
EQUD 0
.INITIALISE
.FINALISE
MOV pc,link
.MTITLE EQUS "Joystick"
equb 0
.HELPSTRING
EQUS "Bogeysticks"
EQUB 9
EQUS "1.00 (5 Apr 1990)"
ALIGN
.SWI_ENTRY
CMP R11,#(JUMPEND-JUMPTB)/4
ADDCC PC,PC,R11,LSL #2
B UNKNOWN
.JUMPTB
BAL readstick0
BAL readstick1
.JUMPEND
.UNKNOWN
ADR R0,XERRORM
ORRS PC,R14,#1<<28
.XERRORM
EQUD &1E6
EQUS "No Such SWI (Joymodule)":equb 0
ALIGN
.SWI_DECODE_TABLE
EQUS "Joy":EQUB 0
EQUS "Read0":EQUB 0
EQUS "Read1":EQUB 0
ALIGN
.delay
mov pc,link
.readstick0 ;Read the joystick
stmfd (sp)!,{link}
; swi "OS_EnterOS"
mov r0,#0
mov r1,#31
ldr r2,pout ;Printer data out
mov r3,#&3200000 ;Base of I/O page
mov r4,#&c1 ;Fire
strb r4,[r2]
bl delay
ldrb r4,[r3,#16]
and r4,r4,#1
orr r0,r0,r4,lsl #4
mov r4,#&c0 ;Up
strb r4,[r2]
bl delay
ldrb r4,[r3,#16]
and r4,r4,#1
orr r0,r0,r4,lsl #3
mov r4,#&c4 ;Down
strb r4,[r2]
bl delay
ldrb r4,[r3,#16]
and r4,r4,#1
orr r0,r0,r4,lsl #2
mov r4,#&c2 ;Left
strb r4,[r2]
bl delay
ldrb r4,[r3,#16]
and r4,r4,#1
orr r0,r0,r4,lsl #1
mov r4,#&c6 ;Right
strb r4,[r2]
bl delay
ldrb r4,[r3,#16]
and r4,r4,#1
orr r0,r0,r4
orr r1,r15,#3
;teqp r1,#3
ldmfd (sp)!,{pc}
.readstick1 ;Read the joystick
stmfd (sp)!,{link}
;swi "OS_EnterOS"
mov r1,#31
ldr r2,pout ;Printer data out
mov r3,#&3200000 ;Base of I/O page
mov r4,#&c1 ;Fire
strb r4,[r2]
bl delay
ldrb r4,[r3]
and r4,r4,#64
eor r1,r1,r4,lsr #2
mov r4,#&c0 ;Up
strb r4,[r2]
bl delay
ldrb r4,[r3]
and r4,r4,#64
eor r1,r1,r4,lsr #3
mov r4,#&c4 ;Down
strb r4,[r2]
bl delay
ldrb r4,[r3]
and r4,r4,#64
eor r1,r1,r4,lsr #4
mov r4,#&c2 ;Left
strb r4,[r2]
bl delay
ldrb r4,[r3]
and r4,r4,#64
eor r1,r1,r4,lsr #5
mov r4,#&c6 ;Right
strb r4,[r2]
bl delay
ldrb r4,[r3]
and r4,r4,#64
eor r1,r1,r4,lsr #6
mov r0,r1
orr r1,r15,#3
;teqp r1,#3
ldmfd (sp)!,{pc}
.pin dcd &3200010
.pout dcd &3250010
.CODEEND
]
NEXT PASS
PRINT "Module ASSEMBLED"
PRINT
A$= "If you want to save the new module type in:"+CHR$(13)+CHR$(10)+"*SAVE JoyMod "+STR$~CODE+"+"+STR$~(CODEEND-CODE)+CHR$(13)+CHR$(10)+"*SetType JoyMod Module"
PRINT A$
PRINT
PRINT "Please do not save the module on your original game disk!!!!"
PRINT
PRINT "RISC OS users can click on the new module from the desktop before clicking on"
PRINT "!!MUFC!! and this version of the module will be used instead if the one on the"
PRINT "disk."
It was later extended to provide RTFM and Serial Port support and Joystick->Keyboard translation with the following * Commands being added:
I've been through all the Krisalis games I have and determined the following rely on JoyMod for their Joystick support:
From comparing JoyMod 4.27 with the Joystick Module that comes with RTFM, it appears JoyMod is a later version of the RTFM Joystick Module, using the same SWI block and SWI's etc. It doesn't appear to provide Serial Port support so the games must be doing that themselves.
The original JoyMod attached above just supports Joysticks on the Parallel Port and was later dropped in favour of the RTFM version.