Retrieve STICK(0) first. STICK(0) will sample all the joystick values and return the x-coordinate of joystick A. STICK(1) returns the y-coordinate of joystick A that it found last time STICK(0) was called. https://archive.org/stream/IBMBASICAV1.10Manual/IBM%20BASICA%20v1.10%20Manua... Also, are you sure the values go from 0-255 like they do on the Apple? In particular, if it's only, say, returning 0-100, then it's never going to be more than 180, and it's likely to go the other way when in an auto-entered resting state. -Paul
On Jul 10, 2018, at 1:34 PM, Evan Koblentz via vcf-midatlantic <vcf-midatlantic@lists.vcfed.org> wrote:
I know anyone can make mistakes, but .... I am VERY confident in my code this time around. :)
Alas, I don't have the actual IBM code here at home.
The joystick routine in my (perfectly working) Applesoft code is:
--------------------------
3000 REM NAVIGATION 3010 FB = PDL (1):LR = PDL (0):M = 0: REM SET VARIABLES 3020 IF FB < 75 THEN M = 5 3030 IF FB > 180 THEN M = 10 3040 IF LR < 75 THEN M = 9 3050 IF LR > 180 THEN M = 6 3060 POKE L,M: REM SEND COMMANDS 3070 IF M = 10 THEN CALL - 198: FOR W = 1 TO 500: NEXT W: REM BACKUP ALERT 3080 RETURN
--------------------------
I made two changes for the IBM side:
3010 FB=STICK(1):LR=STICK(0):M=0: REM SET VARIABLES
3060 OUT P,M: REM SEND COMMANDS
Both lines are correct. No room for gray area there.
I omitted line 3070 for now. It makes the backup beep when the robot goes in reverse. :) I'll add an IBM version back in after I get the navigation working again.
I don't have time now to explain to everyone how the Lego system works, but anyone who's interested is welcome to examine the relevant pages of my under-construction web site about this subject. :)
http://www.snarc.net/mbts/applebasic.htm http://www.snarc.net/mbts/direct.htm