BUG: SetOrigin Diff in Compiled vs. Interpreted Mac QuickBasic (40712)






This article was previously published under Q40712

SYMPTOMS

The SetOrigin routine can be either called by name (with the SetOrigin MBLC routine built into QuickBasic), or invoked with the ToolBox statement (which can invoke the equivalent ROM trap).

The SetOrigin routine works differently when compiled rather than interpreted in QuickBasic version 1.0 for the Macintosh. SetOrigin appears to work differently than documented for the interpreter and compiler.

After invoking SetOrigin in a compiled program (either with the SetOrigin MBLC routine or the ToolBox ROM function call), subsequent graphics routines (such as CIRCLE or LINE) can only draw to coordinates where both x and y components are positive.

On the first run in the interpreted mode, the program behaves the same as the compiled version. But if you abort the program and run it a second time in the interpreter in the same session of QuickBasic, the program will then display graphics correctly, including negative x and y components.

Microsoft has confirmed this to be a bug in Microsoft QuickBasic version 1.0 for Macintosh systems. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The following program demonstrates the problem:
WHILE a$<>"q"
  INPUT "Enter x coordinate: ",a%
  INPUT "Enter y coordinate: ",b%
  CLS
  setorigin (-a%),(-b%)
  circle (0,0),20  ' A full circle should be drawn.
  call lineto(-a%,-b%)  ' A long diagonal line should be drawn.
  a$=""
  WHILE a$="":a$=INKEY$:WEND
WEND
				
In the compiled version, only the circle's lower right-hand quadrant (where both x and y coordinates are positive) is drawn. In the interpreted version, the full circle is correctly drawn on the second loop iteration or second program run during that session of QuickBasic.

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: kbbug KB40712