Jump to content

Machine Code Help?

Recommended Posts

Hello, I was wondering if anyone would be able to help me convert this to machine code?

Plz and Thk u...

Basically, The function parses a string which I manually encoded.
If the byte is not 0x01, it passes that byte to the resulting string.
If the byte is 0x01, then the previous byte is used in reference to the next byte
(not 0x01) to generate a number of bytes in order to reproduce the data.

For example:


;30 01 09
;61 01 1A

;Resulting in:


I'm trying to port this code:

Local $c,$d,$b
For $e=1 To 5
    If $f=1 Then
    ElseIf $b=1 Then
        For $h=$c To $g


What is what? What is what.

Share this post

Link to post
Share on other sites

There are problems with your example.

First: the byte count: either the cleartext is

If 30 01 09 means 0123456789 (total 10 digits)
then 61 01 1A means abcdefghijklmnopqrstuvwxyz{ (total 27 characters)

Also the AutoIt code doesn't work with your first example (some variables are not reset correctly).

In any case, the code you want boils down to:

$a = "090A20015E"
$z = '090930010961011A'

ConsoleWrite(Execute('"' & StringRegExpReplace($a, '(?|(..)01(..)|(..)())', '" & _StrInc(0x$1, 0x00$2) & "') & '"') & @LF)
ConsoleWrite(Execute('"' & StringRegExpReplace($z, '(?|(..)01(..)|(..)())', '" & _StrInc(0x$1, 0x00$2) & "') & '"') & @LF)

Func _StrInc($c, $n)
    If $n = 0 Then Return Chr($c)
    Local $s
    For $i = 0 To $n    ; or is it $n - 1? You decide!
        $s &= Chr($c + $i)
    Return $s

Unless your processing very large strings with this toy, you don't need machine code.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post

Link to post
Share on other sites

Thanks for your reply.
The reasoning for having a machine code version of that function is for research and minimizing code size.
In the end, the script should have 3 binary strings. 1 being 0x090A20015E, another being an index using the same or similar format, and the 3rd being a machine code interpreter, ability to compact or expand large strings might be necessary.


The original string is 96 characters long.
The string is then sorted by byte order.
The binary is then reduced from 96 Bytes to only 5.
Lastly an index is formed to reproduce the original string.

Upon executing the func, a static variable containing the 5Byte string+Index data will be expanded back into the originating format.

The format im using will have multiple methods of both compacting and expanding these binary strings. Not just adding 0x01, but thats for later.

Edited by Biatu

What is what? What is what.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...