well i been going though my code and i had about 35 lookup tables in various values and size , most have been changed now to math calculation , most were of simular in how they need to place font, chrs , on a glcd within menus
the goal is to reduce code size as lookups really do chew up space
this along with change any IF /then to a math caclulation where possible
removing any multi if /then when used to compare to for/next loop compare
moving bit varables into the same byte to use bit matching on them
remove any "and " in if/then and just doing 2 if/then statements - this often saved about 50 bytes each
moving any lookup "txt into spi flash so it not on the main cpu flash
all these saved so far a total of 33k from a code that started at 127k
still trying more space as i really would like to get to 90k code before i add the next section
found pokecode has a limit of 256 bytes before for adata string ,
and this i cant find a better way to do to reduce its compile size
Code:if val < 6 AND Menu_Select = 211 then lookup val,[1,2,4,8,16,32],val ' reasign val to gosub Show_current_sel_2 ' place "* *" on the selected channel in menu using bit pattern sleection endif if val =>6 and val <= 11 and Menu_Select = 2112 then lookup val-6,[1,2,4,8,16,32],val gosub Show_current_sel_2 endif if val =>12 and Menu_Select = 2113 then lookup val-12,[1,2,4,8,16,32],val gosub Show_current_sel_2 endif
i am also ll stuck with a lot of if then statements when input range checks are done when a key is pressed such as
and i cant see away to reduce them
Code:Input_Timevalue_Check: ' input checks for time inputs from menu1111 if Event1_OT_Day >7 then Event1_OT_Day = 0 Event1_OT_hour = 0 Event1_OT_Min = 0 Event1_OT_sec = 0 Event1_OT_100th = 0 ENDIF if Countdwn_Day > 7 then Countdwn_Day = 0 ' day settings Countdwn_Hour = 0 Countdwn_Min = 0 Countdwn_Sec = 0 Countdwn_100th = 0 ENDIF if Event_Penalty_Day >7 then Event_Penalty_Day = 0 Event_Penalty_Hour = 0 Event_Penalty_Min = 0 Event_Penalty_Sec = 0 Event_Penalty_100th = 0 ENDIF if Event2_OT_Day >7 then Event2_OT_Day = 0 Event2_OT_hour = 0 Event2_OT_Min = 0 Event2_OT_sec = 0 Event2_OT_100th = 0 ENDIF if Preset_EL0_Day >7 then Preset_EL0_Day = 0 Preset_EL0_Hour = 0 Preset_EL0_Min = 0 Preset_EL0_Sec = 0 Preset_EL0_100th = 0 ENDIF if Event1_OT_Hour >23 then Event1_OT_Hour = 23 if Countdwn_Hour >23 then Countdwn_Hour = 23 if Event_Penalty_Hour > 23 then Event_Penalty_Hour = 23 if Event2_OT_Hour > 23 then Event2_OT_Hour = 23 if Preset_EL0_Hour > 23 then Preset_EL0_Hour = 23 if Event1_OT_Hour <1 then Event1_OT_Hour = 0 if Countdwn_Hour <1 then Countdwn_Hour = 0 if Event_Penalty_Hour <1 then Event_Penalty_Hour = 0 if Event2_OT_Hour <1 then Event2_OT_Hour = 0 if Preset_EL0_Hour <1 then Preset_EL0_Hour = 0 if Event1_OT_Min >59 then Event1_OT_Min = 59 if Countdwn_Min > 59 then Countdwn_Min = 59 if Event_Penalty_Min > 59 then Event_Penalty_Min = 59 if Event2_OT_Min >59 then Event2_OT_Min = 59 if Preset_EL0_Min >59 then Preset_EL0_Min = 59 if Event1_OT_Min <1 then Event1_OT_Min = 0 if Countdwn_Min <1 then Countdwn_Min = 0 if Event_Penalty_Min <1 then Event_Penalty_Min = 0 if Event2_OT_Min <1 then Event2_OT_Min = 0 if Preset_EL0_Min <1 then Preset_EL0_Min = 0 if Event1_OT_Sec >59 then Event1_OT_Sec = 59 if Countdwn_Sec >59 then Countdwn_Sec = 59 if Event_Penalty_Sec >59 then Event_Penalty_Sec = 59 if Event2_OT_Sec > 59 then Event2_OT_Sec = 59 if Preset_EL0_Sec > 59 then Preset_EL0_Sec = 59 if Event1_OT_Sec <1 then Event1_OT_Sec = 0 if Countdwn_Sec <1 then Countdwn_Sec = 0 if Event_Penalty_Sec <1 then Event_Penalty_Sec = 0 if Event2_OT_Sec <1 then Event2_OT_Sec = 0 if Preset_EL0_Sec <1 then Preset_EL0_Sec = 0 if Event1_OT_100th > 99 then Event1_OT_100th = 99 if Countdwn_100th > 99 then Countdwn_100th = 99 if Event_Penalty_100th >99 then Event_Penalty_100th = 99 if Event2_OT_100th > 99 then Event2_OT_100th = 99 if Preset_EL0_100th > 99 then Preset_EL0_100th = 99 if Event1_OT_100th <1 then Event1_OT_100th = 0 if Countdwn_100th <1 then Countdwn_100th = 0 if Event_Penalty_100th <1 then Event_Penalty_100th = 0 if Event2_OT_100th <1 then Event2_OT_100th = 0 if Preset_EL0_100th <1 then Preset_EL0_100th = 0 return




Bookmarks