4RESTER wrote:What wrong in this code?
Code: Select all
Global BPB_Media.B = $F8
Select BPB_Media.B
Case $F0,$F8 To $FF
Debug "BPB_Media: $"+RSet(Hex(BPB_Media, #PB_Byte),2,"0")
Default
Debug "Wrong BPB_Media: $"+RSet(Hex(BPB_Media, #PB_Byte),2,"0")
EndSelect
In fact, with such value
BPB_Media.B = $F8
the branch of Default shall not be executed.
Same as the posting in your other thread. When the hexadecimal literals are converted to decimal it would read this way:
Code: Select all
Global BPB_Media.B = -8 ;$F8
Select BPB_Media.B
Case 240, 248 To 255 ;$F0,$F8 To $FF
Debug "BPB_Media: $"+RSet(Hex(BPB_Media, #PB_Byte),2,"0")
Default
Debug "Wrong BPB_Media: $"+RSet(Hex(BPB_Media, #PB_Byte),2,"0")
EndSelect
Which clearly shows the default case will be executed.
Use this code to prove it to yourself:
Code: Select all
Global BPB_Media.B = $F8
Select BPB_Media.B
Case $F0,$F8 To $FF
Debug "BPB_Media: $"+RSet(Hex(BPB_Media, #PB_Byte),2,"0")
Case -8
Debug "Right BPB_Media: " + Str(BPB_Media)
Default
Debug "Wrong BPB_Media: $"+RSet(Hex(BPB_Media, #PB_Byte),2,"0")
EndSelect