$hwstack = 32 'default use 32 for the $swstack = 10 'default use 10forthe SW $framesize = 40 'default use 40 for the $baud = 19200 $lib "mcsbyte.lbx" 'for smaller code $lib "glcdKS108.lib" '------------------------------------------------------------------------------- Config Graphlcd = 128 * 64sed , Dataport = Porta , Controlport = Portc , Ce = 4 , Ce2 = 5, Cd = 0 , Rd = 1 , Reset = 3 , Enable = 2 Cls Setfont Font6x8 Config Kbd = Portb '-------------------------------------------------------------------------------- Declare Sub Key Declare Sub Reshte '------------------------------------------------------------------------------- Dim A As Byte Dim B As Byte Dim K As Byte : K = 1 Dim L As Byte Dim S1 As String * 8 : S1 = "" Dim S2 As String * 8 : S2 = "" Dim H1 As Single Dim H1 As Single Dim H2 As Single Dim H3 As Single Dim Fn As Byte Dim Tab As String * 30 Dim M As String * 3 Dim H3_sum As Single Dim Komaki As Single Dim Eram_sum As Eram String * 30 Dim I As Byte Dim J As Byte ‘------------------------------------------------------------------------------" Showpic 0 , 0 , Calk1 Showphc 0 , 35 , Calk 2 Wait 2 For J = 63 To 0 Step -1 For I = 127 To 0 Step -1 Pset I , J , 0 Next Cls St: Tab = Eram _sum H3_sum = Val(tab) If H3_sum <> 0 Then Lcdat 2 , 110 , "+M" End If Do Call Reshte Loop End ‘ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $include"font6x8.font" Sub Reshte If K = 1 Then Lcdat 2 , 3 , ">" Lcdat 4 , 3 , "" Elseif K = 2 Then Lcdat 2 , 3 , "" Lcdat 4 , 3 , ">" End If Call Key If B < 10 And K = 1 Then L = Len(s1) Ifl < 8 Then S1 = S1 + Str(b) End If Lcdat 2 , 11 , S1 ; " " B = 16 Elseif B < 10 And K = 2 Then L = Len(s2) If L < 8 Then S2 = S2 + Str(b) End If Lcdat 4 , 11 , S2 ; " " B = 16 Elseif B = 15 And K = 1 Then S1 = S1 + "." Lcdat 2 , 11 , S1 ; " " B = 16 Elseif B = 15 And K = 2 Then S2 = S2 + "." Lcdat 4 , 11 , S2 ; " " B = 16 Elseif B = 13 And S1 <> "" And K = 1 Then S1 = "" Lcdat 2 , 11 , S1 ; " " B = 16 Elseif B = 13 And S2 <> "" And K = 2 Then S2 = "" Lcdat 4 , 11 , S2 ; " " B = 16 Elseif B = 13 And S2 = "" And K = 2 Then Cls K = 1 S1 = "" Lcdat 2 , 11 , S1 ; " " Fn = 0 H3 = 0 B = 16 Goto St Elseif B = 13 And K = 3 Then S1 = "" S2 = "" Lcdat 2 , 11 , S1 ; " " Lcdat 4 , 11 , S2 ; " " Cls Fn = 0 K = 1 H3 = 0 B = 16 Goto St Elseif B = 11 And K = 3 Then Tab = Eram _sum H3_sum = Val(tab) H3_sum = H3_sum + H3 Tab = Str(h3_sum) Eram_sum = Tab If H3_sum <> 0 Then Lcdat 2 , 110 , "+ M" End If Elseif B = 12 Then Eram_sum = "0" Lcdat2 , 110 , " " Elseif B = 11 And K = 1 Then Tab = Eram_sum Komaki = Val(tab) S1 = Fusing(komaki , "#.##") M = Right(s1 , 1) If M = "0" Then L = Len(s1) L = L - 1 S1 = Left(s1 , L) End If M = Right(s1 , 1) If M = "0" Then L = Len(s1) L = L - 1 S1 = Left(s1 , L) Elseif M = "." Then L = Len(s1) L = L - 1 S1 = Left(s1 , L) End If M = Right(s1 , 1) If M = "." Then L = Len(s1) L = L - 1 S1 = Left(s1 , L) End If Lcdat 2 , 11 , S1 ; " " Elseif B = 11 And K = 2 Then Tab = Eram_sum Komaki = Val(tab) S2 = Fusing(komaki , "#.##") M = Right(s2 , 1) If M = "0" Then L = Len(s2) L = L - 1 S2 = Left(s2 , L) End If M = Right(s2 , 1) If M = "0" Then L = Len(s2) L = L - 1 S2 = Left(s2 , L) Elseif M = "." Then L = Len(s2) L = L - 1 S2 = Left(s2 , L) End If M = Right(s2 , 1) If M = "." Then L = Len(s2) L = L - 1 S2 = Left(s2 , L) End If Lcdat 4 , 11 , S2 ; " " Elseif B = 14 And K = 1 And Fn > 0 Then K = 2 B = 16 Elseif B = 14 And K = 2 Then H1 = Val(s1) H2 = Val(s2) Select Case Fn Case 1: H3 = H1 + H2 Case 2: H3 = H1 - H2 Case 3: H3 = H1 / H2 Case 4: H3 = H1 * H2 End Select Line(5 , 40) -(80 , 40) , 255 Tab = Fusing(h3 , "#.##") M = Right(tab , 1) If M = "0" Then L = Len(tab) L = L - 1 Tab = Left(tab , L) End If M = Right(tab , 1) If M = "0" Then L = Len(tab) L = L - 2 Tab = Left(tab , L) End If Lcdat 7 , 11 , Tab ; " " B = 16 K = 3 Wait 1 Elseif B = 14 And K = 3 Then Cls S1 = Tab If Fn = 5 Then Fn = 1 Select Case Fn Case 1: Lcdat 3 , 77 , "+" Case 2: Lcdat 3 , 77 , "-" Case 3: Lcdat 3 , 77 , "/" Case 4: Lcdat 3 , 77 , "*" End Select Lcdat 2 , 11 , S1 ; " " S2 = "" Lcdat 4 , 11 , S2 ; " " K = 2 Elseif B = 10 Then Incr Fn If Fn = 5 Then Fn = 1 Select Case Fn Case 1: Lcdat 3 , 77 , "+" Case 2: Lcdat 3 , 77 , "-" Case 3: Lcdat 3 , 77 , "/" Case 4: Lcdat 3 , 77 , "*" End Select B = 16 End If End Sub '------------------------------------------------------------ Sub Key A = Getkbd() Select Case A Case 0: B = 13 Case 1: B = 12 Case 2: B = 11 Case 3 : B = 10 Case 4: B = 14 Case 5: B = 9 Case 6: B = 6 Case 7: B = 3 Case 8: B = 0 Case 9: B = 8 Case 10: B = 5 Case 11: B = 2 Case 12: B = 15 Case 13: B = 7 Case 14: B = 4 Case 15: B = 1 Case 16: B = 16 End Select Do A = Getkbd() Loop Until A = 16 End Sub Calk 1: $bgf "calk1.bgf" Calk 2: $bgf "calk2.bgf"