LEX 'RESISLEX' resistor LEX file ID #5E last scratch, TOKEN 33 (dec) MSG 0 no message table POLL 0 no poll handler code *********************************************************** ENTRY PRESST entry point for PRES execution code *////////////////////////////////////////////////////////// CHAR #F a function *********************************************************** KEY 'PRES' the BASIC Keyword which will invoke it *////////////////////////////////////////////////////////// TOKEN 33 use Token 33 (dec) in this file *////////////////////////////////////////////////////////// ENDTXT end of text table * *********************************************************** * this is the start of the EQUate file * POP1N EQU #0BD1C pops one number from the math stack @ D1 * and puts into A(W). DEC set, P=0 on exit * SPLITA EQU #0C6BF converts 12 form in A(W) into a 15 form * in A(W),B(W). this is correct for system * l/X15 EQU #0C33E this takes a 15 form in AB and inverts * it. i.e. AB=1/AB * uRES12 EQU #0C994 this 'packs' a 15 form in AB into a 12 * form in C(W). Now ready to push on stack * FNRTN4 EQU #0F238 this is FUNCTION Return number four. * It assumes the BASIC (not hdwe) PC in D0 * Also assumes D1 already decremented, * stack collision performed, number in C(W) * AD2-15 EQU #0C363 This adds two 15 forms. AB=AB+CD * *********************************************************** * these nibs describe the fifteen parameters * NIBHEX 88888 fifteen maximum NIBHEX 88888 all parameters NIBHEX 88888 are numeric * *////////////////////////////////////////////////////////// * this byte is the minimum & maximum allowable parameters * NIBHEX 2F minimum 2, maximum 15, parameters *////////////////////////////////////////////////////////// * this is the entry point & start of execution code * PRESST P=C 15 set P= to actual number of parameters C=0 W a clean start C=P 0 put actual # of params in C(0) P= 0 good practice C=C-1 A subtract the minimum number (2) of C=C-1 A arguments from the actual number R0=C store in R0 for later * * now we've setup for a loop, counter in R0 *////////////////////////////////////////////////////////// * we now setup to enter the loop,'LOOP' is loop label * GOSBVL POP1N get the first argument GOSBVL SPLITA convert to 15 form GOSBVL l/X15 get 1/X of first argument LOOP R1=A save sign & exponent in R1 A=B W put mantissa into A R2=A save mantissa in R2 D1=D1+ 16 point to next argument on stack GOSBVL POP1N pop to A GOSBVL SPLITA get 15 form GOSBVL l/X15 get 1/15 form C=R2 get saved mantissa D=C W mantissa to D C=R1 get sign & exponent GOSBVL AD2-15 add, AB=CD+AB C=R0 get loop (param) counter C=C-1 A are we out of parameters ? GOC EXIT yes, then exit R0=C no, save new counter value GOTO LOOP go back for more * *////////////////////////////////////////////////////////// * this is the exit routine after the loop * EXIT GOSBVL l/X15 invert for the last time GOSBVL uRES12 convert back to 12 form GOVLNG FNRTN4 go push on stack & move on *********************************************************** END this marks the end of the source file.