Joystick options per target? Cursors as joystick on all targets with cursors?

Discussion about other targets
Post Reply
Fabrizio
Member
Posts: 115
Joined: Tue Jul 11, 2017 9:28 pm

Joystick options per target? Cursors as joystick on all targets with cursors?

Post by Fabrizio »

Hi

Where can I see which joystick options (values for "stick") are possible for a given target?

It would be nice to have cursors+space mapped as joystick on all targets with physical cursors and space keys.

For example I would like to use cursors+space on the Laser500. Does it have an option to use cursors as joystick?
Of course I can do it by reading them as keys but I would have to go through the keyboard buffer, which is probably different from the more immediate joystick routines.
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by RobertK »

Below is an incomplete list I have created manually over the past one or two years, it would be good if something like this could be generated programmatically.

Virtual joystick support for all targets would certainly be very helpful for cross development.

It would also be nice to have a constant defined when games.h support is available. Currently I am doing this:

Code: Select all

#if defined(__ABC80__) || defined(__CPC__) || defined(__SORCERER__) || defined(__KC__) || defined(__MULTI8__) || defined(__NASCOM__) || defined(__PC6001__) || defined(__OSBORNE1__) || defined(__SPC1000__) || defined(__EINSTEIN__) || defined(__TIKI100__) || defined(__Z1013__) || defined(__MZ2500__) || defined(__FP1100__) || defined(__ACE__) || defined(__P2000__) || defined(__X1__) || defined(__KAYPRO83__) || defined(__ATTACHE__) || defined(__QC10__) || defined(__PC88__) || defined(__DMV__) || defined(__LASER500__) || defined(__ZX80__) || defined(__SMC777__) || defined(__PASOPIA7__) || defined(__EXCALIBUR64__) || defined(__RC700__) || defined(__BIC__) || defined(__HEMC__) || defined(__HGMC__) || defined(__KRAMERMC__) || defined(__BONDWELL12__) || defined(__BONDWELL2__) || defined(__PCW__) || defined(__GL__)
	#define GAMES_H_NOT_AVAILABLE 1
#else
	#include <games.h>	// for virtual joystick control
#endif

Alphatronic PC: 1 - QAOP-MN, 2 - 8246-05, 3 - hjkl-sd, 4 - Cursor

Bandai RX-78: 1 - Joystick 1, 2 - Joystick 2, 3 - QAOP-MN, 4 - 8246-05, 5 - hjkl-sd, 6 - Cursor

Bit-90: 1 - QAOP-MN, 2 - 8246-05, 3 - hjkl-sd, 4 - Cursor, 5 - Joystick 1, 6 - Joystick 2, 7 - Joystick 2 + Keypad 1, 8 - Joystick 2 + Keypad 2

Camputers Lynx: No cursor keys input reaction. Seems to require the -pragma-redirect:getk=getk_inkey parameter. Difficult to test because console scrolling is so slow. 1 - QAOP-MN, 2 - 8246-05, 3 - hjkl-sd, 4 - Cursor

Casio PV-1000: Joystick 1 and 2

Casio PV-2000: 1 - QAOP-MN, 2 - 8246-05

Colecovison: Joystick 1 and 2

TRS-80 and EG2000: 1 - QAOP-MN, 2 - 8246-05, 3 - hjkl-sd, 4 - Cursor

Galaksija: 1 - Arrows and Space, 2 - 5678-0

Homelab: 1 - QAOP-MN, 2 - 8246-05, 3 - hjkl-sd, 4 - Cursor

Jupiter Ace: 1 - 1-5, 2 - 6-0, 3 - Cursor
The 6-0 set interferes with the cursor key set. Instead of 1-5 and 6-0, QAOP-MN would be nice to have, like on the ZX81.

Laser 210 / VZ200: 1 = 1-5, 2 = 6-0, 3 = QAOP-MN

Laser 350 / 500: 1 - Joystick 1, 2 - QAOP-MN, 3 - 8246-05, 4 - hjkl-sd

Mattel Aquarius: 1 - QAOP-MN, 2 - 8246-05, 3 - hjkl-sd, 4 - Cursor

MC-1000: probably 1 - Joystick 1, 2 - Joystick 2
Additional QAOP-MN support would be nice to have.

Memotech MTX: 1 - Joystick 1, 2 - Joystick 2
Additional support for cursor keys (1 5 3 .) would be nice to have.

