Is there a way to let the compiler copy a certain portion of the code into another portion?
Let's say I have a function:
And now I call it somewhere:
Now let's say I only call the function in one location in my whole program. I.e. I could write the function code directly into that place, but I choose to put it somewhere else for organization purposes.
So, is there a way to do something like this?
And then somewhere else, I write:
And in the end, the compiler treats the code as if it has been written like that:
Let's say I have a function:
Code:
MyFunction:
; Do stuff
; Do more stuff
RTS
; Do stuff
; Do more stuff
RTS
And now I call it somewhere:
Code:
; Something
JSR MyFunction
; Something else
JSR MyFunction
; Something else
Now let's say I only call the function in one location in my whole program. I.e. I could write the function code directly into that place, but I choose to put it somewhere else for organization purposes.
So, is there a way to do something like this?
Code:
INLINE MyFunction
; Do stuff
; Do more stuff
END INLINE
(Note that there's no RTS this time.); Do stuff
; Do more stuff
END INLINE
And then somewhere else, I write:
Code:
; Something
INSERT INLINE MyFunction
; Something else
INSERT INLINE MyFunction
; Something else
And in the end, the compiler treats the code as if it has been written like that:
Code:
; Something
; Do stuff
; Do more stuff
; Something else
; Do stuff
; Do more stuff
; Something else