Sorry. 25 is the correct value.Quote:
Originally Posted by Charles Pegge
I will fix INC and BI files in next release. I need to work more also on FreeBasic .BI file. If you can send me your version I will "line" them.
Thanks a lot
Eros
Printable View
Sorry. 25 is the correct value.Quote:
Originally Posted by Charles Pegge
I will fix INC and BI files in next release. I need to work more also on FreeBasic .BI file. If you can send me your version I will "line" them.
Thanks a lot
Eros
If you like I can translate the rest of the BI functions and markup where there might be problems. This will help me to get familiar with the interface. Then I can pass them back to you Eros.
thinBasic variables are not 1 to one with the compiler (Power Basic) variable but we have built our own "variable system" so I have full control over how data in handled.Quote:
Originally Posted by Charles Pegge
Internally we have a function that calculates the exact element position giving its coordinates up to 3 dimensions. So, again, we have full control on how that position is calculated. Actually, as you stated, thinBasic follow column order mainly for historical reasons (we wanted thinBasic very compatible with our be-loved Power Basic) but I can change, or better, add a new variable specific characteristic that tells if multidim variable follows column or row order. So a new syntax like the following:
[code=thinbasic]DIM MyMatrix(10, 20) AS LONG {ROWORDER | COLUMNORDER}[/code]
Where ColumnOrder is the default. And internally, the function in place to calculate element position will check if variable has column or row order and act consequently.
I will check if this idea is doable but at first sight I would say yes.
Ciao
Eros
A big thanks Charles.Quote:
Originally Posted by Charles Pegge
If you have any comment to do to thinBasic SDK interface, something you think can improve it or whatever, let me know.
Ciao
Eros
Hi Eros,
roworder, columnorder idea is very nice, it can make life easier when converting code from other languages.
Thanks,
Petr
I have updated Oxygen, allowing variables to be bound directly in the script, and removing case sensitivity, so it can be used with RAWTEXT and the latest preview version of thinBasic.
The zip is updated at the beginning of this thread.
I have also included my latest edits of libthinCore.dll,a, def file and thinCore.bi for FreeBasic development, including the more recent API functions and constants in thinCore.inc. I need to carry out some more checks before handing over to Eros but it was all fairly straightforward.
RAWTEXT has reverted to uppercase conversion even with yesterday's thinCore. It must be doing the conversion elsewhere. But as well as making Oxtgen case insensitive, I envisage the assembler being the same. Also using BASIC style comments.
This is how the new version Oxygen can now be used with RAWTEXT and the variable #vv directly incorporated:
[code=thinbasic]
uses "Oxygen"
dim vv as long = 6
dim sMc as string=rawtext
'--------------'
' nested loops
'--------------'
8b 0d #vv ' mov ecx,vv
ba NL0 ' mov edx,0
( ' [do]
b8 nl7 ' mov eax,7
( ' [do]
42 ' inc edx
48 ' dec eax
7f r ' jg repeat
) ' [end do]
49 ' dec ecx
7f r ' jg repeat
) ' [end do]
eb gEnd ' jmp End_of_Prog
[ This is a string ] ' db ...
" This is a string " ' db ...
'
.End_of_Prog '
'
8b c2 ' mov eax,edx
c3 ' ret
end rawtext
Dim tMC as string=Oxygen_Eval(sMC)
Dim RetVal as long=MC_Exec(tMC)
Msgbox 0, "The meaning of life is: "+RetVal
'Msgbox 0,sMC
[/code]
Hi Charles,
thanks for the update, worked well here!
I think Kent will like the script because of its finally right output ;)
Is the loop performed until EAX = 0 ?
[code=thinbasic]
( ' [do]
42 ' inc edx
48 ' dec eax
7f r ' jg repeat
) ' [end do]
[/code]
Thanks,
Petr
Hmm,
is the following decomposition of your program correct Charles?
[code=thinbasic]
dim vv as long = 6
dim eax, ebx, ecx, edx as long
ecx = vv
edx = 0
do
eax = 7
do
edx += 1
eax -= 1
loop until eax <= 0
ecx -= 1
loop until ecx <= 0 ' -- But why ecx ? Because it was last referenced ?
eax = edx
msgbox 0, "The meaning of life is:"+STR$(eax)
[/code]
I did it to understand it better, still too unsure in machine code and assembly, but want to master it :)
Thanks,
Petr
Corrected according to Charles comments
Hi Petr, I agree with your decompostion except the meaning of jg would be 'until <=0' instead of 'until=0'.
The register codings work like this
eax 000
ecx 001
edx 010
ebx 011
esp 100
ebp 101
esi 110
edi 111
which is added to:
40 inc
48 dec
b8 mov [immediate data]
then there are conditional short jump codes
74 jz
75 jnz
..
7c jl
7d jge
7e jle
7f jg
So encoding is easy. Reading it back is not quite as easy.
Thanks for explanation,
that is interesting. I think my problem is that I still in my mind want to directly equal the machine code to assembler, which is wrong. I need to study the Intel manuals better :)
Thanks,
Petr