HP45 stack logic problem

04142014, 03:24 PM
Post: #1




HP45 stack logic problem
Hi Everyone,
I'm new here and this is my first post, I've been trying to replicate a HP45 calculator in an AVR MCU using a compiler. You might be pleased to know I have accomplished this task and it took me about one month to complete. However, there seems to be a nagging problem I have with the actual HP45 to do with it's stack operations, for example for the following operations Addition,subtraction, division multiplication and lastly Y raised to x or Y^x, the stack follows this logic: t=T t=Z z=y and function xy result in x I dont have a problem with the above, however Y^x seems to misbehave, if you load the stack with two enters and then key in x using the exchange key and then look at the stack you find your numbers correctly displayed on the stack, so e.g. keystrokes might be 30 enter enter 35 exchange your stack will look like 0=T 30=Z 30=Y 35=X Know here's where the problem comes in, if invoke the y^x key say 3 2ndf and press y^x (thats 35^3) and the answer is displayed correctly however if you roll the stack down you find 30=t 30=z 30=y answer displayed correctly in x, notice t contains 30 and it would seem the stack has gone the wrong way, the stack should be 0=t 0=z 30=y answer displayed correctly in x If, at the beginning you pressed enter once or 3x then there is no problem with the stack logic,i.e, it's only when you press enter twice and use the Y^x key does this problem occur.Any ideas anyone? BTW, total code count for the HP45 in an AVR approx 14.2 kbytes Cheers for now Commie 

04142014, 04:09 PM
Post: #2




RE: HP45 stack logic problem
Quote:Know here's where the problem comes in, if invoke the y^x key say 3 2ndf and press y^x (thats 35^3) and the answer is displayed correctly however if you roll the stack down you find Hi, If I followed you correctly, once you keyed the "3" in order to compute 35^3, everything moved up a level and the zero in t was replaced with the 30 from z. Then the y^x would subsequently cause the 30 in t to be replicated back down into z. Had the stack been one more level high, the zero would have been retained. Jake 

04142014, 05:02 PM
Post: #3




RE: HP45 stack logic problem
(04142014 04:09 PM)Jake Schwartz Wrote: Hi, Hi Jake, Basically yes, but you start with 0=t 30=z 30=y 35=x the above is what you start with by pressing, 30 enter enter 35 exchange. Now, if you add,subtract,divide or multiply then the stack will be: 0=t 0=z 30=y answer = x hence, t has moved to z, z moved y and the answer resides in x.At this point, my HP45 does follow the above logic except the y^x command. Again start with, 0=t 30=z 30=y 35=x Now press 3 2ndf Y^x(hence 35^3), and the returned stack is, 30=t 30=z 30=y answer in x when in fact the stack should be 0=t 0=z 30=y answer in x I appreciated the complications and difficulties involved trying to explain this but I would be interested in any answers given.Thanks for your time. Cheers Commie 

04142014, 05:23 PM
Post: #4




RE: HP45 stack logic problem  
04142014, 05:25 PM
Post: #5




RE: HP45 stack logic problem
(04142014 05:02 PM)Commie Wrote: Again start with, As Jake pointed out, when you press the '3', the stack lifts, moving 30 up into the t register (and the others lift as well). Subsequent to that, when the stack drops after the power function, the t register autocopies (30) into z, z to y, etc. So the result is indeed what should be expected. Why are you expecting 0's in the t and z registers? Where would the 0 come from? Bob Prosperi 

04142014, 05:44 PM
Post: #6




RE: HP45 stack logic problem
(04142014 05:23 PM)Thomas Klemm Wrote: No. It looks like: Hi Thomas and others, Me thinks you have cracked my problem Thomas, my oh my what a fast mind you have, thank you very much indeed. I've been on this board as a member for only about an hour and already my problem has been solved, thanks again Thomas for helping me and others who replied, thank you all. Cheers for now Commie 

« Next Oldest  Next Newest »

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