' ========================================================================= ' ' File....... Sid_Proof.BSE ' Purpose.... ' Author..... Jon Williams -- Parallax, Inc. ' E-mail..... jwilliams@parallax.com ' Started.... ' Updated.... DD MMM YYYY ' ' {$STAMP BS2e} ' {$PBASIC 2.5} ' ' ========================================================================= ' -----[ Program Description ]--------------------------------------------- ' -----[ Revision History ]------------------------------------------------ ' -----[ I/O Definitions ]------------------------------------------------- ' -----[ Constants ]------------------------------------------------------- TravelMax CON 5000 ' travel before cooling ' -----[ Variables ]------------------------------------------------------- eePntr VAR Word numMoves VAR Byte dist VAR Word theMove VAR Byte coolTmr VAR Word posX VAR Word posY VAR Word cmd VAR Byte ' -----[ EEPROM Data ]----------------------------------------------------- Pattern1 DATA 10 DATA Word 900, "L" DATA Word 1250, "I" DATA Word 900, "R" DATA Word 1250, "O" DATA Word 175, "L" DATA Word 1250, "I" DATA Word 200, "L" DATA Word 1250, "O" DATA Word 525, "L" DATA Word 175, "I" ' -----[ Initialization ]-------------------------------------------------- Reset: ' -----[ Program Code ]---------------------------------------------------- Main: eePntr = Pattern1 GOSUB Make_Moves GOSUB Cool_Down DEBUG "Process Complete" END ' -----[ Subroutines ]----------------------------------------------------- Make_Moves: READ eePntr, numMoves eePntr = eePntr + 1 DO WHILE (numMoves > 0) READ eePntr, Word dist, theMove DEBUG DEC3 numMoves, " ", DEC4 dist, " ", theMove, CR coolTmr = coolTmr + dist LOOKDOWN theMove, ["IOLR"], theMove ON theMove GOSUB Go_In, Go_Out, Go_Left, Go_Right IF (coolTmr > TravelMax) THEN GOSUB Cool_Down coolTmr = 0 ENDIF eePntr = eePntr + 3 numMoves = numMoves - 1 LOOP RETURN Go_In: posY = posY - dist RETURN Go_Out: posY = posY + dist RETURN Go_Left: posX = posX - dist RETURN Go_Right: posX = posX + dist RETURN Cool_Down: DEBUG CR, CR, "Pause for cooling", CR, "X: ", SDEC posX, CR, "Y: ", SDEC posY, CR, "POWER ON !!", CR, CR, "Press R to return to Start", CR, "Press any other key to continue", CR, CR DEBUGIN cmd IF ((cmd = "R") OR (cmd = "r")) THEN GOTO Reset ENDIF RETURN