Microbee: 1 - Arrows and Space, 2 - Arrows + SPACE (256TC), 3 - Joystick on parallel port

MSX: 1 - Cursor, 2 - Joystick 1, 3 - Joystick 2

Nichibutsu My Vision: Joystick names wrong ("1 - QAOP-MN, 2 - 8246-05"), otherwise "Joystick 1 uses keys A,B,C,D,E,10, joystick 2 uses keys 1,2,3,4,5,6"

Nintendo Gameboy: 1 - QAOP-MN, 2 - 8246-05

Philips P2000: reacts only to left direction input (1 = QAOP-MN, 2 = 8246-05)

Philips VG5000: 1 - Joystick 1, 2 - Joystick 2, 3 - AQOP-MN, 4 - 8246-05, 5 - hjkl-sd, 6 - Cursor

PMD 85: 1 - QAOP-MN, 2 - 8246-05, 3 - hjkl-sd

Sega SC3000: 1 - Joystick 1, 2 - Joystick 2, 3 - QAOP-MN, 4 - 8246-05, 5 - hjkl-sd, 6 - Cursor

Sharp MZ: 1 - QAOP-MN, 2 - 8246-05

Sony SMC-777: 1 - Joystick 1, 2 - Joystick 2

Sord M5: 1 - Joystick 1 + Space, 2 - QAOP-MN, 3 - 8246-05, 4 - hjkl-sd

Super-80: 1 - QAOP-MN, 2 - 8246-05, 3 - hjkl-sd, 4 - Cursor

SVI: joystick input still needs to be tested, otherwise 1 - Joystick 1, 2 - Joystick 2, 3 - QAOP-MN, 4 - 8246-05, 5 - hjkl-sd, 6 - Cursor

Toshiba Pasopia 7: 1 - Joystick 1, 2 - Joystick 2

Z80 TV Game: 1 - Joystick 1

Z9001: 1 - Joystick 1, 2 - Joystick 2
There are slowdowns when the stick is held in one direction. Cursor key support would be nice to have.

ZX80: 1 - QAOP-MN, 2 - 8246-05

ZX81: 1 - Kempston, 2 - ZXPand, 3 - QAOP-MN, 4 - Cursor

ZX Spectrum: 1 - Kempston, 2 - Sinclair 1, 3 - Sinclair 2, 4 - Cursor, 5 - Fuller


ABC80,
Amstrad CPC,
Casio FP-1100,
Exidy Sorcerer,
KC 85/2-5,
Mitsubishi Multi-8,
Nascom,
NEC PC-6001 Mk2,
Osborne 1,
Samsung SPC-1000,
Sharp MZ-2500,
Tatung Einstein,
Tiki-100,
Z1013:
'_joystick_type' not defined (no virtual joystick support)
Fabrizio
Member
Posts: 115
Joined: Tue Jul 11, 2017 9:28 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by Fabrizio »

Thanks!

Could it be possible to have support for cursors on the Laser 500?
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by dom »

Every target does have joystick support, there are effectively 3 levels of it:

* Keyboard joysticks using ROM functions: Only a single direction can be registered at once
* Keyboard joysticks using inkey driver: Multiple directions supported
* Hardware joystick support: Multiple directions supported

I agree a <feature.h> style header would be useful, I just can't face figuring out what things might be useful, let alone writing the best part of 800 #defines at this point in time - sorry.

If a target has <input.h> support, then there's two functions that might be useful:

Code: Select all

/* Order for below is right, left, down, up, fire, fire2, fire3, fire4 */
/* Internal keyboard joysticks that use inkey driver */
extern uint8_t __LIB__ joystick_sc(int *scan_codes) __z88dk_fastcall;
/* Takes an array of ascii codes to check for joystick (0 terminated) */
extern uint8_t __LIB__ kjoystick(uint8_t *keycodes) __z88dk_fastcall;
The first one takes scancodes - the result of in_LookupKey() and the second performs in_LookupKey() on every invocation and takes ascii codes, so for example to get a joystick that uses the cursors something like the following should work:

Code: Select all

uint8_t  keys[] = { 9, 8, 10, 11, 32, 0  }

uint8_t joy = joystick(keys);

if ( joy & MOVE_RIGHT) {

} ....
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by dom »

Fabrizio wrote: Tue May 11, 2021 7:01 pm Thanks!

