![]() |
Logical operators bugged? (*solved*) - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15) +---- Thread: Logical operators bugged? (*solved*) (/showthread.php?tid=142) |
Logical operators bugged? (*solved*) - britlion - 01-27-2010 I can't see why this doesn't work: Code: dim a as uByte Without fail this doesn't capitalise the key I pressed. get(-1) should only produce lower case (a-z), get(0) should produce what's pressed (a-Z) and get(1) should produce UPPER case (A-Z). It doesn't seem to be changing it. I've proved the IF works - I think the AND is failing. I tried Code: IF ((capitalise >0 AND lastK >= 97) AND lastK <= 122) THEN: Are logical functions misbehaving? I don't understand this (*solved*) - britlion - 01-27-2010 Code: dim i as uByte This comes back with: Code: Sent 0 Got 0 Should be Sent 0 got 7 Okay... with "<=3" at least 3 should be the same as 2...yes? And why do 0,1,2 get a return of 0 when they should get a return of 7? Things get weirder: Assuming that it was some weird return issue, I decided to return a variable instead: Code: dim i as uByte This gave me: This comes back with: Code: Sent 0 Got 0 I mean. SRSLY? My opinion of what that code does is clearly disagreeing with zxb's version.. Perhaps it's because we didn't initialise rt? Code: dim i as uByte Gives us a little bit of a clearer picture: Code: Sent 0 Got 9 So. We seem to have a complete logic failure. 0 <= 3 is FALSE and under certain circumstances 7<=3 is TRUE. I am so going to bed. I've programmed myself into something psychedelic. Incidentally: Code: FUNCTION CONTRAST (colour as uByte) as uByte Seems to be working. I suppose just asking for PAPER 9 and INK 9 to work is out of the question? Re: I don't understand this - boriel - 02-11-2010 britlion Wrote: You've found another bug. If you use Byte types instead, it works ok. The <= operator was bugged of Ubyte type. It's been fixed. I guess relational operators need an intensive test :oops: The problem is I can't create tests (I currently run more than 200 test by hand on each compile). Tests need to be automatized. The problem is you can't check the tests results, since they must be run on a real Z80 or on a Z80 emulator. I'm currently developing one. ![]() Re: I don't understand this - britlion - 02-12-2010 I think I have this listed as an issue in my summary post. Glad that I'm not the only one seeing issues with it, though. I was beginning to think I was going crazy ![]() |