There are a few incompatibilities between VM-mode and native-mode devices. For example, the StackCheck() routine is not supported on native mode devices. Most applications should compile with no changes and should run the same except for possible timing differences. Please report any anomalies that you encounter.
If you need to modify your program to add code that is specific to VM or native mode devices, you can use a conditional with the value of Option.TargetCode. For example,
Code: Select all
#if Option.TargetCode = "ZVM"
' VM mode code
#endif
#if Option.TargetCode = "Native"
' native mode code
#endif
The ZX-24n devices that were sent out contain a "Hello, world" program, the source code for which is given below.
Code: Select all
Private msg as StringVectorData({ " says...", " Hello, world" })
Private device as String
Sub Main()
Dim j as Integer
device = getDeviceID()
j = 0
Do
Call Hello(j)
j = (j + 1) And 1
Loop
End Sub
Private Sub Hello(ByVal idx as Integer)
If (idx = 0) Then
Debug.Print device;
End if
Debug.Print msg(idx + 1)
If (StrFind(device, "ZX24", 1, True) = 1) Then
Call PutPin(25, 0)
Call Delay(0.5)
Call PutPin(25, 1)
Call PutPin(26, 0)
Call Delay(0.5)
Call PutPin(26, 1)
Else
Call Delay(1.0)
End If
End Sub
Private Function getDeviceID() as String
Dim idLen as Integer
Dim i as Integer
Dim id(1 to 6) as Byte
Call System.DeviceID(id)
idLen = 0
For i = 1 to UBound(id)
If (id(i) = 0) Then
Exit For
End If
idLen = idLen + 1
Next i
getDeviceID = MakeString(id.DataAddress, idLen)
End Function