%OP%BON %OP%PL70 %OP%TM1 %OP%BM1 %OP%LM5 %OP%HE/%H2%Z88 Users' Club Software Library%H2%/ %OP%FO/%H2%Z137%H2%//@P@/ %CO:A,12,72%%C%%H2%%H1%Calculator RPN%H1%%H2% %H1%Introduction%H1% This is a scientific calculator written to work in a similar manner to Hewlet Packard models. The size of the 'stack' and the number of memories can be easily modified on line 50. The calculator works using the REVERSE POLISH NOTATION, don't panic, as opposed to algibraic notation, which I believe is POLISH NOTATION. The reason for choosing the former is that it is far easier to programme and has some user advantages. If you had the equation:- log(%H1%  1.234^3.4    %H1%)^2 ( 9.4+(6.4/1.1) ) on an algibraic calculator 1.234 %H2%Y%H2% 3.4 / ( 9.4 + ( 6.4 / 1.1 = %H2%Y%H2% 2 %H2%L%H2% on a RPN calculator 1.234 %H2%E%H2% 3.4 %H2%Y%H2% 9.4 %H2%E%H2% 6.4 %H2%E%H2% 1.2 / + 2 %H2%Y%H2% %H2%L%H2% where %H2%E%H2% = Enter %H2%Y%H2% = x^y %H2%L%H2% = log Note neither look like the equation and the LOG function is treated as a postfix in both (i.e. the algibraic is RPN for single number functions!) %H1%Layout%H1% The layout of the display is shown below, unfortunately as it uses all eight lines it will not quite fit in Pipedream. Also I have squashed parts and the fancy hollow arrows cannot be shown! Y 17 Deg [+ ]- ;x '/ S+- Xx/y I1/x Yy^x pI e Clr =. \E 16 sf6 <>lastX ^vstack Fnct Mem iNT fRAC qUIT 15 * ERROR * Too Big 14 1 0 0 0 13 2 0 0 0 12 -1* 3 0 0 0 11 10 4 0 0 0 1.5E55 5 0 0 0 %H1%Functional description%H1% Top left 'a 5' the last key pressed. Second left 17 down to 11 the stack, thus up to seven numbers can be wating to be combined (this is what RPN uses instead of brackets). To the left of the '11' is '10' this is the position of the lastx, if you take the log of 23.4 the result will be in '11', but '10' will contain 23.4. *note 1* Above '10' is the last function (-1* for change sign!) Use with last x. Bottom left, '1.5E55' your latest input. This can be revised with DEL. Third line of text '*ERROR*...' If you ask the impossible you are told the reason, in this case BASIC's limit on exponents. If 1.5E5 was meant then press any key then DEL then ENTER again and off you go! *note2* Four columns of numbers, the memories 1 to 5 then 6 to 10 etc. Apologies that they are not numbered or labeled, but I was trying to keep memory size down! The input of memory number is terminated with ENTER *note1* If you intended to do something else C and < will restore the original situation. Similarly if you + instead x then < - < x will put you straight. Using the stack ^ v and < > you can reorder and duplicate numbers to suit your needs without resorting to memories. *note2* This does not provide a eighth member of the stack because as soon as you carry out any function it is elevated to '11' put in '10' and the function executed! %P0% Deg: an indicator to show if Degrees or Radians are in use! FMD or FMR to change. sf6: six significant figs selected FM1to9 (sf9 is default F%PC%) Top two lines, menu of functions installed. Note for number input 1 to 0 negative sign - , decimal point = or . , exponent \ or E. I have chosen to use the four keys []'£ for the operatiors +-x/ you could easily include PMTD but what then of M for memory? You could use R or S. The programme currently provides all the standard triglog functions with raise to he power an int and frac. *note3* %H1%Running the programme%H1% The programme is written to work when %H1%square capslock%H1% is in operation so that F calls up the fuction menu and SHIFTf gives you the fractional part of '11'. To stop the programme use SHIFTq (ESCAPE ESCAPE no longer exits but RESTARTS) On exit you are reminded that PROCRESTART will do that! %H1%Modifying the programme%H1% The programme uses PROCs for everything the only GOTOs being for the ONERROR and its return. (v1.5 also PROCRESTART a 50%PC% increase TUT TUT) PROCinp is the main circuit, and f%PC% controls if the stack should be refreshed. T is temporary memory for numbers. X$ for the last key input and Z$ for the current input number build up. PROCso moves the stack down with '17' = '16' for dual number operators and su sd roll stack up and down. To add functions just place the if X$="G" in PROCinp and add your own module! Statistical version anyone! To remove functions just find the line and remove it, followed by the PROC and any sub PROCs. Care is needed as I in PROCinp uses PROCsf(O$) and not just PROCfn! Also PROCent,so etc. is used all over the place! I realise that the structure/order of my PROCs is not ideal, they just got written that way! If anybody can shuffle them to increase speed, be my guest. %H1%Keys used%H1% 1...0 numbers - negative sign in numbers i.e. -123 = and . decimal point in numbers \ and E exponent in numbers i.e. 1E2 = 100 DEL deletes character from input line ENTER puts current input into '11' (repeats '11' if input is blank : fuctions carry out ENTER if input exists) Double number functions %H2%[%H2% '12'+'11' | %H2%]%H2% '12'-'11' | %H2%'%H2% '12'*'11' | %H2%£%H2% '12'/'11' | %H2%Y%H2% '12'^'11' Single number functions %H2%S%H2% -1*'11' | %H2%I%H2% 1/'11' | %H2%FS%H2% SIN'11' | %H2%FC%H2% COS'11' | %H2%FT%H2% TAN'11' %H2%FL%H2% LOG'11' | %H2%FN%H2% LN'11' | %H2%FAS%H2% ASN'11' | %H2%FAC%H2% ACS'11' | %H2%FAT%H2% ATN'11' %H2%FIL%H2% 10^'11' | %H2%FIN%H2% EXP'11' | %H2%i%H2% int'11' | %H2%f%H2% frac'11' | %H2%C%H2% clr'11' Number maniputation (Cursors plus) %H2%FMR FMD%H2% Deg Rad | %H2%e%H2%&%H2%p%H2% Consts. | %H2%X%H2% Swap '11' and '12' | %H2%M%H2% Memory options %H2%FM1%H2%to%H2%FM9%H2% significant figs (Memory display only altered when accessed) *note3* I have made int on negative numbers give the higher interger i.e. -13 from -13.456 intedad of -14 as in BASIC, and frac gives -0.456 not 0.544. *note4* I intend a next version (2.0?) which will enable saving and loading of the memories and user defined functions of the X(1)=EVAL(U$(U%PC%)) variety. Addition of "complete PROC's" can be achived in the normal way described above. (Suggestions welcome) M.Foweraker (4423) %CO:B,12,60%%CO:C,12,48%%CO:D,12,36%%CO:E,12,24%%CO:F,12,12%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%%H3%