From b4c06fc38ae74e1c58cd2bf9866e65a26a412696 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 10 Jan 2024 09:38:27 -0500 Subject: Add twos complement, center-click anywhere to paste. --- input.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 62ad271..47a6f59 100644 --- a/input.c +++ b/input.c @@ -403,6 +403,16 @@ key(char c) show_value(); break; + case '@': /* Two's complement */ + end_number(); + { + unsigned int i = ((unsigned int)value) & 0xffffffff; + value = ~i + 1; + } + saved = value; + show_value(); + break; + case '<': /* SHL by one bit only */ /* Modified by Keith Meehl to fix bit shift bug*/ end_number(); @@ -525,6 +535,13 @@ complete_paste(unsigned char *s, int n) void button(int b, int x, int y) { + char k; + + if(b == 2) { + paste(); + return; + } + x = (x-2)/(24 * scale_factor); if (x < 0) x = 0; if (x > 4) x = 4; @@ -532,17 +549,19 @@ button(int b, int x, int y) if (y < 0) y = 0; if (y > 8) y = 8; - if (bmap[y][x] == 27 && b == 3) + k = bmap[y][x]; + + if (k == 27 && b == 3) exit(0); - if (bmap[y][x] == 'P' && b == 1) + if (k == 'P' && b == 1) copy(); - if (bmap[y][x] == 'P' && b != 1) + else if (k == 'P' && b != 1) paste(); - - if(bmap[y][x] == '/' && b != 1) + else if(k == '/' && b != 1) key('%'); + else if(k == '~' && b != 1) + key('@'); else - key(bmap[y][x]); - /* printf("bmap[%i][%i] and b=%i\n", y, x, b); */ + key(k); } -- cgit v1.2.3