$regfile = "m8515.dat" $crystal = 1000000 $baud = 19200 Dim X As Byte , Y As Byte Config Portb = Output Config Portd = Input Set Portd Portb = 255 Wait 1 Portb = 0 Dim a As Byte Dim b As Byte Dim c As Byte a=1 c=255 Do If Pind.0 = 1 Then a=1 else If Pind.1 = 1 Then a=2 else If Pind.2 = 1 Then a=3 else If Pind.3 = 1 Then a=4 else If Pind.4 = 1 Then a=5 else If Pind.5 = 1 Then a=6 else If Pind.6 = 1 Then a=7 else If Pind.7 = 1 Then a=8 if a=1 then b=b+1 if a=2 then b=b-1 if a=3 then shift b, left if a=4 then shift b, right if a=5 then rotate b, left if a=6 then rotate b, right if a=7 then b=256-b if a=8 then swap b,c Portb=b Waitms 200 Loop