GARTHWILSON wrote:
A few years later I stepped up to the HP-41 calculator. <snip> As I understand it however, each jump to a label (except indirects) also keeps an address field which is hidden from the user. When the program is run and there's a jump to a label, the calculator looks where the address field points, and looks to make sure that yes, that's the label. If so, time is saved. But if it's not, it goes searching. When it finds it, it records the address back at the jump instruction, to save time in the future. I think this happens for both local and global labels. The difference in speed is definitely noticeable.
I should have added that when it searches for local labels, it starts from where the program counter points at the moment, and only searches the current program, whereas when it searches for
global labels, it starts the search from the end of program memory, searching in all programs, not just the one you're in. Global labels should be unique, and they make it possible to call a subroutine in another program, since the search is not limited to the current program. Since searches for
local labels start where the program counter points at the moment, you can re-use local labels as many times as you want, like for a sequence of short conditional forward branches. Hopefully this gives some ideas.