HP Forums
HP41 programming. - 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: HP41 programming. (/thread-27224.html)



HP41 programming. - Howard - 02-01-2003

Pardon my ignorance but can somebody give me a good example of what Indirect Addressing is all about. Seems to me that it would be just as efficient to do it by Direct Addressing.


Re: HP41 programming. - Christof - 02-02-2003

okay, imagine a menu for a PIM.

option 1 runs subroutine 01 (LBL 01), which allows you to enter a new contact.

option 2 runs a subroutine (LBL 02) to delete a contact

option 3 runs a subroutine (LBL 03) to search for a contact.


you get the value into the X register, and then you
XEQ IND ST X

(execute function pointed to by the value in X)




Re: HP41 programming. - Johnny Billquist - 02-03-2003

Very simple example: Clear registers 00 to 10:

01 LBL"CLR"
02 .010
03 0
04 LBL 00
05 STO IND Y
06 ISG Y
07 GTO 00
08 END

Now, doing that with direct addressing means you would have
ten stores. Even better, this code could actually take
in X the start and end register, so you have full
flexibility. That isn't even practically possible with
direct addressing.

You can do any number of things with indirect addressing.
The point is that it is what you use when you don't know
which register you really want, or if you want to do
something with a number of registers.


Johnny's example as a CX counterpart - Vieira, Luiz C. (Brazil) - 02-03-2003

Hi, Jhonny;

your example made me remember one CX-only feature: CLRGX. Do you have an HP41CX? Your very good example of how to use indirect addressing as for accessing registers contents would be like this in an HP41CX:

.01
CLRGX
and that's all. CLRGX is available only in the HP41CX, but I do not know if those unusual module (HEPAX, CCD, ADVANTAGE, PPC, PANAME) also have it; the X-Functions doesn't.

Cheers.


Re: Johnny's example as a CX counterpart - Johnny Billquist - 02-04-2003

Me?
Yes, I have a fullnut CX. I also have two X-mem
built in, as well as the ZENROM.
Then I have the barcode reader, magnetic cards,
HPIL, X IO, Advantage Pac, MLDL, Cassette station and
video interface.
I only miss an IL printer, floppy disk and RS-232 interface,
and I'd be totally happy.

Oh, and of course my batteries for the cassette
station are going bad. I'll have to try doing something
about them one day...

About the programming example; I was aware of the fact
that the CX have a function for the thing I wrote, but
it was about the easiest program example I could think
of that really showed a case where you really do something
useful which cannot easily be done without indirect
addressing.