Advertisement
LT1stSoloMID

The System of Address Bus Corresponding to Memory Space

Nov 28th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         'F-conv
  2.        Dim x, y, Ans As Integer : Dim Iris As String = ""
  3.         x = Val(TextBox1.Text) : y = Val(Mid(TextBox2.Text, 1, 1))
  4.         If x < 16 Or x > 52 Or y < 1 Or y > 8 Then MsgBox("輸入錯誤", 48, "Error") : Exit Sub
  5.         If x < 50 Then Ans = 2 ^ (x Mod 10) * y Else Ans = 2 ^ (x - 40) * y '範圍最大只到T
  6.        If Ans >= 1024 And x < 40 Then x += 10 : Ans = Ans \ 1024
  7.         TextBox3.Text = Ans & RetureByte(x)
  8.  
  9.         'R-conv
  10.        Dim x As Integer = Val(TextBox4.Text) : Dim y As Integer = Val(TextBox5.Text)
  11.         If y > 8 Or y < 1 Or x > 32768 Or TextBox5.Text = "" Or TextBox4.Text = "" Then
  12.            MsgBox("輸入錯誤", 48, "Error") : Exit Sub
  13.         End If
  14.         Dim B As String = Mid(TextBox4.Text, TextBox4.Text.Length - 1, 1)
  15.             Dim Iris As Integer
  16.         Select Case UCase(B)
  17.             Case Is = "T" : Iris = 40
  18.             Case Is = "G" : Iris = 30
  19.             Case Is = "M" : Iris = 20
  20.             Case Is = "K" : Iris = 10
  21.         End Select
  22.             If x / y < 1 Then Iris -= 10 : x *= 1024 '單位小於1所以往下 "T > G > M > L
  23.        TextBox6.Text = CInt(Iris + Math.Log((x / y), 2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement