DSP5600x disassembly library is a disassembly code library designed for Motorola DSP5600x, allowing users to analyze and understand the functionality of the device's operational code.
To use the library, there are two initialization functions that one must call beforehand - make_masks() and make_masks2(). These functions are mandatory, and require no input parameters, nor do they produce any results. Nonetheless, you can be assured that these functions will succeed.
Next, allocate memory for a structure, that will be used to pass data to and from the library. The disasm_data structure, defined in the 5600x_disasm.h file, is what we want to focus on here. You may use a pointer in the process, and it is crucial to note that the "memory" member should point to the opcode that you want disassembled. However, bear in mind that the library anticipates this to be a 24-bit word, so if your assembler creates 32-bit words, you'll need to carry out a simple conversion. Not only that, but the library might also have to assess two words simultaneously, which is demonstrated in the provided example source code.
Once the disasm_data struct is set up correctly, with the "memory" pointer accurately specified, you can call the disassemble_opcode function with the pointer to this struct as the only argument. The output of this function will be a string of ASCII characters representing the disassembled opcode, now present in the "line_buf" member. You do not need to concern yourself with the "line_ptr" member, which is simply an internal variable. As for the "words" member, this holds the number of 24-bit words that your memory pointer should advance by. Additionally, this variable is available as a return value of the disassemble_opcode function. You can find an example of all this in the source code provided.
To use the library correctly, you simply have repeat step 3, as many times as you need, until the code is entirely disassembled.
For testing, please examine the makefile to ensure that it contains precise flages and defines for your architecture. Big endian users should be aware that they need to add -DBIGENDIAN to the CFLAGS. By entering "make ./test example_dsp_binary" in your terminal, you can compare the output of "example_dsp_binary" with example.a56, which includes all the addressing modes and instructions explained in the DSP56000/DSP56001 Digital Signal Processor User's Manual. Furthermore, you can carry out a 'diff' on the output against the example.out file to determine if there are any differences. There should be none.