'Imp_20-3.bas 3513 bytes #slot 3 #no_table 'directive cannot be used when program occupies that area #no_data '-------------------------------- Pins: SYMBOL servoLA =D.0 SYMBOL servoLH =D.1 SYMBOL servoRH =D.2 SYMBOL servoRA =D.3 SYMBOL whiskerLLED_ =C.1 SYMBOL whiskerRLED_ =C.2 SYMBOL GwhiskerLLED_ =A.6 SYMBOL GwhiskerRLED_ =A.7 'SYMBOL whiskerLeye =A.0 'READADC needs port.pin not a symbol 'SYMBOL whiskerReye =C.5 'READADC needs port.pin not a symbol 'SYMBOL GwhiskerLeye =A.2 'READADC needs port.pin not a symbol 'SYMBOL GwhiskerReye =A.3 'READADC needs port.pin not a symbol SYMBOL voice =A.5 SYMBOL voiceLED =A.5 SYMBOL inIR =A.1 SYMBOL inIRpin =pinA.1 SYMBOL pingpin =C.0 'Ultrasonic sensor SRF05 in single pin mode ' or HC-SR04 on a single pin '================================================== VarsCons: '========================== SYMBOL Esc =27 'Escape key SYMBOL quit =27 'cmnd quit =Escape key 'built in variables 'ptr - scratchpad pointer 'hserptr - pointer to scratchpad location of last byte received by hardware UART 'X2 parts - bit0-31 b0-55 w0-27 'SYMBOL obstacleMap =B0 '%1111 bitmap of obstacles 'SYMBOL f_Rightobstacle =bit0 'SYMBOL f_Leftobstacle =bit1 'SYMBOL f_Righthole =bit2 'SYMBOL f_Lefthole =bit3 'bit4 'bit4 SYMBOL f_autorun =bit5 'autorun 8 if "." (fullstop) SYMBOL f_readquiet =bit6 ' 'SYMBOL f_temp =bit7 'SYMBOL f_comment =bit8 'true if reading a 'comment' SYMBOL f_ignoreUS =bit9 'SYMBOL f_turnedL =bit10 'last turn =1=L 0=R 'SYMBOL f_Bmodified =bit11 'behaviour settings modified 'SYMBOL f_IRcmnd =bit12 '1=>IRcmnd 0=>Serial/Play cmnd 'SYMBOL f_autoUp =bit13 'IF tested in FBRL THEN Up 'SYMBOL f_ =bit14 ' 'SYMBOL f_warm =bit15 '=0 then init legs 'W1 'SYMBOL f_play =bit16 SYMBOL f_record =bit17 'SYMBOL f_recordC =bit18 'if=1 then record cmnd SYMBOL f_showPos =bit19 'print servo positions and SELECTed servo 'SYMBOL f_F =bit20 'Forward - direction of travel forward/backwards 'SYMBOL f_Rfwd =bit21 'Right Forward 'SYMBOL f_hdo =bit22 'halt frames 'SYMBOL f_waitcmnd =bit23 'just wait for an IRkey or Serin SYMBOL f8_doServos =b3 SYMBOL f_RAdo =bit24 'do servo SYMBOL f_RHdo =bit25 'do servo SYMBOL f_LAdo =bit26 'do servo SYMBOL f_LHdo =bit27 'do servo SYMBOL f_RApulse =bit28 'pulse servos SYMBOL f_RHpulse =bit29 'pulse servos SYMBOL f_LApulse =bit30 'pulse servos SYMBOL f_LHpulse =bit31 'pulse servos SYMBOL W2temp =w2 'TellServos:, Interpage jumps for hserptr SYMBOL W2templo =b4 'SYMBOL W2temp0dark=b4 SYMBOL W2temphi =b5 'SYMBOL W2temp1lit =b5 'W3 SYMBOL LHat =b6 'Servo Left Hip At SYMBOL LHto =b7 'Servo Left Hip To 'W4 SYMBOL LAat =b8 'Servo Left Ankle At SYMBOL LAto =b9 'Servo Left Ankle To 'W5 SYMBOL RHat =b10 'Servo Right Hip At SYMBOL RHto =b11 'Servo Right Hip To 'W6 SYMBOL RAat =b12 'Servo Right Ankle At SYMBOL RAto =b13 'Servo Right Ankle To 'W7 SYMBOL Sspeed =b14 'max to 15 then to can't go past zero SYMBOL Sframe =b15 'Servo frame pause in ms 'W8 SYMBOL hframes =b16 'halt frames SYMBOL Ccmnd =b17 'W9 'SYMBOL IRcmnd =b18 SYMBOL CRootCmnd =b19 'W10 SYMBOL RAC =b20 'Right Ankle Centre for current posture SYMBOL LAC =b21 'Left Ankle Centre for current posture 'W11 SYMBOL RHC =b22 'Right Hip Centre for current posture SYMBOL LHC =b23 'Left Hip Centre for current posture 'W12 SYMBOL FUD =b24 'ToeUpDown movement min 25 SYMBOL FP =b25 'Foot Pace ForwardBack Hips movement +- 9 - 23 'W13 SYMBOL FT =b26 'Toes Turn SYMBOL FUDcmnd =b27 'FootUpDown movement 1-8 'W14 SYMBOL FPcmnd =b28 'FootPace ForwardBack movement 1-8 SYMBOL FTcmnd =b29 'Foot Turn movement 1-8 'W15 SYMBOL HOO =b30 'Hip Offset toes offset from Front + Out SYMBOL AOD =b31 'Ankle Offset outside of foot + Down 'W16 SYMBOL Scmnd =b32 'Speed 1-8 SYMBOL SspeedmaxC =b33 'max servo speed cmnd 'W17 SYMBOL Slotptr =b34 SYMBOL SlotEnd =b35 SYMBOL LoadStart =b35 'W18 'SYMBOL yawn =b36 SYMBOL temp =b37 'SYMBOL tempdiff =b37 'prog1 - QEwhiskerX: 'W19 SYMBOL i =b38 'counter - prog1 QGwhiskerX: SYMBOL i_temp =b38 'SYMBOL i_result =b38 'any result to be used by IF SYMBOL Snum =b38 'prog3 - SETUP: 'SYMBOL usdist =b39 'prog1 'W20 SYMBOL Slot =b40 SYMBOL RAMpage =b41 'current Pageptr in memory 'W21 SYMBOL CPagecmnd =b42 'current Page cmnd SYMBOL ChapterAt =b43 'W22 SYMBOL RPage =b44 'current ReAction Page SYMBOL new_Pagecmnd =b45 'continue reading EEPROM on new_Page 'W23 SYMBOL new_Slot =b46 'continue reading EEPROM at new_Slot SYMBOL subcmnd =b47 'W24 SYMBOL W24temp =W24 SYMBOL W24templo =b48 SYMBOL W24temphi =b49 'W25 SYMBOL Vitality =b50 SYMBOL vitalitymax=b51 'W26 'W27 '-------------------------------------------------- SYMBOL Vitalitynormal =5 'depending on the sensors obsclearL and obsclearR may need to be different SYMBOL obsclearL =20 '% light level difference > for obstacle SYMBOL obsclearR =20 '% light level difference > for obstacle '-------------------------------------------------- 'SspeedScale =1 '1 - 9 SYMBOL FUDscale =4 '4 - 36 LA+52-38 RA+45-47 SYMBOL FPscale =3 '3 - 27 LH+33-29 RH+29-32 SYMBOL FTscale =3 '3 - 27 SYMBOL AChapterAt =0 'Acts SYMBOL RChapterAt =10 'ReActs SYMBOL pChapterAt =20 'Poses SYMBOL BChapterAt =30 'Behaviours SYMBOL TChapterAt =40 'Task SYMBOL VChapterAt =50 'Voice SYMBOL MChapterAt =60 'Mind SYMBOL NChapterAt =70 'Notes SYMBOL HChapterAt =80 'Help 'EEPROM Config DATA addresses SYMBOL EE_autoAct =255 '255 =>uninitialised SYMBOL EE_Scmnd =254 SYMBOL EE_SspeedmaxC =253 SYMBOL EE_FUDcmnd =252 SYMBOL EE_FPcmnd =251 SYMBOL EE_FTcmnd =250 SYMBOL EE_RPage =249 SYMBOL EE_UStoonear =248 SYMBOL EE_USawareat =247 SYMBOL EE_LHC =246 SYMBOL EE_LAC =245 SYMBOL EE_RHC =244 SYMBOL EE_RAC =243 SYMBOL EE_vitality =242 SYMBOL EE_vitalitymax =241 SYMBOL EE_HOO =240 SYMBOL EE_AOD =239 SYMBOL EE_f_autorun =238 SYMBOL EE_threshW =237 SYMBOL EE_threshG =236 'RAM data addresses - 40X2 200 56 to 255 ($38 to $FF) SYMBOL RAMtemp0 =56 'first non variable RAM location SYMBOL RAMtemp1 =57 'SYMBOL RAMtemp2 =58 SYMBOL RAMautoAct =59 '------------------- SYMBOL stackRecSize =5 'bptr is RAMstackptr 'MIN 60 MAX 60 +45 =105 (45=9 *5 for ten deep stack) SYMBOL RAMstack0 =60 'stack base SYMBOL RAMstack9 =105 '60 +(9 *5) base of tenth record SYMBOL RAMstacktop =110 'entries ' SlotPtr ' Slot ' Page ' Pagecmnd ' Chapter '------------------- SYMBOL RAMholedetectR =111 'set by calibrateholewhiskers: % light level difference for hole SYMBOL RAMholedetectL =112 'set by calibrateholewhiskers: % light level difference for hole SYMBOL RAMobstaclesR =113 'map SYMBOL RAMobstaclesL =114 'map SYMBOL RAMlightR =115 'eye ambientlight level Right SYMBOL RAMlightL =116 'eye ambientlight level Left SYMBOL RAMUStoonear =117 SYMBOL RAMUSawareAt =118 SYMBOL RAMUSlast =119 SYMBOL RAMrandvarLo =120 SYMBOL RAMrandvarHi =121 SYMBOL RAMthreshW =122 SYMBOL RAMthreshG =123 '================================================================= SERVOsettings: 'ACTUAL values from Servo tester - values are in 10us units 'black - JX Servo PS-1171MG 17g 3.5kg Torque Metal Gear Analog Servo '========================== 'servos SYMBOL SLHmin = 82 'Left Hip Min foot backwards back dagger SYMBOL SLHout90 =106 'Left Hip toeout foot at 90deg (Setup 100) SYMBOL SLHminwalk=178 'Left Hip MinWalk feet parallel touch SYMBOL SLHmid =205 'Left Hip Mid foot forward SYMBOL SLHmax =231 'Left Hip MaxWalk feet parallel touch SYMBOL SLAmax =194 'Left Ankle Max Foot outside down ankle stop SYMBOL SLAmid =145 'Left Ankle Mid Foot flat (Setup 150) SYMBOL SLAmin =108 'Left Ankle Min Foot outside up ankle stop SYMBOL SRHmax =192 'Right Hip Max foot backwards back dagger SYMBOL SRHout90 =175 'Left Hip toeout foot at 90deg (Setup 200) SYMBOL SRHmaxwalk=108 'Right Hip MaxWalk feet parallel touch SYMBOL SRHmid = 81 'Right Hip Mid foot forward SYMBOL SRHmin = 61 'Right Hip MinWalk feet parallel touch SYMBOL SRAmin =114 'Right Ankle Min Foot outside down ankle stop SYMBOL SRAmid =148 'Right Ankle Mid Foot flat (Setup 150) SYMBOL SRAmax =186 'Right Ankle Max Foot outside up ankle stop 'Left Hip toes out is -ve 'Left Ankle Footoutside down is +ve 'Right Hip toes out is +ve 'Right Ankle Footoutside down is -ve '========================== 'LOGICAL 'Hip - toes out is +ve 'Ankle - Footoutside down is +ve ' servo log SYMBOL LHmax =255 -SLHmin ' 82 173 SYMBOL LHout90 =255 -SLHout90 '106 149 get up SYMBOL LHmaxwalk =255 -SLHminwalk '178 77 not used SYMBOL LHmid =255 -SLHmid '205 50 SYMBOL LHmin =255 -SLHmax '231 24 SYMBOL LAmax =SLAmax ' 194 SYMBOL LAmid =SLAmid ' 145 SYMBOL LAmin =SLAmin ' 108 SYMBOL RHmax =SRHmax ' 192 SYMBOL RHout90 =SRHout90 ' 175 get up SYMBOL RHmaxwalk =SRHmaxwalk ' 100 not used SYMBOL RHmid =SRHmid ' 81 SYMBOL RHmin =SRHmin ' 61 SYMBOL RAmax =255 -SRAmin '114 141 SYMBOL RAmid =255 -SRAmid '148 107 SYMBOL RAmin =255 -SRAmax '186 69 SYMBOL RA =0 SYMBOL RH =1 SYMBOL LA =2 SYMBOL LH =3 '================================================================= Init: hserptr =W2temp 'get back pointer DISCONNECT SETFREQ m16 SERTXD("{3",CRootcmnd,Ccmnd," ") '---------------------------------------------------- SELECT Ccmnd CASE "l" GOSUB load 'l CASE "s" GOSUB PrintSysInfo '?s CASE "h" GOSUB PrintHelp '?h CASE "b" GOSUB PrintBehaviour '?b CASE "1" TO "8" '?<1-8> Slot =Ccmnd -"1" 'Logical Act 0 - 7 IF ChapterAt=0 THEN GOSUB PrintSlot 'Act IF ChapterAt=10 THEN GOSUB PrintReAct 'ReAct IF ChapterAt=20 THEN GOSUB PrintSlot 'Pose IF ChapterAt=30 THEN GOSUB PrintSlot 'Behaviour IF ChapterAt=40 THEN GOSUB PrintSlot 'Task IF ChapterAt=50 THEN GOSUB PrintSlot 'Sound IF ChapterAt=60 THEN GOSUB PrintSlot 'Mind IF ChapterAt=70 THEN GOSUB PrintSlot 'Notes CASE "p","?" '?p,?? RAMpage =ChapterAt +CPagecmnd -"0" 'make sure Page is uptodate IF ChapterAt=0 THEN GOSUB PrintPage 'Acts IF ChapterAt=10 THEN GOSUB PrintReActsPage 'ReActs IF ChapterAt=20 THEN GOSUB PrintPosePage 'Poses IF ChapterAt=30 THEN GOSUB PrintPage 'Behaviours IF ChapterAt=40 THEN GOSUB PrintPage 'Tasks IF ChapterAt=50 THEN GOSUB PrintPage 'Sound IF ChapterAt=60 THEN GOSUB PrintPage 'Mind IF ChapterAt=70 THEN GOSUB PrintPage 'Notes CASE "P" GOSUB PrintChapter '?P CASE "D" GOSUB DumpChapter '?D CASE "d" GOSUB DumpPage '?d CASE "#" GOSUB DumpASCIIpage '?# CASE "C" GOSUB Save_Neutral_Pose 'from b@ C CASE "S" GOSUB Save_Behaviour 'bS CASE "i" GOSUB Initialise_Behaviour 'bi CASE "E" GOSUB InitEEPROM 'bI ELSE GOSUB sshhh 'bad key ENDSELECT leave0: W2temp =hserptr 'Preserve pointer RUN 0 '========================================================================= load: IF f_record=1 THEN 'otherwise recording continues in loaded Act! f_record =0 Ccmnd ="." GOSUB WRITEex_W2PageptrSlotptr_Ccmnd ENDIF GOSUB WaitSerCmnd :sertxd(CCmnd) SELECT Ccmnd ' CASE "0" ' f_allSerial =0 'turn off f_readAllSerial 'just turn on f_readAllSerial to allow immediate control from a file ' CASE "a" ' f_allSerial =1 'Logical Act 0 - 7 CASE "1" TO "8" GOSUB loadslot 'page load CASE "p" f_readquiet=1 Slotptr =0 RAMpage =ChapterAt +CPagecmnd -"0" FOR temp="1" TO "8" Ccmnd =temp GOSUB loadslot W2temp =temp -"0" *32 'start of next Slot IF Slotptr>=W2temp THEN :temp = temp +1 :ENDIF 'cmnds ran over into next Slot NEXT f_readquiet=0 'colon - autoload CASE ":" LoadStart =ptr DO GOSUB WaitSerCmnd LOOP UNTIL Ccmnd=":" OR Ccmnd="." 'colon or end IF Ccmnd=":" THEN 'Ccmnd colon GOSUB WaitSerCmnd SELECT Ccmnd CASE "A" ChapterAt =AChapterAt CASE "R" ChapterAt =RChapterAt CASE "P" ChapterAt =PChapterAt CASE "B" ChapterAt =BChapterAt CASE "T" ChapterAt =TChapterAt CASE "V" ChapterAt =VChapterAt CASE "M" ChapterAt =MChapterAt CASE "N" ChapterAt =NChapterAt ELSE GOTO badload ENDSELECT GOSUB WaitSerCmnd :IF Ccmnd<"0" OR Ccmnd>"9" THEN GOTO badload CPagecmnd =Ccmnd RAMpage =ChapterAt +CPagecmnd -"0" GOSUB WaitSerCmnd :IF Ccmnd<"1" OR Ccmnd>"8" THEN GOTO badload Slot =Ccmnd -"1" Slotptr =Slot *32 ptr =LoadStart DO GOSUB WaitSerCmnd GOSUB WRITEex_W2PageptrSlotptr_Ccmnd Slotptr =Slotptr +1 LOOP UNTIL Ccmnd="." OR Ccmnd=";" ELSE GOSUB sshhh 'dot or not colon ENDIF 'Ccmnd colon 'H Help text - load Help screens CASE "H" f_readquiet=1 GOSUB WaitSerCmnd : sertxd(Ccmnd) SELECT Ccmnd CASE "0" TO "9" 'load one of ten sections temp =Ccmnd -"0" 'sections are 4 pages =1K temp =temp *4 'section offsets W24temp =HChapterAt +temp *256 DO GOSUB WaitSerCmnd HI2COUT W24temp,(Ccmnd) :PAUSE 10 '5ms @16MHz W24temp =W24temp +1 LOOP UNTIL Ccmnd =255 '=EOF ELSE GOSUB sshhh ENDSELECT 'H Ccmnd f_readquiet=0 ELSE badload: GOSUB sshhh hserinflag =0 'Flush Serial buffer ptr =hserptr -1 ENDSELECT 'load Ccmnd RETURN '--------------------------- loadslot: Slot =Ccmnd -"1" Slotptr =Slot *32 RAMpage =ChapterAt +CPagecmnd -"0" DO GOSUB WaitSerCmnd IF Ccmnd="Q" OR Ccmnd=Esc OR Ccmnd="." OR Ccmnd=";" THEN EXIT IF Ccmnd<" " THEN 'sertxd(#Ccmnd) 'control codes so ignore them ELSE GOSUB WRITEex_W2PageptrSlotptr_Ccmnd Slotptr =Slotptr +1 ENDIF LOOP IF Ccmnd<>";" THEN :Ccmnd ="." :ENDIF GOSUB WRITEex_W2PageptrSlotptr_Ccmnd RETURN '========================================================================= PrintSysInfo: temp =ChapterAt /10 LOOKUP temp,("ARPBTSMN"),temp sertxd("Chapter",temp," Page") temp =RAMpage -ChapterAt sertxd(#temp," Slot",#Slot,cr) RETURN '========================================================================= PrintHelp: SERTXD(0,CR,"Enter Help section 0-9 or h for all") '0=cls for Parallax GOSUB Getcmnd SELECT Ccmnd CASE "0" TO "9" temp =Ccmnd -"0" :temp =temp *4 :GOSUB PrintHelpSection 'CASE "a","b" temp =Ccmnd -96 +9 :temp =temp *4 :GOSUB PrintHelpSection 'EEPROM wraps at 32k CASE "h" SERTXD(CR,"All Sections",CR) FOR i ="0" TO "9" :Ccmnd =i :GOSUB PrintHelpSection :NEXT i ELSE RETURN ENDSELECT RETURN PrintHelpSection: SERTXD(CR,"Section ",Ccmnd) W2temp =HChapterAt +temp 'print one of eight sections W2temp =W2temp *256 'byte pointer, section start W24temp =W2temp +1024 'sections end sertxd("start",#W2temp,CR) DO GOSUB READex_W2_Ccmnd IF Ccmnd=255 THEN EXIT 'end marker byte SERTXD(Ccmnd) W2temp =W2temp +1 LOOP UNTIL W2temp=W24temp 'loop until section end RETURN '---------------------------------------------------- PrintBehaviour: SERTXD(CR,"Behaviour settings") CPagecmnd =CPagecmnd MIN "0" 'in case not initialised temp =ChapterAt /10 LOOKUP temp,("A!PBTSMN"),temp SERTXD(CR,"@ ",temp,CPagecmnd) PEEK RAMautoAct,temp :SERTXD(CR,temp," AutoAct") IF f_autorun=1 THEN :SERTXD("auto run ") :ENDIF SERTXD(CR,#vitality," vitality (bm max=",#vitalitymax," normal=",#Vitalitynormal,")") SERTXD(CR,Scmnd," speed (#",Scmnd,"*v=#",#Sspeed,")") SERTXD(CR,SspeedmaxC," speedmax") temp =FUDcmnd -"0" *FUDscale SERTXD(CR,FUDcmnd," Lift (#",#temp,"*v=#",#FUD,")") temp =FPcmnd -"0" *FPscale SERTXD(CR,FPcmnd," Pace (#",#temp,"*v=#",#FP,")") temp =FTcmnd -"0" *FTscale SERTXD(CR,FTcmnd," Turn (#",#temp,"*v=#",#FT,")") IF AOD<128 THEN SERTXD(CR,#AOD," Toes Offset Down") ELSE SERTXD(CR,"-") :temp =255-AOD :SERTXD(#temp," Toes Offset Down") ENDIF IF HOO<128 THEN SERTXD(CR,#HOO," Toes Offset Out") ELSE SERTXD(CR,"-") :temp =255-HOO :SERTXD(#temp," Toes Offset Out") ENDIF SERTXD(CR,"!",#RPage," Reactions page") PEEK RAMUSawareAt,temp :temp =temp /5 SERTXD(CR,#temp," (") PEEK RAMUSawareAt,temp SERTXD(#temp,"cm") SERTXD(") USawareAt") PEEK RAMUStoonear,temp :temp =temp /5 SERTXD(CR,#temp," (") PEEK RAMUStoonear,temp SERTXD(#temp,"cm") SERTXD(") UStoonear") PEEK RAMthreshW,temp SERTXD(CR,#temp," Whisker threshold, cmnd *2") PEEK RAMthreshG,temp SERTXD(CR,#temp," GWhisker threshold") temp =f_ignoreUS XOR 1 SERTXD(CR,#temp," react to US") SERTXD(CR,"LH",#LHat,",LA",#LAat,",RH",#RHat,",RA",#RAat) SERTXD(CR,#HOO," Hips out") SERTXD(CR,#AOD," Ankles down") SERTXD(CR) RETURN '---------------------------------------------------- PrintPosePage: SERTXD(CR,"L,R,Hip,Ankle,Up,Down,In.Out,amount 0-9, eg RHU4 - vital relative") SERTXD(CR,"<3,2,1,0><1,0,+,-> LH,LA,RH,RA,pulse,off,+x*v,-x*v - vital relative") SERTXD(CR,"#LHip #LAnkle #RHip #RAnkle - logical - centre is 150") SERTXD(CR,"jLHip jLAnkle jRHip jRAnkle - logical joint values") SERTXD(CR,"sLHip sLAnkle sRHip sRAnkle - servo values") FOR Slot=0 TO 7 GOSUB PrintSlot NEXT Slot Slot =0 'after FOR Slot=8 which is illegal SERTXD(CR) RETURN '---------------------------------------------------- PrintReActsPage: SERTXD(CR) FOR Slot=0 TO 7 GOSUB PrintReAct NEXT Slot Slot =0 'after FOR Slot=8 which is illegal SERTXD(CR) RETURN '---------------------------------------------------- PrintReAct: temp =ChapterAt :temp =RAMpage -temp SERTXD(CR,"R",#temp," ReAct ") temp =Slot +1 SERTXD(#temp) SELECT Slot CASE 0 SERTXD(" Unear - ") CASE 1 SERTXD(" Ufar - ") CASE 2 SERTXD(" W-R - ") CASE 3 SERTXD(" WL- - ") CASE 4 SERTXD(" WLR - ") CASE 5 SERTXD(" G-R - ") CASE 6 SERTXD(" GL- - ") CASE 7 SERTXD(" GLR - ") ENDSELECT Slotptr =Slot *32 DO GOSUB READex_W2PageptrSlotptr_Ccmnd Slotptr =Slotptr +1 SERTXD(Ccmnd) LOOP UNTIL Ccmnd="." OR Ccmnd=255 '255 in case uninitialised EEPROM RETURN '---------------------------------------------------- PrintChapter: temp = RAMpage FOR i =0 TO 9 RAMpage =ChapterAt +i IF ChapterAt=RChapterAt THEN GOSUB PrintReActsPage ELSE GOSUB PrintPage ENDIF NEXT RAMpage =temp RETURN '---------------------------------------------------- PrintPage: SERTXD(CR) FOR Slot=0 TO 7 GOSUB PrintSlot NEXT Slot Slot =0 'after FOR Slot=8 which is illegal SERTXD(CR) RETURN '---------------------------------------------------- PrintSlot: SERTXD(CR) temp =RAMpage -ChapterAt IF ChapterAt=AChapterAt THEN :SERTXD("A",#temp," Act ") :ENDIF IF ChapterAt=BChapterAt THEN :SERTXD("B",#temp," Behaviour ") :ENDIF IF ChapterAt=PChapterAt THEN :SERTXD("P",#temp," Pose ") :ENDIF IF ChapterAt=TChapterAt THEN :SERTXD("T",#temp," Task ") :ENDIF IF ChapterAt=VChapterAt THEN :SERTXD("V",#temp," Voice "):ENDIF IF ChapterAt=MChapterAt THEN :SERTXD("M",#temp," Mind ") :ENDIF IF ChapterAt=NChapterAt THEN :SERTXD("N",#temp," Note ") :ENDIF temp =Slot +1 IF ChapterAt EEprom not initialised READ EE_autoAct ,temp :POKE RAMautoAct,temp READ EE_Scmnd ,Scmnd READ EE_SspeedmaxC ,SspeedmaxC READ EE_FUDcmnd ,FUDcmnd READ EE_FPcmnd ,FPcmnd READ EE_FTcmnd ,FTcmnd READ EE_RPage ,RPage READ EE_UStoonear ,temp :POKE RAMUStoonear,temp 'cm READ EE_USawareAt ,temp :POKE RAMUSawareAt,temp 'cm READ EE_LHC ,LHC READ EE_LAC ,LAC READ EE_RHC ,RHC READ EE_RAC ,RAC READ EE_vitality ,vitality READ EE_vitalitymax,vitalitymax READ EE_HOO ,HOO 'Hip Offset from Front. (10us) +=out bh<+<0-9>,-<0-5>> READ EE_AOD ,AOD 'Ankle Offset foot outside Down (10us) +=down ba<+<0-9>,-<0-9>> READ EE_f_autorun ,f_autorun READ EE_threshW ,temp :POKE RAMthreshW,temp READ EE_threshG ,temp :POKE RAMthreshG,temp RETURN InitEEPROM: '"E" from "bI" WRITE EE_autoAct ,"0" WRITE EE_Scmnd ,"3" WRITE EE_SspeedmaxC ,"5" WRITE EE_FUDcmnd ,"3" WRITE EE_FPcmnd ,"4" WRITE EE_FTcmnd ,"4" WRITE EE_RPage ,0 WRITE EE_UStoonear ,15 'cm WRITE EE_USawareAt ,30 'cm WRITE EE_LHC ,LHmid 'servo data WRITE EE_LAC ,LAmid 'servo data WRITE EE_RHC ,RHmid 'servo data WRITE EE_RAC ,RAmid 'servo data WRITE EE_vitality ,5 WRITE EE_vitalitymax,7 WRITE EE_HOO ,0 WRITE EE_AOD ,0 WRITE EE_threshW ,10 WRITE EE_threshG ,20 RETURN '=========================================================================