EvilGenius
Member
Language: Assembly
Microcontroller: PIC16F628A
Hello
I need help consolidating several subroutines into a macro.
Here is the simplified setup:
I have main subroutines: Main1, Main2, Main3
Function of Main1-3 are identical.
Main1 calls two subroutines SubA and SubB (with a return).
Main2 calls two subroutines SubC and SubD (with a return).
Main3 calls two subroutines SubE and SubF (with a return).
-------------------------------------------
Now I would like to convert "Main" into a macro and set it up once.
Then be able to do the macro such that I can substitute different subroutine labels in it.
Example:
------------------
Macro Main SubX, SubY
Place label SubX into SubK
Place label SubY into SubJ
Do Something involving calling SubK and then SubJ
endm
------------------
Main SubA,SubB
Main SubC,SubD
Main SubE,SubF
-------------------
How do I do this?
Thank you in advance for your assistance.
Regards,
Rom
Microcontroller: PIC16F628A
Hello
I need help consolidating several subroutines into a macro.
Here is the simplified setup:
I have main subroutines: Main1, Main2, Main3
Function of Main1-3 are identical.
Main1 calls two subroutines SubA and SubB (with a return).
Main2 calls two subroutines SubC and SubD (with a return).
Main3 calls two subroutines SubE and SubF (with a return).
-------------------------------------------
Now I would like to convert "Main" into a macro and set it up once.
Then be able to do the macro such that I can substitute different subroutine labels in it.
Example:
------------------
Macro Main SubX, SubY
Place label SubX into SubK
Place label SubY into SubJ
Do Something involving calling SubK and then SubJ
endm
------------------
Main SubA,SubB
Main SubC,SubD
Main SubE,SubF
-------------------
How do I do this?
Thank you in advance for your assistance.
Regards,
Rom