02-11-2010, 10:11 PM
britlion Wrote:Code:dim i as uByte
FUNCTION CONTRAST (colour as uByte) as uByte
IF colour <=3 then return 7: END IF
return 0
END FUNCTION
FOR i = 0 to 7
PRINT "SENT ";i;" GOT ";CONTRAST(i)
NEXT i
This comes back with:
Code:Sent 0 Got 0 Should be Sent 0 got 7
Sent 1 Got 0 Should be Sent 1 got 7
Sent 2 Got 0 Should be Sent 2 got 7
Sent 3 Got 7 Should be Sent 3 got 7
Sent 4 Got 7 Should be Sent 4 got 0
Sent 5 Got 7 Should be Sent 5 got 0
Sent 6 Got 7 Should be Sent 6 got 0
Sent 7 Got 7 Should be Sent 7 got 0
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?
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.
