IJK-egopad the joypad for Oric by [raxiss]

This is the right place to discuss on how to implement hardware vsync, adding a VIA or AY chipset, puting multiple roms, or how to design a new flash expansion card.
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: IJK-egopad the joypad for Oric by [raxiss]

Post by iss »

Dbug wrote: Thu Dec 10, 2020 4:53 pm
xahmol wrote: Thu Dec 10, 2020 10:57 am By the way: now IJK seems to be much more standard with all developments, would it be an idea to actually include this code in the standard OSDK libs?
That's not a bad idea, if something has some proper clean project that does that, could probably be added, with the joystick code in the libs, and how to use it in a sample program.
Here we go: https://github.com/iss000/IJK-egoist

Includes:
- driver source code - XA compatible, maybe some little optimizations can be done depending on usage, compiled is 148 bytes, works perfectly with mym and pt3 players;
- C testing program - link it with driver source, I tried to be as simple as possible, only TEXT rom routine is used, can be compiled with OSDK or CC65;
- BASIC test program - the driver is compiled at #9000 and converted to DATA statements, exactly the same as the C example (but slower :) );
- see release/ directory for compiled TAPs of above test programs.

Please, try it, by need of changes, updates and/or wishes - give feedback.
I would be happy to move this code to OSDK ;).
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: IJK-egopad the joypad for Oric by [raxiss]

Post by xahmol »

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
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: IJK-egopad the joypad for Oric by [raxiss]

Post by iss »

First post updated again!
Post Reply