-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Running the O'Caml 8051/8052 emulator. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * Compile the C source file with SDCC. SDCC will generate a number of files, including two files in the standard Intel Hex format (extensions .hex and .ihx). These files (both are the same, just with differing extensions) are understood by the O'Caml emulator. * Build the emulator by running: $ ocamlbuild Test.native * The emulator outputs on stderr. As all 8051 programs loop infinitely, you must manually terminate the emulator process after a few seconds, in order to view the execution trace. To execute the emulator, run: $ ./Test.native Test.hex 2> /tmp/log (assuming you are using the Bash shell, where 2> /tmp/log is a pipe from stderr to a temporary log file and Test.hex is any Intex Hex file). * Open /tmp/log. The first section, above the dotted lines, is a sequential readout from the emulator's code memory. You can turn this off by editing test.ml. The number of code memory cells that are printed is hard coded in test.ml, also, so if loading a large program, you may need to change this hard coding (alternatively, the hard coded limit may be too large, in which case NOP is printed). Following the dotted lines, the execution trace begins. Usually, you have to scroll down quite some way until you see the `interesting' part of the execution (i.e. after the standard preamble). NOTE: the emulator does not replace fixed memory locations with their mnenomics. For instance, DPL and DPH are memory locations 0x81 and 0x82, respectively, and the B register is 0xFF (if I remember correctly). -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Translating an INTEL HEX file to Matita. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * Compile the C source file with SDCC. SDCC will generate a number of files, including two files in the standard Intel Hex format (extensions .hex and .ihx). These files (both are the same, just with differing extensions) are understood by the O'Caml translator. * Build the translator by running: $ ocamlbuild ToMatita.native * The translator outputs on stdout. To execute the translator, run: $ ./ToMatita.native Test.hex > Test.ma (assuming you are using the Bash shell, where > Test.ma is a pipe from stdout to a file and Test.hex is any Intex Hex file).