Post Reply 
HP-45 Internal Pointer Operations
04-24-2023, 09:52 PM (This post was last modified: 04-24-2023 10:00 PM by teenix.)
Post: #2
RE: HP-45 Internal Pointer Operations
Welcome to the Forum

I wouldn't worry about post edits, I'd have a red face all the time if I did :-)

The P register will decrement if a Load Constant executes with P at any value and wrap around to 15 after decrementing at 0. However as you mention, the LC instruction will not execute if P > 13. Maybe it does, but there is nowhere in a register to hold the constant. Obviously, the programmers knew of this and the other LC limitations and did not violate them when writing the code.

The code had to be written with limited ROM space in mind, so sometimes a code segment may execute with P > 13 because this code segment is used from multiple sources, but the programmers would have known about this, and the following code won't be affected.

An example of this behavior in the HP-45 can be found when calculating SIN-1 at ROM address $0275.

A constant has to be loaded into the C register for part of the calculation. However, at the start of the loading this value, when C = 09999999999006, the P register = 15, then decrements to 14 and so on until P=1 then the code segment is complete. The segment loop uses Load Constant 6.

P = 15, Load Constant 6, C = 09999999999006
P = 14, Load Constant 6, C = 09999999999006
P = 13, Load Constant 6, C = 69999999999006
etc

The final value of C is 66666666666606

Yes, there are a few redundant instructions, but there might not have been a simple coding way around the P issue. My hat is off to the guys that wrote the original code with the ROM addressing limitations on the Classics. Try adding an instruction anywhere in the ROM code, and you'll see the mess that it can create.

cheers

Tony
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP-45 Internal Pointer Operations - teenix - 04-24-2023 09:52 PM



User(s) browsing this thread: 1 Guest(s)