AnsweredAssumed Answered

Creating Assembly Macros

Question asked by Odin on Sep 15, 2011
Latest reply on Sep 16, 2011 by Odin

I have to reverse engineer a heap of code and it's all assembly code.

 

I want to gradually decrease the massive size of a single file and end up with multiple files with a simple clear set of function calls, service routines and simple MACROS.

 

I not sure if I have used the correct term MACRO but....

say I have some inline code... like this...

 

Example main.asm file

 

.global _main;

 

_main:

call InitSRU;

 

background:

 

//About 3000 lines of other stuff!

 

//Notch1     a rather large routine...
NOTCH:
r13=X_notch1;
r13=r13+1,     m13=r13;
// about 300 lines here
m14=r13;
ENDNOTCH:

 

//yet more code all in line!

 

jump     background

 

_main.end:

 

 

 

I would like to end up with this.....   (or however you do the macro definition)

 

#define     notch_macro

//Notch1
NOTCH:
r13=X_notch1;
r13=r13+1,     m13=r13;
// about 300 lines here
m14=r13;
ENDNOTCH:

 

 

_main:

call InitSRU;

 

background:

notch_macro;          // macro in here that is expanded at compile time but makes my file easier to read.

jump     background

 

_main.end:

 

Thanks for quite a newbie starter question.....

I'm using Visual DSP++ 5 and the ADSP21262 SHARC

 

Pete @ Odin Electronics

Outcomes