FAQ  •  Register  •  Login

Reading Kempston Joystick using function IN 31

<<

Luzie

Posts: 32

Joined: Thu Nov 05, 2015 9:11 pm

Post Sun Jan 08, 2017 9:45 pm

Reading Kempston Joystick using function IN 31

Hi,

I´m missing the IN function in ZX BASIC (as it was in Original Sinclair ZX Spectrum BASIC).

Would like to use it as described here:
https://chuntey.wordpress.com/2010/01/0 ... -programs/

Must I use some machine code emulate?
If so, can someone please post me an example?

Regards,

Luzie
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Sun Jan 08, 2017 11:30 pm

Re: Reading Kempston Joystick using function IN 31

ZX Basic supports the IN and OUT instructions. If you cannot compile them then there is a syntax error.

Reading the listings in the page, remember that ZX BASIC, at this moment, requires every IF to be closed with END IF.
E.g.
  Code:
10 LET x=10: LET y=10
20 LET kj=IN 31: REM get the state of joystick
30 PRINT AT y,x;"*"
40 IF (kj>31) OR (kj=0) THEN GO TO 20: END IF: REM ignore spurious inputs
<<

Luzie

Posts: 32

Joined: Thu Nov 05, 2015 9:11 pm

Post Mon Jan 09, 2017 9:23 pm

Re: Reading Kempston Joystick using function IN 31

Hi,

thanks for your reply. I did some things wrong with the FUSE Emulator I used for testing:

On FUSE Kempston has to be enabled in at least two menus (Options / Peripherals / General and Options / Joystick).

Also I thought IN is not supported as I can´t find it on the Wiki. My fault. If I had a look at the MCode I should see that IN is correctly supported by ZX Basic.

Regards,

Luzie
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Mon Jan 09, 2017 9:31 pm

Re: Reading Kempston Joystick using function IN 31

Luzie wrote:Hi,

thanks for your reply. I did some things wrong with the FUSE Emulator I used for testing:

On FUSE Kempston has to be enabled in at least two menus (Options / Peripherals / General and Options / Joystick).

Also I thought IN is not supported as I can´t find it on the Wiki. My fault. If I had a look at the MCode I should see that IN is correctly supported by ZX Basic.

Regards,

Luzie

No worries! Thanks for using ZX Basic. Hope you find it helpful
<<

britlion

Posts: 766

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Wed Aug 09, 2017 11:34 am

Re: Reading Kempston Joystick using function IN 31

Luzie wrote:Hi,

Also I thought IN is not supported as I can´t find it on the Wiki. My fault. If I had a look at the MCode I should see that IN is correctly supported by ZX Basic.


It seems to be at least in the keyword list:

http://www.boriel.com/wiki/en/index.php ... dentifiers

Return to How-To & Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO