/************************** I2ICE TUTORIAL SCREEN #28 **************************/ menu=1 define literally P = 'include scr.27 nolist' define literally R = 'include scr.28 nolist' define literally RTN = 'include scr.28 nolist' define literally N = 'include scr.29 nolist' define literally M = 'include scr.2 nolist' cls /*******************************************************************************/ ' ------------------------' 'The conversion from CHAR to VALUE should occur on | SCR28: BUG EXPLAINED |' 'lines 70 and 71 (shown below). | M = Go to main menu |' ' 70 VALUE = VALUE + CHAR - ''0'' | N = Next screen |' ' 71 VALUE = VALUE /10 | P = Previous screen |' 'Let''s simulate three passes through these lines | Q = Quit tutorial |' 'that occur when you enter the ASCII-coded hex values | R = Rewrite SCR28 |' 'for 150 (CHAR, as a result, is set successively to | SCR# = Screen desired |' 'the ASCII-coded bytes 31, 35, and 30). Note that ------------------------' 'VALUE is initialized to 0 and the symbol ''0'' shown ' 'in line 70 equals the ASCII value for 0 (30H). ' ' First loop pass 70 VALUE = 0 + 31 - 30 = 1' ' 71 VALUE = 1/10 = 0' ' Second loop pass 70 VALUE = 0 + 35 - 30 = 5' ' 71 VALUE = 5/10 = 0' ' Third loop pass 70 VALUE = 0 + 30 - 30 = 0' ' 71 VALUE = 0/10 = 0' 'Now we know why VALUE is always 0. Apparently the programmer switched the' 'two lines and divided rather than multiplied. Lines 70 and 71 should be' ' 70 VALUE = VALUE * 10' ' 71 VALUE = VALUE + CHAR - ''0''' '-------------------------------------------------------------------------------'