the same in intrinistic with the string reservation?
x86.label( "string" );
x86.db( "Hello World!" );
x86.label( "Helloworld" );
x86.push( "string" );// how to do this?
x86.call((int)printf);
x86.add(esp, 4);
x86.ret();
This db( char * ) is copying the const string here ain't it? If so couldn't we initalize arrays of ints as well with c arrays?
Do I read your assembler right if I guess that you aren't making explicit specification where to put code and where data? Does this mean that I'm responsible to move the instruction pointer past the data to go on with the code?
Greetz, oodoo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, db(char*) is a very special intrinsic because it's the only one that initialises an array. This is because strings are used quite often and it's not as easy as initialising an array to zero with a loop. If you really think that's useful, I could also make it possible to initialise arrays of other types?
You are also correc that code and data are treated the same. This allows advanced users (aka hackers) to write code as data, and data as code. Many other assemblers work this way, and I think it's useful for writing things like protection code. But to begin the code at a different point you just have to call Assembler::callable("HelloWorld"), where HelloWorld is the label where you want to start execution.
Unfortunately, there's a bug in the push intrinsic. It uses the byte operand version, but the full 32-bit address is needed...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think that table functionality, with initialisation is very usefull because it will make conversion of c++/script memory structures into assembler code easier. The intrinistic assembler source gets shorter as well and therefore better to maintain.
Great Library, keep up the good work.
regards oodoo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
helloworld in softwire assembler, copied from the example
string: DB "Hello world!"
HelloWorld:
push string
call printf
add esp, 4
ret
the same in intrinistic with the string reservation?
x86.label( "string" );
x86.db( "Hello World!" );
x86.label( "Helloworld" );
x86.push( "string" );// how to do this?
x86.call((int)printf);
x86.add(esp, 4);
x86.ret();
This db( char * ) is copying the const string here ain't it? If so couldn't we initalize arrays of ints as well with c arrays?
Do I read your assembler right if I guess that you aren't making explicit specification where to put code and where data? Does this mean that I'm responsible to move the instruction pointer past the data to go on with the code?
Greetz, oodoo
Yes, db(char*) is a very special intrinsic because it's the only one that initialises an array. This is because strings are used quite often and it's not as easy as initialising an array to zero with a loop. If you really think that's useful, I could also make it possible to initialise arrays of other types?
You are also correc that code and data are treated the same. This allows advanced users (aka hackers) to write code as data, and data as code. Many other assemblers work this way, and I think it's useful for writing things like protection code. But to begin the code at a different point you just have to call Assembler::callable("HelloWorld"), where HelloWorld is the label where you want to start execution.
Unfortunately, there's a bug in the push intrinsic. It uses the byte operand version, but the full 32-bit address is needed...
The bug with push is corrected now (CVS), and the intrinsics version of HelloWorld now worked correctly.
great, thx a lot.
I think that table functionality, with initialisation is very usefull because it will make conversion of c++/script memory structures into assembler code easier. The intrinistic assembler source gets shorter as well and therefore better to maintain.
Great Library, keep up the good work.
regards oodoo