When you port a new CPU to RevEngE, you first fill out an opcode-data list.

The next thing to do is create a decode-source for your CPU. Let's say, decode-source-x86.

We get this passed to decode-source-x86: [eax+ecx] and a type (say, array).

We generally return a new-offset-container (sometimes called new-offset-bucket) and return that.

Below, the first line matches 'eax+ecx' with a simple regular expression.

It does a set-read which indicates eax and ecx are both marked as being read from.

Next, setf retval creates a new OFFSET_CONTAINER and returns it. This OFFSET_CONTAINER has 2 arguments: a list (1 'eax') and another list (1 'ecx'). The 1st part of this is the count, and the 2nd part is the item being counted. In this case, eax and ecx have no multipliers. They are just '1' register.

Finally, get-value reads that item and returns what it contains. If the register 'eax' is currently 50, get-value returns 50.

        (if-progn (setf matches (matchitstr "\\[(...)\\+(...)\\]$" source))

        (set-read (second matches))

        (set-read (third matches))

        (setf retval (new-offset-bucket (list(list 1 (get-value(second matches))) (list 1 (get-value(third matches))))))