TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: TIM HUTZLER
from: ANTON MONROE
date: 1996-06-17 05:37:00
subject: QuickBasic & PowerB 01/05

Tim,
Mostly for my own purposes, I started keeping a file of notes about
differences between QuickBasic and PowerBasic.  The fixed-length string
problem is a new one to me, I'll add it.  Here's a copy, in case it will
be of any use.
Additions from anyone are welcome.
========================================================================
This is not intended to be a list of all differences between QB and PB.
It only tries to cover differences that might cause problems when
converting existing QB code.  For the sake of thoroughness, I've
included a couple of things that I don't have any personal knowledge
about, but have read in various places.
 AND, XOR, etc. --
    In the case of ambiguous code like:
       IF a% AND b% THEN...
    the AND could be either a Boolean AND ("if a% is non-zero and if b%
    is non-zero then...") or a bitwise AND ("if the bits of a% and b%
    are ANDed together, is the result non-zero?").  Neither QB nor PB
    will give an error in a case like that, they just make an assumption
    about what you mean.  Unfortunately, they make different
    assumptions, which can break code that depends on QB's
    interpretation.
    QB interprets the AND above as bitwise-- "if (a% AND b%) is true".
    PB interprets it as Boolean-- "IF a% is true and b% is true".  There
    was a long and confusing thread on the subject on the BasNet
    PowerBasic echo.  I figure the solution is to not write ambiguous
    code in the first place.  When converting code, the QB
    interpretation can be forced by using parentheses or the ISTRUE and
    ISFALSE functions.
 CLS--
    QB uses "CLS 0|1|2",  PB equivalents are "CLS SCREEN|GRAPHICS|TEXT"
 CALL INTERRUPT--
    For some reason, QB uses two different functions to call interrupts.
    CALL INTERRUPT does not allow the user to use the Flags, DS, or ES
    registers.  You have to use the CALL INTERRUPTX function to access
    all the registers.  PB does it all with CALL INTERRUPT, so it
    actually is more like QB's CALL INTERRUPTX.
    QB requires a user-defined type to be defined and the variables used
    by CALL INTERRUPT must be declared as that type.  Microsoft provides
    a file called QB.BI that contains the TYPE definitions (RegType for
    INTERRUPT, RegTypeX for INTERRUPTX).  So QB-specific lines like the
    following could just be deleted when converting to PB:
       '$INCLUDE: 'QB.BI'
       DIM InRegs AS RegType
       DIM InRegs AS RegTypeX
    To convert existing QB code, any references to the QB variables will
    have to be converted to the PB REG statement or function:
        InRegs.ax = a%     -->   Reg 1, a%
        a% = OutRegs.ax    -->   a% = Reg(1)
    and the variables removed from the CALL INTERRUPT statement:
        CALL INTERRUPT (&H10, InRegs, OutRegs)   -->   CALL INTERRUPT &H10
    QB passes the two user-defined variables to the INTERRUPT or
    INTERRUPTX function.  One represents the values before the call, the
    other the values after the call.  This allows you to test whether a
    register has changed by doing something like:
       InRegs.ax = 1
       CALL INTERRUPT (&h10, InRegs, OutRegs)
       IF InRegs.ax = OutRegs.ax THEN
          .
          etc.
    A routine that uses that technique would have to be rewritten for
    PowerBasic.  For what it's worth, QB does not require you to use two
    different variables.  From reading Ethan Winer's book I got in the

Continued in the next message...
--- FidoPCB v1.4 [ff013/c]
---------------
* Origin: Sound Advice - 24 Nodes (816)436-4516 (1:280/333)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.