<h2>Intro</h2>

Aside from processing assembly source, it can be quite handy to directly generate data for the MegaProcessor simulator.

Categories:

  *  Rotate/shift and bit test/change instructions
  *  Intel Hex format

<h3>Rotate/shift and bit test/change instructions</h3>

File `tools/gen_bitops.lua` generates all the 1088 bit-oriented instructions in mnemonic format.

<h3>Intel Hex format</h3>

Once a library such as is available,<br>
we can simply fill a table with byte-values, and emit intel-hex records to stdout.<br>
( or use the shell redirect '>' )

<pre>
---------------------------------------------
-- All bytes from 0x00 .. 0xff
require('ihex');

local data = {};

for i=0,255 do
    table.insert(data,i)
end

ihex_reset()

for i=0,7 do
    ihex_datarecord(data,32,(i*32+1) );
end

ihex_endrecord();

-- EOF --
---------------------------------------------
</pre>

A somewhat more complicated example...

<pre>
---------------------------------------------
-- All 2-byte combinations starting from d8 00; d8 01; ...
-- up to (and including) ... df fe; df ff;
-- (To test disassembly of the bitwise operations)
require('ihex');

local data = {};

for instr = 0xd8,0xdf do
        for postb = 0x00,0xff do
                table.insert(data,instr);
                table.insert(data,postb);
        end
end

ihex_reset();
for i=0,15 do
    for j=0,15 do
        ihex_datarecord(data,16,i*256+j*16+1);
    end
end
ihex_endrecord();


-- EOF --
---------------------------------------------
</pre>