hp41cx line number branching using indirect. - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: hp41cx line number branching using indirect. (/thread-85896.html) |
hp41cx line number branching using indirect. - hal - 01-20-2006 Hi Folks.
Upon execution it returns "nonexistant".
Re: hp41cx line number branching using indirect. - Namir - 01-20-2006 Hal, I ran a short tetst using GTO IND with a register containing -10. It seems that the 41C ignores the sign and look for LBL 10 (in my case). In your example, the 41C is looking for LBL 136, which of course is outside the range of valid labels. I suugest using a jump to a label. This approach allows you to insert code without worrying about keeping count of the corrected number of lines to jump.
Namir
Re: hp41cx line number branching using indirect. - Eric Smith - 01-20-2006 The HP-41 family does not include any capability of branching to a line number, or the "rapid reverse branching" of some earlier HP models. However, the HP-41 has less need for such a feature. The main purpose of rapid reverse branching was to speed up loops by avoiding a label search. But the HP-41 compiles GTOs. When program execution first encounters the GTO, it finds the target label, and stores the address in the GTO instruction. On subsequent executions of that GTO, no label search is required. Editing the program will decompile it. I don't think RRB can be implemented by synthetic programming, because the RRB routine would have to read the program memory to determine the lengths of the program lines, and reading the program memory as data would "normalize" it, possibly destroying the program. Anyhow, use of synthetic programming for this would be much slower than the label search.
On the other hand, it's possible to implement either a "GTO line number" funcction or an RRB function by custom microcode. Aside from the time needed to develop the microcode, this would require
However, such a microcode function would usually still be slower than using a LBL and compiled GTO, at least for reverse branches, because of the 41's variable length instructions. When the program pointer is at line 42, and you want to get to line 39, the only way to do that is to count forward from the beginning of the program. This is what the non-programmable functions "GTO .nnn" and BST do, and explains why BST is slow on large programs.
Re: hp41cx line number branching using indirect. - hal - 01-20-2006 Thank you gentlemen for your help.
Re: hp41cx line number branching using indirect. - Gene Wright - 01-20-2006 Another option, especially if the branching spans are constant and not variable, is to compute the jump distance, put it in alpha, do a RCL M and then a STO b, or such. This allows for a direct movement of the program pointer and can really make it difficult to decode a program.
These ideas are described fairly well in the PPC ROM manual.
|