' Note: this is a general purpose code testing program
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim label1 As Label
Dim txt As String
Dim n, m, addr As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
label1.Initialize("label1")
label1.Color=Colors.LightGray
label1.TextColor=Colors.Black
label1.Typeface=Typeface.MONOSPACE
activity.AddView(label1,10dip,10dip,300dip,200dip)
activity.Title="general code test"
txt = "Hex data values" & CRLF & CRLF
m=0
addr=0
For n = 1 To 64
If m = 0 Then
txt=txt& cvhex6(n-1) & " "
End If
txt=txt& cvhex2(n)
addr=addr+1
m = m + 1
If m = 16 Then
m = 0
txt = txt & CRLF
End If
Next n
label1.Text = txt
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub cvhex6(nn)
Dim x As String
x=Bit.ToHexString(nn)
Do While x.Length < 6
x="0" & x
Loop
Return x.ToUpperCase
End Sub
Sub cvhex4(nn)
Dim x As String
x=Bit.ToHexString(nn)
Do While x.Length < 4
x="0" & x
Loop
Return x.ToUpperCase
End Sub
Sub cvhex2(nn)
Dim x As String
x=Bit.ToHexString(nn)
Do While x.Length < 2
x="0" & x
Loop
If x.Length > 2 Then
x = "XX"
End If
Return x.ToUpperCase & " "
End Sub