The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
HP45 stack logic problem
04-14-2014, 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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP45 stack logic problem - Commie - 04-14-2014 03:24 PM
RE: HP45 stack logic problem - Commie - 04-14-2014, 05:02 PM
RE: HP45 stack logic problem - rprosperi - 04-14-2014, 05:25 PM
RE: HP45 stack logic problem - Commie - 04-14-2014, 05:44 PM



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