07-26-2012, 11:31 AM
I've tried that. The compiler crashes on the assignment. It doesn't like it.
Output:
The problem has to be the cad (i) thing. Any other way to access a single char within a string?
EDIT: I've found "mid$" inside string.bas in the library. If I take just that function and add it to my code, replacing the cad (i) for mid (cad, i, 1), I still get the same crash, but inside the mid$ function.
Broken compiler?
Code:
Sub Fastcall tdPutChar (c as uByte)
Asm
rst 16
End Asm
End Sub
Sub tdPrint (cad As String)
Dim i As uByte
Dim c As uByte
For i = 1 To Len (cad)
c = cad (i)
tdPutChar (c)
Next i
End Sub
Output:
Code:
H:\Dev\Speccy\mt64x32lib\zxbasic>c:\zxb\zxb textdongle.bas
Traceback (most recent call last):
File "zxb.py", line 312, in <module>
File "zxb.py", line 241, in main
File "ply\yacc.pyc", line 263, in parse
File "ply\yacc.pyc", line 710, in parseopt
File "zxbparser.pyc", line 1793, in p_assignment
File "zxbparser.pyc", line 1019, in make_typecast
File "obj\errmsg.pyc", line 23, in syntax_error
TypeError: %d format: a number is required, not NoneType
The problem has to be the cad (i) thing. Any other way to access a single char within a string?
EDIT: I've found "mid$" inside string.bas in the library. If I take just that function and add it to my code, replacing the cad (i) for mid (cad, i, 1), I still get the same crash, but inside the mid$ function.
Code:
function mid$ (ByVal s$, ByVal x As Uinteger, ByVal n As Uinteger)
return s$(x to x + n - 1)
end function
Broken compiler?