Archived

This topic is now archived and is closed to further replies.

Intel ASM byte codes for scripting language

This topic is 4943 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I don''t know much about ASM, but I would like to use ASM instruction codes in my Visual Basic application to process mathematical expressions in my scripting language. It''s possible to pump ASM instructions to the CPU by hacking the procedure vtable or through WinProc. Getting instructions to the CPU is not the problem. The problem is that I don''t know any Intel ASM byte codes! I understand you can compile an ASM program and rip the memory addresses, and you''ll be left with the actual byte codes. However, I need to generate my own instruction list when the scripts are compiled. Basically, I need a list of Intel ASM instructions (80x86 preferred, may be able to use enhanced instructions sets like MMX, 3DNow, SSE, etc.) and perhaps an explanation of how to use them, i.e., how to include constant and register data. Any help is very much appreciated. Thanks in advance.

Share this post


Link to post
Share on other sites
Yes first check "Art of Assembly" page and I suggest also looking at Intel''s site as I believe they have a PDF titled "Developing for the Pentium" which includes the actual byte values for the opcodes.

Share this post


Link to post
Share on other sites
You want to know something funny? As I was reading this topic I was also downloading the “Art of Assembly” for my own research. That’s ironic isn’t it?

Maybe you should research on how a compiler or assembly is built. Maybe some of the algorithms used to build them will help you. If you build your own compiler or interpreter, you will have the ultimate control on how it is used and interpreted.

Building a complier is quite a task. And if you are working with a limited set of actions, you don’t really need the power of a complex scripting engine. A good alternative would be Mad Lib.

The Mad Lib Scripting system (MLS) uses action identifiers and templates to describe what is being done. The production of a simple Mad Lib might be something similar to this.

Script => Action | [ String | Number ]
Action => Number
String => “’” [ a-z ]+ | [ A-Z ]+ “’”
Number => [ 0-9 ]+

Now say that I have the fallowing actions defined.

enum ACTIONS
{
PRINT = 0,
QUIT = 1
};

The fallowing are valid scripts.

0”Hello, World!”
1

Any ways, try looking on Google for more information on what I’ve talked about if it at all sparks your interests. I hope I have helped you though.


[edited by - sakky on May 29, 2004 6:10:59 PM]

Share this post


Link to post
Share on other sites
Thanks for the replies. I do have a copy of the Art of Assembly. I had a hard time getting past chapter three. I can''t remember if the subject matter was boring, or just the writing, but I plan to give it another go. Today was format day. . . again.

I''m not trying to make a compiler per se. My scripting language is made up of classes, where each class represents a parameterized command. I want a class for processing math expressions, and the fastest way I can see to do that is to engineer the expression into byte code and send it to the CPU.

Thanks again everyone for the info. I''ll read the book --- maybe more than one book, as I seem to have acquired four or five on general principle (there''s just never enough time) --- and post again if I''m still having problems in a few days.

Share this post


Link to post
Share on other sites
quote:
Original post by Tom
I''m not trying to make a compiler per se. My scripting language is made up of classes, where each class represents a parameterized command. I want a class for processing math expressions, and the fastest way I can see to do that is to engineer the expression into byte code and send it to the CPU.



That''s what I thought you wanted to do and that''s why I looked up those links. Softwire does what you describe. Engineering byte code and sending it to the CPU can be described as a "run time assembler". But if what you want to do is to evaluate math expressions, there are easier ways to do that - but maybe not in VB.

Share this post


Link to post
Share on other sites