The Museum of HP Calculators

HP Forum Archive 10

[ Return to Index | Top of Index ]

HP41 programming.
Message #1 Posted by Howard on 1 Feb 2003, 11:39 p.m.

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.
Message #2 Posted by Christof on 2 Feb 2003, 12:16 a.m.,
in response to message #1 by Howard

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.
Message #3 Posted by Johnny Billquist on 3 Feb 2003, 12:59 p.m.,
in response to message #1 by Howard

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
Message #4 Posted by Vieira, Luiz C. (Brazil) on 3 Feb 2003, 1:58 p.m.,
in response to message #3 by Johnny Billquist

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
Message #5 Posted by Johnny Billquist on 4 Feb 2003, 9:28 a.m.,
in response to message #4 by Vieira, Luiz C. (Brazil)

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.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall