Posts: 2,771
Threads: 96
Joined: Oct 2003
Ok, I wasnt sure wether to put this in programming help, but anyway:
--1--
ok, I know what AND, OR, XOR, NOT, NOR, etc do, but what does EQV and IMP do?
--2--
Have you ever had a really strange goings on in Qbasic? Like your simple program not working, you spending an hour trying to find out what the hell is wrong with it, only to eventually give up, Reload Qbasic and try again, only to discover that your program suddenly works perfectly with no "Illegal Function Calls". Happened to me the other day, very strange, I wasnt even messing with POKE or anything...
--3--
My programming computer doesnt like screen 7. The text produced in screen 7 comes up as complete garbage, not even correct characters, the characters it displays are half of two different ones. Ive guessed it was my video card, but anyone any ideas wether its a solvable problem, or am I stuck with it as long as I have that video card?
Posts: 1,752
Threads: 21
Joined: Jun 2002
3: Not sure why this is happening, but if the font shows up ok in screen 13 then this fix should work for you:
Code: DEFINT A-Z
SCREEN 13
DEF SEG = &H0
Font1OffL = PEEK(&H43 * 4)
Font1OffH = PEEK(&H43 * 4 + 1)
Font1SegL = PEEK(&H43 * 4 + 2)
Font1SegH = PEEK(&H43 * 4 + 3)
Font2OffL = PEEK(&H1F * 4)
Font2OffH = PEEK(&H1F * 4 + 1)
Font2SegL = PEEK(&H1F * 4 + 2)
Font2SegH = PEEK(&H1F * 4 + 3)
SCREEN 7
POKE &H43 * 4, Font1OffL
POKE &H43 * 4 + 1, Font1OffH
POKE &H43 * 4 + 2, Font1SegL
POKE &H43 * 4 + 3, Font1SegH
POKE &H1F * 4, Font2OffL
POKE &H1F * 4 + 1, Font2OffH
POKE &H1F * 4 + 2, Font2SegL
POKE &H1F * 4 + 3, Font2SegH
Posts: 2,771
Threads: 96
Joined: Oct 2003
Thanks, will try the fix as soon as I can.
Posts: 3,368
Threads: 195
Joined: Jan 2003
Goto either the FAQ or programming help section for the EQV and IMP answers....
http://faq.qbasicnews.com/?blast=LogicOptimize
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 144
Threads: 8
Joined: Feb 2004
There is no point in having EQV.
Instead of:
Code: IF a = 10 EQV b = 20 THEN CALL doSomething
Do this:
Code: IF (a = 10) = (b = 20) THEN CALL doSomething
Unless QBs parser is wierd, that is, and thinks you are assigned 'a' and 'b' values.
Posts: 3,368
Threads: 195
Joined: Jan 2003
Or, it transfers this:
Code: IF (A = 6 AND B = 4) OR (A <> 6 AND B <> 4) THEN...
....to this:
Code: IF a = 6 EQV b = 4 THEN.....
err EDIT EDIT!
"EQV" is not the same as "=". It acts in the same way when given True=-1, False=0 values, but this is different:
PRINT (7 EQV 8 )
PRINT (7 = 8 )
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 144
Threads: 8
Joined: Feb 2004
Quote:Or, it transfers this:
"EQV" is not the same as "=". It acts in the same way when given True=-1, False=0 values, but this is different:
PRINT (7 EQV 8 )
PRINT (7 = 8 )
I understand that... look what I had, though:
Code: IF (a = 10) = (b = 20) THEN CALL doSomething
If both expressions evaluate to the same thing (either true or false), than doSomething would be called.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Quote:There is no point in having EQV.
Instead of:
Code: IF a = 10 EQV b = 20 THEN CALL doSomething
Do this:
Code: IF (a = 10) = (b = 20) THEN CALL doSomething
Unless QBs parser is wierd, that is, and thinks you are assigned 'a' and 'b' values.
Not always. Try this:
Code: a%=7
b%=8
IF a% EQV b% THEN PRINT a%;" EQV";b%;" !!"
IF a% = b% THEN PRINT a%, " ="; b%; " !!"
Posts: 144
Threads: 8
Joined: Feb 2004
na_th_an, with that example, does EQV turn each number into a true/false expression?
If so, the what you would have to do is:
Code: IF (a = 0) = (b = 0) THEN...
Posts: 6,419
Threads: 74
Joined: Mar 2002
Yeah, EQV compares logically, not arithmetically (sp?). That means that it checks for 0 or non-zero. Two values that are non-zero will be EQuiValent. Two values that are zero will be as well.
|