Can definately work with it, great! Added IJK support to my Ludo game. Was not that difficult as my original C128 code actually already supported joystick so only had to add an IJKread routine to be used in stead of the C128 JOY(n) function.
https://github.com/xahmol/ludo/raw/main/Oric%20Atmos/BUILD/LUDO.dsk
I cannot test on real hardware yet, as my IJK interface is still in the mail from Bulgaria, but it works in Oricutron, alltough somewhat sluggisch (not every joystick press is immediately picked up it seems). Wil see if I can refine after I see performance on real hardware/real interface.
You can now also navigate menus by IJK joystick.
To do still is to convert the whole thing to C to improve performance further. But for now glad it seems to work.
BTW: did not use the BASIC sample as loading at #9000 was crashing with the music data.... so compiled the assembler code to a diferent address. See sources at
https://github.com/xahmol/ludo/tree/main/Oric%20Atmos. Tips are of course welcome.
My present code (using the Optimized and Label settings of the OSDK tekst to BASIC converter):
Code: Select all
'IJK INTERFACE DETECT
subIJKDetect
CALL #A000
IF PEEK(#A006)=0 THEN JP=0: ELSE JP=1
RETURN
'IJK JOYSTICK INTERFACE READ
subIJKRead
JL = 0: JR = 0: JU = 0: JD = 0: JF = 0
IF JP=0 THEN RETURN
CALL #A003
JA = PEEK(#A007): JB = PEEK(#A008)
IF MID$(TJ$,1,1)="0" THEN GOTO endifIJKRead1
IF (JA AND 1) OR (JB AND 1) THEN JR=1
endifIJKRead1
IF MID$(TJ$,2,1)="0" THEN GOTO endifIJKRead2
IF (JA AND 2) OR (JB AND 2) THEN JL=1
endifIJKRead2
IF MID$(TJ$,3,1)="0" THEN GOTO endifIJKRead3
IF (JA AND 8) OR (JB AND 8) THEN JD=1
endifIJKRead3
IF MID$(TJ$,4,1)="0" THEN GOTO endifIJKRead4
IF (JA AND 16) OR (JB AND 16) THEN JU=1
endifIJKRead4
IF (JA AND 4) OR (JB AND 4) THEN JF=1
RETURN
Input of the Read routine is:
- JP: Joystick present =1, otherwise 0
- TJ$: Permitted joystick values, a four length string with 0 or 1 for respectively allowing Right, Left, Down, Up.
Output:
- If buttons are pressed on either of the two joystick ports, set JR, JL, JD, JU and/or JF on 1 for Right, Left, Down, Up, Fire