ILA: Inline (mini) Assembler for P2...
Cluso99
Posts: 18,069
I have been thinking about adding inline assembly capability to my P2 LMM Debugger...
http://forums.parallax.com/forumdisplay.php/97-Propeller-2-Multicore
This would be a simple inline assembler built right into the debugger. So you could enter a small program (no labels, just addresses so you will only do small programs), and then test it out and verify the correct results with the debugger. The debuger can examine and display both cog and hub memory, as well as changing it inputting bytes/longs. It can partially decode instructions (at least into their bit patterns now, and will do some basic opcodes soon).
Your program calls the debugger, while it waits patiently in cog to resume (almost all debugger code resides in hub and is executed by an LMM unit in cog). You can return to the user program, or restart at any cog address, or do coginit (wip).
So, wouldn't it be a nice addition to be able to change or add a few short asm instructions into your user code in cog, and then execute it?
Initially I think only the basic instructions will be implemented (there are over 300 instructions in the P2).
This could work quite nicely with Chip's little interpreter for testing the small code units.
BTW I proved the debugger concept will happily run on the P1 also because I chose not to use any of the newer features of the P2 where possible.
Chip: Would you be willing to release the code tables for pnut and just that part of the assembly using it? I won't be using labels/symbols so I don't need any of that, nor the editor. I was proficient in 486 assembler a number of years ago so I can certainly read the code.
http://forums.parallax.com/forumdisplay.php/97-Propeller-2-Multicore
This would be a simple inline assembler built right into the debugger. So you could enter a small program (no labels, just addresses so you will only do small programs), and then test it out and verify the correct results with the debugger. The debuger can examine and display both cog and hub memory, as well as changing it inputting bytes/longs. It can partially decode instructions (at least into their bit patterns now, and will do some basic opcodes soon).
Your program calls the debugger, while it waits patiently in cog to resume (almost all debugger code resides in hub and is executed by an LMM unit in cog). You can return to the user program, or restart at any cog address, or do coginit (wip).
So, wouldn't it be a nice addition to be able to change or add a few short asm instructions into your user code in cog, and then execute it?
Initially I think only the basic instructions will be implemented (there are over 300 instructions in the P2).
This could work quite nicely with Chip's little interpreter for testing the small code units.
BTW I proved the debugger concept will happily run on the P1 also because I chose not to use any of the newer features of the P2 where possible.
Chip: Would you be willing to release the code tables for pnut and just that part of the assembly using it? I won't be using labels/symbols so I don't need any of that, nor the editor. I was proficient in 486 assembler a number of years ago so I can certainly read the code.
Comments
I'll do whatever you need, but what do you mean by code tables? Do you mean a comprehensive list of instructions and their coding? I've been working on that. The PC assembly code is pure spaghetti.
Here is what I have prepared
For disassembling in my debugger, I will do this...
By extracting cccc I can check for '0000' (if_never) and '1111' (if_always). The remainder I will fetch a byte from the table, offset by cccc.
Then I can output "if_", then check the first 2 bits to see if the Z flag is used, and if so, output either "z" or "nz".
Then I check the next 3 bits to determine if there needs to be "_and_", "_or_", "_eq_" or "_ne_" output,
And last I skip a bit and check the 2 bits to see if the C flag is used and if so, output either "c" or "nc".
Obviously, compile works the opposite, and I have to check for the alternatives such as if_be, etc. However, I may only support those basic ones since this will be a mini inline compiler.
I can handle any PC assembly -- So if You can release code -- I can made my additions to it that help in LMM coding
Thanks