Version 24 March uploaded (
download: top of thread)
New functions are ArraySet, SetPoly3 and GetPoly3, see example below and \Masm32\MasmBasic\MbGuide.rtf
As shown in the repeat loop below, AllPts(ecx
+1) is now valid syntax (same for string arrays)
include \masm32\MasmBasic\
MasmBasic.inc ;
download Init Dim My3Pts(5) As DWORD
; create an array with 3 XY pairs, i.e. 6 elements (0 .. 5) ArraySet My3Pts() = 1, 100, 2, 300, 4, 150
; assign XY values (ArraySet can be handy but any other array works, too) SetPoly3 My3Pts()
; create coefficients for a 3-point polynomial, i.e. Y=a0+a1*X+a2*X2 Dim AllPts(11) As REAL4
; create a destination array with 12 elements Print "N", Tb$, "X", Tb$, "Y", Tb$, "Y(ecx)"
; the last column uses the "direct" variant GetPoly3(X)
GetPoly3(AllPts())
; fill starting from X=0, create coefficients for Y=a0+a1*X+a2*X2 add eax, eax
push
eax xor ecx, ecx
.Repeat
; print N, X, Y=f(x), Y=f(2*X) Print Str$("\n%i\t", ecx/2),
Str$("%2f\t", AllPts(ecx)),
Str$("%3f\t", AllPts(ecx+1)),
Str$("%3f",
GetPoly3(ecx))
fstp st ; pop the return value from the FPU add ecx, 2
.Until ecx>=
stack pop
eax Inkey CrLf$, "ok"
Exitend start
Output:
N X Y Y(ecx)
0 0.0 -283.0 -283.0
1 1.0 100.0 300.0
2 2.0 300.0 150.0
3 3.0 317.0 -733.0
4 4.0 150.0 -2.35e+03
5 5.0 -200.0 -4.70e+03