Intro
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
Rotate/shift and bit test/change instructions
File `tools/gen_bitops.lua` generates all the 1088 bit-oriented instructions in mnemonic format.
Intel Hex format
Once a library such as ihex.lua is available,
we can simply fill a table with byte-values, and emit intel-hex records to stdout.
( or use the shell redirect '>' )
---------------------------------------------
-- 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 --
---------------------------------------------
A somewhat more complicated example...
---------------------------------------------
-- All 2-byte combinations starting from d8 00; d8 01; ...
-- up to (and including) ... df fe; df ff;
-- (To test disassembly of the bitwise shift/rotate/change/test 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 --
---------------------------------------------