Re: If you'd have looked at my corrections Tim

You can quite easily POKE a LONG address. Take, for example, a test pattern such as:

DEF SEG = &HA000
FOR i& = 0 TO 63999
POKE i&, i& MOD 256
NEXT

Where an INTEGER is required, getting around QB's insistence on signed integers becomes the problem. Converting to hex and back is a rather slow and cumbersome way to do it (sadly, sometimes that's the way with QB), but works. You could also do:
Offset% = longOffs& AND &HFFFF&
Which has a modulo-65536 result in case it goes over, and will always fit in an INTEGER. You could also increment the index, in which case you might get something *like*:

Offset% = Offset% + Wide%
IF Offset% > 32767 THEN Offset% = Offset% - 65535

Of course, getting Offset% (signed) greater than 32767 is impossible, so the comparison would still have to be done LONG. The addition could be tested in the IF statement before actually assigning it, for instance..

There's nothing wrong with using INTEGERs for addresses, you just need to remember that 32767 + 1 = -32768.

Tim

Posted on Jul 15, 2008, 9:54 PM

Respond to this message