DSP5600x disassembly library is a code disassembly library for the Motorola DSP5600x.
Version:lib5600x is a library implementing Motorola DSP5600x disassembler. It's an ANSI C link library that should be useful for people writing debuggers, memory monitors etc for DSP5600x chips.
License: BSD License
Operating System: Linux
1. First you call two initialization functions in the library. This step is mandatory:
You pass nothing and check for no results -- these functions are guaranteed to succeed.
2. Now you have to allocate memory for a structure that will be used for passing data to/from the library. You may do that on the stack
struct disasm_data dis, *d = &dis;
Yes, the pointer will be useful, too. The disasm_data structure is defined in 5600x_disasm.h file. Let's take a closer look:
#define LINE_SIZE 256
unsigned char *memory;
First member -- "memory" -- should point to the opcode you want disassembled. IMPORTANT! The library expects it to be a 24-bit word, so if your assembler creates 32-bit words, you'll have to make a simple conversion. Take a look at test.c to see how it is done. What's more, the library may wish to evaluate two words at a time, so you have to account for that -- this is also demonstrated in the example source.
3. After properly setting up disasm_data struct (i.e. "memory" pointer), you call following function:
int disassemble_opcode(struct disasm_data *);
This function takes pointer to the struct you've just prepared as an argument. When it returns, disasm_data struct's "line_buf" member contains the disassembled opcode as a string of ASCII characters. "line_ptr" should be of no interest to you (it is merely a internal variable) and "words" holds the number of 24-bit words you should advance your memory pointer by. This variable is also available as a return value of above function. Again, I
shall refer you to the example source.
4. Repeat step 3 until you run out of code to disassemble.
First, check out the makefile and make sure it contains proper flags and defines for your architecture. Big endian users should add -DBIGENDIAN to CFLAGS (I'd appreciate if someone created Autoconf script to avoid such tricks). Following that, type
and compare the output (visually) with example.a56 which is a source code I used to create example_dsp_binary and which contains all instructions and addressing modes described in DSP56000/DSP56001 Digital Signal Processor User's Manual. You can also 'diff' your output and supplied example.out file to check if there are any differences (there should be none).