8051 include file issue

Hi,

I wrote a very long routine and and hence i want to put it in seperate files for cleaner view,Im using an 8051 ,coding in assembler ,does any one know how for example do you  seperate  your file and include it in your main file , so that at the time of call it can go to that file ,inside the routine, do its job and come back where it was going to execute the next instruction , I have tried it but as it goes in the other file and comes back to the main file ,it goes to the first instruction in my code instead of basically continuing where it left off ?


Thanks
Owais Ahmed  ,

Parents
  • You're completely mixing up to completely separate issues there: splitting the flow of your code into properly structured subroutines, and splitting source text into reasonably-sized compilable source files.

    You have to separate these concepts before you have any chance of implementing either successfully.

    You should not include entire source code files into others.  And if a routine has become very long, that means it's doing too many things in a single routine.  Learn what CALL and RET machine instructions are for.  Then learn what PUBLIC and EXTERN are for.  Then combine these two to understand how to properly put some of the code in a separate routine in a separate file, and how to use the linker and assembler to translate each file on its own, and then combine them.

Reply
  • You're completely mixing up to completely separate issues there: splitting the flow of your code into properly structured subroutines, and splitting source text into reasonably-sized compilable source files.

    You have to separate these concepts before you have any chance of implementing either successfully.

    You should not include entire source code files into others.  And if a routine has become very long, that means it's doing too many things in a single routine.  Learn what CALL and RET machine instructions are for.  Then learn what PUBLIC and EXTERN are for.  Then combine these two to understand how to properly put some of the code in a separate routine in a separate file, and how to use the linker and assembler to translate each file on its own, and then combine them.

Children
No data
More questions in this forum