Could it be possible to have support for cursors on the Laser 500?
I actually think this is implemented as joystick(5) - it's only recently the extended keyboard rows were scanned by default.
Fabrizio
Member
Posts: 115
Joined: Tue Jul 11, 2017 9:28 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by Fabrizio »

@dom Maybe the joystick does not work on the Laser500 I have tried stick=2 and stick=5 and none of them worked.
Maybe I am doing something wrong.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by dom »

Yeah, I can't get stick=5 working (which doesn't surprise me since I never tested it), but sticks 2,3,4 are working for me.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by dom »

dom wrote: Tue May 11, 2021 7:49 pmI agree a <feature.h> style header would be useful, I just can't face figuring out what things might be useful, let alone writing the best part of 800 #defines at this point in time - sorry.
However, I think I can take a spreadsheet and auto generate the 133 targets * 21 feature flags I've figured out so far.

Code: Select all

HAVE_KEYBOARD	
HAVE_INKEY	
HAVE_ONEBITSOUND	
HAVE_PSG_AY	
HAVE_PSG_AY_WYZ	
HAVE_PSG_AY_VT2	
HAVE_PSG_SN76489	
HAVE_PSG_SAA1099	
HAVE_INTERRUPTS	
NEED_INTERRUPT_INIT	
HAVE_RS232	
HAVE_FILEIO	
HAVE_TIME	
HAVE_VIDEO_MC6847	
HAVE_VIDEO_MC6845	
HAVE_VIDEO_VDP	
HARDWARE_JOY1_INDEX	
HARDWARE_JOY2_INDEX	
GENCON_MAX_UDGS	
HAVE_GFX
HAVE_GFX_COLOUR
Anything obvious that I've missed?
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by dom »

Okay, first version of this is now up here: https://github.com/z88dk/z88dk/blob/mas ... features.h

The file is autogenerated so it's easy to change names, adding features is tedious but can be done. This is in addition to __CONIO_VT100 which is defined for -clib=ansi and __HAVE_GENCON which is defined when --generic-console is supplied as an option.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by stefano »

Sorry for getting here late, you could add HAVE_CLOCK and HAVE_DATE (this latter is less interesting, I think) and/or we could invent a custom funnction name like randomize()..
Other possible options could involve graphics resolution ranges (wide, blocky..), CPU speed (e.g. FAST_CPU or SLOW_CPU), console features and peculiarities(scrolling, autorepeat, getk..), memory capabilities (banking, small stack or mem space).
These are just sparse thoughts, not real requests, though.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by dom »

There's HAVE_TIME which indicates a fully working <time.h>, HAVE_CLOCK might be useful in terms of being able to get hold of a tick counter though.

I was thinking about graphics resolutions, but couldn't think of a way to do it sensibly! Many targets have multiple screen modes, and sometimes a choice between them to get change the colour capabilities at the same resolution so coming up with anything static is tricky. I suspect leaving that to the user with a call to getmaxx()/getmaxy() is easiest.

For console capabilities, again due to the screen mode this can't be static, there is the capabilities API which reflects the current screen mode: https://github.com/z88dk/z88dk/wiki/Cla ... pabilities which handles that side of things.

I think by the time you get down to banking, the code is going to end up pretty machine specific so there may not be much value there: I've not seen any multi-target projects using banking for either code or data.

Amazingly, apart from the console targets it looks like there's only one target without an available getk().

The spreadsheet to update/add parameters is here: https://github.com/z88dk/z88dk/blob/mas ... atures.csv which is processed into the header file using a bit of awk: https://github.com/z88dk/z88dk/blob/mas ... atures.awk Each of the lines in the csv (apart from +cpm -subtype=pasopia which doesn't seem to do anything) is tied into the multi target makefile here: https://github.com/z88dk/z88dk/blob/mas ... d/Makefile - I've added support into that for the -subtype variants - which means that makefile to test all of this stuff is really quite simple: https://github.com/z88dk/z88dk/blob/mas ... e/Makefile
Fabrizio
Member
Posts: 115
Joined: Tue Jul 11, 2017 9:28 pm

Re: Joystick options per target? Cursors as joystick on all targets with cursors?

Post by Fabrizio »

I think keyboard-mapped joystick and cursor-mapped joystick does not work on the Laser 500. At least I have not managed to get it work.
Post Reply