[vcf-midatlantic] If anyone's interested: latest robot program

Dan Roganti ragooman at gmail.com
Mon Feb 20 11:45:15 EST 2017


On Mon, Feb 20, 2017 at 2:47 AM, Jeffrey Brace via vcf-midatlantic <
vcf-midatlantic at lists.vintagecomputerfederation.org> wrote:

> Yeah! No more spaghetti code! And using GOSUBs instead of GOTO.
>
> Well I will have to work on ways to defeat your Lego robot in a future
> robot war! ;)



​Jeff,
FYI, if you want, pretty soon you can use the Lego robot kits on the C64
too,
getting the adapter cable made here​ to run it on mine
all you need is just need a 9750 box, the software is basically the same

Evan,
FYI, this is what I mentioned last time,
this will let you operate the forklift at the same time, just like a real
one
Because it speeds up your reaction time during a robot contest
Even when the forklift motor is slow
which is best reason to use this "multi-motor" option

Also, this removes the *redundant* subroutine 3000 for the Forklift motor
All motors can be controlled in *one* subroutine at 2000
As you can see, the Poke value is the sum of M and F,
So one setting doesn't disturb the other
The new Input subroutine at 3000 takes care of *all* inputs
and they're saved into their respective variables
This allow non-blocking operation
Dan

 10 GOSUB 1000: REM  INIT LEGO
 15 M=0:F=0
 20 POKE L,0: REM  ALL OFF
 25 GOSUB 3000: REM CHECK INPUT
 30 GOSUB 2000: REM MOTORS
 40 GOTO 25
 50 END

 1000 S = 7:L = 49280 + S * 16
 1010  POKE L + 3,1
 1020  POKE L + 2,63
 1030  POKE L + 1,0
 1040  POKE L,0
 1050  RETURN

 2000  REM MOTORS, BOTH DRIVE AND FORKLIFT SETTINGS
 2070  POKE L,M+F
 2080  IF M = 10 THEN  CALL  - 198: FOR W = 1 TO 500: NEXT W
 2090  RETURN

 3000 REM CHECK INPUT, JOYSTICK FIRST
 3010 FB =  PDL (1):LR =  PDL (0)
 3015 IF FB < 75 THEN M = 5:GOTO 3040
 3020 IF FB > 180 THEN M = 10:GOTO 3040
 3025 IF LR < 75 THEN M = 9:GOTO 3040
 3030 IF LR > 180 THEN M = 6:GOTO 3040
 3035 M = 0:REM IF NO DIR, KEEP OFF
 3040 REM CHECK BUTTONS
 3045 IF  PEEK (49249) > 127 THEN  F=16:GOTO 3060
 3050 IF  PEEK (49250) > 127 THEN  F=32:GOTO 3060
 3055 F=0:REM IF NO BUTTON, KEEP OFF
 3060 RETURN



More information about the vcf-midatlantic mailing list