' {$STAMP BS2} ' {$PBASIC 2.5} DEBUG "Beeber" 'History '------- '2020-07-13 wrote program 'PC keyboard delay = short(ish), repeat rate = fast 'Acts '---- 'units cm, 5deg a1 DATA F,6,B,6,L,10,R,10,a,2,z a2 DATA F,20,R,2,L,2,B,20,z DIRL =%1111 F CON %0101 B CON %1010 R CON %0110 L CON %1001 z CON 255 'end of list a CON 16 'do an Act fb CON 45 'pause time for 0.5 cm rl CON 45 'pause time for 5 deg Rbump PIN 4 'bump =1 Lbump PIN 5 'bump =1 Reye PIN 6 Leye PIN 7 cmnd VAR Byte time VAR Byte Aptr VAR Byte moves VAR Byte move VAR Byte OUTS =0 Start: 'DEBUG BIN Lbump,BIN Rbump,CR 'GOTO start 'avoid bumps IF Rbump THEN OUTS =B :PAUSE 100 :OUTS =L :PAUSE 100 IF Lbump THEN OUTS =B :PAUSE 100 :OUTS =R :PAUSE 100 OUTS =0 'aim for light IF Leye AND Reye THEN getcmnd IF Reye THEN OUTS =R :PAUSE 50 IF Leye THEN OUTS =L :PAUSE 50 OUTS =0 getcmnd: DEBUGIN cmnd SELECT cmnd CASE "f" :OUTS =F :time =fb CASE "b" :OUTS =B :time =fb CASE "r" :OUTS =R :time =rl CASE "l" :OUTS =L :time =rl CASE "1" :Aptr =a1 :GOTO play :play Act1 CASE "2" :Aptr =a2 :GOTO play :play Act2 ENDSELECT PAUSE time '0.5 cm 90deg/22 ie about 4 deg OUTS =0 GOTO Start play: READ Aptr,cmnd IF cmnd=z THEN Start Aptr =Aptr +1 READ Aptr,moves Aptr =Aptr +1 IF cmnd=a THEN LOOKUP moves,[0,a1,a2],Aptr :GOTO play DEBUG ? cmnd,? moves FOR move =1 TO moves DEBUG ? move SELECT cmnd CASE f :OUTS =F :time =fb CASE b :OUTS =B :time =fb CASE r :OUTS =R :time =rl CASE l :OUTS =L :time =rl ENDSELECT PAUSE time OUTS =0 NEXT GOTO play