You may be able to look at this and work it out in PBP

It's from sowrdfish basic

Code:
Public Function StrToDec(pValue As String) As LongWord
   Dim Value As Byte
   Dim IsSigned As Boolean
   
   FTextAddress = @pValue
   Result = 0
   Value = FTextIn
   IsSigned = false
   If Value = Byte("-") Then
      IsSigned = true
      Value = FTextIn
   EndIf   
   While Value <> 0 
      Result = 10 * Result + (Value - 48)
      Value = FTextIn
   Wend
   If IsSigned Then
      Result = Not Result
      Inc(Result)
   EndIf   
End Function
{