Like others before I'm running into the problem of reusing code and keeping track of variables in biggish programs. There's a lot of very good info in http://www.picaxeforum.co.uk/showthread.php?9299-Writing-Maintainable-Picaxe-Code&highlight=modular and I'm using several of the techniques in my 20M2 GPS program.
But maintaining stacks and pointers with only peek/poke/bptr ends up pretty clumsy and rather slow.
A couple of thoughts:
Would it be possible to extend the range of variables w0-w13 to say w32, w64 - or even w255 on the M2?
I assume the answer is no, or you would have done it already .
Maybe extend bptr by providing @wptrinc/dec to handle words, rather than having to do byte-by-byte?
Probably easier to implement than a 'real' stack - PUSH(w0,w3,w5), [do stuff using these regs] , POP(w0,w3,w5).
POP(w5,w3,w0) would be more traditional, but also confusing to some.
A couple more 'bptr' like pointers for indirect addressing would also be very useful IMHO!
(Hardhat on - ducking for cover!)
But maintaining stacks and pointers with only peek/poke/bptr ends up pretty clumsy and rather slow.
A couple of thoughts:
Would it be possible to extend the range of variables w0-w13 to say w32, w64 - or even w255 on the M2?
I assume the answer is no, or you would have done it already .
Maybe extend bptr by providing @wptrinc/dec to handle words, rather than having to do byte-by-byte?
Probably easier to implement than a 'real' stack - PUSH(w0,w3,w5), [do stuff using these regs] , POP(w0,w3,w5).
POP(w5,w3,w0) would be more traditional, but also confusing to some.
A couple more 'bptr' like pointers for indirect addressing would also be very useful IMHO!
(Hardhat on - ducking for cover!)
Last edited: