Author Topic: Calling OpCode Strings  (Read 3713 times)

0 Members and 1 Guest are viewing this topic.

Aurel

  • Guest
Calling OpCode Strings
« on: August 06, 2013, 05:40:37 AM »
Hi Charles
I just found your topic on Jose forum about this OpCode Strings
where you say that on this way can be speed up interpreter without need for bytecode or interpreting
text.
Do you can show us something similar created in Oxygen Basic.
I am interested about this because maybe i can use this technique in my new interpreter... ;)

Charles Pegge

  • Guest
Re: Calling OpCode Strings
« Reply #1 on: August 06, 2013, 12:35:13 PM »
Hi Aurel,

That is very similar to what Oxygen does now, but going directly to machine code bytes without using an assembly code layer.

You need to be familiar with how the Pentium works, and the coding patterns of turning instructions into opcodes and address operands. The Pentium is a complex beast, but you only need a small proportion of the instruction set for performing math and logical operations.

The simplest call you can perform is the ret instruction: 0xc3

string s=chr(0xc3)
sys a=strptr s
call a
print "ok"


JRS

  • Guest
Re: Calling OpCode Strings
« Reply #2 on: August 06, 2013, 03:33:29 PM »
Quote
That is very similar to what Oxygen does now, but going directly to machine code bytes without using an assembly code layer.

That crazy idea I had of using SB as a replacement for FB with O2 until it self compiled doesn't sound so nuts after all.  8)

If I remember correctly, you said that you only used FB as an easy way to manage variables (data) and any language would do. (please correct anything I said that is untrue)




Emil_halim

  • Guest
Re: Calling OpCode Strings
« Reply #3 on: August 12, 2013, 08:21:27 AM »
nice idea Mr Charles.

Quote
string s=chr(0xc3)
sys a=strptr s
call a
print "ok"


for the sake of simplicity you can change that to
Quote
string s=chr(0xc3)
call s
print "ok"
Oxy must be smart enough to recognize that. 
 

Charles Pegge

  • Guest
Re: Calling OpCode Strings
« Reply #4 on: August 13, 2013, 12:38:30 AM »
You can do it with bstrings:

bstring s=chr(0xc3)
call s
print "ok"
frees s


or with normal strings like this:

string s=chr(0xc3)
call *s
print "ok"