Re: How to compile the enhanced firmware?
Posted: 01 Feb 2012, 18:21
So if you could use absolute JMPs rather than relative JMPs and you could store the absolute address in a variable that you pass to the JMP what would you use that for and how would you get the address that you stick into the variable?
Describe for me the opcode that would store either a PC value (either absolute or relative) or a Clump ID into a variable. Once your code is compiled there is no such thing as a clump name so it seems like a set opcode where the compiler figures out that you are passing in a label or a clump name and it calculates the right value for the set opcode to use.
Something like
which would probably have to stick an absolute PC address into JumpTarget. Then you could have a single line of code like this:
which would do an absolute indirect jump to the PC address stored in the JumpTarget variable.
Supposing that we make all the firmware and compiler changes to support this capability. How do you see it providing us with any substantial benefit? Draw me a code picture of what it would enable you to do. I'm thinking it would not enable anything that you can't already do but I could be wrong.
With respect to clumps and subroutine calling, I think the goal you are after is something like function pointers. That sounds promising. So you would like to have support in the compiler to take the address (clump ID) of a subroutine like so:
I can imagine how the compiler would generate a number in this case and stick it into FuncPointer using set. And I can also imagine a new opcode that could call a subroutine with a variable instead of a constant clump ID. Can you draw me a code picture of what that would let you do that would be totally awesome? For some reason I keep getting stuck on the notion that it won't let you do anything that you can't already do in some other way.
John Hansen
Describe for me the opcode that would store either a PC value (either absolute or relative) or a Clump ID into a variable. Once your code is compiled there is no such thing as a clump name so it seems like a set opcode where the compiler figures out that you are passing in a label or a clump name and it calculates the right value for the set opcode to use.
Something like
Code: Select all
set JumpTarget, __Label123
Code: Select all
absindjmp JumpTarget
Supposing that we make all the firmware and compiler changes to support this capability. How do you see it providing us with any substantial benefit? Draw me a code picture of what it would enable you to do. I'm thinking it would not enable anything that you can't already do but I could be wrong.
With respect to clumps and subroutine calling, I think the goal you are after is something like function pointers. That sounds promising. So you would like to have support in the compiler to take the address (clump ID) of a subroutine like so:
Code: Select all
set FuncPointer, MyTotallyAwesomeFunction
John Hansen