add shift key and ability to calculate ln()

This commit is contained in:
Jeff Wang
2019-10-02 22:47:53 -04:00
parent 9fc462ca94
commit cb92a82f4b
3 changed files with 29 additions and 3 deletions

View File

@ -17,6 +17,7 @@
#define STACK_T 3
uint8_t NoLift = 0;
uint8_t IsShifted = 0;
//stack "grows" towards 0
__xdata dec80 Stack[STACK_SIZE]; //0->x, 1->y, 2->z, 3->t initially
@ -60,6 +61,10 @@ static void do_binary_op(void (*f_ptr)(void)){
pop();
}
static void toggle_shifted(void){
IsShifted ^= 1;
}
void process_cmd(char cmd){
//turn off backlight before start of processing
backlight_off();
@ -108,6 +113,18 @@ void process_cmd(char cmd){
copy_decn(&stack(STACK_Y), &tmp);
}
} break;
//////////
case 'm':{ //use as shift
toggle_shifted();
} break;
//////////
case '8':{
if (IsShifted && !decn_is_nan(&stack(STACK_X))){ //ln(x)
copy_decn(&AccDecn, &stack(STACK_X));
ln_decn();
copy_decn(&stack(STACK_X), &AccDecn);
toggle_shifted();
}
} break;
//////////
} //switch(cmd)